From 9ee715feb56d03c7e0452a4c637a9e074bbf934b Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 12 Sep 2018 22:11:25 +0100 Subject: [PATCH] debian/rules{,.real}: Use /usr/share/dpkg/architecture.mk Currently we don't set all the architecture variables, so direct use of these makefiles (not under dpkg-architecture or dpkg-buildpackage) may fail. In case ARCH and DEB_HOST_ARCH don't match in rules.real, we really should fail, so add an explicit check for that. This also fixes lintian warning debian-rules-sets-dpkg-architecture-variable. --- debian/changelog | 1 + debian/rules | 3 ++- debian/rules.real | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 3bfb7f1ef..17ac5c76e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -23,6 +23,7 @@ linux (4.19~rc3-1~exp2) UNRELEASED; urgency=medium * tools: turbostat: Add checks for failure of fgets() and fscanf() * debian/control: Build-depend on texlive-latex-{base,extra}, dvipng for linux-doc + * debian/rules{,.real}: Use /usr/share/dpkg/architecture.mk -- Ben Hutchings Mon, 10 Sep 2018 22:25:53 +0100 diff --git a/debian/rules b/debian/rules index 90973714a..1ddbb45ad 100755 --- a/debian/rules +++ b/debian/rules @@ -1,12 +1,13 @@ #!/usr/bin/make -f SHELL := sh -e -DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) SOURCE := $(shell dpkg-parsechangelog -SSource) VERSION := $(shell dpkg-parsechangelog -SVersion) VERSION_UPSTREAM := $(shell echo "$(VERSION)" | sed -e 's,-[^-]*$$,,') VERSION_BINNMU := $(shell echo "$(VERSION)" | sed -rne 's,.*\+b([0-9]+)$$,\1,p') +include /usr/share/dpkg/architecture.mk + include debian/rules.defs ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) diff --git a/debian/rules.real b/debian/rules.real index b7af0ddbd..24c2182e5 100644 --- a/debian/rules.real +++ b/debian/rules.real @@ -16,8 +16,16 @@ ifeq ($(DISTRIBUTOR),) DISTRIBUTOR := Debian endif +include /usr/share/dpkg/architecture.mk + include debian/rules.defs +ifdef ARCH + ifneq ($(DEB_HOST_ARCH),$(ARCH)) + $(error Attempting to build a $(ARCH) target but host architecture is $(DEB_HOST_ARCH). Use dpkg-architecture to override the host architecture) + endif +endif + ifdef OVERRIDE_HOST_TYPE CROSS_COMPILE := $(OVERRIDE_HOST_TYPE)- else ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))