Bug#768167: dpkg-architecture export DEB_TARGET_* make cross build failure
On Thu, 6 Nov 2014 00:15:13 +0800 YunQiang Su <wzssyqa@gmail.com> wrote:
> Package: src:gcc-4.9
> Version: 4.9.2-1
>
> In the past, dpkg-architecture doesn't export DEB_TARGET_* Vars,
>
> so in rules.defs
>
> ifdef DEB_TARGET_GNU_TYPE
> TARGET_VARS := $(shell dpkg-architecture -f -t$(DEB_TARGET_GNU_TYPE)
> 2>/dev/null)
> else
> # allow debian/target to be used instead of DEB_GCC_TARGET - this
> was requested
> # by toolchain-source maintainer
> DEBIAN_TARGET_FILE := $(strip $(if $(wildcard debian/target),$(shell
> cat debian/target 2>/dev/null)))
> ifndef DEB_TARGET_ARCH
> ifneq (,$(DEBIAN_TARGET_FILE))
> DEB_TARGET_ARCH := $(DEBIAN_TARGET_FILE)
> else
> ifdef DEB_GCC_TARGET
> DEB_TARGET_ARCH := $(DEB_GCC_TARGET)
> else
> DEB_TARGET_ARCH := $(DEB_HOST_ARCH)
> endif
> endif
> endif
> TARGET_VARS := $(shell dpkg-architecture -f -a$(DEB_TARGET_ARCH) 2>/dev/null)
> endif
>
> DEB_TARGET_ARCH ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH)
> DEB_TARGET_ARCH_OS ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_OS)
> DEB_TARGET_ARCH_CPU ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_CPU)
> DEB_TARGET_GNU_CPU ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_CPU)
> DEB_TARGET_GNU_TYPE ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_TYPE)
> DEB_TARGET_GNU_SYSTEM ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_SYSTEM)
> DEB_TARGET_MULTIARCH ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_MULTIARCH)
>
> works
> But now, when DEB_TARGET_GNU_TYPE and DEB_TARGET_ARCH always define,
> we can not get cross complier with debian/target file or DEB_GCC_TARGET var.
>
> Modifying it to this can fix this problem
>
> # allow debian/target to be used instead of DEB_GCC_TARGET - this was requested
> # by toolchain-source maintainer
> DEBIAN_TARGET_FILE := $(strip $(if $(wildcard debian/target),$(shell
> cat debian/target 2>/dev/null)))
> ifndef DEB_TARGET_ARCH
This line is also need to be removed, so update the patch.
> ifneq (,$(DEBIAN_TARGET_FILE))
> DEB_TARGET_ARCH := $(DEBIAN_TARGET_FILE)
> else
> ifdef DEB_GCC_TARGET
> DEB_TARGET_ARCH := $(DEB_GCC_TARGET)
> else
> DEB_TARGET_ARCH := $(DEB_HOST_ARCH)
> endif
> endif
> endif
> TARGET_VARS := $(shell dpkg-architecture -f -a$(DEB_TARGET_ARCH) 2>/dev/null)
--- gcc-4.9-4.9.2/debian/rules.defs 2014-11-06 00:12:34.000000000 +0800
+++ gcc-4.9/debian/rules.defs 2014-11-06 00:34:16.521099152 +0800
@@ -89,33 +89,28 @@
ifdef GCC_TARGET
DEB_GCC_TARGET := $(GCC_TARGET)
endif
-ifdef DEB_TARGET_GNU_TYPE
- TARGET_VARS := $(shell dpkg-architecture -f -t$(DEB_TARGET_GNU_TYPE) 2>/dev/null)
+
+# allow debian/target to be used instead of DEB_GCC_TARGET - this was requested
+# by toolchain-source maintainer
+DEBIAN_TARGET_FILE := $(strip $(if $(wildcard debian/target),$(shell cat debian/target 2>/dev/null)))
+ifneq (,$(DEBIAN_TARGET_FILE))
+ DEB_TARGET_ARCH := $(DEBIAN_TARGET_FILE)
else
- # allow debian/target to be used instead of DEB_GCC_TARGET - this was requested
- # by toolchain-source maintainer
- DEBIAN_TARGET_FILE := $(strip $(if $(wildcard debian/target),$(shell cat debian/target 2>/dev/null)))
- ifndef DEB_TARGET_ARCH
- ifneq (,$(DEBIAN_TARGET_FILE))
- DEB_TARGET_ARCH := $(DEBIAN_TARGET_FILE)
- else
- ifdef DEB_GCC_TARGET
- DEB_TARGET_ARCH := $(DEB_GCC_TARGET)
- else
- DEB_TARGET_ARCH := $(DEB_HOST_ARCH)
- endif
- endif
+ ifdef DEB_GCC_TARGET
+ DEB_TARGET_ARCH := $(DEB_GCC_TARGET)
+ else
+ DEB_TARGET_ARCH := $(DEB_HOST_ARCH)
endif
- TARGET_VARS := $(shell dpkg-architecture -f -a$(DEB_TARGET_ARCH) 2>/dev/null)
endif
+TARGET_VARS := $(shell dpkg-architecture -f -a$(DEB_TARGET_ARCH) 2>/dev/null)
-DEB_TARGET_ARCH ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH)
-DEB_TARGET_ARCH_OS ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_OS)
-DEB_TARGET_ARCH_CPU ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_CPU)
-DEB_TARGET_GNU_CPU ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_CPU)
-DEB_TARGET_GNU_TYPE ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_TYPE)
-DEB_TARGET_GNU_SYSTEM ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_SYSTEM)
-DEB_TARGET_MULTIARCH ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_MULTIARCH)
+DEB_TARGET_ARCH := $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH)
+DEB_TARGET_ARCH_OS := $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_OS)
+DEB_TARGET_ARCH_CPU := $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_CPU)
+DEB_TARGET_GNU_CPU := $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_CPU)
+DEB_TARGET_GNU_TYPE := $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_TYPE)
+DEB_TARGET_GNU_SYSTEM := $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_SYSTEM)
+DEB_TARGET_MULTIARCH := $(call vafilt,$(TARGET_VARS),DEB_HOST_MULTIARCH)
ifeq ($(DEB_TARGET_GNU_TYPE),i486-linux-gnu)
DEB_TARGET_GNU_TYPE = i586-linux-gnu
Reply to: