Source: stockfish
Version: 8-3
Severity: important
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

stockfish completely messes up the use of DEB_{BUILD,HOST}_* variables.

 * It does not set defaults for these variables. While dpkg-buildpackage
   sets them, running ./debian/rules directly is still permitted. In
   the latter case, the variables will be empty. An easy way to ensure
   that these variables are available is including
   /usr/share/dpkg/architecture.mk.
 * It confuses build and host breaking cross compilation. See man
   dpkg-architecture for when to use which.
 * It uses ARCH=general-32 for 64bit targets such as s390x or sparc64.
 * It generally uses loose matching on the architecture name rather than
   relevant aspects (e.g. matching only the cpu part).

The attached patch fixes a significant fraction of these issues while
trying hard not to introduce any accidental regressions. I recommend
moving further using constructs such as

    ifneq (,$(filter $(DEB_HOST_ARCH_CPU),ia64 m68k))

to treat multiple architectures in the same way. The DEB_HOST_ARCH_CPU
variable is subtly different from the DEB_HOST_ARCH. When in doubt,
check the output of dpkg-architecture -a$somearch.

Please consider applying the attached patch.

Helmut
diff --minimal -Nru stockfish-8/debian/changelog stockfish-8/debian/changelog
--- stockfish-8/debian/changelog        2016-11-12 18:55:54.000000000 +0100
+++ stockfish-8/debian/changelog        2018-04-30 06:53:28.000000000 +0200
@@ -1,3 +1,10 @@
+stockfish (8-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix us of DEB_{BUILD,HOST}_* variables; closes: #-1.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Mon, 30 Apr 2018 06:53:28 +0200
+
 stockfish (8-3) unstable; urgency=low
 
   * Set architecture bits from dpkg-architecture.
diff --minimal -Nru stockfish-8/debian/rules stockfish-8/debian/rules
--- stockfish-8/debian/rules    2016-11-12 11:45:57.000000000 +0100
+++ stockfish-8/debian/rules    2018-04-30 06:53:26.000000000 +0200
@@ -9,64 +9,64 @@
 # Uncomment this to turn on verbose mode.
 # export DH_VERBOSE=1
 
-DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
+include /usr/share/dpkg/architecture.mk
 
-TARGET := profile-build ARCH=general-$(shell dpkg-architecture 
-qDEB_HOST_ARCH_BITS)
+TARGET := profile-build ARCH=general-$(DEB_HOST_ARCH_BITS)
 
-ifneq (,$(findstring i386,$(DEB_BUILD_ARCH)))
+ifeq (i386,$(DEB_HOST_ARCH_CPU))
 TARGET := profile-build ARCH=x86-32-old
 endif
 
-ifneq (,$(findstring amd64,$(DEB_BUILD_ARCH)))
+ifneq (,$(findstring amd64,$(DEB_HOST_ARCH)))
 TARGET := profile-build ARCH=x86-64
 endif
 
 # no compile on the first shot so building without profile
-ifneq (,$(findstring hppa,$(DEB_BUILD_ARCH)))
-TARGET := build ARCH=general-32
+ifeq (hppa,$(DEB_HOST_ARCH_CPU))
+TARGET := build ARCH=general-$(DEB_HOST_ARCH_BITS)
 endif
 
 # no compile on the first shot
-ifneq (,$(findstring powerpc,$(DEB_BUILD_ARCH)))
-TARGET := build ARCH=general-32
+ifneq (,$(findstring powerpc,$(DEB_HOST_ARCH_CPU)))
+TARGET := build ARCH=general-$(DEB_HOST_ARCH_BITS)
 endif
 
-ifneq (,$(findstring s390,$(DEB_BUILD_ARCH)))
-TARGET := profile-build ARCH=general-32
+ifneq (,$(findstring s390,$(DEB_HOST_ARCH_CPU)))
+TARGET := profile-build ARCH=general-$(DEB_HOST_ARCH_BITS)
 endif
 
-ifneq (,$(findstring sparc,$(DEB_BUILD_ARCH)))
-TARGET := build ARCH=general-32
+ifneq (,$(findstring sparc,$(DEB_HOST_ARCH_CPU)))
+TARGET := build ARCH=general-$(DEB_HOST_ARCH_BITS)
 endif
 
-ifneq (,$(findstring mips,$(DEB_BUILD_ARCH)))
-TARGET := profile-build ARCH=general-32
+ifneq (,$(findstring mips,$(DEB_HOST_ARCH_CPU)))
+TARGET := profile-build ARCH=general-$(DEB_HOST_ARCH_BITS)
 endif
 
 # Profiling fails due to compiler issues
-ifneq (,$(findstring mipsel,$(DEB_BUILD_ARCH)))
-TARGET := build ARCH=general-32
+ifneq (,$(findstring mipsel,$(DEB_HOST_ARCH_CPU)))
+TARGET := build ARCH=general-$(DEB_HOST_ARCH_BITS)
 endif
 
-ifneq (,$(findstring alpha,$(DEB_BUILD_ARCH)))
-TARGET := build ARCH=general-64
+ifeq (alpha,$(DEB_HOST_ARCH_CPU))
+TARGET := build ARCH=general-$(DEB_HOST_ARCH_BITS)
 endif
 
 # no compile on the first shot
-ifneq (,$(findstring armel,$(DEB_BUILD_ARCH)))
-TARGET := build ARCH=general-32
+ifneq (,$(findstring armel,$(DEB_HOST_ARCH)))
+TARGET := build ARCH=general-$(DEB_HOST_ARCH_BITS)
 endif
 
-ifneq (,$(findstring armhf,$(DEB_BUILD_ARCH)))
-TARGET := build ARCH=general-32
+ifneq (,$(findstring armhf,$(DEB_HOST_ARCH)))
+TARGET := build ARCH=general-$(DEB_HOST_ARCH_BITS)
 endif
 
-ifneq (,$(findstring ia64,$(DEB_BUILD_ARCH)))
-TARGET := profile-build ARCH=general-64 optimize=no
+ifeq (ia64,$(DEB_HOST_ARCH_CPU))
+TARGET := profile-build ARCH=general-$(DEB_HOST_ARCH_BITS) optimize=no
 endif
 
-ifneq (,$(findstring m86k,$(DEB_BUILD_ARCH)))
-TARGET := build ARCH=general-32
+ifeq (m68k,$(DEB_HOST_ARCH_CPU))
+TARGET := build ARCH=general-$(DEB_HOST_ARCH_BITS)
 endif
 
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))

Reply via email to