[linux] 07/08: Fix build rules for userland tools to support cross-building

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Mon Jun 13 01:10:00 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 0ad327058ff5e1890526f6bcc85382ef53c19047
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Mon Jun 13 01:17:13 2016 +0100

    Fix build rules for userland tools to support cross-building
    
    Pass $(CROSS_COMPILE) or host GNU type through to upstream build rules.
    
    debian/rules.real: Filter tools packages by host arch, not build arch
    
    debian/rules.d/Makefile: Build the tools needed for headers_install in
    a separate subdirectory
---
 debian/README.source                         | 5 ++---
 debian/changelog                             | 1 +
 debian/rules.d/Makefile                      | 3 ++-
 debian/rules.d/Makefile.inc                  | 4 ++--
 debian/rules.d/tools/power/cpupower/Makefile | 2 ++
 debian/rules.d/tools/usb/usbip/Makefile      | 3 ++-
 debian/rules.real                            | 5 +++--
 7 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/debian/README.source b/debian/README.source
index 92225ca..b488d8b 100644
--- a/debian/README.source
+++ b/debian/README.source
@@ -233,8 +233,7 @@ 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.
+- cross: Needed when cross-building.  Currently this must be used together
+  with nopython as the build-dependencies will be unsatisfiable otherwise.
 - nopython: Disable Python bindings.  This currently disables building the
   linux-perf-<version> package, as the perf program embeds Python.
diff --git a/debian/changelog b/debian/changelog
index 16229b6..1565a8c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,7 @@ linux (4.7~rc2-1~exp1) UNRELEASED; urgency=medium
   * debian/README.source: Document the supported build profiles
   * debian/control: Fix build-dependencies for cross-building
   * Add support for the nopython build profile, disabling the linux-perf package
+  * Fix build rules for userland tools to support cross-building
 
  -- Ben Hutchings <ben at decadent.org.uk>  Tue, 07 Jun 2016 19:37:55 +0100
 
diff --git a/debian/rules.d/Makefile b/debian/rules.d/Makefile
index 6fab0dc..c7506d3 100644
--- a/debian/rules.d/Makefile
+++ b/debian/rules.d/Makefile
@@ -11,6 +11,7 @@ include $(top_rulesdir)/Makefile.inc
 # Build userland headers first
 unexport VERSION
 all-local:
-	$(MAKE) -C $(top_srcdir) ARCH=$(KERNEL_ARCH) O=$(CURDIR) \
+	mkdir -p headers-tools
+	$(MAKE) -C $(top_srcdir) ARCH=$(KERNEL_ARCH) O=$(CURDIR)/headers-tools \
 		INSTALL_HDR_PATH=$(CURDIR) headers_install
 all-recursive: all-local
diff --git a/debian/rules.d/Makefile.inc b/debian/rules.d/Makefile.inc
index 2f05db4..48f8c2e 100644
--- a/debian/rules.d/Makefile.inc
+++ b/debian/rules.d/Makefile.inc
@@ -5,8 +5,8 @@ VPATH = $(top_rulesdir)/$(OUTDIR) $(top_srcdir)/$(OUTDIR)
 
 SHELL = /bin/sh -e
 
-CC = gcc
-CXX = g++
+CC = $(CROSS_COMPILE)gcc
+CXX = $(CROSS_COMPILE)g++
 CFLAGS := $(shell dpkg-buildflags --get CFLAGS) -Wall
 CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) \
 	-I$(top_srcdir)/$(OUTDIR) \
diff --git a/debian/rules.d/tools/power/cpupower/Makefile b/debian/rules.d/tools/power/cpupower/Makefile
index 414d4af..23193b5 100644
--- a/debian/rules.d/tools/power/cpupower/Makefile
+++ b/debian/rules.d/tools/power/cpupower/Makefile
@@ -4,6 +4,8 @@ MAKE_CPUPOWER := $(shell dpkg-buildflags --export=cmdline) $(MAKE) O=$(CURDIR) C
 
 MAKE_CPUPOWER += DEBUG=$(if $(findstring nostrip,$(DEB_BUILD_OPTIONS)),true,)
 
+MAKE_CPUPOWER += CROSS='$(CROSS_COMPILE)'
+
 MAKE_CPUPOWER += PACKAGE_BUGREPORT='Debian\ \(reportbug\ linux-cpupower\)'
 
 all:
diff --git a/debian/rules.d/tools/usb/usbip/Makefile b/debian/rules.d/tools/usb/usbip/Makefile
index 4c29b61..887573b 100644
--- a/debian/rules.d/tools/usb/usbip/Makefile
+++ b/debian/rules.d/tools/usb/usbip/Makefile
@@ -11,7 +11,8 @@ all:
 		--prefix=/usr \
 		--with-tcp-wrappers \
 		--with-usbids-dir=/usr/share/misc \
-		--disable-shared
+		--disable-shared \
+		--host=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 	$(MAKE)
 
 install:
diff --git a/debian/rules.real b/debian/rules.real
index f90edf7..c0cd09a 100644
--- a/debian/rules.real
+++ b/debian/rules.real
@@ -24,6 +24,7 @@ else ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
 else
   CROSS_COMPILE :=
 endif
+export CROSS_COMPILE
 
 export PYTHONPATH = $(CURDIR)/debian/lib/python
 export DH_OPTIONS
@@ -74,12 +75,12 @@ binary-indep: install-support
 ifneq ($(DO_TOOLS),False)
   build-arch-arch: $(STAMPS_DIR)/build-tools
   binary-arch-arch: install-kbuild install-usbip install-liblockdep install-cpupower
-  ifneq ($(filter alpha amd64 arm64 armel armhf hppa i386 mips mips64 mips64el mipsel powerpc powerpcspe ppc64 ppc64el s390 s390x sh4 sparc sparc64,$(DEB_BUILD_ARCH)),)
+  ifneq ($(filter alpha amd64 arm64 armel armhf hppa i386 mips mips64 mips64el mipsel powerpc powerpcspe ppc64 ppc64el s390 s390x sh4 sparc sparc64,$(DEB_HOST_ARCH)),)
     ifeq ($(filter nopython,$(DEB_BUILD_PROFILES)),)
       binary-arch-arch: install-perf
     endif
   endif
-  ifneq ($(filter i386 amd64 x32,$(DEB_BUILD_ARCH)),)
+  ifneq ($(filter i386 amd64 x32,$(DEB_HOST_ARCH)),)
     binary-arch-arch: install-hyperv-daemons
   endif
   binary-indep: install-lockdep

-- 
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