Source: tbb Version: 4.3~20150611-2 Tags: patch User: helm...@debian.org Usertags: rebootstrap
tbb fails to cross build from source, because it uses the build architecture compiler and detects other aspects from the build architecture. Translating the Debian nomenclature into the tbb nomenclature is non-trivial, but I hope that the attached patch works for many architectures. It works at least for arm64, armhf, mipsel, powerpc and ppc64el. Please consider applying it despite its length. Helmut
diff --minimal -Nru tbb-4.3~20150611/debian/changelog tbb-4.3~20150611/debian/changelog --- tbb-4.3~20150611/debian/changelog 2016-06-03 22:20:25.000000000 +0200 +++ tbb-4.3~20150611/debian/changelog 2016-09-09 06:24:48.000000000 +0200 @@ -1,3 +1,10 @@ +tbb (4.3~20150611-2.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Fix FTCBFS: Pass build configuration to make. Closes: #-1 + + -- Helmut Grohne <hel...@subdivi.de> Fri, 09 Sep 2016 06:24:31 +0200 + tbb (4.3~20150611-2) unstable; urgency=medium * Add support for armel by distinguishing from armhf. diff --minimal -Nru tbb-4.3~20150611/debian/patches/cross.patch tbb-4.3~20150611/debian/patches/cross.patch --- tbb-4.3~20150611/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 +0100 +++ tbb-4.3~20150611/debian/patches/cross.patch 2016-09-09 21:30:17.000000000 +0200 @@ -0,0 +1,33 @@ +From: Helmut Grohne <hel...@subdivi.de> +Subject: have tbb honour $(CC) and $(CXX) + +Index: tbb-4.3~20150611/build/FreeBSD.gcc.inc +=================================================================== +--- tbb-4.3~20150611.orig/build/FreeBSD.gcc.inc ++++ tbb-4.3~20150611/build/FreeBSD.gcc.inc +@@ -28,8 +28,8 @@ + DYLIB_KEY = -shared + WARNING_SUPPRESS = -Wno-parentheses + +-CPLUS = g++ +-CONLY = gcc ++CPLUS = $(CXX) ++CONLY = $(CC) + LIB_LINK_FLAGS = -shared + LIBS = -lpthread + C_FLAGS = $(CPLUS_FLAGS) +Index: tbb-4.3~20150611/build/linux.gcc.inc +=================================================================== +--- tbb-4.3~20150611.orig/build/linux.gcc.inc ++++ tbb-4.3~20150611/build/linux.gcc.inc +@@ -32,8 +32,8 @@ + EXPORT_KEY = -Wl,--version-script, + LIBDL = -ldl + +-CPLUS = g++ +-CONLY = gcc ++CPLUS = $(CXX) ++CONLY = $(CC) + LIB_LINK_FLAGS = $(DYLIB_KEY) -Wl,-soname=$(BUILDING_LIBRARY) + LIBS += -lpthread -lrt + LINK_FLAGS = -Wl,-rpath-link=. -rdynamic diff --minimal -Nru tbb-4.3~20150611/debian/patches/series tbb-4.3~20150611/debian/patches/series --- tbb-4.3~20150611/debian/patches/series 2016-06-03 22:20:05.000000000 +0200 +++ tbb-4.3~20150611/debian/patches/series 2016-09-09 21:28:12.000000000 +0200 @@ -9,3 +9,4 @@ gcc-atomic-always.patch allow-armel-build.patch tweak-64bits-s390-hppa.patch +cross.patch diff --minimal -Nru tbb-4.3~20150611/debian/rules tbb-4.3~20150611/debian/rules --- tbb-4.3~20150611/debian/rules 2016-05-30 18:46:12.000000000 +0200 +++ tbb-4.3~20150611/debian/rules 2016-09-09 21:34:01.000000000 +0200 @@ -5,9 +5,46 @@ DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk +include /usr/share/dpkg/architecture.mk CFLAGS+=$(CPPFLAGS) CXXFLAGS+=$(CPPFLAGS) +ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH)) + +# Provide OS= +OS_MAP_linux = Linux +OS_MAP_kfreebsd = GNU/kFreeBSD +OS_MAP_hurd = GNU +ifneq ($(OS_MAP_$(DEB_HOST_ARCH_OS)),) +BUILD_FLAGS += OS=$(OS_MAP_$(DEB_HOST_ARCH_OS)) +endif + +# Provide compiler information +BUILD_FLAGS += compiler=gcc +BUILD_FLAGS += CC=$(DEB_HOST_GNU_TYPE)-gcc +BUILD_FLAGS += CXX=$(DEB_HOST_GNU_TYPE)-g++ + +# Provide arch= +arch_MAP_amd64 = intel64 +arch_MAP_i386 = ia32 +arch_MAP_mips64el = mips64 +arch_MAP_powerpc = ppc32 +arch_MAP_ppc64 = ppc64 +arch_MAP_ppc64el = ppc64le +ifneq ($(arch_MAP_$(DEB_HOST_ARCH_CPU)),) +BUILD_FLAGS += arch=$(arch_MAP_$(DEB_HOST_ARCH_CPU)) +else +ifeq ($(DEB_HOST_ARCH),armhf) +BUILD_FLAGS += arch=armv7 +else +# covers arm64, ia64, mips, sparc64, etc. +BUILD_FLAGS += arch=$(DEB_HOST_GNU_CPU) +endif +endif + +endif + + %: dh $@ --parallel --dbg-package=libtbb2-dbg @@ -20,7 +57,7 @@ sed -e"s/@VERSION@/$(VERSION)/g;s/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g" \ debian/tbb.pc.in > debian/tbb.pc - dh_auto_build + dh_auto_build -- $(BUILD_FLAGS) # Makefiles should not be compressed (tbb-examples) override_dh_compress-indep: