[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#893493: gcc-8: simplify arch_gnutype_map and make it more consistent



Source: gcc-8
Version: 8-20180218-1
Tags: patch
User: helmutg@debian.org
Usertags: rebootstrap
Control: block 666743 by -1

Hi Matthias,

this is my second patch towards gcc-for-host. It reworks the
debian/rules.conf variable arch_gnutype_map. The first major change is
that it is now being generated from $(any_archs). This change is
intended to reduce the maintenance cost, because it will now be
automatically consistent with $(any_archs). The next change is that
any_archs and arch_gnutype_map always contain the target architecture.
This is automatically true for release and ports architectures, but for
new architectures it might not be. When using such an architecture, one
may have to regenerate debian/control then. Finally, this patch fixes
dependencies on architectures whose gnu triplet contains underscores
(i.e. amd64).

After performing this change, we can pass arch_gnutype_map into
debian/control.m4 and generate all those $tool-$archsuffix:$arch
packages. This is quite similar to the p_nat package in binutils.
Updating of debian/control.m4 and introducing those extra packages is
subject of a later patch.

I would like to thank James Clarke for his help in figuring out the
right approach and his review of this patch.

What needs to be done before you can apply this patch? Do you need
specific test builds?

Helmut
--- a/debian/rules.conf
+++ b/debian/rules.conf
@@ -445,37 +445,13 @@
 ifeq (yes,$(MIPS_R6_ENABLED))
   any_archs +=  mipsn32el mipsr6 mipsr6el mips64r6 mips64r6el mipsn32r6 mipsn32r6el
 endif
-arch_gnutype_map = \
-	alpha=alpha-linux-gnu \
-	amd64=x86-64-linux-gnu \
-	armel=arm-linux-gnueabi \
-	armhf=arm-linux-gnueabihf \
-	arm64=aarch64-linux-gnu \
-	i386=i686-linux-gnu \
-	mips=mips-linux-gnu \
-	mipsel=mipsel-linux-gnu \
-	mipsn32=mips64-linux-gnuabin32 \
-	mipsn32el=mips64el-linux-gnuabin32 \
-	mips64=mips64-linux-gnuabi64 \
-	mips64el=mips64el-linux-gnuabi64 \
-	mipsr6=mipsisa32r6-linux-gnu \
-	mipsr6el=mipsisa32r6el-linux-gnu \
-	mipsn32r6=mipsisa64r6-linux-gnuabin32 \
-	mipsn32r6el=mipsisa64r6el-linux-gnuabin32 \
-	mips64r6=mipsisa64r6-linux-gnuabi64 \
-	mips64r6el=mipsisa64r6el-linux-gnuabi64 \
-	powerpc=powerpc-linux-gnu \
-	powerpcspe=powerpc-linux-gnuspe \
-	ppc64=powerpc64-linux-gnu \
-	ppc64el=powerpc64le-linux-gnu \
-	m68k=m68k-linux-gnu \
-	sh4=sh4-linux-gnu \
-	sparc64=sparc64-linux-gnu \
-	s390x=s390x-linux-gnu \
-	x32=x86-64-linux-gnux32
+ifeq ($(filter $(DEB_HOST_ARCH),$(any_archs)),)
+any_archs += $(DEB_HOST_ARCH)
+endif
 
-_element = $(filter $1=%,$(arch_gnutype_map))
+arch_gnutype_map := $(foreach a,$(any_archs),$(a)=$(shell CC=true dpkg-architecture -f -a$(a) -qDEB_HOST_GNU_TYPE))
 _gnu_type = $(subst $1=,,$(filter $1=%,$(arch_gnutype_map)))
+_gnu_suffix = -$(subst _,-,$(call _gnu_type,$1))
 
 ifneq (,$(filter $(distrelease),lenny etch squeeze wheezy wheezy dapper hardy jaunty karmic lucid maverick natty oneiric precise quantal raring saucy trusty utopic vivid))
   DEBHELPER_BUILD_DEP = debhelper (>= 9),
@@ -486,16 +462,16 @@
   DEBHELPER_BUILD_DEP = debhelper (>= 9.20141010),
   TARGET_TOOL_BUILD_DEP = \
 	$(foreach a, $(any_archs), \
-	  g++-$(BASE_VERSION)-$(call _gnu_type,$(a)) [$(a)] <cross>, \
+	  g++-$(BASE_VERSION)$(call _gnu_suffix,$(a)) [$(a)] <cross>, \
 	  $(if $(filter $(a), avr),, \
-	    gobjc-$(BASE_VERSION)-$(call _gnu_type,$(a)) [$(a)] <cross>,) \
-	  gfortran-$(BASE_VERSION)-$(call _gnu_type,$(a)) [$(a)] <cross>, \
+	    gobjc-$(BASE_VERSION)$(call _gnu_suffix,$(a)) [$(a)] <cross>,) \
+	  gfortran-$(BASE_VERSION)$(call _gnu_suffix,$(a)) [$(a)] <cross>, \
 	  $(if $(filter $(a), s390 sh4),, \
-	    gdc-$(BASE_VERSION)-$(call _gnu_type,$(a)) [$(a)] <cross>,) \
+	    gdc-$(BASE_VERSION)$(call _gnu_suffix,$(a)) [$(a)] <cross>,) \
 	  $(if $(filter $(a), hppa m68k sh4),, \
-	    gccgo-$(BASE_VERSION)-$(call _gnu_type,$(a)) [$(a)] <cross>,) \
+	    gccgo-$(BASE_VERSION)$(call _gnu_suffix,$(a)) [$(a)] <cross>,) \
 	  $(if $(filter $(a), m68k),, \
-	    gnat-$(BASE_VERSION)-$(call _gnu_type,$(a)) [$(a)] <cross>,) \
+	    gnat-$(BASE_VERSION)$(call _gnu_suffix,$(a)) [$(a)] <cross>,) \
 	)
   pf_cross = $(SPACE)<cross>
   pf_ncross = $(SPACE)<!cross>
@@ -572,6 +548,7 @@
     SOURCE_BUILD_DEP := gcc-$(BASE_VERSION)-source (>= $(GCC_SOURCE_VERSION)), gcc-$(BASE_VERSION)-source (<< $(NEXT_GCC_SOURCE_VERSION)),
   endif
   GNAT_BUILD_DEP :=
+  arch_gnutype_map = $(DEB_TARGET_ARCH)=$(TARGET_ALIAS)
 endif # cross compiler
 
 BASE_BREAKS := gcc-4.4-base (<< 4.4.7), gcc-4.7-base (<< 4.7.3), gcj-4.4-base (<< 4.4.6-9~), gnat-4.4-base (<< 4.4.6-3~), gcj-4.6-base (<< 4.6.1-4~), gnat-4.6 (<< 4.6.1-5~)

Reply to: