diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py index 6d20829cb..3dbb0c102 100755 --- a/debian/bin/gencontrol.py +++ b/debian/bin/gencontrol.py @@ -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), diff --git a/debian/changelog b/debian/changelog index 7ad750fe5..05a0a274f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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. diff --git a/debian/rules.real b/debian/rules.real index 534501de5..598e4c549 100644 --- a/debian/rules.real +++ b/debian/rules.real @@ -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'