[linux] 05/08: debian/control: Fix build-dependencies for cross-building

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Mon Jun 13 01:09:59 UTC 2016


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch master
in repository linux.

commit 0aceb8739a06586ace099b070b38f06fb14bfc02
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Sun Jun 12 20:45:36 2016 +0100

    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 b917bae..17b4366 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-<version>,
   linux-perf-<version>, 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 1e772ee..0537546 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 750d66b..d27a266 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 <ben at decadent.org.uk>  Tue, 07 Jun 2016 19:37:55 +0100
 
diff --git a/debian/config/defines b/debian/config/defines
index a872e4c..7f60986 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 <!stage1>
+gcc-5: gcc-5 <!stage1 !cross>, gcc-5- at gnu-type-package@:native <!stage1 cross>
 
 # initramfs-generators
 initramfs-fallback: linux-initramfs-tool
diff --git a/debian/config/hppa/defines b/debian/config/hppa/defines
index 67351e6..9b139c6 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 <!stage1>, binutils-hppa64-linux-gnu <!stage1>, gcc-5-hppa64-linux-gnu <!stage1>
+gcc-5: gcc-5 <!stage1 !cross>, binutils-hppa64-linux-gnu <!stage1 !cross>, gcc-5-hppa64-linux-gnu <!stage1 !cross>, gcc-5-hppa-linux-gnu:native <!stage1 cross>, binutils-hppa64-linux-gnu:native <!stage1 cross>, gcc-5-hppa64-linux-gnu:native <!stage1 cross>
 
diff --git a/debian/templates/control.source.in b/debian/templates/control.source.in
index 392e062..cf4af36 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 <!stage1>,
 # used by upstream to build signing tools and to process certificates
- libssl-dev <!stage1>,
- openssl <!stage1>,
+ libssl-dev:native <!stage1>, libssl-dev <!stage1 !pkg.linux.notools cross>,
+ openssl:native <!stage1>,
 # used by upstream to build perf documentation
  asciidoc <!stage1 !nodoc !pkg.linux.notools>,
  xmlto <!stage1 !nodoc !pkg.linux.notools>,
 # used by upstream to build perf
  bison <!stage1 !pkg.linux.notools>,
- flex <!stage1 !pkg.linux.notools>,
+ flex:native <!stage1 !pkg.linux.notools>,
  gcc-multilib [amd64 ppc64 s390x sparc64] <!stage1 !pkg.linux.notools>,
  libaudit-dev <!stage1 !pkg.linux.notools>,
  libdw-dev <!stage1 !pkg.linux.notools>,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list