From 0aceb8739a06586ace099b070b38f06fb14bfc02 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 12 Jun 2016 20:45:36 +0100 Subject: [PATCH] debian/control: Fix build-dependencies for cross-building The current cross-compiler packages don't set the Multi-Arch field, so specify that the cross-compiler package must be native, rather than any architecture. flex doesn't support multi-arch, and this would require splitting it (#611230, #761449). Force use of the native package for now. openssl doesn't support multi-arch but probably easily could (#827028). Force use of the native package for now. We need the native libssl-dev while building the kernel itself and the host libssl-dev while building tools for linux-kbuild. Document the state of cross-building in README.source. --- debian/README.source | 3 +++ debian/bin/gencontrol.py | 25 +++++++++++++++++++++---- debian/changelog | 1 + debian/config/defines | 2 +- debian/config/hppa/defines | 2 +- debian/templates/control.source.in | 6 +++--- 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/debian/README.source b/debian/README.source index b917baeb0..17b4366c6 100644 --- a/debian/README.source +++ b/debian/README.source @@ -233,3 +233,6 @@ Several build profiles are understood and supported: - nodoc: Exclude most documentation - pkg.linux.notools: Exclude userland tool packages (linux-kbuild-, linux-perf-, etc.) +- cross: Needed when cross-building. Currently this must be used + together with pkg.linux.notools as not all the userland tools can be + cross-built. diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py index 1e772eebc..053754670 100755 --- a/debian/bin/gencontrol.py +++ b/debian/bin/gencontrol.py @@ -134,6 +134,17 @@ class Gencontrol(Base): self._setup_makeflags(self.arch_makeflags, makeflags, config_base) + try: + gnu_type_bytes = subprocess.check_output(['dpkg-architecture', + '-a', arch, + '-q', 'DEB_HOST_GNU_TYPE'], + stderr=subprocess.DEVNULL) + except subprocess.CalledProcessError: + # This sometimes happens for the newest ports :-/ + print('W: Unable to get GNU type for %s' % arch, file=sys.stderr) + else: + vars['gnu-type-package'] = gnu_type_bytes.decode('utf-8').strip().replace('_', '-') + def do_arch_packages(self, packages, makefile, arch, vars, makeflags, extra): if self.version.linux_modifier is None: try: @@ -296,16 +307,22 @@ class Gencontrol(Base): compiler = config_entry_base.get('compiler', 'gcc') - # Work out dependency from linux-headers to compiler. Strip + # Work out dependency from linux-headers to compiler. Drop + # dependencies for cross-builds. Strip any remaining # restrictions, as they don't apply to binary Depends. relations_compiler_headers = PackageRelation( - config_entry_relations.get('headers%' + compiler) or - config_entry_relations.get(compiler)) + self.substitute(config_entry_relations.get('headers%' + compiler) or + config_entry_relations.get(compiler), vars)) + relations_compiler_headers = PackageRelation( + PackageRelationGroup(entry for entry in group + if 'cross' not in entry.restrictions) + for group in relations_compiler_headers) for group in relations_compiler_headers: for entry in group: entry.restrictions = [] - relations_compiler_build_dep = PackageRelation(config_entry_relations[compiler]) + relations_compiler_build_dep = PackageRelation( + self.substitute(config_entry_relations[compiler], vars)) for group in relations_compiler_build_dep: for item in group: item.arches = [arch] diff --git a/debian/changelog b/debian/changelog index 750d66b39..d27a266ef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,7 @@ linux (4.7~rc2-1~exp1) UNRELEASED; urgency=medium userland headers * linux-cpupower: Define PACKAGE_BUGREPORT to refer to reportbug, not upstream * debian/README.source: Document the supported build profiles + * debian/control: Fix build-dependencies for cross-building -- Ben Hutchings Tue, 07 Jun 2016 19:37:55 +0100 diff --git a/debian/config/defines b/debian/config/defines index a872e4c2e..7f60986f9 100644 --- a/debian/config/defines +++ b/debian/config/defines @@ -59,7 +59,7 @@ initramfs-generators: initramfs-tools initramfs-fallback [relations] # compilers -gcc-5: gcc-5 +gcc-5: gcc-5 , gcc-5-@gnu-type-package@:native # initramfs-generators initramfs-fallback: linux-initramfs-tool diff --git a/debian/config/hppa/defines b/debian/config/hppa/defines index 67351e67b..9b139c6ef 100644 --- a/debian/config/hppa/defines +++ b/debian/config/hppa/defines @@ -24,5 +24,5 @@ hardware: multiprocessor 64-bit PA-RISC hardware-long: HP PA-RISC 64-bit SMP systems with support for more than 4 GB RAM [relations] -gcc-5: gcc-5 , binutils-hppa64-linux-gnu , gcc-5-hppa64-linux-gnu +gcc-5: gcc-5 , binutils-hppa64-linux-gnu , gcc-5-hppa64-linux-gnu , gcc-5-hppa-linux-gnu:native , binutils-hppa64-linux-gnu:native , gcc-5-hppa64-linux-gnu:native diff --git a/debian/templates/control.source.in b/debian/templates/control.source.in index 392e06219..cf4af3658 100644 --- a/debian/templates/control.source.in +++ b/debian/templates/control.source.in @@ -20,14 +20,14 @@ Build-Depends: # used by upstream to build include/generated/timeconst.h bc , # used by upstream to build signing tools and to process certificates - libssl-dev , - openssl , + libssl-dev:native , libssl-dev , + openssl:native , # used by upstream to build perf documentation asciidoc , xmlto , # used by upstream to build perf bison , - flex , + flex:native , gcc-multilib [amd64 ppc64 s390x sparc64] , libaudit-dev , libdw-dev ,