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
This commit is contained in:
Ben Hutchings 2016-06-13 01:17:13 +01:00
parent a7ebaf2684
commit 0ad327058f
7 changed files with 14 additions and 9 deletions

View File

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

1
debian/changelog vendored
View File

@ -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@decadent.org.uk> Tue, 07 Jun 2016 19:37:55 +0100

View File

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

View File

@ -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) \

View File

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

View File

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

5
debian/rules.real vendored
View File

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