Add support for compilers installed outside the default PATH

The obvious way to do this is to edit the PATH in .kernelvariables.
But this obvious way doesn't work due to a bug in make (#895835).

(cherry picked from commit 4c6213fbbbff44710dda2091a7b26e0f0ea0a610)
This commit is contained in:
Ben Hutchings 2018-04-16 15:03:31 +01:00
parent 175171d42d
commit 083ddaa564
3 changed files with 13 additions and 0 deletions

View File

@ -291,6 +291,7 @@ class Gencontrol(Base):
flavour_makeflags_base = (
('compiler', 'COMPILER', False),
('compiler-filename', 'COMPILER', True),
('kernel-arch', 'KERNEL_ARCH', False),
('cflags', 'CFLAGS_KERNEL', True),
('override-host-type', 'OVERRIDE_HOST_TYPE', True),

1
debian/changelog vendored
View File

@ -4,6 +4,7 @@ linux (4.16-1~exp2) UNRELEASED; urgency=medium
* aufs: gen-patch: Fix Subject generation to skip SPDX-License-Identifier
* aufs: Update support patchset to aufs4.16-20180409 (no functional change)
* wireless: Add Debian wireless-regdb certificates (see #892229)
* Add support for compilers installed outside the default PATH
[ Vagrant Cascadian ]
* [arm64] Add patches to support SATA on Tegra210/Jetson-TX1.

11
debian/rules.real vendored
View File

@ -166,7 +166,18 @@ $(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(STAMPS_DIR)/source_$(FEA
echo 'override ARCH = $(KERNEL_ARCH)' >> '$(DIR)/.kernelvariables'
echo 'override KERNELRELEASE = $(ABINAME)$(LOCALVERSION_IMAGE)' >> '$(DIR)/.kernelvariables'
echo 'CCACHE = ccache' >> '$(DIR)/.kernelvariables'
ifeq (./,$(dir $(COMPILER)))
echo 'CC = $$(if $$(DEBIAN_KERNEL_USE_CCACHE),$$(CCACHE)) $$(CROSS_COMPILE)$(COMPILER)' >> '$(DIR)/.kernelvariables'
else
# To allow for cross-compiles, we want to split up the configured
# compiler filename and prepend the directory to $PATH. For a native
# compile, so long as the configured compiler is installed it should
# always be found first.
# However, $PATH changes don't work consistently in make (bug #895835).
# Instead we do the path lookup here and generate a new absolute
# filename.
echo 'CC = $$(if $$(DEBIAN_KERNEL_USE_CCACHE),$$(CCACHE)) $$(word 1,$$(foreach dir,$(dir $(COMPILER)) $$(subst :, ,$$(PATH)),$$(wildcard $$(dir)/$$(CROSS_COMPILE)$(notdir $(COMPILER)))))' >> '$(DIR)/.kernelvariables'
endif
# TODO: Should we set CROSS_COMPILE always?
ifdef OVERRIDE_HOST_TYPE
echo 'override CROSS_COMPILE = $(OVERRIDE_HOST_TYPE)-' >> '$(DIR)/.kernelvariables'