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.
This commit is contained in:
Ben Hutchings 2018-09-12 22:11:25 +01:00
parent 47d37cf949
commit 9ee715feb5
3 changed files with 11 additions and 1 deletions

1
debian/changelog vendored
View File

@ -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 <ben@decadent.org.uk> Mon, 10 Sep 2018 22:25:53 +0100

3
debian/rules vendored
View File

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

8
debian/rules.real vendored
View File

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