diff options
Diffstat (limited to '')
45 files changed, 13119 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..81e5581 --- /dev/null +++ b/debian/rules @@ -0,0 +1,100 @@ +#! /usr/bin/make -f +# -*- makefile -*- +# Build rules for gcc (>= 2.95) and gcc-snapshot +# Targets found in this makefile: +# - unpack tarballs +# - patch sources +# - (re)create the control file +# - create a debian/rules.parameters file, which is included +# by debian/rules2 +# All other targets are passed to the debian/rules2 file + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +unexport LANG LC_ALL LC_CTYPE LC_COLLATE LC_TIME LC_NUMERIC LC_MESSAGES + +default: build + +include debian/rules.defs +include debian/rules.unpack +include debian/rules.patch + +control: $(control_dependencies) + @echo "Build environment: derivative=$(derivative), release=$(distrelease)" + -mkdir -p $(stampdir) + $(MAKE) -f debian/rules.conf $@ + +configure: control $(unpack_stamp) $(patch_stamp) + $(MAKE) -f debian/rules2 $@ + +pre-build: +# no backport support for these releases ..., keep conditionals for +# Debian: jessie stretch buster bullseye ... +# UBuntu: precise trusty xenial bionic focal groovy hirsute ... +ifneq (,$(filter $(distrelease),lenny squeeze wheezy hardy lucid)) + @echo explicitely fail the build for $(distribution)/$(distrelease) on $(DEB_TARGET_ARCH). + @echo no bug report required. please figure out the back port yourself. + false +endif +#ifeq ($(PKGSOURCE),gcc-13) +# ifneq (,$(findstring native, $(build_type))) +# ifneq (,$(findstring mips, $(TARGET_ALIAS))) +# @echo "native compiler for $(TARGET_ALIAS) not built from this source." +# @echo "See https://lists.debian.org/debian-gcc/2021/05/msg00011.html" +# false +# endif +# endif +#endif + +build: pre-build control + $(MAKE) $(NJOBS) -f debian/rules2 $@ +build-arch: pre-build control + $(MAKE) $(NJOBS) -f debian/rules2 $@ +build-indep: pre-build control + DEB_BUILD_OPTIONS="$(DEB_BUILD_OPTIONS) nostrap nohppa64 nonvptx nocheck nopgo nolto" \ + $(MAKE) $(NJOBS) -f debian/rules2 $@ + +check: $(check_stamp) +$(check_stamp): $(build_stamp) + $(MAKE) -f debian/rules2 $@ + +clean: + rm -rf $(stampdir) +# remove temporary dirs used for unpacking + rm -rf $(gcc_srcdir) $(gdc_srcdir) $(newlib_srcdir) $(binutils_srcdir) + -$(MAKE) -f debian/rules2 $@ + rm -rf $(srcdir)* $(builddir)* debian/tmp* html + rm -f bootstrap-* test-protocol* first-move-stamp + rm -f debian/*.tmp + rm -f debian/soname-cache + find debian -name '.#*' | xargs -r rm -f + rm -f $(series_file)* + rm -rf .pc + dh_clean + +install: + $(MAKE) -f debian/rules2 $@ + +html-docs doxygen-docs update-doxygen-docs update-ada-files xxx: + $(MAKE) -f debian/rules2 $@ + +binary-arch binary: + $(MAKE) -f debian/rules2 $@ + +binary-indep: + DEB_BUILD_OPTIONS="$(DEB_BUILD_OPTIONS) nostrap nohppa64 nonvptx nocheck nopgo nolto" \ + $(MAKE) -f debian/rules2 $@ + +source diff: + @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false + +release: + foo=$(shell basename $(CURDIR)); \ + if [ "$$foo" != "gcc-3.4" ]; then \ + find -name CVS -o -name .cvsignore -o -name '.#*' | \ + xargs rm -rf; \ + fi + +.NOTPARALLEL: +.PHONY: build clean binary-indep binary-arch binary release diff --git a/debian/rules.conf b/debian/rules.conf new file mode 100644 index 0000000..e72ea2e --- /dev/null +++ b/debian/rules.conf @@ -0,0 +1,1453 @@ +# -*- makefile -*- +# rules.conf +# - used to build debian/control and debian/rules.parameters +# - assumes unpacked sources + +include debian/rules.defs +include debian/rules.sonames + +ifneq (,$(findstring gcc-toolchain, $(PKGSOURCE))) +include $(binutils_srcdir)/debian/rules.defs +endif + +# manual ... +ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),hppa m68k)) + ifeq ($(DEB_TARGET_ARCH),m68k) + GCC_SONAME := 2 + endif + ifeq ($(DEB_TARGET_ARCH),hppa) + GCC_SONAME := 4 + endif +else + GCC_SONAME := 1 +endif +DEB_LIBGCC_SOVERSION := $(DEB_SOVERSION) +DEB_LIBGCC_VERSION := $(DEB_VERSION) + +_soname_map = gcc-s=$(GCC_SONAME) gcc=$(GCC_SONAME) stdc++=$(CXX_SONAME) \ + gomp=$(GOMP_SONAME) ssp=$(SSP_SONAME) gfortran=$(FORTRAN_SONAME) \ + itm=$(ITM_SONAME) objc=$(OBJC_SONAME) quadmath=$(QUADMATH_SONAME) \ + go=$(GO_SONAME) backtrace=$(BTRACE_SONAME) \ + atomic=$(ATOMIC_SONAME) asan=$(ASAN_SONAME) lsan=$(LSAN_SONAME) \ + tsan=$(TSAN_SONAME) ubsan=$(UBSAN_SONAME) hwasan=$(HWASAN_SONAME) \ + vtv=$(VTV_SONAME) gm2=$(GM2_SONAME) \ + gphobos=$(GPHOBOS_SONAME) +_soname = $(patsubst $(1)=%,%,$(filter $(1)=%,$(_soname_map))) + +rel_on_dev := $(if $(cross_lib_arch),>=,=) +# $(call _lib_name,<name>,<biarch>,<ext>) +_lib_name = $(subst $(SPACE),, \ + lib$(2)$(1) \ + $(if $(filter dev,$(3)),,$(call _soname,$(1))) \ + $(if $(or $(filter $(3),dev),$(and $(filter $(3),dbg),$(filter $(1),stdc++))),-$(BASE_VERSION)) \ + $(if $(3),-$(3))$(LS)$(AQ)) +# $(call _lib_vers,<ext>,<vers>) +_lib_vers = ($(if $(filter $(1),dev),$(rel_on_dev),>=) $(2)) + +# Helper to generate biarch/triarch dependencies. +# For example, $(eval $(call gen_multilib_deps,gomp)) will create the +# libgompbiarch variable, and make it contains the libgompbiarch{32,64,n32} +# variables if biarch{32,64,n32} is set to yes. + +define gen_multilib_deps + lib$1biarch64$2 := $(call _lib_name,$(1),64,$(2)) $(call _lib_vers,$(2),$(3)) + lib$1biarch32$2 := $(call _lib_name,$(1),32,$(2)) $(call _lib_vers,$(2),$(3)) + lib$1biarchn32$2 := $(call _lib_name,$(1),n32,$(2)) $(call _lib_vers,$(2),$(3)) + lib$1biarchx32$2 := $(call _lib_name,$(1),x32,$(2)) $(call _lib_vers,$(2),$(3)) + lib$1biarchhf$2 := $(call _lib_name,$(1),hf,$(2)) $(call _lib_vers,$(2),$(3)) + lib$1biarchsf$2 := $(call _lib_name,$(1),sf,$(2)) $(call _lib_vers,$(2),$(3)) + ifeq ($$(biarch64),yes) + lib$1biarch$2 := $$(lib$1biarch64$2) + endif + ifeq ($$(biarch32),yes) + ifeq ($$(biarch64),yes) + lib$1biarch$2 := $$(lib$1biarch64$2), $$(lib$1biarch32$2) + else + lib$1biarch$2 := $$(lib$1biarch32$2) + endif + endif + ifeq ($$(biarchx32),yes) + ifeq ($$(biarch64),yes) + lib$1biarch$2 := $$(lib$1biarch64$2), $$(lib$1biarchx32$2) + else ifeq ($$(biarch32),yes) + lib$1biarch$2 := $$(lib$1biarch32$2), $$(lib$1biarchx32$2) + else + lib$1biarch$2 := $$(lib$1biarchx32$2) + endif + endif + ifeq ($$(biarchn32),yes) + ifeq ($$(biarch64),yes) + lib$1biarch$2 := $$(lib$1biarch64$2), $$(lib$1biarchn32$2) + else ifeq ($$(biarch32),yes) + lib$1biarch$2 := $$(lib$1biarch32$2), $$(lib$1biarchn32$2) + else + lib$1biarch$2 := $$(lib$1biarchn32$2) + endif + endif + ifeq ($$(biarchhf),yes) + lib$1biarch$2 := $$(lib$1biarchhf$2) | $(call _lib_name,$(1),hf,$(2)) + endif + ifeq ($$(biarchsf),yes) + lib$1biarch$2 := $$(lib$1biarchsf$2) | $(call _lib_name,$(1),sf,$(2)) + endif +endef +ifeq ($(with_shared_libgcc),yes) + LIBGCC_DEP := libgcc-s$(GCC_SONAME)$(LS)$(AQ) (>= $${gcc:Version}) + $(eval $(call gen_multilib_deps,gcc-s,,$$$${gcc:Version})) +endif +LIBGCC_DEV_DEP := libgcc-$(BASE_VERSION)-dev$(LS)$(AQ) ($(rel_on_dev) $${gcc:Version}) +$(foreach x,stdc++ gomp ssp gfortran itm objc atomic asan lsan ubsan hwasan quadmath go vtv, \ + $(eval $(call gen_multilib_deps,$(x),,$$$${gcc:Version}))) +$(foreach x,gcc gcc-s stdc++ gfortran objc go gphobos, \ + $(eval $(call gen_multilib_deps,$(x),dev,$$$${gcc:Version}))) +$(foreach x,gcc gcc-s stdc++ gfortran objc go gphobos, \ + $(eval $(call gen_multilib_deps,$(x),dbg,$$$${gcc:Version}))) + +# Helper to generate _no_archs variables. +# For example, $(eval $(call gen_no_archs,go)) will create the go_no_archs +# variable, using the go_no_cpu and go_no_systems variables. +define gen_no_archs + $1_no_archs := + ifneq (,$$($1_no_cpus)) + $1_no_archs += $$(foreach cpu,$$(filter-out i386 amd64 alpha arm,$$($1_no_cpus)),!$$(cpu)) + ifneq (,$$(filter i386,$$($1_no_cpus))) + $1_no_archs += !i386 !hurd-i386 !kfreebsd-i386 + endif + ifneq (,$$(filter amd64,$$($1_no_cpus))) + $1_no_archs += !amd64 !hurd-amd64 !kfreebsd-amd64 + endif + ifneq (,$$(filter alpha,$$($1_no_cpus))) + $1_no_archs += !alpha !hurd-alpha + endif + ifneq (,$$(filter arm,$$($1_no_cpus))) + $1_no_archs += !arm !armel !armhf + endif + ifneq (,$$(strip $3)) + $1_no_systems_tmp := $$(subst $$(SPACE)gnu$$(SPACE),$$(SPACE)hurd-gnu$$(SPACE),$$(SPACE)$3$$(SPACE)) + $1_no_archs += $$(foreach cpu,$$($1_no_cpus),$$(foreach system,$$($1_no_systems_tmp),!$$(subst gnu,$$(cpu),$$(system)))) + endif + endif + ifneq (,$$($1_no_systems)) + $1_no_systems_tmp := $$(subst $$(SPACE)gnu$$(SPACE),$$(SPACE)hurd-gnu$$(SPACE),$$(SPACE)$$($1_no_systems)$$(SPACE)) + $1_no_archs += $$(foreach system,$$($1_no_systems_tmp),$$(foreach cpu,$2,!$$(subst gnu,$$(cpu),$$(system)))) + endif + $1_no_archs := $$(strip $$($1_no_archs)) +endef +base_deb_cpus := amd64 i386 +base_deb_systems := +$(foreach x,ada d fortran go m2 rs libgphobos libgc check locale,$(eval $(call gen_no_archs,$(x),$(base_deb_cpus),$(base_deb_systems)))) +linux_no_archs := !hurd-any !kfreebsd-any + +GCC_VERSION := $(strip $(shell cat $(firstword $(wildcard $(srcdir)/gcc/FULL-VER $(srcdir)/gcc/BASE-VER)))) +NEXT_GCC_VERSION := $(shell echo $(GCC_VERSION) | \ + awk -F. '{OFS="."; $$2 += 1; $$3=0; print}') +GCC_MAJOR_VERSION := $(shell echo $(GCC_VERSION) | sed -r 's/([0-9])\.[0-9]\.[0-9]/\1/') +GCC_MINOR_VERSION := $(shell echo $(GCC_VERSION) | sed -r 's/[0-9]\.([0-9])\.[0-9]/\1/') +GCC_RELEASE_VERSION := $(shell echo $(GCC_VERSION) | sed -r 's/[0-9]\.[0-9]\.([0-9])/\1/') +NEXT_GCC_MAJOR_VERSION := $(shell expr $(echo $(GCC_MAJOR_VERSION)) + 1) +NEXT_GCC_MINOR_VERSION := $(shell expr $(echo $(GCC_MINOR_VERSION)) + 1) +NEXT_GCC_RELEASE_VERSION := $(shell expr $(echo $(GCC_MAJOR_VERSION)) + 1) + +ifeq ($(single_package),yes) + BASE_VERSION := $(shell echo $(GCC_VERSION) | sed -e 's/\([0-9]*\).*/\1/') +endif + +GCC_SOURCE_VERSION := $(shell echo $(DEB_VERSION) | sed 's/-.*//') +NEXT_GCC_SOURCE_VERSION := $(shell echo $(GCC_SOURCE_VERSION) | \ + awk -F. '{OFS="."; $$2 += 1; $$3=0; print}') + +MAINTAINER = Debian GCC Maintainers <debian-gcc@lists.debian.org> +ifeq ($(distribution),Ubuntu) + ifneq (,$(findstring $(PKGSOURCE),gnat gdc)) + MAINTAINER = Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com> + else + MAINTAINER = Ubuntu Core developers <ubuntu-devel-discuss@lists.ubuntu.com> + endif +endif + +UPLOADERS = Matthias Klose <doko@debian.org> +ifneq (,$(findstring $(PKGSOURCE),gnat)) + UPLOADERS = Ludovic Brenta <lbrenta@debian.org> +endif +ifneq (,$(findstring $(PKGSOURCE),gdc)) + UPLOADERS = Iain Buclaw <ibuclaw@ubuntu.com>, Matthias Klose <doko@debian.org> +endif + +DPKGV = 1.14.15 +ifeq ($(with_multiarch_lib),yes) + DPKGV = 1.16.0~ubuntu4 +endif +ifeq ($(multiarch_stage1),yes) + DPKGV = 1.16.0~ubuntu4 +endif +ifeq (,$(filter $(distrelease), precise trusty)) + DPKGV = 1.17.14 +endif +DPKG_BUILD_DEP = dpkg-dev (>= $(DPKGV)), + +ifeq ($(DEB_HOST_ARCH),$(DEB_TARGET_ARCH)) + TARGET_QUAL = :$(DEB_TARGET_ARCH) +endif + +ifneq (,$(filter $(distrelease), precise trusty xenial)) + LOCALES = locales +else + LOCALES = locales-all +endif + +# The binutils version needed. +# The oldest suitable versions for the various platforms can be found in +# INSTALL/specific.html ; we take a tighter dependency if possible to be on +# the safe side (something like newest( version in stable, versions for the +# various platforms in INSTALL/specific.html) ). +# We need binutils (>= 2.19.1) for a new dwarf unwind expression opcode. +# See http://gcc.gnu.org/ml/gcc-patches/2008-09/msg01713.html +ifeq ($(trunk_build),yes) + BINUTILSBDV = 2.23 +else + BINUTILSBDV = 2.22 + ifneq (,$(filter $(distrelease),precise)) + BINUTILSBDV = 2.22-6~ + else ifneq (,$(filter $(distrelease),trusty)) + BINUTILSBDV = 2.24-5~ + else ifneq (,$(filter $(distrelease),jessie)) + BINUTILSBDV = 2.25-7~ + else ifneq (,$(filter $(distrelease),xenial)) + BINUTILSBDV = 2.26.1 + else ifneq (,$(filter $(distrelease),stretch)) + BINUTILSBDV = 2.28 + else ifneq (,$(filter $(distrelease),bionic)) + BINUTILSBDV = 2.30 + else ifneq (,$(filter $(distrelease),buster focal)) + BINUTILSBDV = 2.34 + else ifneq (,$(filter $(distrelease),groovy)) + BINUTILSBDV = 2.35 + else ifneq (,$(filter $(distrelease),bullseye)) + BINUTILSBDV = 2.35.2 + else ifneq (,$(filter $(distrelease),hirsute)) + BINUTILSBDV = 2.36 + else + BINUTILSBDV = 2.37 + endif +endif +ifeq ($(DEB_CROSS),yes) + ifneq (,$(filter $(distrelease),stretch jessie precise trusty xenial)) + BINUTILS_BUILD_DEP = binutils$(TS)$(NT) (>= $(BINUTILSBDV)), binutils-multiarch$(NT) (>= $(BINUTILSBDV)) + else + BINUTILS_BUILD_DEP = binutils$(TS)$(NT) (>= $(BINUTILSBDV)), debhelper (>= 10.10.6~) + endif + BINUTILSV := $(shell dpkg -l binutils$(TS) \ + | awk '/^ii/{print $$3;exit}' | sed 's/-.*//') +else + BINUTILS_BUILD_DEP = binutils$(NT) (>= $(BINUTILSBDV)) + ifneq (,$(findstring cross-build-,$(build_type))) + BINUTILSV := $(shell dpkg -l binutils$(TS) \ + | awk '/^ii/{print $$3;exit}' | sed 's/-.*//') + else + BINUTILSV := $(shell dpkg -l binutils binutils-multiarch \ + | awk '/^ii/{print $$3;exit}' | sed 's/-.*//') + endif +endif +ifneq (,$(filter $(build_type), build-native cross-build-native)) + ifeq (,$(filter gccgo% gnat%, $(PKGSOURCE))) + BINUTILS_BUILD_DEP += , $(binutils_hppa64)$(NT) (>= $(BINUTILSBDV)) [$(hppa64_archs)] + endif +endif +ifeq (,$(BINUTILSV)) + BINUTILSV := $(BINUTILSBDV) +endif + +# FIXME; stripping doesn't work with gold +#BINUTILS_BUILD_DEP += , binutils-gold (>= $(BINUTILSV)) [$(gold_archs)] + +# libc-dev dependencies +libc_ver := 2.23 +libc_dev_ver := $(libc_ver) +kfreebsd_libc_dev_ver := 2.25 +ifeq ($(with_multiarch_lib),yes) + ifeq ($(derivative),Debian) + libc_dev_ver := 2.23-1~ + else + libc_dev_ver := 2.13-0ubuntu6 + endif +endif +# first set LIBC_DEP/LIBC_DEV_DEP for native builds only +ifeq ($(DEB_TARGET_ARCH_OS),linux) + LIBC_DEP = $(if $(filter alpha ia64, $(DEB_TARGET_ARCH)),libc6.1,libc6) + ifneq (,$(findstring musl-linux-,$(DEB_TARGET_ARCH))) + LIBC_DEP = musl + libc_ver = 0.9 + libc_dev_ver = 0.9 + endif +else ifeq ($(DEB_TARGET_ARCH_OS),hurd) + LIBC_DEP = libc0.3 +else ifeq ($(DEB_TARGET_ARCH_OS),kfreebsd) + LIBC_DEP = libc0.1 + libc_dev_ver := $(kfreebsd_libc_dev_ver) +else ifeq ($(DEB_TARGET_ARCH),uclibc) + LIBC_DEP = libuclibc +endif +LIBC_DEV_DEP := $(LIBC_DEP)-dev + +# this is about Debian archs name, *NOT* GNU target triplet +biarch_deb_map := \ + i386=amd64 amd64=i386 \ + mips=mips64 mipsel=mips64el \ + mipsn32=mips mipsn32el=mipsel \ + mips64=mips mips64el=mipsel \ + mipsr6=mips64r6 mipsr6el=mips64r6el \ + mipsn32r6=mipsr6 mipsn32r6el=mipsr6el \ + mips64r6=mipsr6 mips64r6el=mipsr6el \ + powerpc=ppc64 ppc64=powerpc \ + sparc=sparc64 sparc64=sparc\ + s390=s390x s390x=s390 \ + kfreebsd-amd64=i386 \ + armel=armhf \ + armhf=armel +biarch_deb_arch := $(patsubst $(DEB_TARGET_ARCH)=%,%, \ + $(filter $(DEB_TARGET_ARCH)=%,$(biarch_deb_map))) + +LIBC_BIARCH_DEP := +LIBC_BIARCH_DEV_DEP := +ifneq (,$(findstring yes,$(biarch64) $(biarch32) $(biarchn32) $(biarchx32)$(biarchhf)$(biarchsf))) + LIBC_BIARCH_DEP := $${shlibs:Depends} + LIBC_BIARCH_DEV_DEP := $(LIBC_DEV_DEP)-$(biarch_deb_arch)$(LS)$(AQ) (>= $(libc_dev_ver)) + # amd64, x32, i386 + ifneq (,$(findstring $(DEB_TARGET_ARCH),amd64 x32 i386)) + ifeq ($(biarch64)$(biarch32),yesyes) + LIBC_BIARCH_DEV_DEP := $(LIBC_DEV_DEP)-amd64$(LS)$(AQ) (>= $(libc_dev_ver)), + LIBC_BIARCH_DEV_DEP += $(LIBC_DEV_DEP)-i386$(LS)$(AQ) (>= $(libc_dev_ver)) + endif + ifeq ($(biarch64)$(biarchx32),yesyes) + LIBC_BIARCH_DEV_DEP := $(LIBC_DEV_DEP)-amd64$(LS)$(AQ) (>= $(libc_dev_ver)), + LIBC_BIARCH_DEV_DEP += $(LIBC_DEV_DEP)-x32$(LS)$(AQ) (>= $(libc_dev_ver)) + endif + ifeq ($(biarch32)$(biarchx32),yesyes) + LIBC_BIARCH_DEV_DEP := $(LIBC_DEV_DEP)-i386$(LS)$(AQ) (>= $(libc_dev_ver)), + LIBC_BIARCH_DEV_DEP += $(LIBC_DEV_DEP)-x32$(LS)$(AQ) (>= $(libc_dev_ver)) + endif + endif + # mips* + ifneq (,$(findstring mips, $(DEB_TARGET_ARCH))) + ifeq ($(biarchn32)$(biarch32),yesyes) + LIBC_BIARCH_DEV_DEP := libc6-dev-mips32$(LS)$(AQ) (>= $(libc_dev_ver)), + LIBC_BIARCH_DEV_DEP += libc6-dev-mipsn32$(LS)$(AQ) (>= $(libc_dev_ver)) + endif + ifeq ($(biarch64)$(biarch32),yesyes) + triarch := $(COMMA)$(SPACE) + LIBC_BIARCH_DEV_DEP := libc6-dev-mips32$(LS)$(AQ) (>= $(libc_dev_ver)), + LIBC_BIARCH_DEV_DEP += libc6-dev-mips64$(LS)$(AQ) (>= $(libc_dev_ver)) + endif + ifeq ($(biarchn32)$(biarch64),yesyes) + triarch := $(COMMA)$(SPACE) + LIBC_BIARCH_DEV_DEP := libc6-dev-mips64$(LS)$(AQ) (>= $(libc_dev_ver)), + LIBC_BIARCH_DEV_DEP += libc6-dev-mipsn32$(LS)$(AQ) (>= $(libc_dev_ver)) + endif + endif + + ifeq ($(biarchhf),yes) + LIBC_BIARCH_DEP := $(LIBC_DEP)-$(biarch_deb_arch)$(LS)$(AQ) (>= $(libc_dev_ver)) + LIBC_BIARCH_DEP += | $(LIBC_DEP)-$(biarch_deb_arch)$(LS)$(AQ) + LIBC_BIARCH_DEV_DEP += | $(LIBC_DEV_DEP)-$(biarch_deb_arch)$(LS)$(AQ) + endif + ifeq ($(biarchsf),yes) + LIBC_BIARCH_DEP := $(LIBC_DEP)-$(biarch_deb_arch)$(LS)$(AQ) (>= $(libc_dev_ver)) + LIBC_BIARCH_DEP += | $(LIBC_DEP)-$(biarch_deb_arch)$(LS)$(AQ) + LIBC_BIARCH_DEV_DEP += | $(LIBC_DEV_DEP)-$(biarch_deb_arch)$(LS)$(AQ) + endif +endif + +# now add the cross suffix and required version +LIBC_DEP := $(LIBC_DEP)$(LS)$(AQ) +LIBC_DEV_DEP := $(LIBC_DEV_DEP)$(LS)$(AQ) (>= $(libc_dev_ver)) + +ifneq (,$(filter $(build_type), build-native cross-build-native)) + LIBC_DBG_DEP = libc6.1-dbg [alpha ia64] | libc0.3-dbg [hurd-amd64 hurd-i386] | libc0.1-dbg [kfreebsd-amd64 kfreebsd-i386] | libc6-dbg, +endif + +# TODO: make this automatic, there must be a better way to define LIBC_DEP. +ifneq ($(DEB_CROSS),yes) + LIBC_BUILD_DEP = libc6.1-dev (>= $(libc_dev_ver)) [alpha ia64] | libc0.3-dev (>= $(libc_dev_ver)) [hurd-amd64 hurd-i386] | libc0.1-dev (>= $(kfreebsd_libc_dev_ver)) [kfreebsd-amd64 kfreebsd-i386] | libc6-dev (>= $(libc_dev_ver)) + LIBC_BIARCH_BUILD_DEP = libc6-dev-amd64 [i386 x32], libc6-dev-sparc64 [sparc], libc6-dev-sparc [sparc64], libc6-dev-s390 [s390x], libc6-dev-s390x [s390], libc6-dev-i386 [amd64 x32], libc6-dev-powerpc [ppc64], libc6-dev-ppc64 [powerpc], libc0.1-dev-i386 [kfreebsd-amd64], lib32gcc-s1 [amd64 ppc64 kfreebsd-amd64 mipsn32 mipsn32el mips64 mips64el s390x sparc64 x32], libn32gcc-s1 [mips mipsel mips64 mips64el], lib64gcc-s1 [i386 mips mipsel mipsn32 mipsn32el powerpc sparc s390 x32], libc6-dev-mips64 [mips mipsel mipsn32 mipsn32el], libc6-dev-mipsn32 [mips mipsel mips64 mips64el], libc6-dev-mips32 [mipsn32 mipsn32el mips64 mips64el], + ifeq (yes,$(MIPS_R6_ENABLED)) + LIBC_BIARCH_BUILD_DEP = libc6-dev-amd64 [i386 x32], libc6-dev-sparc64 [sparc], libc6-dev-sparc [sparc64], libc6-dev-s390 [s390x], libc6-dev-s390x [s390], libc6-dev-i386 [amd64 x32], libc6-dev-powerpc [ppc64], libc6-dev-ppc64 [powerpc], libc0.1-dev-i386 [kfreebsd-amd64], lib32gcc-s1 [amd64 ppc64 kfreebsd-amd64 mipsn32 mipsn32el mips64 mips64el mipsn32r6 mipsn32r6el mips64r6 mips64r6el s390x sparc64 x32], libn32gcc-s1 [mips mipsel mips64 mips64el mipsr6 mipsr6el mips64r6 mips64r6el], lib64gcc-s1 [i386 mips mipsel mipsn32 mipsn32el mipsr6 mipsr6el mipsn32r6 mipsn32r6el powerpc sparc s390 x32], libc6-dev-mips64 [mips mipsel mipsn32 mipsn32el mipsr6 mipsr6el mipsn32r6 mipsn32r6el], libc6-dev-mipsn32 [mips mipsel mips64 mips64el mipsr6 mipsr6el mips64r6 mips64r6el], libc6-dev-mips32 [mipsn32 mipsn32el mips64 mips64el mipsn32r6 mipsn32r6el mips64r6 mips64r6el], + endif + ifneq (,$(findstring amd64,$(biarchx32archs))) + LIBC_BIARCH_BUILD_DEP += libc6-dev-x32 [amd64 i386], libx32gcc-s1 [amd64 i386], + endif + ifneq (,$(findstring armel,$(biarchhfarchs))) + LIBC_BIARCH_BUILD_DEP += libc6-dev-armhf [armel], libhfgcc-s1 [armel], + endif + ifneq (,$(findstring armhf,$(biarchsfarchs))) + LIBC_BIARCH_BUILD_DEP += libc6-dev-armel [armhf], libsfgcc-s1 [armhf], + endif + # FIXME: needed for backports + #LIBC_BIARCH_BUILD_DEP := $(subst gcc-s,gcc,$(LIBC_BIARCH_BUILD_DEP)) +else + LIBC_BUILD_DEP = $(LIBC_DEV_DEP), + ifneq ($(LIBC_BIARCH_DEV_DEP),) + LIBC_BIARCH_BUILD_DEP = $(LIBC_BIARCH_DEV_DEP), + else + LIBC_BIARCH_BUILD_DEP = + endif +endif + +# needed for the include/asm symlink to run the testsuite for +# non default multilibs +ifneq (,$(multilib_archs)) + GCC_MULTILIB_BUILD_DEP = g++-multilib [$(multilib_archs)]$(pf_ncross), +endif + +LIBUNWIND_DEV_DEP := libunwind8-dev$(LS)$(AQ) +LIBUNWIND_BUILD_DEP := $(LIBUNWIND_DEV_DEP) [ia64], +LIBATOMIC_OPS_BUILD_DEP := libatomic-ops-dev$(LS) [ia64], +ifneq ($(DEB_TARGET_ARCH),ia64) + LIBUNWIND_DEV_DEP := # nothing +else ifneq (,$(filter $(DEB_STAGE),stage1 stage2)) + LIBUNWIND_DEV_DEP := # nothing +endif + +GMP_BUILD_DEP = libgmp-dev (>= 2:5.0.1~), +MPFR_BUILD_DEP = libmpfr-dev (>= 3.0.0-9~), + +ISL_BUILD_DEP = libisl-dev, +ifeq (,$(filter $(distrelease), jessie stretch precise trusty xenial bionic)) + ISL_BUILD_DEP = libisl-dev (>= 0.20), +endif + +ifneq (,$(filter $(distrelease), precise)) + MPC_BUILD_DEP = libmpc-dev, +else + MPC_BUILD_DEP = libmpc-dev (>= 1.0), +endif + +SOURCE_BUILD_DEP := +ifeq (,$(findstring gcc,$(PKGSOURCE))) + SOURCE_BUILD_DEP := gcc-$(BASE_VERSION)-source (>= $(GCC_SOURCE_VERSION)), gcc-$(BASE_VERSION)-source (<< $(NEXT_GCC_SOURCE_VERSION)), +endif + +ifneq (,$(filter $(distrelease), precise)) + CHECK_BUILD_DEP := dejagnu$(if $(check_no_archs), [$(check_no_archs)]), +else + CHECK_BUILD_DEP := dejagnu$(if $(check_no_archs), [$(check_no_archs)]) <!nocheck>, +endif + +AUTO_BUILD_DEP := m4, libtool, +autoconf_version = 2.69 +ifneq (,$(filter $(distrelease),stretch buster trusty xenial bionic focal groovy)) + autoconf_version = +endif +AUTO_BUILD_DEP += autoconf$(autoconf_version), + +ifeq (,$(filter $(distrelease), precise trusty)) + SDT_BUILD_DEP = systemtap-sdt-dev [linux-any], +endif + +# ensure that the common libs, built from the next GCC version are available +ifeq ($(PKGSOURCE),gcc-$(BASE_VERSION)) + ifneq ($(with_common_libs),yes) + BASE_BUILD_DEP = gcc-14-base, + endif +endif + +ifeq (,$(filter $(distrelease), precise)) + OFFLOAD_BUILD_DEP += nvptx-tools [$(nvptx_archs)], +endif + +ifeq ($(with_offload_gcn),yes) + ifeq ($(gcn_tools_llvm_version),tools) + LLVM_DEP = amdgcn-tools [$(gcn_archs)], + else + LLVM_DEP = llvm-$(gcn_tools_llvm_version)$(if $(pkg_llvm_ver), (>= $(pkg_llvm_ver))) [$(gcn_archs)], \ + lld-$(gcn_tools_llvm_version)$(if $(pkg_llvm_ver), (>= $(pkg_llvm_ver))) [$(gcn_archs)], + endif + OFFLOAD_BUILD_DEP += $(LLVM_DEP) +endif + +PHOBOS_BUILD_DEP = lib32z1-dev [amd64 kfreebsd-amd64], lib64z1-dev [i386], +ifeq ($(derivative),Ubuntu) + ifeq (,$(filter $(distrelease),precise)) + PHOBOS_BUILD_DEP += libx32z1-dev [amd64 kfreebsd-amd64 i386], + endif +endif +PHOBOS_BUILD_DEP += unzip <!nocheck>, + +ifeq ($(with_m2),yes) + GM2_BUILD_DEP = python3:any, +endif + +ifeq ($(usage_stats),yes) + ifeq (,$(no_usage_archs)) + USAGE_BUILD_DEP = python3:any, python3-psutil, python3-matplotlib, + else + USAGE_BUILD_DEP = python3:any, \ + python3-psutil [$(foreach a,$(no_usage_archs),!$(a))], \ + python3-matplotlib [$(foreach a,$(no_usage_archs),!$(a))], + endif +endif + +ifneq (,$(filter $(distrelease),precise trusty)) + DEBHELPER_BUILD_DEP = debhelper (>= 9), +else + DEBHELPER_BUILD_DEP = debhelper (>= 9.20141010), +endif + +ifneq ($(DEB_CROSS),yes) +# all archs for which to create b-d's +any_archs := alpha amd64 armel armhf arm64 i386 loong64 mips mipsel mips64 mips64el mipsn32 powerpc ppc64 ppc64el m68k riscv64 sh4 sparc64 s390x x32 +ifeq (,$(filter $(distrelease), jessie stretch buster precise xenial bionic)) + any_archs := $(filter-out mips, $(any_archs)) +endif +ifeq (yes,$(MIPS_R6_ENABLED)) + any_archs += mipsn32el mipsr6 mipsr6el mips64r6 mips64r6el mipsn32r6 mipsn32r6el +endif +ifeq (,$(filter $(DEB_HOST_ARCH),$(any_archs))) +any_archs += $(DEB_HOST_ARCH) +endif + +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),precise trusty)) + TARGET_TOOL_BUILD_DEP = bash, # non-empty line + pf_cross = + pf_ncross = +else + TARGET_TOOL_BUILD_DEP = \ + $(foreach a, $(any_archs), \ + g++-$(BASE_VERSION)$(call _gnu_suffix,$(a)) [$(a)] <cross>, \ + $(if $(filter $(a), avr),, \ + 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_suffix,$(a)) [$(a)] <cross>,) \ + $(if $(filter $(a), hppa m68k sh4),, \ + gccgo-$(BASE_VERSION)$(call _gnu_suffix,$(a)) [$(a)] <cross>,) \ + $(if $(filter $(a), m68k),, \ + gnat-$(BASE_VERSION)$(call _gnu_suffix,$(a)) [$(a)] <cross>,) \ + $(if $(filter !$(a), $(m2_no_archs)),, \ + gm2-$(BASE_VERSION)$(call _gnu_suffix,$(a)) [$(a)] <cross>,) \ + ) + pf_cross = $(SPACE)<cross> + pf_ncross = $(SPACE)<!cross> + NT = :native +endif + +ifeq ($(single_package),yes) + LIBSTDCXX_BUILD_INDEP = doxygen (>= 1.7.2), graphviz (>= 2.2), ghostscript, texlive-latex-base + LIBSTDCXX_BUILD_INDEP +=, xsltproc, libxml2-utils, docbook-xsl-ns +endif + +ifeq ($(PKGSOURCE),gcc-$(BASE_VERSION)) + LIBSTDCXX_BUILD_INDEP = doxygen (>= 1.7.2), graphviz (>= 2.2), ghostscript, \ + texlive-latex-base, xsltproc, libxml2-utils, docbook-xsl-ns +endif + +GO_BUILD_DEP := netbase, + +# try to build with itself, or with the last version +ifneq (,$(filter $(distrelease), precise)) + gnat_build_dep := +else ifneq (,$(filter $(distrelease), jessie)) + gnat_build_dep := gnat-4.9$(NT) [$(ada_no_archs)], g++-4.9$(NT) +else ifneq (,$(filter $(distrelease), precise)) + gnat_build_dep := gnat-6$(NT) [$(ada_no_archs)], g++-6$(NT) +else ifneq (,$(filter $(distrelease), trusty xenial)) + gnat_build_dep := gnat-5$(NT) [$(ada_no_archs)], g++-5$(NT) +else ifneq (,$(filter $(distrelease), stretch)) + gnat_build_dep := gnat-6$(NT) [$(ada_no_archs) !x32], g++-7 [x32], gnat-7 [x32], g++-6$(NT) +else ifneq (,$(filter $(distrelease), buster)) + gnat_build_dep := gnat-8$(NT) [$(ada_no_archs)], g++-8$(NT) +else ifneq (,$(filter $(distrelease), bionic focal)) + gnat_build_dep := gnat-11$(NT) [$(ada_no_archs)], g++-11$(NT) + gdc_build_dep := gdc-11$(NT) +else ifneq (,$(filter $(distrelease), bullseye hirsute jammy)) + gnat_build_dep := gnat-11$(NT) [$(ada_no_archs) !alpha !m68k], g++-11$(NT), gnat-12 [alpha m68k], g++-12$(NT) [alpha m68k] + gdc_build_dep := gdc-11$(NT) [$(d_no_archs)] +else ifneq (,$(filter $(distrelease), impish)) + gnat_build_dep := gnat-11$(NT) [$(ada_no_archs)], g++-11$(NT) + gdc_build_dep := gdc-11$(NT) [$(d_no_archs)] +else + gnat_build_dep := gnat-12$(NT) [$(ada_no_archs)], g++-12$(NT) + gdc_build_dep := gdc-12$(NT) [$(d_no_archs)] +endif +ifneq (,$(filter $(DEB_STAGE),stage1 stage2)) + gnat_build_dep := + gdc_build_dep := +endif + +ifeq ($(PKGSOURCE),gcc-$(BASE_VERSION)) + ifneq ($(with_separate_gnat),yes) + # Build gnat as part of the combined gcc-x.y source package. Do not fail + # if gnat is not present on unsupported architectures; the build scripts + # will not use gnat anyway. + GNAT_BUILD_DEP := $(gnat_build_dep), + endif + GDC_BUILD_DEP := $(gdc_build_dep), +else ifeq ($(single_package),yes) + # Ditto, as part of the gcc-snapshot package. + GNAT_BUILD_DEP := $(gnat_build_dep), + GDC_BUILD_DEP := $(gdc_build_dep), +else ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION)) + # Special source package just for gnat. Fail early if gnat is not present, + # rather than waste CPU cycles and fail later. + # Bootstrap step needs a gnatgcc symbolic link. + GNAT_BUILD_DEP := $(gnat_build_dep), + GNAT_BUILD_DEP += $(SOURCE_BUILD_DEP) + GDC_BUILD_DEP := + GO_BUILD_DEP := +else ifeq ($(PKGSOURCE),gdc-$(BASE_VERSION)) + # Special source package just for gdc. + GNAT_BUILD_DEP := + GDC_BUILD_DEP := $(SOURCE_BUILD_DEP) + GO_BUILD_DEP := +else ifeq ($(PKGSOURCE),gccgo-$(BASE_VERSION)) + # Special source package just for gccgo. + GNAT_BUILD_DEP := + GDC_BUILD_DEP := $(SOURCE_BUILD_DEP) +endif + + +else +# build cross compiler + CROSS_BUILD_DEP := libc6-dev$(cross_lib_arch), +ifneq (,$(findstring cross-build-,$(build_type))) + CROSS_BUILD_DEP += zlib1g-dev$(cross_lib_arch), libmpfr-dev$(cross_lib_arch), +endif + SOURCE_BUILD_DEP := + ifeq (,$(findstring gcc,$(PKGSOURCE))) + SOURCE_BUILD_DEP := gcc-$(BASE_VERSION)-source (>= $(GCC_SOURCE_VERSION)), gcc-$(BASE_VERSION)-source (<< $(NEXT_GCC_SOURCE_VERSION)), + endif + GNAT_BUILD_DEP := gnat-$(BASE_VERSION), + ifneq (,$(filter !$(DEB_TARGET_ARCH),$(ada_no_archs))) + GNAT_BUILD_DEP := + endif + GDC_BUILD_DEP := gdc-$(BASE_VERSION), + ifneq (,$(filter !$(DEB_TARGET_ARCH),$(d_no_archs))) + GDC_BUILD_DEP := + endif + ifeq (yes_,$(with_m2)_$(filter !$(DEB_TARGET_ARCH),$(m2_no_archs))) + GM2_BUILD_DEP += gm2-$(BASE_VERSION), + endif + arch_gnutype_map = $(DEB_TARGET_ARCH)=$(TARGET_ALIAS) +endif # cross compiler + +BASE_BREAKS := gnat (<< 7) +# these would need proper updates, and are only needed for upgrades +ifneq (,$(filter $(distrelease),stretch jessie trusty xenial bionic)) + BASE_BREAKS := +endif + +# FIXME: can these be dropped? In the end the libgcc_s.so.1 remained in the same location. +ifneq (,$(filter $(DEB_HOST_ARCH), arm64 s390x sparc64)) + ifeq (,$(filter $(distrelease), jessie stretch buster trusty xenial bionic)) + LIBGCC_BREAKS := libgcc-9-dev (<< 9.2.1-26), libgcc-8-dev (<< 8.3.0-27), libgcc-7-dev (<< 7.5.0-4), + endif +endif +ifneq (,$(filter $(distrelease),sid bullseye focal)) + LIBGCC_BREAKS += cryptsetup-initramfs (<< 2:2.2.2-3~), +endif + +# The numeric part of the gcc version number (x.yy.zz) +NEXT_GCC_VERSION := $(shell echo $(GCC_VERSION) | \ + awk -F. '{OFS="."; if (NF==2) $$3=1; else $$NF += 1; print}') +# first version with a new path component in gcc_lib_dir (i.e. GCC_VERSION +# or TARGET_ALIAS changes), or last version available for all architectures +DEB_GCC_SOFT_VERSION := 13 +DEB_GNAT_SOFT_VERSION := 13 + +ifeq ($(with_d),yes) + GDC_VERSION := $(BASE_VERSION) + DEB_GDC_VERSION := $(DEB_VERSION) +endif + +ifeq ($(with_m2),yes) + GM2_VERSION := $(BASE_VERSION) + DEB_GM2_VERSION := $(DEB_VERSION) +endif + +# semiautomatic ... +DEB_SOVERSION := $(DEB_VERSION) +DEB_SOVERSION := 5 +DEB_SOEVERSION := $(EPOCH):5 +DEB_STDCXX_SOVERSION := 5 +DEB_GOMP_SOVERSION := $(DEB_SOVERSION) + +DEB_GCC_VERSION := $(DEB_VERSION) + +DEB_GNAT_VERSION := $(DEB_VERSION) +ifeq ($(with_separate_gnat),yes) + ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION)) + DEB_GCC_VERSION := $(DEB_GCC_SOFT_VERSION) + endif +endif + +GNAT_VERSION := $(BASE_VERSION) + +LIBGNAT_DEP := +ifeq ($(with_libgnat),yes) + LIBGNAT_DEP := libgnat-$(GNAT_VERSION)$(LS)$(AQ) (>= $${gcc:Version}) +endif + +pkg_ver := -$(BASE_VERSION) + +ctrl_flags = \ + -DBINUTILSV=$(BINUTILSV) \ + -DBINUTILSBDV=$(BINUTILSBDV) \ + -DSRCNAME=$(PKGSOURCE) \ + -D__$(DEB_TARGET_GNU_CPU)__ \ + -DARCH=$(DEB_TARGET_ARCH) \ + -DDIST=$(distribution) \ + -DLOCALES=$(LOCALES) \ + +ctrl_flags += \ + -DLIBC_DEV_DEP="$(LIBC_DEV_DEP)" \ + -DLIBC_BIARCH_BUILD_DEP="$(LIBC_BIARCH_BUILD_DEP)" \ + -DLIBC_DBG_DEP="$(LIBC_DBG_DEP)" \ + -DBASE_BUILD_DEP="$(BASE_BUILD_DEP)" \ + -DFORTRAN_BUILD_DEP="$(FORTRAN_BUILD_DEP)" \ + -DGNAT_BUILD_DEP="$(GNAT_BUILD_DEP)" \ + -DGO_BUILD_DEP="$(GO_BUILD_DEP)" \ + -DLIBSTDCXX_BUILD_INDEP="$(LIBSTDCXX_BUILD_INDEP)" \ + -DGDC_BUILD_DEP="$(GDC_BUILD_DEP)" \ + -DBINUTILS_BUILD_DEP="$(BINUTILS_BUILD_DEP)" \ + -DLIBC_BUILD_DEP="$(LIBC_BUILD_DEP)" \ + -DCHECK_BUILD_DEP="$(CHECK_BUILD_DEP)" \ + -DAUTO_BUILD_DEP="$(AUTO_BUILD_DEP)" \ + -DSDT_BUILD_DEP="$(SDT_BUILD_DEP)" \ + -DISL_BUILD_DEP="$(ISL_BUILD_DEP)" \ + -DGMP_BUILD_DEP="$(GMP_BUILD_DEP)" \ + -DMPFR_BUILD_DEP="$(MPFR_BUILD_DEP)" \ + -DMPC_BUILD_DEP="$(MPC_BUILD_DEP)" \ + -DDEBHELPER_BUILD_DEP="$(DEBHELPER_BUILD_DEP)" \ + -DDPKG_BUILD_DEP="$(DPKG_BUILD_DEP)" \ + -DSOURCE_BUILD_DEP="$(SOURCE_BUILD_DEP)" \ + -DCROSS_BUILD_DEP="$(CROSS_BUILD_DEP)" \ + -DGCC_MULTILIB_BUILD_DEP='$(GCC_MULTILIB_BUILD_DEP)' \ + -DTARGET_TOOL_BUILD_DEP='$(TARGET_TOOL_BUILD_DEP)' \ + -DPHOBOS_BUILD_DEP="$(PHOBOS_BUILD_DEP)" \ + -DGM2_BUILD_DEP="$(GM2_BUILD_DEP)" \ + -DOFFLOAD_BUILD_DEP="$(OFFLOAD_BUILD_DEP)" \ + -DUSAGE_BUILD_DEP="$(USAGE_BUILD_DEP)" \ + -DLLVM_DEP="$(LLVM_DEP)" \ + -DARCH_GNUTYPE_MAP="$(arch_gnutype_map)" \ + -DMULTILIB_ARCHS="$(multilib_archs)" \ + -DTP=$(TP) \ + -DTS=$(TS) \ + -DLS=$(LS) \ + -DAQ=$(AQ) \ + -DNT=$(NT) + +ifeq ($(DEB_CROSS),yes) + ctrl_flags += \ + -DTARGET=$(DEB_TARGET_ARCH) \ + -DLIBUNWIND_BUILD_DEP="$(LIBUNWIND_BUILD_DEP)" \ + -DLIBATOMIC_OPS_BUILD_DEP="$(LIBATOMIC_OPS_BUILD_DEP)" + ifeq ($(DEB_STAGE),rtlibs) + ctrl_flags += -DCROSS_ARCH=$(DEB_TARGET_ARCH) + endif +else + # add '-DPRI=optional' to ctrl_flags if this is not the default compiler + # ctrl_flags += \ + # -DPRI=optional +endif + +ifeq ($(with_base_only),yes) + ctrl_flags += \ + -DBASE_ONLY=yes +endif + +ifeq ($(with_multiarch_lib),yes) + ctrl_flags += \ + -DMULTIARCH=yes +endif + +ctrl_flags += -DBUILD_DEP_FOR_BINUTILS="$(if $(filter yes, $(with_binutils)),$(bd_binutils_only))" + +control: control-file readme-bugs-file parameters-file symbols-files copyright-file substvars-file versioned-files check-versions + +# stage1 and stage2 compilers are only C +ifneq (,$(filter $(DEB_STAGE),stage1 stage2)) + languages = c + addons = gccbase cdev plugindev + ifeq ($(with_gcclbase),yes) + addons += gcclbase + endif + ifeq ($(multilib),yes) + addons += multilib + endif + addons += $(if $(findstring armel,$(biarchhfarchs)),armml) + addons += $(if $(findstring armhf,$(biarchsfarchs)),armml) + addons += $(if $(findstring amd64,$(biarchx32archs)),x32dev) + ifeq ($(DEB_STAGE),stage2) + addons += libgcc + ifeq ($(multilib),yes) + addons += lib32gcc lib64gcc libn32gcc + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32gcc) + addons += $(if $(findstring armel,$(biarchhfarchs)),libhfgcc) + addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfgcc) + endif + else + LIBC_BIARCH_DEV_DEP := + endif +else +languages = c c++ fortran objc objpp +ifeq ($(DEB_STAGE),rtlibs) + ifeq (,$(filter libgfortran, $(with_rtlibs))) + languages := $(filter-out fortran, $(languages)) + endif + ifeq (,$(filter libobjc, $(with_rtlibs))) + languages := $(filter-out objc objpp, $(languages)) + endif +endif +ifeq ($(with_dbg),yes) + addons += libdbg +endif +ifeq ($(with_gccbase),yes) + addons += gccbase +endif +ifeq ($(with_gcclbase),yes) + addons += gcclbase +endif +ifneq ($(DEB_STAGE),rtlibs) + addons += cdev c++dev source multilib + ifeq ($(build_type),build-native) + addons += testresults + endif + ifneq (,$(filter fortran, $(languages))) + addons += fdev + endif + ifneq (,$(filter objc, $(languages))) + addons += objcdev + endif + ifneq (,$(filter objpp, $(languages))) + addons += objppdev + endif + addons += plugindev +endif +addons += $(if $(findstring armel,$(biarchhfarchs)),armml) +addons += $(if $(findstring armhf,$(biarchsfarchs)),armml) +addons += $(if $(findstring amd64,$(biarchx32archs)),x32dev) +ifeq ($(with_libgcc),yes) + addons += libgcc lib4gcc lib32gcc lib64gcc libn32gcc + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32gcc) + addons += $(if $(findstring armel,$(biarchhfarchs)),libhfgcc) + addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfgcc) + ifeq ($(with_libcompatgcc),yes) + addons += libcompatgcc + endif +endif +ifeq ($(with_libcxx),yes) + addons += libcxx lib32cxx lib64cxx libn32cxx + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32cxx) + addons += $(if $(findstring armel,$(biarchhfarchs)),libhfcxx) + addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfcxx) +endif +addons += $(if $(findstring amd64,$(biarchx32archs)),libx32dbgcxx) +addons += $(if $(findstring armel,$(biarchhfarchs)),libhfdbgcxx) +addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfdbgcxx) +ifeq ($(with_libgfortran),yes) + addons += libgfortran lib32gfortran lib64gfortran libn32gfortran + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32gfortran) + addons += $(if $(findstring armel,$(biarchhfarchs)),libhfgfortran) + addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfgfortran) +endif +ifeq ($(with_libobjc),yes) + addons += libobjc lib32objc lib64objc libn32objc + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32objc) + addons += $(if $(findstring armel,$(biarchhfarchs)),libhfobjc) + addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfobjc) +endif +ifeq ($(with_libgomp),yes) + addons += libgomp lib32gomp lib64gomp libn32gomp + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32gomp) + addons += $(if $(findstring armel,$(biarchhfarchs)),libhfgomp) + addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfgomp) +endif +ifeq ($(with_libitm),yes) + addons += libitm lib32itm lib64itm libn32itm + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32itm) + addons += $(if $(findstring armel,$(biarchhfarchs)),libhfitm) + addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfitm) +endif +ifeq ($(with_libatomic),yes) + addons += libatomic lib32atomic lib64atomic libn32atomic + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32atomic) + addons += $(if $(findstring armel,$(biarchhfarchs)),libhfatomic) + addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfatomic) +endif +ifeq ($(with_libbacktrace),yes) + addons += libbtrace lib32btrace lib64btrace libn32btrace + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32btrace) + addons += $(if $(findstring armel,$(biarchhfarchs)),libhfbtrace) + addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfbtrace) +endif +ifeq ($(with_libasan),yes) + addons += libasan lib32asan lib64asan libn32asan + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32asan) + addons += $(if $(findstring armel,$(biarchhfarchs)),libhfasan) + addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfasan) +endif +ifeq ($(with_liblsan),yes) + addons += liblsan + ifneq (,$(filter $(distrelease),lunar jammy focal)) + addons += lib32lsan lib64lsan libn32lsan + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32lsan) + #addons += $(if $(findstring armel,$(biarchhfarchs)),libhflsan) + #addons += $(if $(findstring armhf,$(biarchsfarchs)),libsflsan) + endif +endif +ifeq ($(with_libtsan),yes) + addons += libtsan + addons += libtsan #lib32tsan lib64tsan libn32tsan + #addons += $(if $(findstring amd64,$(biarchx32archs)),libx32tsan) + #addons += $(if $(findstring armel,$(biarchhfarchs)),libhftsan) + #addons += $(if $(findstring armhf,$(biarchsfarchs)),libsftsan) +endif +ifeq ($(with_libubsan),yes) + addons += libubsan lib32ubsan lib64ubsan libn32ubsan + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32ubsan) + addons += $(if $(findstring armel,$(biarchhfarchs)),libhfubsan) + addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfubsan) +endif +#ifeq ($(with_libhwasan),yes) + addons += libhwasan +#endif +ifeq ($(with_vtv),yes) + addons += libvtv lib32vtv lib64vtv #libn32vtv + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32vtv) + #addons += $(if $(findstring armel,$(biarchhfarchs)),libhfvtv) + #addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfvtv) +endif +ifeq ($(with_libqmath),yes) + addons += libqmath lib32qmath lib64qmath libn32qmath + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32qmath) + addons += $(if $(findstring armel,$(biarchhfarchs)),libhfqmath) + addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfqmath) +endif +ifeq ($(with_jit),yes) + addons += jit +endif +ifeq ($(with_libgccjit),yes) + addons += libjit +endif +ifeq ($(with_offload_nvptx),yes) + addons += olnvptx gompnvptx +endif +ifeq ($(with_offload_gcn),yes) + addons += olgcn gompgcn +endif +ifeq ($(with_offload_hsa),yes) + addons += olhsa gomphsa +endif +ifeq ($(with_libcc1),yes) + addons += libcc1 +endif +ifeq ($(with_d),yes) + languages += d + ifeq ($(with_libphobos),yes) + addons += libphobos libn32phobos + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32phobos) + endif + ifeq ($(with_libphobosdev),yes) + addons += libdevphobos libdevn32phobos + addons += $(if $(findstring amd64,$(biarchx32archs)),libdevx32phobos) + endif +endif +ifeq ($(with_go),yes) + addons += ggo godev + ifeq ($(with_libgo),yes) + addons += libggo lib32ggo lib64ggo libn32ggo + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32ggo) + endif +endif +ifeq ($(with_m2),yes) + languages += m2 + addons += libdevgm2 + ifeq ($(with_libgm2),yes) + addons += libgm2 # lib32gm2 lib64gm2 libn32gm2 + #addons += $(if $(findstring amd64,$(biarchx32archs)),libx32gm2) + endif +endif +ifeq ($(with_rs),yes) + languages += rust + #addons += libdevgrs + #ifeq ($(with_libgrs),yes) + # addons += libgrs # lib32gm2 lib64gm2 libn32gm2 + # #addons += $(if $(findstring amd64,$(biarchx32archs)),libx32gm2) + #endif +endif +ifeq ($(with_ada),yes) + languages += ada + addons += libgnat libs # libgmath libnof lib64gnat ssp + ifeq ($(with_gnatsjlj),yes) + addons += adasjlj + endif +endif + + ifneq ($(DEB_CROSS),yes) + endif # DEB_CROSS + ifeq ($(with_separate_libgo),yes) + ifeq ($(PKGSOURCE),gcc-$(BASE_VERSION)) + languages := $(filter-out go,$(languages)) + addons := $(filter-out ggo godev libggo lib64ggo lib32ggo libn32ggo libx32ggo,$(addons)) + endif + ifeq ($(PKGSOURCE),gccgo-$(BASE_VERSION)) + languages = go + addons = ggo godev libggo lib64ggo lib32ggo libn32ggo gccbase multilib + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32ggo) + ifeq ($(with_standalone_go),yes) + addons += libgcc lib4gcc lib32gcc lib64gcc libn32gcc + addons += $(if $(findstring amd64,$(biarchx32archs)),libx32gcc) + addons += $(if $(findstring armel,$(biarchhfarchs)),libhfgcc) + addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfgcc) + ifeq ($(with_libcc1),yes) + addons += libcc1 + endif + endif + endif + endif + ifeq ($(with_standalone_go),yes) + ifeq ($(PKGSOURCE),gccgo-$(BASE_VERSION)) + ctrl_flags += -DSTANDALONEGO + endif + endif + ifeq ($(with_separate_gnat),yes) + ifeq ($(PKGSOURCE),gcc-$(BASE_VERSION)) + languages := $(filter-out ada,$(languages)) + addons := $(filter-out libgnat adasjlj,$(addons)) + endif + ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION)) + languages = ada + addons = gnatbase libgnat + endif + endif + ifeq ($(with_separate_gdc),yes) + ifeq ($(PKGSOURCE),gcc-$(BASE_VERSION)) + languages := $(filter-out d,$(languages)) + endif + ifeq ($(PKGSOURCE),gdc-$(BASE_VERSION)) + languages = d + addons = + ifeq ($(with_libphobos),yes) + addons += libphobos + endif + ifeq ($(with_libphobosdev),yes) + addons += libdevphobos + endif + endif + endif + ifneq ($(DEB_CROSS),yes) # no docs for cross compilers + ifneq ($(GFDL_INVARIANT_FREE),yes) + addons += gfdldoc + endif + endif +endif # not stage + +control-file: + echo "addons: $(addons)"; \ + m4 $(ctrl_flags) \ + -DPV=$(pkg_ver) \ + -DCXX_SO=$(CXX_SONAME) \ + -DGCC_SO=$(GCC_SONAME) \ + -DOBJC_SO=$(OBJC_SONAME) \ + -DFORTRAN_SO=$(FORTRAN_SONAME) \ + -DGNAT_SO=$(GNAT_SONAME) \ + -DGNAT_V=$(GNAT_VERSION) \ + -DPHOBOS_V=$(GPHOBOS_SONAME) \ + -DGM2_V=$(GM2_SONAME) \ + -DGDRUNTIME_V=$(GDRUNTIME_SONAME) \ + -DGOMP_SO=$(GOMP_SONAME) \ + -DITM_SO=$(ITM_SONAME) \ + -DATOMIC_SO=$(ATOMIC_SONAME) \ + -DBTRACE_SO=$(BTRACE_SONAME) \ + -DASAN_SO=$(ASAN_SONAME) \ + -DLSAN_SO=$(LSAN_SONAME) \ + -DTSAN_SO=$(TSAN_SONAME) \ + -DUBSAN_SO=$(UBSAN_SONAME) \ + -DHWASAN_SO=$(HWASAN_SONAME) \ + -DVTV_SO=$(VTV_SONAME) \ + -DQMATH_SO=$(QUADMATH_SONAME) \ + -DSSP_SO=$(SSP_SONAME) \ + -DGO_SO=$(GO_SONAME) \ + -DCC1_SO=$(CC1_SONAME) \ + -DGCCJIT_SO=$(GCCJIT_SONAME) \ + -Denabled_languages="$(languages) $(addons)" \ + -Dada_no_archs="$(ada_no_archs)" \ + -Dfortran_no_archs="$(fortran_no_archs)" \ + -Dgo_no_archs="$(go_no_archs)" \ + -Dd_no_archs="$(d_no_archs)" \ + -Dm2_no_archs="$(m2_no_archs)" \ + -Drs_no_archs="$(rs_no_archs)" \ + -Dlibgc_no_archs="$(libgc_no_archs)" \ + -Dlibphobos_archs="$(phobos_archs)" \ + -Dlibphobos_no_archs="$(phobos_no_archs)" \ + -Dcheck_no_archs="$(check_no_archs)" \ + -Dlocale_no_archs="$(locale_no_archs)" \ + -Dlinux_gnu_archs="$(linux_gnu_archs)" \ + -Dbiarch32_archs="$(strip $(subst /, ,$(biarch32archs)))" \ + -Dbiarch64_archs="$(strip $(subst /, ,$(biarch64archs)))" \ + -Dbiarchn32_archs="$(strip $(subst /, ,$(biarchn32archs)))" \ + -Dbiarchx32_archs="$(strip $(subst /, ,$(biarchx32archs)))" \ + -Dbiarchhf_archs="$(strip $(subst /, ,$(biarchhfarchs)))" \ + -Dbiarchsf_archs="$(strip $(subst /, ,$(biarchsfarchs)))" \ + -Dnvptx_archs="$(nvptx_archs)" \ + -Dgcn_archs="$(gcn_archs)" \ + -Dadd_built_using=$(add_built_using) \ + -DGCC_PORTS_BUILD=$(GCC_PORTS_BUILD) \ + $(if $(findstring build-native, $(build_type)), \ + $(if $(filter $(distrelease),jessie stretch buster xenial bionic focal),,-DLIBGCCPROTECTED=1)) \ + debian/control.m4 > debian/control.tmp2 + uniq debian/control.tmp2 | grep -v '^ *, *$$' | sed -E '/^Build/s/ *, +/, /g;/^ /s/, +/, /g;/^ /s/ *,/,/g; s/ +$$//' \ + $(if $(filter yes, $(with_base_only)), | awk '/^$$/ {if (p) exit; else p=1; } {print}') \ + > debian/control.tmp + rm -f debian/control.tmp2 + [ -e debian/control ] \ + && cmp -s debian/control debian/control.tmp \ + && rm -f debian/control.tmp && exit 0; \ + mv debian/control.tmp debian/control; touch $(control_stamp) + +readme-bugs-file: + m4 -DDIST=$(distribution) -DSRCNAME=$(PKGSOURCE) \ + debian/README.Bugs.m4 > debian/README.Bugs + +copyright-file: + rm -f debian/copyright + if echo $(SOURCE_VERSION) | grep -E ^'[0-9][0-9]*\.[0-9]-[0-9]{8}' ; \ + then SVN_BRANCH="trunk" ; \ + else \ + SVN_BRANCH="gcc-$(subst .,_,$(BASE_VERSION))-branch" ; \ + fi ; \ + sed debian/copyright.in \ + -e "s/@BV@/$(BASE_VERSION)/g" \ + -e "s/@SVN_BRANCH@/$$SVN_BRANCH/g" \ + > debian/copyright + +substvars-file: control-file + rm -f debian/substvars.local.tmp + ( \ + echo 'libgcc:Version=$(DEB_GCC_VERSION)'; \ + echo 'gcc:Version=$(DEB_GCC_VERSION)'; \ + echo 'gcc:EpochVersion=$(DEB_EVERSION)'; \ + echo 'gcc:SoftVersion=$(DEB_GCC_SOFT_VERSION)'; \ + echo 'gdc:Version=$(DEB_GDC_VERSION)'; \ + echo 'gm2:Version=$(DEB_GM2_VERSION)'; \ + echo 'gnat:Version=$(DEB_GNAT_VERSION)'; \ + echo 'gnat:SoftVersion=$(DEB_GNAT_SOFT_VERSION)'; \ + echo 'binutils:Version=$(BINUTILSV)'; \ + echo 'dep:libgcc=$(LIBGCC_DEP)'; \ + echo 'dep:libgccdev=$(LIBGCC_DEV_DEP)'; \ + echo 'dep:libgccbiarch=$(libgcc-sbiarch)'; \ + echo 'dep:libgccbiarchdev=$(libgccbiarchdev)'; \ + echo 'dep:libc=$(LIBC_DEP) (>= $(libc_ver))'; \ + echo 'dep:libcdev=$(LIBC_DEV_DEP)'; \ + echo 'dep:libcbiarch=$(LIBC_BIARCH_DEP)'; \ + echo 'dep:libcbiarchdev=$(LIBC_BIARCH_DEV_DEP)'; \ + echo 'dep:libunwinddev=$(LIBUNWIND_DEV_DEP)'; \ + echo 'dep:libcxxbiarchdev=$(libstdc++biarchdev)'; \ + echo 'dep:libcxxbiarchdbg=$(libstdc++biarchdbg)'; \ + echo 'dep:libgnat=$(LIBGNAT_DEP)'; \ + echo 'base:Breaks=$(BASE_BREAKS)'; \ + echo 'libgcc:Breaks=$(LIBGCC_BREAKS)'; \ + echo 'target:suffix=-$(subst _,-,$(TARGET_ALIAS))'; \ + ) > debian/substvars.local.tmp +ifneq (,$(filter $(DEB_TARGET_ARCH), $(multilib_archs))) + ( \ + echo 'gcc:multilib=gcc-$(BASE_VERSION)-multilib$(TS)'; \ + echo 'gxx:multilib=g++-$(BASE_VERSION)-multilib$(TS)'; \ + echo 'gobjc:multilib=gobjc-$(BASE_VERSION)-multilib$(TS)'; \ + echo 'gobjcxx:multilib=gobjc++-$(BASE_VERSION)-multilib$(TS)'; \ + echo 'gfortran:multilib=gfortran-$(BASE_VERSION)-multilib$(TS)'; \ + ) >> debian/substvars.local.tmp +endif +ifeq ($(with_gold),yes) + echo 'dep:gold=binutils-gold (>= $(BINUTILSV))' \ + >> debian/substvars.local.tmp +endif +ifeq ($(with_libssp),yes) + echo 'dep:libssp=libssp$(SSP_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \ + >> debian/substvars.local.tmp +endif +ifeq ($(with_gomp),yes) + echo 'dep:libgomp=libgomp$(GOMP_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \ + >> debian/substvars.local.tmp +endif +ifeq ($(with_itm),yes) + echo 'dep:libitm=libitm$(ITM_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \ + >> debian/substvars.local.tmp +endif +ifeq ($(with_atomic),yes) + echo 'dep:libatomic=libatomic$(ATOMIC_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \ + >> debian/substvars.local.tmp +endif +ifeq ($(with_libbacktrace),yes) + echo 'dep:libbacktrace=libbtrace$(BTRACE_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \ + >> debian/substvars.local.tmp +endif +ifeq ($(with_asan),yes) + echo 'dep:libasan=libasan$(ASAN_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \ + >> debian/substvars.local.tmp +endif +ifeq ($(with_lsan),yes) + echo 'dep:liblsan=liblsan$(LSAN_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \ + >> debian/substvars.local.tmp +endif +ifeq ($(with_tsan),yes) + echo 'dep:libtsan=libtsan$(TSAN_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \ + >> debian/substvars.local.tmp +endif +ifeq ($(with_ubsan),yes) + echo 'dep:libubsan=libubsan$(UBSAN_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \ + >> debian/substvars.local.tmp +endif +ifeq ($(with_hwasan),yes) + echo 'dep:libhwasan=libhwasan$(HWASAN_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \ + >> debian/substvars.local.tmp +endif +ifeq ($(with_vtv),yes) + echo 'dep:libvtv=libvtv$(VTV_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \ + >> debian/substvars.local.tmp +endif +ifeq ($(with_qmath),yes) + echo 'dep:libqmath=libquadmath$(QUADMATH_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \ + >> debian/substvars.local.tmp +endif +ifeq ($(distribution),Debian) + echo 'dep:libx32z=$(if $(filter $(distribution), Debian),,libx32z1-dev)' \ + >> debian/substvars.local.tmp +endif +ifeq ($(multilib),yes) + echo 'dep:libgfortranbiarchdev=$(libgfortranbiarchdev)' \ + >> debian/substvars.local.tmp + echo 'dep:libobjcbiarchdev=$(libobjcbiarchdev)' \ + >> debian/substvars.local.tmp + ifeq ($(with_phobos),yes) + echo 'dep:libphobosbiarchdev=$(libgphobosbiarchdev)' \ + >> debian/substvars.local.tmp + endif + ifeq ($(with_libssp),yes) + echo 'dep:libsspbiarch=$(libsspbiarch)' \ + >> debian/substvars.local.tmp + endif + ifeq ($(with_gomp),yes) + echo 'dep:libgompbiarch=$(libgompbiarch)' \ + >> debian/substvars.local.tmp + endif + ifeq ($(with_itm),yes) + echo 'dep:libitmbiarch=$(libitmbiarch)' \ + >> debian/substvars.local.tmp + endif + ifeq ($(with_atomic),yes) + echo 'dep:libatomicbiarch=$(libatomicbiarch)' \ + >> debian/substvars.local.tmp + endif + ifeq ($(with_libbacktrace),yes) + echo 'dep:libbtracebiarch=$(libbtracebiarch)' \ + >> debian/substvars.local.tmp + endif + ifeq ($(with_asan),yes) + echo 'dep:libasanbiarch=$(libasanbiarch)' \ + >> debian/substvars.local.tmp + endif + ifeq ($(with_lsan),yes) + #echo 'dep:liblsanbiarch=$(liblsanbiarch)' \ + # >> debian/substvars.local.tmp + endif + ifeq ($(with_tsan),yes) + #echo 'dep:libtsanbiarch=$(libtsanbiarch)' \ + # >> debian/substvars.local.tmp + endif + ifeq ($(with_ubsan),yes) + echo 'dep:libubsanbiarch=$(libubsanbiarch)' \ + >> debian/substvars.local.tmp + endif + ifeq ($(with_hwasan),yes) + # amd64 hwasan not available for 32/x32 + ifeq ($(DEB_TARGET_ARCH),amd64) + else + echo 'dep:libhwasanbiarch=$(libhwasanbiarch)' \ + >> debian/substvars.local.tmp + endif + endif + ifeq ($(with_vtv),yes) + echo 'dep:libvtvbiarch=$(libvtvbiarch)' \ + >> debian/substvars.local.tmp + endif + ifeq ($(with_qmath),yes) + echo 'dep:libqmathbiarch=$(libquadmathbiarch)' \ + >> debian/substvars.local.tmp + endif + ifeq ($(with_go),yes) + echo 'dep:libgobiarchdev=$(libgobiarchdev)' \ + >> debian/substvars.local.tmp + echo 'dep:libgobiarch=$(libgobiarch)' \ + >> debian/substvars.local.tmp + endif +endif +ifeq ($(DEB_CROSS),yes) + echo 'dep:gdccross=gdc$(pkg_ver) (>= $(DEB_GCC_SOFT_VERSION))' \ + >> debian/substvars.local.tmp +endif +ifeq ($(with_phobos),yes) + echo 'dep:phobosdev=libgphobos$(pkg_ver)-dev$(LS)$(AQ) (>= $(DEB_GCC_SOFT_VERSION))' \ + >> debian/substvars.local.tmp + ifeq ($(DEB_CROSS),yes) + : # FIXME: make the cross gdc aware of both include paths + echo 'dep:gdccross=gdc$(pkg_ver) (>= $(DEB_GCC_SOFT_VERSION))' \ + >> debian/substvars.local.tmp + endif + ifeq ($(with_libphobosdev),yes) + echo 'dep:libphobosbiarchdev=$(libgphobosbiarchdev)' \ + >> debian/substvars.local.tmp + echo 'dep:libphobosbiarch=$(libgphobosbiarch)' \ + >> debian/substvars.local.tmp + endif +endif +ifeq ($(with_cc1),yes) + ifneq (,$(findstring build-cross, $(build_type))) + echo 'dep:libcc1=libcc1-$(CC1_SONAME) (>= $${gcc:SoftVersion})' \ + >> debian/substvars.local.tmp + else + echo 'dep:libcc1=libcc1-$(CC1_SONAME) (>= $${gcc:Version})' \ + >> debian/substvars.local.tmp + endif +endif +ifeq ($(DEB_HOST_ARCH),hppa) + echo 'dep:prctl=prctl' >> debian/substvars.local.tmp +endif +ifeq ($(derivative)-$(DEB_HOST_ARCH),Debian-amd64) + echo 'confl:lib32=libc6-i386 (<< 2.9-22)' >> debian/substvars.local.tmp +endif +ifeq ($(with_multiarch_lib),yes) + echo 'multiarch:breaks=gcc-4.3 (<< 4.3.6-1), gcc-4.4 (<< 4.4.6-4), gcc-4.5 (<< 4.5.3-2)' >> debian/substvars.local.tmp +endif + echo 'golang:Conflicts=golang-go (<< 2:1.3.3-1ubuntu2)' >> debian/substvars.local.tmp +ifeq ($(add_built_using),yes) + echo "Built-Using=$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W gcc$(pkg_ver)-source)" \ + >> debian/substvars.local.tmp +endif + v=`sed -n '/^#define MOD_VERSION/s/.* "\([0-9]*\)"/\1/p' \ + $(srcdir)/gcc/fortran/module.cc`; \ + echo "fortran:mod-version=gfortran-mod-$$v" >> debian/substvars.local.tmp + + [ -e debian/substvars.local ] \ + && cmp -s debian/substvars.local debian/substvars.local.tmp \ + && rm -f debian/substvars.local.tmp && exit 0; \ + mv debian/substvars.local.tmp debian/substvars.local; \ + touch $(control_stamp) + +parameters-file: + rm -f debian/rules.parameters.tmp + ( \ + echo '# configuration parameters taken from upstream source files'; \ + echo 'GCC_VERSION := $(GCC_VERSION)'; \ + echo 'NEXT_GCC_VERSION := $(NEXT_GCC_VERSION)'; \ + echo 'BASE_VERSION := $(BASE_VERSION)'; \ + echo 'SOURCE_VERSION := $(SOURCE_VERSION)'; \ + echo 'DEB_VERSION := $(DEB_VERSION)'; \ + echo 'DEB_EVERSION := $(DEB_EVERSION)'; \ + echo 'DEB_GDC_VERSION := $(DEB_GDC_VERSION)'; \ + echo 'DEB_SOVERSION := $(DEB_SOVERSION)'; \ + echo 'DEB_SOEVERSION := $(DEB_SOEVERSION)'; \ + echo 'DEB_LIBGCC_SOVERSION := $(DEB_LIBGCC_SOVERSION)'; \ + echo 'DEB_LIBGCC_VERSION := $(DEB_LIBGCC_VERSION)'; \ + echo 'DEB_STDCXX_SOVERSION := $(DEB_STDCXX_SOVERSION)'; \ + echo 'DEB_GOMP_SOVERSION := $(DEB_GOMP_SOVERSION)'; \ + echo 'GCC_SONAME := $(GCC_SONAME)'; \ + echo 'CXX_SONAME := $(CXX_SONAME)'; \ + echo 'FORTRAN_SONAME := $(FORTRAN_SONAME)'; \ + echo 'OBJC_SONAME := $(OBJC_SONAME)'; \ + echo 'GDC_VERSION := $(GDC_VERSION)'; \ + echo 'GNAT_VERSION := $(GNAT_VERSION)'; \ + echo 'GNAT_SONAME := $(GNAT_SONAME)'; \ + echo 'FFI_SONAME := $(FFI_SONAME)'; \ + echo 'SSP_SONAME := $(SSP_SONAME)'; \ + echo 'GOMP_SONAME := $(GOMP_SONAME)'; \ + echo 'ITM_SONAME := $(ITM_SONAME)'; \ + echo 'ATOMIC_SONAME := $(ATOMIC_SONAME)'; \ + echo 'BTRACE_SONAME := $(BTRACE_SONAME)'; \ + echo 'ASAN_SONAME := $(ASAN_SONAME)'; \ + echo 'LSAN_SONAME := $(LSAN_SONAME)'; \ + echo 'TSAN_SONAME := $(TSAN_SONAME)'; \ + echo 'UBSAN_SONAME := $(UBSAN_SONAME)'; \ + echo 'HWASAN_SONAME := $(HWASAN_SONAME)'; \ + echo 'VTV_SONAME := $(VTV_SONAME)'; \ + echo 'QUADMATH_SONAME := $(QUADMATH_SONAME)'; \ + echo 'GO_SONAME := $(GO_SONAME)'; \ + echo 'CC1_SONAME := $(CC1_SONAME)'; \ + echo 'GCCJIT_SONAME := $(GCCJIT_SONAME)'; \ + echo 'GPHOBOS_SONAME := $(GPHOBOS_SONAME)'; \ + echo 'GDRUNTIME_SONAME := $(GDRUNTIME_SONAME)'; \ + echo 'GM2_SONAME := $(GM2_SONAME)'; \ + echo 'LIBC_DEP := $(LIBC_DEP)'; \ + ) > debian/rules.parameters.tmp + [ -e debian/rules.parameters ] \ + && cmp -s debian/rules.parameters debian/rules.parameters.tmp \ + && rm -f debian/rules.parameters.tmp && exit 0; \ + mv debian/rules.parameters.tmp debian/rules.parameters; \ + touch $(control_stamp) + +symbols-files: control-file +ifeq ($(DEB_CROSS),yes) + ifneq ($(DEB_STAGE),rtlibs) + test -n "$(LS)" + set -e; \ + for p in $$(dh_listpackages -i | grep '^lib'); do \ + p=$${p%$(LS)}; \ + if [ -f debian/$$p.symbols.$(DEB_TARGET_ARCH) ]; then \ + f=debian/$$p.symbols.$(DEB_TARGET_ARCH); \ + elif [ -f debian/$$p.symbols ]; then \ + f=debian/$$p.symbols; \ + else \ + continue; \ + fi; \ + link=debian/$$p$(LS).symbols; \ + if [ -L $$link ]; then \ + echo >&2 "removing left over symbols file link: $$link"; \ + rm -f $$link; \ + fi; \ + ln -s $$f $$link; \ + done + endif +endif + +versioned-files: + fs=`echo debian/*BV* debian/*CXX* debian/*LC* | sort -u`; \ + for f in $$fs; do \ + [ -f $$f ] || echo "CANNOT FIND $$f"; \ + [ -f $$f ] || continue; \ + if [ -z "$(DEB_CROSS)" ]; then case "$$f" in *-CR*) continue; esac; fi; \ + f2=$$(echo $$f \ + | sed 's/BV/$(BASE_VERSION)/;s/CXX/$(CXX_SONAME)/;s/LC/$(GCC_SONAME)/;s/-CRB/$(cross_bin_arch)/;s/\.in$$//'); \ + sed -e 's/@BV@/$(BASE_VERSION)/g' \ + -e 's/@CXX@/$(CXX_SONAME)/g' \ + -e 's/@LC@/$(GCC_SONAME)/g' \ + -e 's/@SRC@/$(PKGSOURCE)/g' \ + -e 's/@GFDL@/$(if $(filter yes,$(GFDL_INVARIANT_FREE)),#)/g' \ + -e 's/@gcc_priority@/$(subst .,,$(BASE_VERSION))/g' \ + -e 's/@TARGET@/$(DEB_TARGET_GNU_TYPE)/g' \ + -e 's/@TARGET_QUAL@/$(TARGET_QUAL)/g' \ + $$f > $$f2; \ + touch -r $$f $$f2; \ + done + for t in ar nm ranlib; do \ + sed "s/@BV@/$(BASE_VERSION)/g;s/@TOOL@/$$t/g" \ + debian/gcc-XX-BV.1 > debian/gcc-$$t-$(BASE_VERSION).1; \ + done + +# don't encode versioned build dependencies in the control file, but check +# these here instead. +check-versions: + v=$$(dpkg-query -l dpkg-dev | awk '/^.i/ {print $$3}'); \ + if dpkg --compare-versions "$$v" lt "$(DPKGV)"; then \ + echo "dpkg-dev (>= $(DPKGV)) required, found $$v"; \ + exit 1; \ + fi + v=$$(dpkg-query -l binutils binutils-multiarch 2>/dev/null | awk '/^.i/ {print $$3;exit}'); \ + if dpkg --compare-versions "$$v" lt "$(BINUTILSBDV)"; then \ + echo "binutils (>= $(BINUTILSBDV)) required, found $$v"; \ + exit 1; \ + fi + +.PRECIOUS: $(stampdir)/%-stamp diff --git a/debian/rules.d/binary-ada.mk b/debian/rules.d/binary-ada.mk new file mode 100644 index 0000000..3cd21fd --- /dev/null +++ b/debian/rules.d/binary-ada.mk @@ -0,0 +1,286 @@ +ifeq ($(with_separate_gnat),yes) + $(lib_binaries) += gnatbase +endif + +ifeq ($(with_libgnat),yes) + # During native builds, gnat-BV Depends: + # * libgnat because of the development symlink. + # During cross builds, gnat1 is linked statically. Only the latter remains. + $(lib_binaries) += libgnat +endif + +arch_binaries := $(arch_binaries) ada +ifneq ($(DEB_CROSS),yes) + ifneq ($(GFDL_INVARIANT_FREE),yes) + indep_binaries := $(indep_binaries) ada-doc + endif +endif + +p_gbase = $(p_xbase) +p_glbase = $(p_lbase) +ifeq ($(with_separate_gnat),yes) + p_gbase = gnat$(pkg_ver)$(cross_bin_arch)-base + p_glbase = gnat$(pkg_ver)$(cross_bin_arch)-base +endif + +p_gnat = gnat-$(GNAT_VERSION)$(cross_bin_arch) +p_gnatsjlj= gnat-$(GNAT_VERSION)-sjlj$(cross_bin_arch) +p_lgnat = libgnat-$(GNAT_VERSION)$(cross_lib_arch) +p_lgnat_dbg = libgnat-$(GNAT_VERSION)-dbg$(cross_lib_arch) +p_gnatd = $(p_gnat)-doc + +d_gbase = debian/$(p_gbase) +d_gnat = debian/$(p_gnat) +d_gnatsjlj = debian/$(p_gnatsjlj) +d_lgnat = debian/$(p_lgnat) +d_gnatd = debian/$(p_gnatd) + +GNAT_TOOLS = gnat gnatbind gnatchop gnatclean gnatkr gnatlink \ + gnatls gnatmake gnatname gnatprep gnathtml + +dirs_gnat = \ + $(docdir)/$(p_gbase) \ + $(PF)/bin \ + $(PF)/share/man/man1 \ + $(gcc_lib_dir)/{adalib,adainclude} \ + $(gcc_lexec_dir) + +files_gnat = \ + $(gcc_lexec_dir)/gnat1 \ + $(gcc_lib_dir)/ada_target_properties \ + $(gcc_lib_dir)/adainclude/*.ad[bs] \ + $(gcc_lib_dir)/adainclude/*.h \ + $(gcc_lib_dir)/adalib/*.ali \ + $(gcc_lib_dir)/adalib/lib*.a \ + $(foreach i,$(GNAT_TOOLS),$(PF)/bin/$(cmd_prefix)$(i)$(pkg_ver)) + +# Strip unreproducible -f*-prefix-map= options from installed .ali +# files until the proper solution BUILD_PATH_PREFIX_MAP is accepted. +sed_ali_strip_prefix_map := sed -i '/^A -f[a-z]+-prefix-map=/d' + +$(binary_stamp)-gnatbase: $(install_stamp) + dh_testdir + dh_testroot + dh_installdocs -p$(p_gbase) debian/ada/README.gnat debian/README.maintainers + : # $(p_gbase) +ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION)) + mkdir -p $(d_gbase)/$(docdir)/$(p_xbase) + ln -sf ../$(p_gbase) $(d_gbase)/$(docdir)/$(p_xbase)/Ada +endif + dh_installchangelogs -p$(p_gbase) src/gcc/ada/ChangeLog + dh_compress -p$(p_gbase) + dh_fixperms -p$(p_gbase) + dh_gencontrol -p$(p_gbase) -- -v$(DEB_VERSION) $(common_substvars) + dh_installdeb -p$(p_gbase) + dh_md5sums -p$(p_gbase) + dh_builddeb -p$(p_gbase) + touch $@ + + +$(binary_stamp)-libgnat: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + : # libgnat + rm -rf $(d_lgnat) + + dh_install -p$(p_lgnat) $(gcc_lib_dir)/adalib/libgna{t,rl}-$(GNAT_SONAME).so $(usr_lib) + + debian/dh_doclink -p$(p_lgnat) $(p_glbase) + + debian/dh_rmemptydirs -p$(p_lgnat) + + b=libgnat; \ + v=$(GNAT_VERSION); \ + for ext in preinst postinst prerm postrm; do \ + for t in '' -dev -dbg; do \ + if [ -f debian/$$b$$t.$$ext ]; then \ + cp -pf debian/$$b$$t.$$ext debian/$$b$$v$$t.$$ext; \ + fi; \ + done; \ + done + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_lgnat) \ + -V '$(p_lgnat) (>= $(shell echo $(DEB_VERSION) | sed 's/-.*//'))' + $(call cross_mangle_shlibs,$(p_lgnat)) + +ifneq (,$(filter $(build_type), build-native cross-build-native)) + mkdir -p $(d_lgnat)/usr/share/lintian/overrides + echo package-name-doesnt-match-sonames > \ + $(d_lgnat)/usr/share/lintian/overrides/$(p_lgnat) +endif + +# The subst Make command below could be simplified, but ensures +# consistency with libraries building non-default multilib packages. + $(call do_strip_lib_dbg, $(p_lgnat), $(p_lgnat_dbg), $(v_dbg),,) + $(cross_shlibdeps) dh_shlibdeps -p$(p_lgnat) \ + $(call shlibdirs_to_search, \ + $(subst gnat-$(GNAT_SONAME),gcc-s$(GCC_SONAME),$(p_lgnat)) \ + $(subst gnat-$(GNAT_SONAME),atomic$(ATOMIC_SONAME),$(p_lgnat)) \ + ,) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common) + $(call cross_mangle_substvars,$(p_lgnat)) + +ifeq ($(with_dbg),yes) + : # $(p_lgnat_dbg) + debian/dh_doclink -p$(p_lgnat_dbg) $(p_glbase) +endif + echo $(p_lgnat) $(if $(with_dbg), $(p_lgnat_dbg)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +$(binary_stamp)-ada: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + : # $(p_gnat) + rm -rf $(d_gnat) + dh_installdirs -p$(p_gnat) $(dirs_gnat) + : # Upstream does not install gnathtml. + cp src/gcc/ada/gnathtml.pl debian/tmp/$(PF)/bin/$(cmd_prefix)gnathtml$(pkg_ver) + chmod 755 debian/tmp/$(PF)/bin/$(cmd_prefix)gnathtml$(pkg_ver) + $(dh_compat2) dh_movefiles -p$(p_gnat) $(files_gnat) + +ifeq ($(with_gnatsjlj),yes) + dh_installdirs -p$(p_gnatsjlj) $(gcc_lib_dir) + $(dh_compat2) dh_movefiles -p$(p_gnatsjlj) $(gcc_lib_dir)/rts-sjlj/adalib $(gcc_lib_dir)/rts-sjlj/adainclude +endif + +ifeq ($(with_libgnat),yes) + # Development links to actual shared libraries provided by libgnat. + dh_install -p$(p_gnat) $(gcc_lib_dir)/adalib/libgna{t,rl}.so $(usr_lib) + # Similar links specific to Debian. FIXME: what is their purpose? + dh_link -p$(p_gnat) $(foreach lib,libgnat libgnarl,\ + $(usr_lib)/$(lib)-$(GNAT_SONAME).so $(gcc_lib_dir)/adalib/$(lib).so) +endif + debian/dh_doclink -p$(p_gnat) $(p_gbase) +ifeq ($(with_gnatsjlj),yes) + debian/dh_doclink -p$(p_gnatsjlj) $(p_gbase) +endif +ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION)) + ifeq ($(with_check),yes) + cp -p test-summary $(d_gnat)/$(docdir)/$(p_gbase)/. + endif +else + mkdir -p $(d_gnat)/$(docdir)/$(p_gbase)/ada + cp -p src/gcc/ada/ChangeLog $(d_gnat)/$(docdir)/$(p_gbase)/ada/. +endif + + for i in $(GNAT_TOOLS); do \ + case "$$i" in \ + gnat) cp -p debian/gnat.1 $(d_gnat)/$(PF)/share/man/man1/$(cmd_prefix)gnat$(pkg_ver).1 ;; \ + *) ln -sf $(cmd_prefix)gnat$(pkg_ver).1 $(d_gnat)/$(PF)/share/man/man1/$(cmd_prefix)$$i$(pkg_ver).1; \ + esac; \ + done + +ifneq (,$(filter $(build_type), build-native cross-build-native)) + : # still ship the unversioned prefixed names in the gnat package. + for i in $(GNAT_TOOLS); do \ + ln -sf $(cmd_prefix)$$i$(pkg_ver) \ + $(d_gnat)/$(PF)/bin/$(cmd_prefix)$$i; \ + ln -sf $(cmd_prefix)gnat$(pkg_ver).1.gz \ + $(d_gnat)/$(PF)/share/man/man1/$(cmd_prefix)$$i.1.gz; \ + done + ifeq ($(unprefixed_names),yes) + : # ship the versioned prefixed names in the gnat package. + for i in $(GNAT_TOOLS); do \ + ln -sf $(cmd_prefix)$$i$(pkg_ver) \ + $(d_gnat)/$(PF)/bin/$$i$(pkg_ver); \ + ln -sf $(cmd_prefix)gnat$(pkg_ver).1.gz \ + $(d_gnat)/$(PF)/share/man/man1/$$i$(pkg_ver).1.gz; \ + done + + : # still ship the unversioned names in the gnat package. + for i in $(GNAT_TOOLS); do \ + ln -sf $$i$(pkg_ver) \ + $(d_gnat)/$(PF)/bin/$$i; \ + ln -sf gnat$(pkg_ver).1.gz \ + $(d_gnat)/$(PF)/share/man/man1/$$i.1.gz; \ + done + + endif +else + : # still ship the unversioned prefixed names in the gnat package. + for i in $(GNAT_TOOLS); do \ + ln -sf $(cmd_prefix)$$i$(pkg_ver) \ + $(d_gnat)/$(PF)/bin/$(cmd_prefix)$$i; \ + ln -sf $(cmd_prefix)gnat$(pkg_ver).1.gz \ + $(d_gnat)/$(PF)/share/man/man1/$(cmd_prefix)$$i.1.gz; \ + done +endif + + : # keep this one unversioned, see Debian #802838. + install -m755 debian/ada/gnatgcc $(d_gnat)/usr/bin/$(cmd_prefix)gnatgcc +ifneq ($(GFDL_INVARIANT_FREE),yes) + dh_link -p$(p_gnat) \ + usr/share/man/man1/$(cmd_prefix)gcc$(pkg_ver).1.gz \ + usr/share/man/man1/$(cmd_prefix)gnatgcc.1.gz +endif +ifeq ($(unprefixed_names),yes) + dh_link -p$(p_gnat) \ + usr/bin/$(cmd_prefix)gnatgcc usr/bin/gnatgcc + ifneq ($(GFDL_INVARIANT_FREE),yes) + dh_link -p$(p_gnat) \ + usr/share/man/man1/$(cmd_prefix)gcc$(pkg_ver).1.gz \ + usr/share/man/man1/gnatgcc.1.gz + endif +endif + debian/dh_rmemptydirs -p$(p_gnat) + +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTONS))) + $(DWZ) \ + $(d_gnat)/$(gcc_lexec_dir)/gnat1 +endif + dh_strip -p$(p_gnat) + find $(d_gnat) -name '*.ali' | xargs $(sed_ali_strip_prefix_map) + find $(d_gnat) -name '*.ali' | xargs chmod 444 + dh_shlibdeps -p$(p_gnat) + mkdir -p $(d_gnat)/usr/share/lintian/overrides + ( \ + echo '$(p_gnat) binary: hardening-no-pie'; \ + echo '$(p_gnat) binary: non-standard-file-perm' \ + ) > $(d_gnat)/usr/share/lintian/overrides/$(p_gnat) +ifeq ($(GFDL_INVARIANT_FREE),yes) + echo '$(p_gnat) binary: binary-without-manpage' \ + >> $(d_gnat)/usr/share/lintian/overrides/$(p_gnat) +endif + + echo $(p_gnat) >> debian/arch_binaries + +ifeq ($(with_gnatsjlj),yes) + dh_strip -p$(p_gnatsjlj) + find $(d_gnatsjlj) -name '*.ali' | xargs $(sed_ali_strip_prefix_map) + find $(d_gnatsjlj) -name '*.ali' | xargs chmod 444 + dh_shlibdeps -p$(p_gnatsjlj) + echo $(p_gnatsjlj) >> debian/arch_binaries +endif + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + + +$(build_gnatdoc_stamp): $(build_stamp) + mkdir -p html + rm -f html/*.info + echo -n gnat_ugn gnat_rm gnat-style | xargs -d ' ' -L 1 -P $(USE_CPUS) -I{} \ + sh -c 'cd html && \ + echo "generating {}-$(GNAT_VERSION).info"; \ + makeinfo -I $(srcdir)/gcc/doc/include -I $(srcdir)/gcc/ada \ + -I $(builddir)/gcc \ + -o {}-$(GNAT_VERSION).info \ + $(srcdir)/gcc/ada/{}.texi' + touch $@ + +$(binary_stamp)-ada-doc: $(build_html_stamp) $(build_gnatdoc_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_gnatd) + dh_installdirs -p$(p_gnatd) \ + $(PF)/share/info + cp -p html/gnat*info* $(d_gnatd)/$(PF)/share/info/. + dh_installdocs -p$(p_gnatd) \ + html/gnat_ugn.html html/gnat_rm.html html/gnat-style.html + echo $(p_gnatd) >> debian/indep_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) diff --git a/debian/rules.d/binary-base.mk b/debian/rules.d/binary-base.mk new file mode 100644 index 0000000..c6f589b --- /dev/null +++ b/debian/rules.d/binary-base.mk @@ -0,0 +1,49 @@ +arch_binaries += base +ifeq ($(with_gcclbase),yes) + ifneq ($(with_base_only),yes) + indep_binaries += lbase + endif +endif + +# --------------------------------------------------------------------------- +# gcc-base + +$(binary_stamp)-base: $(install_dependencies) + dh_testdir + dh_testroot + rm -rf $(d_base) + dh_installdirs -p$(p_base) + +ifeq ($(with_base_only),yes) + dh_installdocs -p$(p_base) debian/README.Debian +else + dh_installdocs -p$(p_base) debian/README.Debian.$(DEB_TARGET_ARCH) +endif + rm -f $(d_base)/usr/share/doc/$(p_base)/README.Debian + dh_installchangelogs -p$(p_base) + dh_compress -p$(p_base) + dh_fixperms -p$(p_base) +ifeq ($(DEB_STAGE)-$(DEB_CROSS),rtlibs-yes) + $(cross_gencontrol) dh_gencontrol -p$(p_base) -- -v$(DEB_VERSION) $(common_substvars) +else + dh_gencontrol -p$(p_base) -- -v$(DEB_VERSION) $(common_substvars) +endif + dh_installdeb -p$(p_base) + dh_md5sums -p$(p_base) + dh_builddeb -p$(p_base) + touch $@ + +$(binary_stamp)-lbase: $(install_dependencies) + dh_testdir + dh_testroot + rm -rf $(d_lbase) + dh_installdocs -p$(p_lbase) debian/README.Debian + rm -f debian/$(p_lbase)/usr/share/doc/$(p_lbase)/README.Debian + dh_installchangelogs -p$(p_lbase) + dh_compress -p$(p_lbase) + dh_fixperms -p$(p_lbase) + dh_gencontrol -p$(p_lbase) -- -v$(DEB_VERSION) $(common_substvars) + dh_installdeb -p$(p_lbase) + dh_md5sums -p$(p_lbase) + dh_builddeb -p$(p_lbase) + touch $@ diff --git a/debian/rules.d/binary-cpp.mk b/debian/rules.d/binary-cpp.mk new file mode 100644 index 0000000..cbeeb26 --- /dev/null +++ b/debian/rules.d/binary-cpp.mk @@ -0,0 +1,85 @@ +ifneq ($(DEB_STAGE),rtlibs) + arch_binaries := $(arch_binaries) cpp + ifneq ($(DEB_CROSS),yes) + ifneq ($(GFDL_INVARIANT_FREE),yes) + indep_binaries := $(indep_binaries) cpp-doc + endif + endif +endif + +dirs_cpp = \ + $(docdir) \ + $(PF)/share/man/man1 \ + $(PF)/bin \ + $(gcc_lexec_dir) + +files_cpp = \ + $(PF)/bin/$(cmd_prefix)cpp$(pkg_ver) \ + $(gcc_lexec_dir)/cc1 + +ifneq ($(GFDL_INVARIANT_FREE),yes) + files_cpp += \ + $(PF)/share/man/man1/$(cmd_prefix)cpp$(pkg_ver).1 +endif + +# ---------------------------------------------------------------------- +$(binary_stamp)-cpp: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_cpp) + dh_installdirs -p$(p_cpp) $(dirs_cpp) + $(dh_compat2) dh_movefiles -p$(p_cpp) $(files_cpp) + +ifeq ($(unprefixed_names),yes) + ln -sf $(cmd_prefix)cpp$(pkg_ver) \ + $(d_cpp)/$(PF)/bin/cpp$(pkg_ver) + ifneq ($(GFDL_INVARIANT_FREE),yes) + ln -sf $(cmd_prefix)cpp$(pkg_ver).1 \ + $(d_cpp)/$(PF)/share/man/man1/cpp$(pkg_ver).1 + endif +endif + + mkdir -p $(d_cpp)/usr/share/lintian/overrides + echo '$(p_cpp) binary: hardening-no-pie' \ + > $(d_cpp)/usr/share/lintian/overrides/$(p_cpp) +ifeq ($(GFDL_INVARIANT_FREE),yes) + echo '$(p_cpp) binary: binary-without-manpage' \ + >> $(d_cpp)/usr/share/lintian/overrides/$(p_cpp) +endif + + debian/dh_doclink -p$(p_cpp) $(p_xbase) + debian/dh_rmemptydirs -p$(p_cpp) + +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTONS))) + $(DWZ) $(d_cpp)/$(gcc_lexec_dir)/cc1 +endif + dh_strip -p$(p_cpp) \ + $(if $(unstripped_exe),-X/cc1) + dh_shlibdeps -p$(p_cpp) + + echo $(p_cpp) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +# ---------------------------------------------------------------------- +$(binary_stamp)-cpp-doc: $(build_html_stamp) $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_cppd) + dh_installdirs -p$(p_cppd) \ + $(docdir)/$(p_xbase) \ + $(PF)/share/info + $(dh_compat2) dh_movefiles -p$(p_cppd) \ + $(PF)/share/info/cpp* + + debian/dh_doclink -p$(p_cppd) $(p_xbase) + dh_installdocs -p$(p_cppd) html/cpp.html html/cppinternals.html + rm -f $(d_cppd)/$(docdir)/$(p_xbase)/copyright + debian/dh_rmemptydirs -p$(p_cppd) + echo $(p_cppd) >> debian/indep_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) diff --git a/debian/rules.d/binary-cxx.mk b/debian/rules.d/binary-cxx.mk new file mode 100644 index 0000000..30af1b7 --- /dev/null +++ b/debian/rules.d/binary-cxx.mk @@ -0,0 +1,86 @@ +ifneq ($(DEB_STAGE),rtlibs) + ifneq (,$(filter yes, $(biarch64) $(biarch32) $(biarchn32) $(biarchx32) $(biarchhf) $(biarchsf))) + arch_binaries := $(arch_binaries) cxx-multi + endif + arch_binaries := $(arch_binaries) cxx +endif + +dirs_cxx = \ + $(docdir)/$(p_xbase)/C++ \ + $(PF)/bin \ + $(PF)/share/info \ + $(gcc_lexec_dir) \ + $(PF)/share/man/man1 +files_cxx = \ + $(PF)/bin/$(cmd_prefix)g++$(pkg_ver) \ + $(gcc_lexec_dir)/cc1plus \ + $(gcc_lexec_dir)/g++-mapper-server + +ifneq ($(GFDL_INVARIANT_FREE),yes) + files_cxx += \ + $(PF)/share/man/man1/$(cmd_prefix)g++$(pkg_ver).1 +endif + +p_cxx_m = g++$(pkg_ver)-multilib$(cross_bin_arch) +d_cxx_m = debian/$(p_cxx_m) + +# ---------------------------------------------------------------------- +$(binary_stamp)-cxx: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_cxx) + dh_installdirs -p$(p_cxx) $(dirs_cxx) + $(dh_compat2) dh_movefiles -p$(p_cxx) $(files_cxx) + +ifeq ($(unprefixed_names),yes) + ln -sf $(cmd_prefix)g++$(pkg_ver) \ + $(d_cxx)/$(PF)/bin/g++$(pkg_ver) + ifneq ($(GFDL_INVARIANT_FREE),yes) + ln -sf $(cmd_prefix)g++$(pkg_ver).1.gz \ + $(d_cxx)/$(PF)/share/man/man1/g++$(pkg_ver).1.gz + endif +endif + + mkdir -p $(d_cxx)/usr/share/lintian/overrides + echo '$(p_cxx) binary: hardening-no-pie' \ + > $(d_cxx)/usr/share/lintian/overrides/$(p_cxx) +ifeq ($(GFDL_INVARIANT_FREE),yes) + echo '$(p_cxx) binary: binary-without-manpage' \ + >> $(d_cxx)/usr/share/lintian/overrides/$(p_cxx) +endif + + debian/dh_doclink -p$(p_cxx) $(p_xbase) + cp -p debian/README.C++ $(d_cxx)/$(docdir)/$(p_xbase)/C++/ + cp -p $(srcdir)/gcc/cp/ChangeLog \ + $(d_cxx)/$(docdir)/$(p_xbase)/C++/changelog + debian/dh_rmemptydirs -p$(p_cxx) + + dh_shlibdeps -p$(p_cxx) +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTONS))) + $(DWZ) \ + $(d_cxx)/$(gcc_lexec_dir)/cc1plus +endif + dh_strip -p$(p_cxx) $(if $(unstripped_exe),-X/cc1plus) + echo $(p_cxx) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +$(binary_stamp)-cxx-multi: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_cxx_m) + dh_installdirs -p$(p_cxx_m) \ + $(docdir) + + debian/dh_doclink -p$(p_cxx_m) $(p_xbase) + debian/dh_rmemptydirs -p$(p_cxx_m) + + dh_strip -p$(p_cxx_m) + dh_shlibdeps -p$(p_cxx_m) + echo $(p_cxx_m) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) diff --git a/debian/rules.d/binary-d.mk b/debian/rules.d/binary-d.mk new file mode 100644 index 0000000..131d8b0 --- /dev/null +++ b/debian/rules.d/binary-d.mk @@ -0,0 +1,292 @@ +ifneq ($(DEB_STAGE),rtlibs) + ifneq (,$(filter yes, $(biarch64) $(biarch32) $(biarchn32) $(biarchx32) $(biarchsf))) + arch_binaries := $(arch_binaries) gdc-multi + endif + arch_binaries := $(arch_binaries) gdc + + ifeq ($(with_libphobosdev),yes) + $(lib_binaries) += libphobos-dev + endif + ifeq ($(with_libphobos),yes) + $(lib_binaries) += libphobos + endif + + ifeq ($(with_lib64phobosdev),yes) + $(lib_binaries) += lib64phobos-dev + endif + ifeq ($(with_lib32phobosdev),yes) + $(lib_binaries) += lib32phobos-dev + endif + ifeq ($(with_libn32phobosdev),yes) + $(lib_binaries) += libn32phobos-dev + endif + ifeq ($(with_libx32phobosdev),yes) + $(lib_binaries) += libx32phobos-dev + endif + ifeq ($(with_libhfphobosdev),yes) + $(lib_binaries) += libhfphobos-dev + endif + ifeq ($(with_libsfphobosdev),yes) + $(lib_binaries) += libsfphobos-dev + endif + + ifeq ($(with_lib64phobos),yes) + $(lib_binaries) += lib64phobos + endif + ifeq ($(with_lib32phobos),yes) + $(lib_binaries) += lib32phobos + endif + ifeq ($(with_libn32phobos),yes) + $(lib_binaries) += libn32phobos + endif + ifeq ($(with_libx32phobos),yes) + $(lib_binaries) += libx32phobos + endif + ifeq ($(with_libhfphobos),yes) + $(lib_binaries) += libhfphobos + endif + ifeq ($(with_libsfphobos),yes) + $(lib_binaries) += libsfphobos + endif +endif + +p_gdc = gdc$(pkg_ver)$(cross_bin_arch) +p_gdc_m = gdc$(pkg_ver)-multilib$(cross_bin_arch) +p_libphobos = libgphobos$(GPHOBOS_SONAME) +p_libphobosdev = libgphobos$(pkg_ver)-dev + +d_gdc = debian/$(p_gdc) +d_gdc_m = debian/$(p_gdc_m) +d_libphobos = debian/$(p_libphobos) +d_libphobosdev = debian/$(p_libphobosdev) + +ifeq ($(DEB_CROSS),yes) + gdc_include_dir := $(gcc_lib_dir)/include/d +else + gdc_include_dir := $(PF)/include/d/$(BASE_VERSION) +endif +# FIXME: always here? +gdc_include_dir := $(gcc_lib_dir)/include/d + +dirs_gdc = \ + $(PF)/bin \ + $(PF)/share/man/man1 \ + $(gcc_lib_dir) \ + $(gcc_lexec_dir) +ifneq ($(DEB_CROSS),yes) + dirs_gdc += \ + $(gdc_include_dir) +endif + +files_gdc = \ + $(PF)/bin/$(cmd_prefix)gdc$(pkg_ver) \ + $(gcc_lexec_dir)/d21 +ifneq ($(GFDL_INVARIANT_FREE),yes-now-pure-gfdl) + files_gdc += \ + $(PF)/share/man/man1/$(cmd_prefix)gdc$(pkg_ver).1 +endif + +dirs_libphobos = \ + $(PF)/lib \ + $(gdc_include_dir) \ + $(gcc_lib_dir) + +$(binary_stamp)-gdc: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_gdc) + dh_installdirs -p$(p_gdc) $(dirs_gdc) + + dh_installdocs -p$(p_gdc) + dh_installchangelogs -p$(p_gdc) src/gcc/d/ChangeLog + + $(dh_compat2) dh_movefiles -p$(p_gdc) -X/zlib/ $(files_gdc) + +ifeq ($(with_phobos),yes) + mv $(d)/$(usr_lib)/libgphobos.spec $(d_gdc)/$(gcc_lib_dir)/ +endif + +ifeq ($(unprefixed_names),yes) + ln -sf $(cmd_prefix)gdc$(pkg_ver) \ + $(d_gdc)/$(PF)/bin/gdc$(pkg_ver) + ifneq ($(GFDL_INVARIANT_FREE),yes-now-pure-gfdl) + ln -sf $(cmd_prefix)gdc$(pkg_ver).1 \ + $(d_gdc)/$(PF)/share/man/man1/gdc$(pkg_ver).1 + endif +endif + +# FIXME: __entrypoint.di needs to go into a libgdc-dev Multi-Arch: same package +## # Always needed by gdc. +## mkdir -p $(d_gdc)/$(gdc_include_dir) +## cp $(srcdir)/libphobos/libdruntime/__entrypoint.di \ +## $(d_gdc)/$(gdc_include_dir)/. +#ifneq ($(DEB_CROSS),yes) +# dh_link -p$(p_gdc) \ +# /$(gdc_include_dir) \ +# /$(dir $(gdc_include_dir))/$(GCC_VERSION) +#endif + + dh_link -p$(p_gdc) \ + /$(docdir)/$(p_xbase)/README.Bugs \ + /$(docdir)/$(p_gdc)/README.Bugs + +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTONS))) + $(DWZ) \ + $(d_gdc)/$(gcc_lexec_dir)/d21 +endif + dh_strip -p$(p_gdc) \ + $(if $(unstripped_exe),-X/d21) + dh_shlibdeps -p$(p_gdc) + + mkdir -p $(d_gdc)/usr/share/lintian/overrides + echo '$(p_gdc) binary: hardening-no-pie' \ + > $(d_gdc)/usr/share/lintian/overrides/$(p_gdc) + + echo $(p_gdc) >> debian/arch_binaries + + find $(d_gdc) -type d -empty -delete + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +$(binary_stamp)-gdc-multi: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_gdc_m) + dh_installdirs -p$(p_gdc_m) $(docdir) + + debian/dh_doclink -p$(p_gdc_m) $(p_xbase) + + dh_strip -p$(p_gdc_m) + dh_shlibdeps -p$(p_gdc_m) + echo $(p_gdc_m) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +define __do_libphobos + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + dh_installdirs -p$(p_l) \ + $(usr_lib$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) \ + $(usr_lib$(2))/libgphobos.so.* \ + $(usr_lib$(2))/libgdruntime.so.* + + debian/dh_doclink -p$(p_l) $(p_lbase) + $(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase)) + + $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,) + ln -sf libgphobos.symbols debian/$(p_l).symbols + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) \ + -- -a$(call mlib_to_arch,$(2)) || echo XXXXXXXXXXX ERROR $(p_l) + rm -f debian/$(p_l).symbols + $(call cross_mangle_shlibs,$(p_l)) + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search, \ + $(subst gphobos$(GPHOBOS_SONAME),gcc-s$(GCC_SONAME),$(p_l)) \ + ,$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_l)) + + mkdir -p $(d_l)/usr/share/lintian/overrides; \ + $(if $(filter $(DEB_TARGET_ARCH), amd64), + $(if $(2), + echo "$(p_l) binary: symbols-file-contains-current-version-with-debian-revision" \ + >> $(d_l)/usr/share/lintian/overrides/$(p_l) + ) + , + echo "$(p_l) binary: symbols-file-contains-current-version-with-debian-revision" \ + >> $(d_l)/usr/share/lintian/overrides/$(p_l) + ) + $(if $(2), + echo "$(p_l) binary: embedded-library" \ + >> $(d_l)/usr/share/lintian/overrides/$(p_l) + ) + + dh_lintian -p$(p_l) + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +define __do_libphobos_dev + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) + dh_installdirs -p$(p_l) \ + $(gcc_lib_dir$(2)) + + $(call install_gcc_lib,libgdruntime,$(GDRUNTIME_SONAME),$(2),$(p_l)) + $(call install_gcc_lib,libgphobos,$(GPHOBOS_SONAME),$(2),$(p_l)) + + $(if $(2),, + $(dh_compat2) dh_movefiles -p$(p_l) \ + $(gdc_include_dir) + ) + +## : # included in gdc package +## rm -f $(d_l)/$(gdc_include_dir)/__entrypoint.di + + debian/dh_doclink -p$(p_l) \ + $(if $(filter yes,$(with_separate_gdc)),$(p_gdc),$(p_lbase)) + echo $(p_l) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +# don't put this as a comment within define/endef +# $(call install_gcc_lib,libphobos,$(PHOBOS_SONAME),$(2),$(p_l)) + +do_libphobos = $(call __do_libphobos,lib$(1)gphobos$(GPHOBOS_SONAME),$(1)) +do_libphobos_dev = $(call __do_libphobos_dev,lib$(1)gphobos-$(BASE_VERSION)-dev,$(1)) + +$(binary_stamp)-libphobos: $(install_stamp) + $(call do_libphobos,) + +$(binary_stamp)-lib64phobos: $(install_stamp) + $(call do_libphobos,64) + +$(binary_stamp)-lib32phobos: $(install_stamp) + $(call do_libphobos,32) + +$(binary_stamp)-libn32phobos: $(install_stamp) + $(call do_libphobos,n32) + +$(binary_stamp)-libx32phobos: $(install_stamp) + $(call do_libphobos,x32) + +$(binary_stamp)-libhfphobos: $(install_stamp) + $(call do_libphobos,hf) + +$(binary_stamp)-libsfphobos: $(install_stamp) + $(call do_libphobos,sf) + + +$(binary_stamp)-libphobos-dev: $(install_stamp) + $(call do_libphobos_dev,) + +$(binary_stamp)-lib64phobos-dev: $(install_stamp) + $(call do_libphobos_dev,64) + +$(binary_stamp)-lib32phobos-dev: $(install_stamp) + $(call do_libphobos_dev,32) + +$(binary_stamp)-libx32phobos-dev: $(install_stamp) + $(call do_libphobos_dev,x32) + +$(binary_stamp)-libn32phobos-dev: $(install_stamp) + $(call do_libphobos_dev,n32) + +$(binary_stamp)-libhfphobos-dev: $(install_stamp) + $(call do_libphobos_dev,hf) + +$(binary_stamp)-libsfphobos-dev: $(install_stamp) + $(call do_libphobos_dev,sf) diff --git a/debian/rules.d/binary-fortran.mk b/debian/rules.d/binary-fortran.mk new file mode 100644 index 0000000..ead1ee2 --- /dev/null +++ b/debian/rules.d/binary-fortran.mk @@ -0,0 +1,279 @@ +ifeq ($(with_libgfortran),yes) + $(lib_binaries) += libgfortran +endif +ifeq ($(with_fdev),yes) + $(lib_binaries) += libgfortran-dev +endif +ifeq ($(with_lib64gfortran),yes) + $(lib_binaries) += lib64fortran +endif +ifeq ($(with_lib64gfortrandev),yes) + $(lib_binaries) += lib64gfortran-dev +endif +ifeq ($(with_lib32gfortran),yes) + $(lib_binaries) += lib32fortran +endif +ifeq ($(with_lib32gfortrandev),yes) + $(lib_binaries) += lib32gfortran-dev +endif +ifeq ($(with_libn32gfortran),yes) + $(lib_binaries) += libn32fortran +endif +ifeq ($(with_libn32gfortrandev),yes) + $(lib_binaries) += libn32gfortran-dev +endif +ifeq ($(with_libx32gfortran),yes) + $(lib_binaries) += libx32fortran +endif +ifeq ($(with_libx32gfortrandev),yes) + $(lib_binaries) += libx32gfortran-dev +endif +ifeq ($(with_libhfgfortran),yes) + $(lib_binaries) += libhffortran +endif +ifeq ($(with_libhfgfortrandev),yes) + $(lib_binaries) += libhfgfortran-dev +endif +ifeq ($(with_libsfgfortran),yes) + $(lib_binaries) += libsffortran +endif +ifeq ($(with_libsfgfortrandev),yes) + $(lib_binaries) += libsfgfortran-dev +endif + +ifeq ($(with_fdev),yes) + ifneq (,$(filter yes, $(biarch64) $(biarch32) $(biarchn32) $(biarchx32) $(biarchhf) $(biarchsf))) + arch_binaries := $(arch_binaries) fdev-multi + endif + arch_binaries := $(arch_binaries) fdev + ifneq ($(DEB_CROSS),yes) + ifneq ($(GFDL_INVARIANT_FREE),yes) + indep_binaries := $(indep_binaries) fortran-doc + endif + endif +endif + +p_g95 = gfortran$(pkg_ver)$(cross_bin_arch) +p_g95_m = gfortran$(pkg_ver)-multilib$(cross_bin_arch) +p_g95d = gfortran$(pkg_ver)-doc +p_flib = libgfortran$(FORTRAN_SONAME)$(cross_lib_arch) + +d_g95 = debian/$(p_g95) +d_g95_m = debian/$(p_g95_m) +d_g95d = debian/$(p_g95d) + +dirs_g95 = \ + $(docdir)/$(p_xbase)/fortran \ + $(PF)/bin \ + $(gcc_lexec_dir) \ + $(gcc_lib_dir) \ + $(PF)/include \ + $(PF)/share/man/man1 +files_g95 = \ + $(PF)/bin/$(cmd_prefix)gfortran$(pkg_ver) \ + $(gcc_lib_dir)/finclude \ + $(gcc_lexec_dir)/f951 + +ifneq ($(GFDL_INVARIANT_FREE),yes) + files_g95 += \ + $(PF)/share/man/man1/$(cmd_prefix)gfortran$(pkg_ver).1 +endif + +# ---------------------------------------------------------------------- +define __do_fortran + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + dh_installdirs -p$(p_l) $(usr_lib$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) $(usr_lib$(2))/libgfortran.so.* + + debian/dh_doclink -p$(p_l) $(p_lbase) + $(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase)) + + if [ -f debian/$(p_l).overrides ]; then \ + mkdir -p debian/$(p_l)/usr/share/lintian/overrides; \ + cp debian/$(p_l).overrides debian/$(p_l)/usr/share/lintian/overrides/$(p_l); \ + fi + + $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,) + ln -sf libgfortran.symbols debian/$(p_l).symbols + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) + $(call cross_mangle_shlibs,$(p_l)) + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search, \ + $(subst gfortran$(FORTRAN_SONAME),gcc-s$(GCC_SONAME),$(p_l)) \ + $(subst gfortran$(FORTRAN_SONAME),gcc$(QUADMATH_SONAME),$(p_l)) \ + ,$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_l)) + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +do_fortran = $(call __do_fortran,lib$(1)gfortran$(FORTRAN_SONAME),$(1)) + + +define __do_libgfortran_dev + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) + dh_installdirs -p$(p_l) $(gcc_lib_dir$(2)) + + $(dh_compat2) dh_movefiles -p$(p_l) \ + $(gcc_lib_dir$(2))/libcaf_single.a + $(call install_gcc_lib,libgfortran,$(FORTRAN_SONAME),$(2),$(p_l)) + + $(if $(2),, \ + $(dh_compat2) dh_movefiles -p$(p_l) \ + $(gcc_lib_dir$(2))/include/ISO_Fortran_binding.h) + + debian/dh_doclink -p$(p_l) $(p_lbase) + debian/dh_rmemptydirs -p$(p_l) + + dh_strip -p$(p_l) + $(cross_shlibdeps) dh_shlibdeps -p$(p_l) + $(call cross_mangle_substvars,$(p_l)) + echo $(p_l) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef +# ---------------------------------------------------------------------- + +do_libgfortran_dev = $(call __do_libgfortran_dev,lib$(1)gfortran-$(BASE_VERSION)-dev,$(1)) + +$(binary_stamp)-libgfortran: $(install_stamp) + $(call do_fortran,) + +$(binary_stamp)-lib64fortran: $(install_stamp) + $(call do_fortran,64) + +$(binary_stamp)-lib32fortran: $(install_stamp) + $(call do_fortran,32) + +$(binary_stamp)-libn32fortran: $(install_stamp) + $(call do_fortran,n32) + +$(binary_stamp)-libx32fortran: $(install_stamp) + $(call do_fortran,x32) + +$(binary_stamp)-libhffortran: $(install_stamp) + $(call do_fortran,hf) + +$(binary_stamp)-libsffortran: $(install_stamp) + $(call do_fortran,sf) + +# ---------------------------------------------------------------------- +$(binary_stamp)-fdev: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_g95) + dh_installdirs -p$(p_g95) $(dirs_g95) + + $(dh_compat2) dh_movefiles -p$(p_g95) $(files_g95) + + mv $(d)/$(usr_lib)/libgfortran.spec $(d_g95)/$(gcc_lib_dir)/ + +ifeq ($(unprefixed_names),yes) + ln -sf $(cmd_prefix)gfortran$(pkg_ver) \ + $(d_g95)/$(PF)/bin/gfortran$(pkg_ver) + ifneq ($(GFDL_INVARIANT_FREE),yes) + ln -sf $(cmd_prefix)gfortran$(pkg_ver).1 \ + $(d_g95)/$(PF)/share/man/man1/gfortran$(pkg_ver).1 + endif +endif + + mkdir -p $(d_g95)/usr/share/lintian/overrides + ( \ + echo '$(p_g95) binary: hardening-no-pie'; \ + echo '$(p_g95) binary: missing-prerequisite-for-gfortran-module'; \ + ) > $(d_g95)/usr/share/lintian/overrides/$(p_g95) +ifeq ($(GFDL_INVARIANT_FREE),yes) + echo '$(p_g95) binary: binary-without-manpage' \ + >> $(d_g95)/usr/share/lintian/overrides/$(p_g95) +endif + + debian/dh_doclink -p$(p_g95) $(p_xbase) + + cp -p $(srcdir)/gcc/fortran/ChangeLog \ + $(d_g95)/$(docdir)/$(p_xbase)/fortran/changelog + debian/dh_rmemptydirs -p$(p_g95) + +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTONS))) + $(DWZ) \ + $(d_g95)/$(gcc_lexec_dir)/f951 +endif + dh_strip -p$(p_g95) \ + $(if $(unstripped_exe),-X/f951) + dh_shlibdeps -p$(p_g95) + echo $(p_g95) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +# ---------------------------------------------------------------------- +$(binary_stamp)-fdev-multi: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_g95_m) + dh_installdirs -p$(p_g95_m) $(docdir) + + debian/dh_doclink -p$(p_g95_m) $(p_xbase) + debian/dh_rmemptydirs -p$(p_g95_m) + dh_strip -p$(p_g95_m) + dh_shlibdeps -p$(p_g95_m) + echo $(p_g95_m) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +# ---------------------------------------------------------------------- +$(binary_stamp)-fortran-doc: $(build_html_stamp) $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_g95d) + dh_installdirs -p$(p_g95d) \ + $(docdir)/$(p_xbase)/fortran \ + $(PF)/share/info + $(dh_compat2) dh_movefiles -p$(p_g95d) \ + $(PF)/share/info/gfortran* + + debian/dh_doclink -p$(p_g95d) $(p_xbase) +ifneq ($(GFDL_INVARIANT_FREE),yes) + dh_installdocs -p$(p_g95d) + rm -f $(d_g95d)/$(docdir)/$(p_xbase)/copyright + cp -p html/gfortran.html $(d_g95d)/$(docdir)/$(p_xbase)/fortran/ +endif + echo $(p_g95d) >> debian/indep_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +$(binary_stamp)-libgfortran-dev: $(install_stamp) + $(call do_libgfortran_dev,) + +$(binary_stamp)-lib64gfortran-dev: $(install_stamp) + $(call do_libgfortran_dev,64) + +$(binary_stamp)-lib32gfortran-dev: $(install_stamp) + $(call do_libgfortran_dev,32) + +$(binary_stamp)-libn32gfortran-dev: $(install_stamp) + $(call do_libgfortran_dev,n32) + +$(binary_stamp)-libx32gfortran-dev: $(install_stamp) + $(call do_libgfortran_dev,x32) + +$(binary_stamp)-libhfgfortran-dev: $(install_stamp) + $(call do_libgfortran_dev,hf) + +$(binary_stamp)-libsfgfortran-dev: $(install_stamp) + $(call do_libgfortran_dev,sf) + diff --git a/debian/rules.d/binary-gcc.mk b/debian/rules.d/binary-gcc.mk new file mode 100644 index 0000000..d8982c1 --- /dev/null +++ b/debian/rules.d/binary-gcc.mk @@ -0,0 +1,322 @@ +ifneq ($(DEB_STAGE),rtlibs) + ifneq (,$(filter yes, $(biarch64) $(biarch32) $(biarchn32) $(biarchx32) $(biarchhf) $(biarchsf))) + arch_binaries := $(arch_binaries) gcc-multi + endif + ifeq ($(with_plugins),yes) + arch_binaries := $(arch_binaries) gcc-plugindev + endif + + arch_binaries := $(arch_binaries) gcc + + ifneq ($(DEB_CROSS),yes) + ifneq ($(GFDL_INVARIANT_FREE),yes) + indep_binaries := $(indep_binaries) gcc-doc + endif + ifeq ($(with_nls),yes) + indep_binaries := $(indep_binaries) gcc-locales + endif + endif + + ifeq ($(build_type),build-native) + arch_binaries := $(arch_binaries) testresults + endif +endif + +# gcc must be moved after g77 and g++ +# not all files $(PF)/include/*.h are part of gcc, +# but it becomes difficult to name all these files ... + +dirs_gcc = \ + $(docdir)/$(p_xbase)/{gcc,libssp,gomp,itm,quadmath,sanitizer} \ + $(PF)/bin \ + $(gcc_lexec_dir) \ + $(gcc_lib_dir)/include \ + $(PF)/share/man/man1 $(libgcc_dir) + +# XXX: what about triarch mapping? +files_gcc = \ + $(PF)/bin/$(cmd_prefix){gcc,gcov,gcov-tool,gcov-dump,lto-dump}$(pkg_ver) \ + $(PF)/bin/$(cmd_prefix)gcc-{ar,ranlib,nm}$(pkg_ver) \ + $(PF)/share/man/man1/$(cmd_prefix)gcc-{ar,nm,ranlib}$(pkg_ver).1 \ + $(gcc_lexec_dir)/{collect2,lto1,lto-wrapper} \ + $(shell test -e $(d)/$(gcc_lib_dir)/SYSCALLS.c.X \ + && echo $(gcc_lib_dir)/SYSCALLS.c.X) + +ifeq ($(with_libcc1_plugin),yes) + files_gcc += \ + $(gcc_lib_dir)/plugin/libc[cp]1plugin.so{,.0,.0.0.0} +endif + +files_gcc += \ + $(gcc_lexec_dir)/liblto_plugin.so + +ifeq ($(DEB_STAGE),stage1) + files_gcc += \ + $(gcc_lib_dir)/include +endif + +ifneq ($(GFDL_INVARIANT_FREE),yes) + files_gcc += \ + $(PF)/share/man/man1/$(cmd_prefix){gcc,gcov}$(pkg_ver).1 \ + $(PF)/share/man/man1/$(cmd_prefix)gcov-{dump,tool}$(pkg_ver).1 \ + $(PF)/share/man/man1/$(cmd_prefix)lto-dump$(pkg_ver).1 +endif + +usr_doc_files = debian/README.Bugs \ + $(shell test -f $(srcdir)/FAQ && echo $(srcdir)/FAQ) + +p_loc = gcc$(pkg_ver)-locales +d_loc = debian/$(p_loc) + +p_gcc_m = gcc$(pkg_ver)-multilib$(cross_bin_arch) +d_gcc_m = debian/$(p_gcc_m) + +p_pld = gcc$(pkg_ver)-plugin-dev$(cross_bin_arch) +d_pld = debian/$(p_pld) + +# ---------------------------------------------------------------------- +$(binary_stamp)-gcc: $(install_dependencies) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_gcc) + dh_installdirs -p$(p_gcc) $(dirs_gcc) + +ifeq ($(with_libssp),yes) + cp -p $(srcdir)/libssp/ChangeLog \ + $(d_gcc)/$(docdir)/$(p_xbase)/libssp/changelog +endif +ifeq ($(with_gomp),yes) + mv $(d)/$(usr_lib)/libgomp*.spec $(d_gcc)/$(gcc_lib_dir)/ + cp -p $(srcdir)/libgomp/ChangeLog \ + $(d_gcc)/$(docdir)/$(p_xbase)/gomp/changelog +endif +ifeq ($(with_itm),yes) + mv $(d)/$(usr_lib)/libitm*.spec $(d_gcc)/$(gcc_lib_dir)/ + cp -p $(srcdir)/libitm/ChangeLog \ + $(d_gcc)/$(docdir)/$(p_xbase)/itm/changelog +endif +ifeq ($(with_qmath),yes) + cp -p $(srcdir)/libquadmath/ChangeLog \ + $(d_gcc)/$(docdir)/$(p_xbase)/quadmath/changelog +endif +ifeq ($(with_asan),yes) + mv $(d)/$(usr_lib)/libsanitizer*.spec $(d_gcc)/$(gcc_lib_dir)/ + cp -p $(srcdir)/libsanitizer/ChangeLog \ + $(d_gcc)/$(docdir)/$(p_xbase)/sanitizer/changelog +endif +ifeq ($(with_hwasan),yes) + mv $(d)/$(usr_lib)/libhwasan_preinit.o $(d_gcc)/$(gcc_lib_dir)/ +endif +ifeq ($(with_cc1),yes) + rm -f $(d)/$(PF)/lib/$(DEB_HOST_MULTIARCH)/libcc1.so + dh_link -p$(p_gcc) \ + /$(PF)/lib/$(DEB_HOST_MULTIARCH)/libcc1.so.$(CC1_SONAME) \ + /$(gcc_lib_dir)/libcc1.so +endif + + $(dh_compat2) dh_movefiles -p$(p_gcc) $(files_gcc) + : # keep the lto_plugin.so link in the old place for a while + dh_link -p$(p_gcc) \ + /$(gcc_lexec_dir)/liblto_plugin.so /$(gcc_lib_dir)/liblto_plugin.so + +ifeq ($(unprefixed_names),yes) + for i in gcc gcov gcov-dump gcov-tool gcc-ar gcc-nm gcc-ranlib lto-dump; do \ + ln -sf $(cmd_prefix)$$i$(pkg_ver) \ + $(d_gcc)/$(PF)/bin/$$i$(pkg_ver); \ + done + ifneq ($(GFDL_INVARIANT_FREE),yes) + for i in gcc gcov gcov-dump gcov-tool lto-dump; do \ + ln -sf $(cmd_prefix)$$i$(pkg_ver).1.gz \ + $(d_gcc)/$(PF)/share/man/man1/$$i$(pkg_ver).1.gz; \ + done + endif + for i in gcc-ar gcc-nm gcc-ranlib; do \ + ln -sf $(cmd_prefix)$$i$(pkg_ver).1.gz \ + $(d_gcc)/$(PF)/share/man/man1/$$i$(pkg_ver).1.gz; \ + done +endif + +# dh_installdebconf + debian/dh_doclink -p$(p_gcc) $(p_xbase) + cp -p $(usr_doc_files) $(d_gcc)/$(docdir)/$(p_xbase)/. + cp -p debian/README.ssp $(d_gcc)/$(docdir)/$(p_xbase)/ + cp -p debian/NEWS.gcc $(d_gcc)/$(docdir)/$(p_xbase)/NEWS + cp -p debian/NEWS.html $(d_gcc)/$(docdir)/$(p_xbase)/NEWS.html + cp -p $(srcdir)/ChangeLog $(d_gcc)/$(docdir)/$(p_xbase)/changelog + cp -p $(srcdir)/gcc/ChangeLog \ + $(d_gcc)/$(docdir)/$(p_xbase)/gcc/changelog + if [ -f $(builddir)/gcc/.bad_compare ]; then \ + ( \ + echo "The comparision of the stage2 and stage3 object files shows differences."; \ + echo "The Debian package was modified to ignore these differences."; \ + echo ""; \ + echo "The following files differ:"; \ + echo ""; \ + cat $(builddir)/gcc/.bad_compare; \ + ) > $(d_gcc)/$(docdir)/$(p_xbase)/BOOTSTRAP_COMPARISION_FAILURE; \ + else \ + true; \ + fi + + mkdir -p $(d_gcc)/usr/share/lintian/overrides + echo '$(p_gcc) binary: hardening-no-pie' \ + > $(d_gcc)/usr/share/lintian/overrides/$(p_gcc) +ifeq ($(GFDL_INVARIANT_FREE),yes) + echo '$(p_gcc) binary: binary-without-manpage' \ + >> $(d_gcc)/usr/share/lintian/overrides/$(p_gcc) +endif + + debian/dh_rmemptydirs -p$(p_gcc) +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTONS))) + $(DWZ) \ + $(d_gcc)/$(gcc_lexec_dir)/lto1 \ + $(d_gcc)/$(gcc_lexec_dir)/lto-wrapper \ + $(d_gcc)/$(gcc_lexec_dir)/collect2 +endif + dh_strip -p$(p_gcc) \ + $(if $(unstripped_exe),-X/lto1) + dh_shlibdeps -p$(p_gcc) + echo $(p_gcc) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +# ---------------------------------------------------------------------- + +$(binary_stamp)-gcc-multi: $(install_dependencies) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_gcc_m) + dh_installdirs -p$(p_gcc_m) $(docdir) + + debian/dh_doclink -p$(p_gcc_m) $(p_xbase) + debian/dh_rmemptydirs -p$(p_gcc_m) + + dh_strip -p$(p_gcc_m) + dh_shlibdeps -p$(p_gcc_m) + echo $(p_gcc_m) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +# ---------------------------------------------------------------------- +$(binary_stamp)-gcc-plugindev: $(install_dependencies) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_pld) + dh_installdirs -p$(p_pld) \ + $(docdir) \ + $(gcc_lib_dir)/plugin + $(dh_compat2) dh_movefiles -p$(p_pld) \ + $(gcc_lib_dir)/plugin/include \ + $(gcc_lib_dir)/plugin/gtype.state \ + $(gcc_lexec_dir)/plugin/gengtype + + debian/dh_doclink -p$(p_pld) $(p_xbase) + debian/dh_rmemptydirs -p$(p_pld) + dh_strip -p$(p_pld) + dh_shlibdeps -p$(p_pld) + mkdir -p $(d_pld)/usr/share/lintian/overrides + echo '$(p_pld) binary: hardening-no-pie' \ + > $(d_pld)/usr/share/lintian/overrides/$(p_pld) + echo $(p_pld) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +# ---------------------------------------------------------------------- +$(binary_stamp)-gcc-locales: $(install_dependencies) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_loc) + dh_installdirs -p$(p_loc) \ + $(docdir) + $(dh_compat2) dh_movefiles -p$(p_loc) \ + $(PF)/share/locale/*/*/cpplib*.* \ + $(PF)/share/locale/*/*/gcc*.* + + debian/dh_doclink -p$(p_loc) $(p_xbase) + debian/dh_rmemptydirs -p$(p_loc) + echo $(p_loc) >> debian/indep_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + + +# ---------------------------------------------------------------------- + +$(binary_stamp)-testresults: $(install_dependencies) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_tst) + dh_installdirs -p$(p_tst) $(docdir) + + debian/dh_doclink -p$(p_tst) $(p_xbase) + + mkdir -p $(d_tst)/$(docdir)/$(p_xbase)/test +ifeq ($(with_check),yes) + cd $(d_tst) && tar xvf ../../installed-testlogs.tar +else + echo "Nothing to compare (testsuite not run)" + echo 'Test run disabled, reason: $(with_check)' \ + > $(d_tst)/$(docdir)/$(p_xbase)/test-run-disabled +endif + + debian/dh_rmemptydirs -p$(p_tst) + + echo $(p_tst) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +# ---------------------------------------------------------------------- +$(binary_stamp)-gcc-doc: $(build_html_stamp) $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_doc) + dh_installdirs -p$(p_doc) \ + $(docdir)/$(p_xbase) \ + $(PF)/share/info + $(dh_compat2) dh_movefiles -p$(p_doc) \ + $(PF)/share/info/cpp{,internals}-* \ + $(PF)/share/info/gcc{,int}-* \ + $(PF)/share/info/lib{gomp,itm}-* \ + $(if $(with_qmath),$(PF)/share/info/libquadmath-*) + rm -f $(d_doc)/$(PF)/share/info/gccinst* + +ifeq ($(with_gomp),yes) + $(MAKE) -C $(buildlibdir)/libgomp stamp-build-info + cp -p $(buildlibdir)/libgomp/$(cmd_prefix)libgomp$(pkg_ver).info \ + $(d_doc)/$(PF)/share/info/libgomp$(pkg_ver).info +endif +ifeq ($(with_itm),yes) + -$(MAKE) -C $(buildlibdir)/libitm stamp-build-info + if [ -f $(buildlibdir)/libitm/$(cmd_prefix)libitm$(pkg_ver).info ]; then \ + cp -p $(buildlibdir)/libitm/$(cmd_prefix)libitm$(pkg_ver).info \ + $(d_doc)/$(PF)/share/info/libitm$(pkg_ver).info; \ + fi +endif + + debian/dh_doclink -p$(p_doc) $(p_xbase) + dh_installdocs -p$(p_doc) html/gcc.html html/gccint.html +ifeq ($(with_gomp),yes) + cp -p html/libgomp.html $(d_doc)/usr/share/doc/$(p_doc)/ +endif +ifeq ($(with_itm),yes) + cp -p html/libitm.html $(d_doc)/usr/share/doc/$(p_doc)/ +endif +ifeq ($(with_qmath),yes) + cp -p html/libquadmath.html $(d_doc)/usr/share/doc/$(p_doc)/ +endif + rm -f $(d_doc)/$(docdir)/$(p_xbase)/copyright + debian/dh_rmemptydirs -p$(p_doc) + echo $(p_doc) >> debian/indep_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) diff --git a/debian/rules.d/binary-gcn.mk b/debian/rules.d/binary-gcn.mk new file mode 100644 index 0000000..3c80699 --- /dev/null +++ b/debian/rules.d/binary-gcn.mk @@ -0,0 +1,122 @@ +ifeq ($(with_offload_gcn),yes) + arch_binaries := $(arch_binaries) gcn + ifeq ($(with_common_libs),yes) + arch_binaries := $(arch_binaries) gcn-plugin + endif +endif + +p_gcn = gcc$(pkg_ver)-offload-amdgcn +d_gcn = debian/$(p_gcn) + +p_pl_gcn = libgomp-plugin-amdgcn1 +d_pl_gcn = debian/$(p_pl_gcn) + +dirs_gcn = \ + $(docdir)/$(p_xbase)/ \ + $(PF)/bin \ + $(gcc_lexec_dir)/accel + +files_gcn = \ + $(PF)/bin/$(DEB_TARGET_GNU_TYPE)-accel-$(gcn_target_name)-gcc$(pkg_ver) \ + $(gcc_lexec_dir)/accel/$(gcn_target_name) + +# not needed: libs moved, headers not needed for lto1 +# $(PF)/amdgcn-none + +# are these needed? +# $(PF)/lib/gcc/$(gcn_target_name)/$(versiondir)/{include,finclude,mgomp} + +ifneq ($(GFDL_INVARIANT_FREE),yes) + files_gcn += \ + $(PF)/share/man/man1/$(DEB_HOST_GNU_TYPE)-accel-$(gcn_target_name)-gcc$(pkg_ver).1 +endif + +$(binary_stamp)-gcn: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_gcn) + dh_installdirs -p$(p_gcn) $(dirs_gcn) + tar -c -C $(d)-gcn -f - $(files_gcn) \ + | tar -x -v -C $(d_gcn) -f - + +ifeq ($(gcn_tools_llvm_version),tools) + : # re-create the symlinks as relative symlinks + dh_link -p$(p_gcn) \ + /usr/$(gcn_target_name)/bin/ar /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ar \ + /usr/$(gcn_target_name)/bin/as /$(gcc_lexec_dir)/accel/$(gcn_target_name)/as \ + /usr/$(gcn_target_name)/bin/ld /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ld \ + /usr/$(gcn_target_name)/bin/nm /$(gcc_lexec_dir)/accel/$(gcn_target_name)/nm \ + /usr/$(gcn_target_name)/bin/ranlib /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ranlib +else + : # re-create the symlinks as relative symlinks + dh_link -p$(p_gcn) \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-ar /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ar \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-mc /$(gcc_lexec_dir)/accel/$(gcn_target_name)/as \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/lld /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ld \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-nm /$(gcc_lexec_dir)/accel/$(gcn_target_name)/nm \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-ranlib /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ranlib + + mkdir -p $(d_gcn)/usr/$(gcn_target_name)/bin + dh_link -p$(p_gcn) \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-ar /usr/$(gcn_target_name)/bin/ar \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-mc /usr/$(gcn_target_name)/bin/as \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/lld /usr/$(gcn_target_name)/bin/ld \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-nm /usr/$(gcn_target_name)/bin/nm \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-ranlib /usr/$(gcn_target_name)/bin/ranlib +endif + + mkdir -p $(d_gcn)/usr/share/lintian/overrides + ( \ + echo '$(p_gcn) binary: hardening-no-pie'; \ + echo '$(p_gcn) binary: non-standard-dir-in-usr'; \ + echo '$(p_gcn) binary: file-in-unusual-dir'; \ + echo '$(p_gcn) binary: binary-from-other-architecture'; \ + ) > $(d_gcn)/usr/share/lintian/overrides/$(p_gcn) +ifeq ($(GFDL_INVARIANT_FREE),yes) + echo '$(p_gcn) binary: binary-without-manpage' \ + >> $(d_gcn)/usr/share/lintian/overrides/$(p_gcn) +endif + + debian/dh_doclink -p$(p_gcn) $(p_xbase) + + debian/dh_rmemptydirs -p$(p_gcn) + +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTONS))) + $(DWZ) \ + $(d_gcn)/$(gcc_lexec_dir)/accel/$(gcn_target_name)/{collect2,lto1,lto-wrapper,mkoffload} +endif + dh_strip -p$(p_gcn) \ + $(if $(unstripped_exe),-X/lto1) -X/lib{c,g,m,gcc,gomp,gcov,gfortran,caf_single,ssp,ssp_nonshared}.a + dh_shlibdeps -p$(p_gcn) + echo $(p_gcn) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +# ---------------------------------------------------------------------- +$(binary_stamp)-gcn-plugin: $(install_dependencies) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_pl_gcn) + dh_installdirs -p$(p_pl_gcn) \ + $(docdir) \ + $(usr_lib) + $(dh_compat2) dh_movefiles -p$(p_pl_gcn) \ + $(usr_lib)/libgomp-plugin-gcn.so.* + + mkdir -p $(d_pl_gcn)/usr/share/lintian/overrides + ( \ + echo '$(p_pl_gcn) binary: package-name-doesnt-match-sonames'; \ + ) > $(d_pl_gcn)/usr/share/lintian/overrides/$(p_pl_gcn) + debian/dh_doclink -p$(p_pl_gcn) $(p_xbase) + debian/dh_rmemptydirs -p$(p_pl_gcn) + + dh_strip -p$(p_pl_gcn) + dh_makeshlibs -p$(p_pl_gcn) + dh_shlibdeps -p$(p_pl_gcn) + echo $(p_pl_gcn) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) diff --git a/debian/rules.d/binary-go.mk b/debian/rules.d/binary-go.mk new file mode 100644 index 0000000..29e0ea6 --- /dev/null +++ b/debian/rules.d/binary-go.mk @@ -0,0 +1,367 @@ +ifeq ($(with_libgo),yes) + $(lib_binaries) += libgo +endif +ifeq ($(with_godev),yes) + $(lib_binaries) += libgo-dev +endif +ifeq ($(with_lib64go),yes) + $(lib_binaries) += lib64go +endif +ifeq ($(with_lib64godev),yes) + $(lib_binaries) += lib64go-dev +endif +ifeq ($(with_lib32go),yes) + $(lib_binaries) += lib32go +endif +ifeq ($(with_lib32godev),yes) + $(lib_binaries) += lib32go-dev +endif +ifeq ($(with_libn32go),yes) + $(lib_binaries) += libn32go +endif +ifeq ($(with_libn32godev),yes) + $(lib_binaries) += libn32go-dev +endif +ifeq ($(with_libx32go),yes) + $(lib_binaries) += libx32go +endif +ifeq ($(with_libx32godev),yes) + $(lib_binaries) += libx32go-dev +endif + +ifneq ($(DEB_STAGE),rtlibs) + arch_binaries := $(arch_binaries) gccgo + ifneq (,$(filter yes, $(biarch64) $(biarch32) $(biarchn32) $(biarchx32))) + arch_binaries := $(arch_binaries) gccgo-multi + endif + ifneq ($(DEB_CROSS),yes) + ifneq ($(GFDL_INVARIANT_FREE),yes) + indep_binaries := $(indep_binaries) go-doc + endif + endif +endif + +p_go = gccgo$(pkg_ver)$(cross_bin_arch) +p_go_m = gccgo$(pkg_ver)-multilib$(cross_bin_arch) +p_god = gccgo$(pkg_ver)-doc +p_golib = libgo$(GO_SONAME)$(cross_lib_arch) + +d_go = debian/$(p_go) +d_go_m = debian/$(p_go_m) +d_god = debian/$(p_god) +d_golib = debian/$(p_golib) + +dirs_go = \ + $(docdir)/$(p_xbase)/go \ + $(PF)/bin \ + $(gcc_lexec_dir) \ + $(gcc_lib_dir) \ + $(PF)/include \ + $(PF)/share/man/man1 +files_go = \ + $(PF)/bin/$(cmd_prefix)gccgo$(pkg_ver) \ + $(gcc_lexec_dir)/go1 + +ifneq (,$(filter $(build_type), build-native cross-build-native)) + files_go += \ + $(PF)/bin/$(cmd_prefix){go,gofmt}$(pkg_ver) \ + $(gcc_lexec_dir)/cgo \ + $(gcc_lexec_dir)/{buildid,test2json,vet} \ + $(PF)/share/man/man1/$(cmd_prefix){go,gofmt}$(pkg_ver).1 +endif + +ifneq ($(GFDL_INVARIANT_FREE),yes) + files_go += \ + $(PF)/share/man/man1/$(cmd_prefix)gccgo$(pkg_ver).1 +endif + +ifeq ($(with_standalone_go),yes) + + dirs_go += \ + $(gcc_lib_dir)/include \ + $(PF)/share/man/man1 + +# XXX: what about triarch mapping? + files_go += \ + $(PF)/bin/$(cmd_prefix){cpp,gcc,gcov,gcov-tool}$(pkg_ver) \ + $(PF)/bin/$(cmd_prefix)gcc-{ar,ranlib,nm}$(pkg_ver) \ + $(PF)/share/man/man1/$(cmd_prefix)gcc-{ar,nm,ranlib}$(pkg_ver).1 \ + $(gcc_lexec_dir)/{cc1,collect2,lto1,lto-wrapper} \ + $(gcc_lexec_dir)/liblto_plugin.so{,.0,.0.0.0} \ + $(gcc_lib_dir)/{libgcc*,libgcov.a,*.o} \ + $(header_files) \ + $(shell test -e $(d)/$(gcc_lib_dir)/SYSCALLS.c.X \ + && echo $(gcc_lib_dir)/SYSCALLS.c.X) + + ifeq ($(with_cc1),yes) + files_go += \ + $(gcc_lib_dir)/plugin/libcc1plugin.so{,.0,.0.0.0} + endif + + ifneq ($(GFDL_INVARIANT_FREE),yes) + files_go += \ + $(PF)/share/man/man1/$(cmd_prefix){cpp,gcc,gcov,gcov-tool}$(pkg_ver).1 + endif + + ifeq ($(biarch64),yes) + files_go += $(gcc_lib_dir)/$(biarch64subdir)/{libgcc*,libgcov.a,*.o} + endif + ifeq ($(biarch32),yes) + files_go += $(gcc_lib_dir)/$(biarch32subdir)/{libgcc*,*.o} + endif + ifeq ($(biarchn32),yes) + files_go += $(gcc_lib_dir)/$(biarchn32subdir)/{libgcc*,libgcov.a,*.o} + endif + ifeq ($(biarchx32),yes) + files_go += $(gcc_lib_dir)/$(biarchx32subdir)/{libgcc*,libgcov.a,*.o} + endif +endif + +# ---------------------------------------------------------------------- +define __do_libgo + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + dh_installdirs -p$(p_l) $(usr_lib$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) \ + $(usr_lib$(2))/libgo.so.* + + debian/dh_doclink -p$(p_l) $(p_lbase) + $(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase)) + + mkdir -p debian/$(p_l)/usr/share/lintian/overrides + echo '$(p_l) binary: unstripped-binary-or-object' \ + >> debian/$(p_l)/usr/share/lintian/overrides/$(p_l) + + : # don't strip: https://gcc.gnu.org/ml/gcc-patches/2015-02/msg01722.html + : # dh_strip -p$(p_l) --dbg-package=$(p_d) + : # $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,) + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) + $(call cross_mangle_shlibs,$(p_l)) + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search, \ + $(subst go$(GO_SONAME),gcc-s$(GCC_SONAME),$(p_l)) \ + $(subst go$(GO_SONAME),atomic$(ATOMIC_SONAME),$(p_l)) \ + ,$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_l)) + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +define install_gccgo_lib + mv $(d)/$(usr_lib$(3))/$(1).a debian/$(4)/$(gcc_lib_dir$(3))/ + if [ -f $(d)/$(usr_lib$(3))/$(1)libbegin.a ]; then \ + mv $(d)/$(usr_lib$(3))/$(1)libbegin.a debian/$(4)/$(gcc_lib_dir$(3))/; \ + fi + rm -f $(d)/$(usr_lib$(3))/$(1)*.{la,so} + dh_link -p$(4) \ + /$(usr_lib$(3))/$(1).so.$(2) /$(gcc_lib_dir$(3))/$(1).so +endef + +# __do_gccgo_libgcc(flavour,package,todir,fromdir) +define __do_gccgo_libgcc + $(if $(findstring gccgo,$(PKGSOURCE)), + : # libgcc_s.so may be a linker script on some architectures + set -e; \ + if [ -h $(4)/libgcc_s.so ]; then \ + rm -f $(4)/libgcc_s.so; \ + dh_link -p$(2) /$(libgcc_dir$(1))/libgcc_s.so.$(GCC_SONAME) \ + $(3)/libgcc_s.so; \ + else \ + mv $(4)/libgcc_s.so $(d)/$(3)/libgcc_s.so; \ + dh_link -p$(2) /$(libgcc_dir$(1))/libgcc_s.so.$(GCC_SONAME) \ + $(3)/libgcc_s.so.$(GCC_SONAME); \ + fi; \ + $(if $(1), dh_link -p$(2) /$(3)/libgcc_s.so \ + $(gcc_lib_dir)/libgcc_s_$(1).so;) + ) +endef + +define __do_libgo_dev + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) + dh_installdirs -p$(p_l) \ + $(gcc_lib_dir$(2)) \ + $(usr_lib$(2)) + mv $(d)/$(usr_lib$(2))/{libgobegin,libgolibbegin}.a \ + $(d)/$(gcc_lib_dir$(2))/ + $(dh_compat2) dh_movefiles -p$(p_l) \ + $(gcc_lib_dir$(2))/{libgobegin,libgolibbegin}.a \ + $(usr_lib$(2))/go + $(call install_gccgo_lib,libgo,$(GO_SONAME),$(2),$(p_l)) + + $(if $(filter yes, $(with_standalone_go)), \ + $(call install_gccgo_lib,libgomp,$(GOMP_SONAME),$(2),$(p_l))) + $(call __do_gccgo_libgcc,$(2),$(p_l),$(gcc_lib_dir$(2)),$(d)/$(usr_lib$(2))) + + debian/dh_doclink -p$(p_l) $(p_lbase) + echo $(p_l) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +do_libgo = $(call __do_libgo,lib$(1)go$(GO_SONAME),$(1)) +do_libgo_dev = $(call __do_libgo_dev,lib$(1)go-$(BASE_VERSION)-dev,$(1)) + +# ---------------------------------------------------------------------- +$(binary_stamp)-libgo: $(install_stamp) + $(call do_libgo,) + +$(binary_stamp)-lib64go: $(install_stamp) + $(call do_libgo,64) + +$(binary_stamp)-lib32go: $(install_stamp) + $(call do_libgo,32) + +$(binary_stamp)-libn32go: $(install_stamp) + $(call do_libgo,n32) + +$(binary_stamp)-libx32go: $(install_stamp) + $(call do_libgo,x32) + +$(binary_stamp)-libgo-dev: $(install_stamp) + $(call do_libgo_dev,) + +$(binary_stamp)-lib64go-dev: $(install_stamp) + $(call do_libgo_dev,64) + +$(binary_stamp)-lib32go-dev: $(install_stamp) + $(call do_libgo_dev,32) + +$(binary_stamp)-libx32go-dev: $(install_stamp) + $(call do_libgo_dev,x32) + +$(binary_stamp)-libn32go-dev: $(install_stamp) + $(call do_libgo_dev,n32) + +# ---------------------------------------------------------------------- +$(binary_stamp)-gccgo: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_go) + dh_installdirs -p$(p_go) $(dirs_go) + + $(dh_compat2) dh_movefiles -p$(p_go) $(files_go) + +ifneq (,$(findstring gccgo,$(PKGSOURCE))) + rm -rf $(d_go)/$(gcc_lib_dir)/include/cilk + rm -rf $(d_go)/$(gcc_lib_dir)/include/openacc.h +endif + +ifeq ($(unprefixed_names),yes) + ln -sf $(cmd_prefix)gccgo$(pkg_ver) \ + $(d_go)/$(PF)/bin/gccgo$(pkg_ver) + ln -sf $(cmd_prefix)go$(pkg_ver) \ + $(d_go)/$(PF)/bin/go$(pkg_ver) + ln -sf $(cmd_prefix)gofmt$(pkg_ver) \ + $(d_go)/$(PF)/bin/gofmt$(pkg_ver) + ifneq ($(GFDL_INVARIANT_FREE),yes) + ln -sf $(cmd_prefix)gccgo$(pkg_ver).1 \ + $(d_go)/$(PF)/share/man/man1/gccgo$(pkg_ver).1 + endif + ln -sf $(cmd_prefix)go$(pkg_ver).1 \ + $(d_go)/$(PF)/share/man/man1/go$(pkg_ver).1 + ln -sf $(cmd_prefix)gofmt$(pkg_ver).1 \ + $(d_go)/$(PF)/share/man/man1/gofmt$(pkg_ver).1 +endif + +ifeq ($(with_standalone_go),yes) + ifeq ($(unprefixed_names),yes) + for i in gcc gcov gcov-tool gcc-ar gcc-nm gcc-ranlib; do \ + ln -sf $(cmd_prefix)$$i$(pkg_ver) \ + $(d_go)/$(PF)/bin/$$i$(pkg_ver); \ + done + ifneq ($(GFDL_INVARIANT_FREE),yes) + for i in gcc gcov gcov-tool gcc-ar gcc-nm gcc-ranlib; do \ + ln -sf $(cmd_prefix)gcc$(pkg_ver).1 \ + $(d_go)/$(PF)/share/man/man1/$$i$(pkg_ver).1; \ + done + endif + endif + ifeq ($(with_gomp),yes) + mv $(d)/$(usr_lib)/libgomp*.spec $(d_go)/$(gcc_lib_dir)/ + endif + ifeq ($(with_cc1),yes) + rm -f $(d)/$(usr_lib)/libcc1.so + dh_link -p$(p_go) \ + /$(usr_lib)/libcc1.so.$(CC1_SONAME) /$(gcc_lib_dir)/libcc1.so + endif +endif + + mkdir -p $(d_go)/usr/share/lintian/overrides + echo '$(p_go) binary: unstripped-binary-or-object' \ + > $(d_go)/usr/share/lintian/overrides/$(p_go) + echo '$(p_go) binary: hardening-no-pie' \ + >> $(d_go)/usr/share/lintian/overrides/$(p_go) +ifeq ($(GFDL_INVARIANT_FREE),yes) + echo '$(p_go) binary: binary-without-manpage' \ + >> $(d_go)/usr/share/lintian/overrides/$(p_go) +endif + + debian/dh_doclink -p$(p_go) $(p_xbase) + +# cp -p $(srcdir)/gcc/go/ChangeLog \ +# $(d_go)/$(docdir)/$(p_base)/go/changelog + debian/dh_rmemptydirs -p$(p_go) + +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTONS))) + $(DWZ) \ + $(d_go)/$(gcc_lexec_dir)/go1 +endif + dh_strip -v -p$(p_go) -X/cgo -X/go$(pkg_ver) -X/gofmt$(pkg_ver) \ + -X/buildid -X/test2json -X/vet $(if $(unstripped_exe),-X/go1) + dh_shlibdeps -p$(p_go) + echo $(p_go) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +# ---------------------------------------------------------------------- +$(binary_stamp)-gccgo-multi: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_go_m) + dh_installdirs -p$(p_go_m) $(docdir) + + mkdir -p $(d_go_m)/usr/share/lintian/overrides + echo '$(p_go_m) binary: non-multi-arch-lib-dir' \ + > $(d_go_m)/usr/share/lintian/overrides/$(p_go_m) + + debian/dh_doclink -p$(p_go_m) $(p_xbase) + debian/dh_rmemptydirs -p$(p_go_m) + dh_strip -p$(p_go_m) + dh_shlibdeps -p$(p_go_m) + echo $(p_go_m) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +# ---------------------------------------------------------------------- +$(binary_stamp)-go-doc: $(build_html_stamp) $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_god) + dh_installdirs -p$(p_god) \ + $(docdir)/$(p_xbase)/go \ + $(PF)/share/info + $(dh_compat2) dh_movefiles -p$(p_god) \ + $(PF)/share/info/gccgo* + + debian/dh_doclink -p$(p_god) $(p_xbase) + dh_installdocs -p$(p_god) + rm -f $(d_god)/$(docdir)/$(p_xbase)/copyright + cp -p html/gccgo.html $(d_god)/$(docdir)/$(p_xbase)/go/ + echo $(p_god) >> debian/indep_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) diff --git a/debian/rules.d/binary-hppa64.mk b/debian/rules.d/binary-hppa64.mk new file mode 100644 index 0000000..36f91f5 --- /dev/null +++ b/debian/rules.d/binary-hppa64.mk @@ -0,0 +1,39 @@ +arch_binaries := $(arch_binaries) hppa64 + +# ---------------------------------------------------------------------- +$(binary_stamp)-hppa64: $(install_hppa64_stamp) + dh_testdir + dh_testroot + +# dh_installdirs -p$(p_hppa64) + + rm -f $(d_hppa64)/usr/lib/libiberty.a + -find $(d_hppa64) ! -type d + + : # provide as and ld links + dh_link -p $(p_hppa64) \ + /usr/bin/hppa64-linux-gnu-as \ + /$(hppa64libexecdir)/gcc/hppa64-linux-gnu/$(versiondir)/as \ + /usr/bin/hppa64-linux-gnu-ld \ + /$(hppa64libexecdir)/gcc/hppa64-linux-gnu/$(versiondir)/ld + + debian/dh_doclink -p$(p_hppa64) $(p_xbase) + debian/dh_rmemptydirs -p$(p_hppa64) + +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTONS))) + $(DWZ) \ + $(d_hppa64)/$(hppa64libexecdir)/gcc/hppa64-linux-gnu/$(versiondir)/cc1 \ + $(d_hppa64)/$(hppa64libexecdir)/gcc/hppa64-linux-gnu/$(versiondir)/collect2 \ + $(d_hppa64)/$(hppa64libexecdir)/gcc/hppa64-linux-gnu/$(versiondir)/lto-wrapper \ + $(d_hppa64)/$(hppa64libexecdir)/gcc/hppa64-linux-gnu/$(versiondir)/lto1 +endif + dh_strip -p$(p_hppa64) -X.o -Xlibgcc.a -Xlibgcov.a + dh_shlibdeps -p$(p_hppa64) + + mkdir -p $(d_hppa64)/usr/share/lintian/overrides + cp -p debian/$(p_hppa64).overrides \ + $(d_hppa64)/usr/share/lintian/overrides/$(p_hppa64) + + echo $(p_hppa64) >> debian/arch_binaries + + touch $@ diff --git a/debian/rules.d/binary-libasan.mk b/debian/rules.d/binary-libasan.mk new file mode 100644 index 0000000..82c4cf5 --- /dev/null +++ b/debian/rules.d/binary-libasan.mk @@ -0,0 +1,84 @@ +$(lib_binaries) += libasan +ifeq ($(with_lib64asan),yes) + $(lib_binaries) += lib64asan +endif +ifeq ($(with_lib32asan),yes) + $(lib_binaries) += lib32asan +endif +ifeq ($(with_libn32asan),yes) + $(lib_binaries) += libn32asan +endif +ifeq ($(with_libx32asan),yes) + $(lib_binaries) += libx32asan +endif +ifeq ($(with_libhfasan),yes) + $(lib_binaries) += libhfasan +endif +ifeq ($(with_libsfasan),yes) + $(lib_binaries) += libsfasan +endif + +define __do_asan + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + dh_installdirs -p$(p_l) $(usr_lib$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) $(usr_lib$(2))/libasan.so.* + + debian/dh_doclink -p$(p_l) $(p_lbase) + $(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase)) + + if [ -f debian/$(p_l).overrides ]; then \ + mkdir -p debian/$(p_l)/usr/share/lintian/overrides; \ + cp debian/$(p_l).overrides debian/$(p_l)/usr/share/lintian/overrides/$(p_l); \ + fi + mkdir -p debian/$(p_l)/usr/share/lintian/overrides + echo "$(p_l): unstripped-binary-or-object" \ + >> debian/$(p_l)/usr/share/lintian/overrides/$(p_l) + + $(if $(2), \ + mkdir -p debian/$(p_l)/usr/share/lintian/overrides; \ + echo "$(p_l): symbols-file-contains-current-version-with-debian-revision" \ + >> debian/$(p_l)/usr/share/lintian/overrides/$(p_l)) + + $(if $(strip_sanitizer), $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,)) + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) + $(call cross_mangle_shlibs,$(p_l)) + $(if $(ignshld),$(ignshld),-)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search, \ + $(subst asan$(ASAN_SONAME),gcc-s$(GCC_SONAME),$(p_l)) \ + $(subst asan$(ASAN_SONAME),stdc++$(CXX_SONAME),$(p_l)) \ + ,$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_l)) + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +# ---------------------------------------------------------------------- + +do_asan = $(call __do_asan,lib$(1)asan$(ASAN_SONAME),$(1)) + +$(binary_stamp)-libasan: $(install_stamp) + $(call do_asan,) + +$(binary_stamp)-lib64asan: $(install_stamp) + $(call do_asan,64) + +$(binary_stamp)-lib32asan: $(install_stamp) + $(call do_asan,32) + +$(binary_stamp)-libn32asan: $(install_stamp) + $(call do_asan,n32) + +$(binary_stamp)-libx32asan: $(install_stamp) + $(call do_asan,x32) + +$(binary_stamp)-libhfasan: $(install_dependencies) + $(call do_asan,hf) + +$(binary_stamp)-libsfasan: $(install_dependencies) + $(call do_asan,sf) diff --git a/debian/rules.d/binary-libatomic.mk b/debian/rules.d/binary-libatomic.mk new file mode 100644 index 0000000..9c2b591 --- /dev/null +++ b/debian/rules.d/binary-libatomic.mk @@ -0,0 +1,68 @@ +$(lib_binaries) += libatomic +ifeq ($(with_lib64atomic),yes) + $(lib_binaries) += lib64atomic +endif +ifeq ($(with_lib32atomic),yes) + $(lib_binaries) += lib32atomic +endif +ifeq ($(with_libn32atomic),yes) + $(lib_binaries) += libn32atomic +endif +ifeq ($(with_libx32atomic),yes) + $(lib_binaries) += libx32atomic +endif +ifeq ($(with_libhfatomic),yes) + $(lib_binaries) += libhfatomic +endif +ifeq ($(with_libsfatomic),yes) + $(lib_binaries) += libsfatomic +endif + +define __do_atomic + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + dh_installdirs -p$(p_l) $(usr_lib$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) $(usr_lib$(2))/libatomic.so.* + + debian/dh_doclink -p$(p_l) $(p_lbase) + $(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase)) + + $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,) + ln -sf libatomic.symbols debian/$(p_l).symbols + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) + $(call cross_mangle_shlibs,$(p_l)) + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search,,$(2)) + $(call cross_mangle_substvars,$(p_l)) + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +# ---------------------------------------------------------------------- + +do_atomic = $(call __do_atomic,lib$(1)atomic$(ATOMIC_SONAME),$(1)) + +$(binary_stamp)-libatomic: $(install_stamp) + $(call do_atomic,) + +$(binary_stamp)-lib64atomic: $(install_stamp) + $(call do_atomic,64) + +$(binary_stamp)-lib32atomic: $(install_stamp) + $(call do_atomic,32) + +$(binary_stamp)-libn32atomic: $(install_stamp) + $(call do_atomic,n32) + +$(binary_stamp)-libx32atomic: $(install_stamp) + $(call do_atomic,x32) + +$(binary_stamp)-libhfatomic: $(install_dependencies) + $(call do_atomic,hf) + +$(binary_stamp)-libsfatomic: $(install_dependencies) + $(call do_atomic,sf) diff --git a/debian/rules.d/binary-libcc1.mk b/debian/rules.d/binary-libcc1.mk new file mode 100644 index 0000000..1dba145 --- /dev/null +++ b/debian/rules.d/binary-libcc1.mk @@ -0,0 +1,31 @@ +ifeq ($(with_libcc1),yes) + ifneq ($(DEB_CROSS),yes) + arch_binaries := $(arch_binaries) libcc1 + endif +endif + +p_cc1 = libcc1-$(CC1_SONAME) +d_cc1 = debian/$(p_cc1) + +# ---------------------------------------------------------------------- +$(binary_stamp)-libcc1: $(install_dependencies) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_cc1) + dh_installdirs -p$(p_cc1) \ + $(docdir) \ + $(usr_lib) + $(dh_compat2) dh_movefiles -p$(p_cc1) \ + $(usr_lib)/libcc1.so.* + + debian/dh_doclink -p$(p_cc1) $(p_xbase) + debian/dh_rmemptydirs -p$(p_cc1) + + dh_strip -p$(p_cc1) + dh_makeshlibs -p$(p_cc1) + dh_shlibdeps -p$(p_cc1) + echo $(p_cc1) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) diff --git a/debian/rules.d/binary-libgcc.mk b/debian/rules.d/binary-libgcc.mk new file mode 100644 index 0000000..836e553 --- /dev/null +++ b/debian/rules.d/binary-libgcc.mk @@ -0,0 +1,357 @@ +ifeq ($(with_libgcc),yes) + $(lib_binaries) += libgcc +endif +ifeq ($(with_lib64gcc),yes) + $(lib_binaries) += lib64gcc +endif +ifeq ($(with_lib32gcc),yes) + $(lib_binaries) += lib32gcc +endif +ifeq ($(with_libn32gcc),yes) + $(lib_binaries) += libn32gcc +endif +ifeq ($(with_libx32gcc),yes) + $(lib_binaries) += libx32gcc +endif +ifeq ($(with_libhfgcc),yes) + $(lib_binaries) += libhfgcc +endif +ifeq ($(with_libsfgcc),yes) + $(lib_binaries) += libsfgcc +endif + +ifneq ($(DEB_STAGE),rtlibs) + ifeq ($(with_cdev),yes) + $(lib_binaries) += libgcc-dev + endif + ifeq ($(with_lib64gccdev),yes) + $(lib_binaries) += lib64gcc-dev + endif + ifeq ($(with_lib32gccdev),yes) + $(lib_binaries) += lib32gcc-dev + endif + ifeq ($(with_libn32gccdev),yes) + $(lib_binaries) += libn32gcc-dev + endif + ifeq ($(with_libx32gccdev),yes) + $(lib_binaries) += libx32gcc-dev + endif + ifeq ($(with_libhfgccdev),yes) + $(lib_binaries) += libhfgcc-dev + endif + ifeq ($(with_libsfgccdev),yes) + $(lib_binaries) += libsfgcc-dev + endif +endif + +p_lgcc = libgcc-s$(GCC_SONAME)$(cross_lib_arch) +p_lgccdbg = libgcc-s$(GCC_SONAME)-dbg$(cross_lib_arch) +p_lgccdev = libgcc-$(BASE_VERSION)-dev$(cross_lib_arch) +d_lgcc = debian/$(p_lgcc) +d_lgccdbg = debian/$(p_lgccdbg) +d_lgccdev = debian/$(p_lgccdev) + +p_l32gcc = lib32gcc-s$(GCC_SONAME)$(cross_lib_arch) +p_l32gccdbg = lib32gcc-s$(GCC_SONAME)-dbg$(cross_lib_arch) +p_l32gccdev = lib32gcc-$(BASE_VERSION)-dev$(cross_lib_arch) +d_l32gcc = debian/$(p_l32gcc) +d_l32gccdbg = debian/$(p_l32gccdbg) +d_l32gccdev = debian/$(p_l32gccdev) + +p_l64gcc = lib64gcc-s$(GCC_SONAME)$(cross_lib_arch) +p_l64gccdbg = lib64gcc-s$(GCC_SONAME)-dbg$(cross_lib_arch) +p_l64gccdev = lib64gcc-$(BASE_VERSION)-dev$(cross_lib_arch) +d_l64gcc = debian/$(p_l64gcc) +d_l64gccdbg = debian/$(p_l64gccdbg) +d_l64gccdev = debian/$(p_l64gccdev) + +p_ln32gcc = libn32gcc-s$(GCC_SONAME)$(cross_lib_arch) +p_ln32gccdbg = libn32gcc-s$(GCC_SONAME)-dbg$(cross_lib_arch) +p_ln32gccdev = libn32gcc-$(BASE_VERSION)-dev$(cross_lib_arch) +d_ln32gcc = debian/$(p_ln32gcc) +d_ln32gccdbg = debian/$(p_ln32gccdbg) +d_ln32gccdev = debian/$(p_ln32gccdev) + +p_lx32gcc = libx32gcc-s$(GCC_SONAME)$(cross_lib_arch) +p_lx32gccdbg = libx32gcc-s$(GCC_SONAME)-dbg$(cross_lib_arch) +p_lx32gccdev = libx32gcc-$(BASE_VERSION)-dev$(cross_lib_arch) +d_lx32gcc = debian/$(p_lx32gcc) +d_lx32gccdbg = debian/$(p_lx32gccdbg) +d_lx32gccdev = debian/$(p_lx32gccdev) + +p_lhfgcc = libhfgcc-s$(GCC_SONAME)$(cross_lib_arch) +p_lhfgccdbg = libhfgcc-s$(GCC_SONAME)-dbg$(cross_lib_arch) +p_lhfgccdev = libhfgcc-$(BASE_VERSION)-dev$(cross_lib_arch) +d_lhfgcc = debian/$(p_lhfgcc) +d_lhfgccdbg = debian/$(p_lhfgccdbg) +d_lhfgccdev = debian/$(p_lhfgccdev) + +p_lsfgcc = libsfgcc-s$(GCC_SONAME)$(cross_lib_arch) +p_lsfgccdbg = libsfgcc-s$(GCC_SONAME)-dbg$(cross_lib_arch) +p_lsfgccdev = libsfgcc-$(BASE_VERSION)-dev$(cross_lib_arch) +d_lsfgcc = debian/$(p_lsfgcc) +d_lsfgccdbg = debian/$(p_lsfgccdbg) +d_lsfgccdev = debian/$(p_lsfgccdev) + +# __do_gcc_devels(flavour,package,todir,fromdir) +define __do_gcc_devels + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + test -n "$(2)" + rm -rf debian/$(2) + dh_installdirs -p$(2) $(docdir) #TODO + dh_installdirs -p$(2) $(3) + + $(call __do_gcc_devels2,$(1),$(2),$(3),$(4)) + + debian/dh_doclink -p$(2) $(p_lbase) + debian/dh_rmemptydirs -p$(2) + + dh_strip -p$(2) + $(cross_shlibdeps) dh_shlibdeps -p$(2) + $(call cross_mangle_substvars,$(2)) + echo $(2) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +# __do_gcc_devels2(flavour,package,todir,fromdir) +define __do_gcc_devels2 +# stage1 builds static libgcc only + $(if $(filter $(DEB_STAGE),stage1),, + : # libgcc_s.so may be a linker script on some architectures + set -e; \ + if [ -h $(4)/libgcc_s.so ]; then \ + rm -f $(4)/libgcc_s.so; \ + rm -f $(d)/$(3)/libgcc_s.so; \ + ( \ + echo '/* GNU ld script'; \ + echo ' Use a trivial linker script instead of a symlink. */'; \ + echo 'GROUP ( libgcc_s.so.$(GCC_SONAME) )'; \ + ) > $(d)/$(3)/libgcc_s.so; \ + else \ + mv $(4)/libgcc_s.so $(d)/$(3)/libgcc_s.so; \ + fi; \ + ) + $(dh_compat2) dh_movefiles -p$(2) \ + $(3)/{libgcc*,libgcov.a,*.o} \ + $(if $(1),,$(gcc_lib_dir)/include/*.h $(gcc_lib_dir)/include/sanitizer/*.h) # Only move headers for the "main" package + $(if $(1),, for h in ISO_Fortran_binding.h libgccjit.h libgccjit++.h; do \ + if [ -f debian/$(2)/$(gcc_lib_dir)/include/$$h ]; then \ + mv debian/$(2)/$(gcc_lib_dir)/include/$$h $(d)/$(gcc_lib_dir)/include/.; \ + fi; done) + + : # libbacktrace not installed by default + $(if $(filter yes, $(with_backtrace)), + if [ -f $(buildlibdir)/$(1)/libbacktrace/.libs/libbacktrace.a ]; then \ + install -m644 $(buildlibdir)/$(1)/libbacktrace/.libs/libbacktrace.a \ + debian/$(2)/$(gcc_lib_dir)/$(1); \ + fi; \ + $(if $(1),, + if [ -f $(buildlibdir)/libbacktrace/backtrace-supported.h ]; then \ + install -m644 $(buildlibdir)/libbacktrace/backtrace-supported.h \ + debian/$(2)/$(gcc_lib_dir)/include/; \ + install -m644 $(srcdir)/libbacktrace/backtrace.h \ + debian/$(2)/$(gcc_lib_dir)/include/; \ + fi + )) + + : # If building a flavour, add a lintian override + $(if $(1), + #TODO: use a file instead of a hacky echo + # but do we want to use one override file (in the source package) per + # flavour or not since they are essentially the same? + mkdir -p debian/$(2)/usr/share/lintian/overrides + echo "$(2) binary: binary-from-other-architecture" \ + >> debian/$(2)/usr/share/lintian/overrides/$(2) + ) + $(if $(filter yes, $(with_lib$(1)gmath)), + $(call install_gcc_lib,libgcc-math,$(GCC_SONAME),$(1),$(2)) + ) + $(if $(filter yes, $(with_libssp)), + $(call install_gcc_lib,libssp,$(SSP_SONAME),$(1),$(2)) + ) + $(if $(filter yes, $(with_ssp)), + mv $(4)/libssp_nonshared.a debian/$(2)/$(3)/; + ) + $(if $(filter yes, $(with_gomp)), + $(call install_gcc_lib,libgomp,$(GOMP_SONAME),$(1),$(2)) + ) + $(if $(filter yes, $(with_itm)), + $(call install_gcc_lib,libitm,$(ITM_SONAME),$(1),$(2)) + ) + $(if $(filter yes, $(with_atomic)), + $(call install_gcc_lib,libatomic,$(ATOMIC_SONAME),$(1),$(2)) + ) + $(if $(filter yes, $(with_asan)), + $(call install_gcc_lib,libasan,$(ASAN_SONAME),$(1),$(2)) + mv $(4)/libasan_preinit.o debian/$(2)/$(3)/; + ) + $(if $(1),,$(if $(filter yes, $(with_lsan)), + $(call install_gcc_lib,liblsan,$(LSAN_SONAME),$(1),$(2)) + mv $(4)/liblsan_preinit.o debian/$(2)/$(3)/; + )) + $(if $(1),,$(if $(filter yes, $(with_tsan)), + $(call install_gcc_lib,libtsan,$(TSAN_SONAME),$(1),$(2)) + mv $(4)/libtsan_preinit.o debian/$(2)/$(3)/; + )) + $(if $(filter yes, $(with_ubsan)), + $(call install_gcc_lib,libubsan,$(UBSAN_SONAME),$(1),$(2)) + ) + $(if $(1),,$(if $(filter yes, $(with_hwasan)), + $(call install_gcc_lib,libhwasan,$(HWASAN_SONAME),$(1),$(2)) + )) + $(if $(filter yes, $(with_vtv)), + $(call install_gcc_lib,libvtv,$(VTV_SONAME),$(1),$(2)) + ) + $(if $(filter yes, $(with_cilkrts)), + $(call install_gcc_lib,libcilkrts,$(CILKRTS_SONAME),$(1),$(2)) + ) + $(if $(filter yes, $(with_qmath)), + $(call install_gcc_lib,libquadmath,$(QUADMATH_SONAME),$(1),$(2)) + ) +endef + +# do_gcc_devels(flavour) +define do_gcc_devels + $(call __do_gcc_devels,$(1),$(p_l$(1)gccdev),$(gcc_lib_dir$(1)),$(d)/$(usr_lib$(1))) +endef + + +define __do_libgcc + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + + dh_installdirs -p$(p_l) \ + $(docdir)/$(p_l) \ + $(libgcc_dir$(2)) + + $(if $(filter yes,$(with_shared_libgcc)), + mv $(d)/$(usr_lib$(2))/libgcc_s.so.$(GCC_SONAME) \ + $(d_l)/$(libgcc_dir$(2))/. + ) + + $(if $(filter yes, $(with_internal_libunwind)), + mv $(d)/$(usr_lib$(2))/libunwind.* \ + $(d_l)/$(libgcc_dir$(2))/. + ) + + debian/dh_doclink -p$(p_l) $(if $(3),$(3),$(p_lbase)) + debian/dh_rmemptydirs -p$(p_l) + $(if $(with_dbg), + debian/dh_doclink -p$(p_d) $(if $(3),$(3),$(p_lbase)) + debian/dh_rmemptydirs -p$(p_d) + ) + $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,) + + # see Debian #533843 for the __aeabi symbol handling; this construct is + # just to include the symbols for dpkg versions older than 1.15.3 which + # didn't allow bypassing the symbol blacklist + $(if $(filter yes,$(with_shared_libgcc)), + $(if $(findstring gcc-s1,$(p_l)), \ + ln -sf libgcc-s.symbols debian/$(p_l).symbols \ + ) + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) \ + -- -v$(DEB_LIBGCC_VERSION) -a$(call mlib_to_arch,$(2)) || echo XXXXXXXXXXXXXX ERROR $(p_l) + $(call cross_mangle_shlibs,$(p_l)) + $(if $(filter arm-linux-gnueabi%,$(DEB_TARGET_GNU_TYPE)), + if head -1 $(d_l)/DEBIAN/symbols 2>/dev/null | grep -q '^lib'; then \ + grep -q '^ __aeabi' $(d_l)/DEBIAN/symbols \ + || cat debian/libgcc.symbols.aeabi \ + >> $(d_l)/DEBIAN/symbols; \ + fi + ) + ) + + $(if $(DEB_STAGE),, + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search,,$(2)) + ) + $(call cross_mangle_substvars,$(p_l)) + + $(if $(2),, # only for native + mkdir -p $(d_l)/usr/share/lintian/overrides + echo '$(p_l): package-name-doesnt-match-sonames' \ + > $(d_l)/usr/share/lintian/overrides/$(p_l) + ) + + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + $(if $(filter yes,$(with_libcompatgcc)), + debian/dh_doclink -p$(subst gcc-s,gcc,$(p_l)) $(if $(3),$(3),$(p_lbase)) + $(if $(with_dbg), + debian/dh_doclink -p$(subst gcc-s,gcc,$(p_d)) $(if $(3),$(3),$(p_lbase)) + ) + + $(if $(2),, + mkdir -p $(subst gcc-s,gcc,$(d_l))/$(libgcc_dir$(2)) + cp -p $(d_l)/$(libgcc_dir$(2))/libgcc_s.so.$(GCC_SONAME) \ + $(subst gcc-s,gcc,$(d_l))/lib/. + mkdir -p $(subst gcc-s,gcc,$(d_l))/DEBIAN + cp -p $(d_l)/DEBIAN/{symbols,shlibs} \ + $(subst gcc-s,gcc,$(d_l))/DEBIAN/. + cp -p $(d_l).substvars $(subst gcc-s,gcc,$(d_l)).substvars + mkdir -p $(subst gcc-s,gcc,$(d_l))/usr/share/lintian/overrides + ( \ + echo '$(subst gcc-s,gcc,$(p_l)): package-name-doesnt-match-sonames'; \ + echo '$(subst gcc-s,gcc,$(p_l)): shlibs-declares-dependency-on-other-package'; \ + echo '$(subst gcc-s,gcc,$(p_l)): symbols-declares-dependency-on-other-package'; \ + ) > $(subst gcc-s,gcc,$(d_l))/usr/share/lintian/overrides/$(subst gcc-s,gcc,$(p_l)) + ) + + echo $(subst gcc-s,gcc,$(p_l) $(if $(with_dbg), $(p_d))) >> debian/$(lib_binaries).epoch + ) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +do_libgcc = $(call __do_libgcc,lib$(1)gcc-s$(GCC_SONAME),$(1),$(2)) +# ---------------------------------------------------------------------- + +$(binary_stamp)-libgcc: $(install_dependencies) + $(call do_libgcc,,) + +$(binary_stamp)-lib64gcc: $(install_dependencies) + $(call do_libgcc,64,) + +$(binary_stamp)-lib32gcc: $(install_dependencies) + $(call do_libgcc,32,) + +$(binary_stamp)-libn32gcc: $(install_dependencies) + $(call do_libgcc,n32,) + +$(binary_stamp)-libx32gcc: $(install_dependencies) + $(call do_libgcc,x32,) + +$(binary_stamp)-libhfgcc: $(install_dependencies) + $(call do_libgcc,hf) + +$(binary_stamp)-libsfgcc: $(install_dependencies) + $(call do_libgcc,sf) + +$(binary_stamp)-libgcc-dev: $(install_dependencies) + $(call do_gcc_devels,) + +$(binary_stamp)-lib64gcc-dev: $(install_dependencies) + $(call do_gcc_devels,64) + +$(binary_stamp)-lib32gcc-dev: $(install_dependencies) + $(call do_gcc_devels,32) + +$(binary_stamp)-libn32gcc-dev: $(install_dependencies) + $(call do_gcc_devels,n32) + +$(binary_stamp)-libx32gcc-dev: $(install_dependencies) + $(call do_gcc_devels,x32) + +$(binary_stamp)-libhfgcc-dev: $(install_dependencies) + $(call do_gcc_devels,hf) + +$(binary_stamp)-libsfgcc-dev: $(install_dependencies) + $(call do_gcc_devels,sf) + diff --git a/debian/rules.d/binary-libgccjit.mk b/debian/rules.d/binary-libgccjit.mk new file mode 100644 index 0000000..9441a49 --- /dev/null +++ b/debian/rules.d/binary-libgccjit.mk @@ -0,0 +1,95 @@ +ifeq ($(with_libgccjit),yes) + $(lib_binaries) += libgccjit +endif + +$(lib_binaries) += libgccjitdev + +ifneq ($(DEB_CROSS),yes) + indep_binaries := $(indep_binaries) libgccjitdoc +endif + +p_jitlib = libgccjit$(GCCJIT_SONAME) +p_jitdbg = libgccjit$(GCCJIT_SONAME)-dbg +p_jitdev = libgccjit$(pkg_ver)-dev +p_jitdoc = libgccjit$(pkg_ver)-doc + +d_jitlib = debian/$(p_jitlib) +d_jitdev = debian/$(p_jitdev) +d_jitdbg = debian/$(p_jitdbg) +d_jitdoc = debian/$(p_jitdoc) + +$(binary_stamp)-libgccjit: $(install_jit_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_jitlib) $(d_jitdbg) + dh_installdirs -p$(p_jitlib) \ + $(usr_lib) +ifeq ($(with_dbg),yes) + dh_installdirs -p$(p_jitdbg) +endif + + $(dh_compat2) dh_movefiles -p$(p_jitlib) \ + $(usr_lib)/libgccjit.so.* + rm -f $(d)/$(usr_lib)/libgccjit.so + + debian/dh_doclink -p$(p_jitlib) $(p_base) +ifeq ($(with_dbg),yes) + debian/dh_doclink -p$(p_jitdbg) $(p_base) +endif + + $(call do_strip_lib_dbg, $(p_jitlib), $(p_jitdbg), $(v_dbg),,) + $(cross_makeshlibs) dh_makeshlibs -p$(p_jitlib) + $(call cross_mangle_shlibs,$(p_jitlib)) + $(ignshld)$(cross_shlibdeps) dh_shlibdeps -p$(p_jitlib) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_jitlib)) + echo $(p_jitlib) $(if $(with_dbg), $(p_jitdbg)) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + touch $@ + +$(binary_stamp)-libgccjitdev: $(install_jit_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_jitdev) + dh_installdirs -p$(p_jitdev) \ + $(usr_lib) \ + $(gcc_lib_dir)/include + + rm -f $(d)/$(usr_lib)/libgccjit.so + + $(dh_compat2) dh_movefiles -p$(p_jitdev) \ + $(gcc_lib_dir)/include/libgccjit*.h + dh_link -p$(p_jitdev) \ + $(usr_lib)/libgccjit.so.$(GCCJIT_SONAME) $(gcc_lib_dir)/libgccjit.so + + debian/dh_doclink -p$(p_jitdev) $(p_base) + + echo $(p_jitdev) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + touch $@ + +$(binary_stamp)-libgccjitdoc: $(install_jit_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_jitdoc) + dh_installdirs -p$(p_jitdoc) \ + $(PF)/share/info/libgccjit-figures + + $(dh_compat2) dh_movefiles -p$(p_jitdoc) \ + $(PF)/share/info/libgccjit* + cp -p $(srcdir)/gcc/jit/docs/_build/texinfo/libgccjit-figures/*.png \ + $(d_jitdoc)/$(PF)/share/info/libgccjit-figures/. + + debian/dh_doclink -p$(p_jitdoc) $(p_base) + echo $(p_jitdoc) >> debian/indep_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + touch $@ diff --git a/debian/rules.d/binary-libgomp.mk b/debian/rules.d/binary-libgomp.mk new file mode 100644 index 0000000..1a86ae2 --- /dev/null +++ b/debian/rules.d/binary-libgomp.mk @@ -0,0 +1,69 @@ +$(lib_binaries) += libgomp +ifeq ($(with_lib64gomp),yes) + $(lib_binaries) += lib64gomp +endif +ifeq ($(with_lib32gomp),yes) + $(lib_binaries) += lib32gomp +endif +ifeq ($(with_libn32gomp),yes) + $(lib_binaries) += libn32gomp +endif +ifeq ($(with_libx32gomp),yes) + $(lib_binaries) += libx32gomp +endif +ifeq ($(with_libhfgomp),yes) + $(lib_binaries) += libhfgomp +endif +ifeq ($(with_libsfgomp),yes) + $(lib_binaries) += libsfgomp +endif + +define __do_gomp + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + dh_installdirs -p$(p_l) $(usr_lib$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) $(usr_lib$(2))/libgomp.so.* + + debian/dh_doclink -p$(p_l) $(p_lbase) + $(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase)) + + $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,) + ln -sf libgomp.symbols debian/$(p_l).symbols + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) + $(call cross_mangle_shlibs,$(p_l)) + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search,$(subst gomp$(GOMP_SONAME),gcc-s$(GCC_SONAME),$(p_l)),$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_l)) + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +# ---------------------------------------------------------------------- + +do_gomp = $(call __do_gomp,lib$(1)gomp$(GOMP_SONAME),$(1)) + +$(binary_stamp)-libgomp: $(install_stamp) + $(call do_gomp,) + +$(binary_stamp)-lib64gomp: $(install_stamp) + $(call do_gomp,64) + +$(binary_stamp)-lib32gomp: $(install_stamp) + $(call do_gomp,32) + +$(binary_stamp)-libn32gomp: $(install_stamp) + $(call do_gomp,n32) + +$(binary_stamp)-libx32gomp: $(install_stamp) + $(call do_gomp,x32) + +$(binary_stamp)-libhfgomp: $(install_dependencies) + $(call do_gomp,hf) + +$(binary_stamp)-libsfgomp: $(install_dependencies) + $(call do_gomp,sf) diff --git a/debian/rules.d/binary-libhwasan.mk b/debian/rules.d/binary-libhwasan.mk new file mode 100644 index 0000000..f9475f4 --- /dev/null +++ b/debian/rules.d/binary-libhwasan.mk @@ -0,0 +1,83 @@ +$(lib_binaries) += libhwasan +ifeq ($(with_lib64hwasan),yes) + $(lib_binaries) += lib64hwasan +endif +ifeq ($(with_lib32hwasan),yes) + $(lib_binaries) += lib32hwasan +endif +ifeq ($(with_libn32hwasan),yes) + $(lib_binaries) += libn32hwasan +endif +ifeq ($(with_libx32hwasan),yes) + $(lib_binaries) += libx32hwasan +endif +ifeq ($(with_libhfhwasan),yes) + $(lib_binaries) += libhfhwasan +endif +ifeq ($(with_libsfhwasan),yes) + $(lib_binaries) += libsfhwasan +endif + +define __do_hwasan + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + dh_installdirs -p$(p_l) $(usr_lib$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) $(usr_lib$(2))/libhwasan.so.* + + debian/dh_doclink -p$(p_l) $(p_lbase) + $(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase)) + + if [ -f debian/$(p_l).overrides ]; then \ + mkdir -p debian/$(p_l)/usr/share/lintian/overrides; \ + cp debian/$(p_l).overrides debian/$(p_l)/usr/share/lintian/overrides/$(p_l); \ + fi + mkdir -p debian/$(p_l)/usr/share/lintian/overrides + echo "$(p_l): unstripped-binary-or-object" \ + >> debian/$(p_l)/usr/share/lintian/overrides/$(p_l) + $(if $(2), \ + mkdir -p debian/$(p_l)/usr/share/lintian/overrides; \ + echo "$(p_l): symbols-file-contains-current-version-with-debian-revision" \ + >> debian/$(p_l)/usr/share/lintian/overrides/$(p_l)) + + $(if $(strip_sanitizer), $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,)) + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) + $(call cross_mangle_shlibs,$(p_l)) + $(if $(ignshld),$(ignshld),-)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search, \ + $(subst hwasan$(HWASAN_SONAME),gcc-s$(GCC_SONAME),$(p_l)) \ + $(subst hwasan$(HWASAN_SONAME),stdc++$(CXX_SONAME),$(p_l)) \ + ,$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_l)) + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +# ---------------------------------------------------------------------- + +do_hwasan = $(call __do_hwasan,lib$(1)hwasan$(HWASAN_SONAME),$(1)) + +$(binary_stamp)-libhwasan: $(install_stamp) + $(call do_hwasan,) + +$(binary_stamp)-lib64hwasan: $(install_stamp) + $(call do_hwasan,64) + +$(binary_stamp)-lib32hwasan: $(install_stamp) + $(call do_hwasan,32) + +$(binary_stamp)-libn32hwasan: $(install_stamp) + $(call do_hwasan,n32) + +$(binary_stamp)-libx32hwasan: $(install_stamp) + $(call do_hwasan,x32) + +$(binary_stamp)-libhfhwasan: $(install_dependencies) + $(call do_hwasan,hf) + +$(binary_stamp)-libsfhwasan: $(install_dependencies) + $(call do_hwasan,sf) diff --git a/debian/rules.d/binary-libitm.mk b/debian/rules.d/binary-libitm.mk new file mode 100644 index 0000000..a618647 --- /dev/null +++ b/debian/rules.d/binary-libitm.mk @@ -0,0 +1,69 @@ +$(lib_binaries) += libitm +ifeq ($(with_lib64itm),yes) + $(lib_binaries) += lib64itm +endif +ifeq ($(with_lib32itm),yes) + $(lib_binaries) += lib32itm +endif +ifeq ($(with_libn32itm),yes) + $(lib_binaries) += libn32itm +endif +ifeq ($(with_libx32itm),yes) + $(lib_binaries) += libx32itm +endif +ifeq ($(with_libhfitm),yes) + $(lib_binaries) += libhfitm +endif +ifeq ($(with_libsfitm),yes) + $(lib_binaries) += libsfitm +endif + +define __do_itm + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + dh_installdirs -p$(p_l) $(usr_lib$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) $(usr_lib$(2))/libitm.so.* + + debian/dh_doclink -p$(p_l) $(p_lbase) + $(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase)) + + $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,) + ln -sf libitm.symbols debian/$(p_l).symbols + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) + $(call cross_mangle_shlibs,$(p_l)) + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search,,$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_l)) + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +# ---------------------------------------------------------------------- + +do_itm = $(call __do_itm,lib$(1)itm$(ITM_SONAME),$(1)) + +$(binary_stamp)-libitm: $(install_stamp) + $(call do_itm,) + +$(binary_stamp)-lib64itm: $(install_stamp) + $(call do_itm,64) + +$(binary_stamp)-lib32itm: $(install_stamp) + $(call do_itm,32) + +$(binary_stamp)-libn32itm: $(install_stamp) + $(call do_itm,n32) + +$(binary_stamp)-libx32itm: $(install_stamp) + $(call do_itm,x32) + +$(binary_stamp)-libhfitm: $(install_dependencies) + $(call do_itm,hf) + +$(binary_stamp)-libsfitm: $(install_dependencies) + $(call do_itm,sf) diff --git a/debian/rules.d/binary-liblsan.mk b/debian/rules.d/binary-liblsan.mk new file mode 100644 index 0000000..a4b3e64 --- /dev/null +++ b/debian/rules.d/binary-liblsan.mk @@ -0,0 +1,79 @@ +$(lib_binaries) += liblsan +ifeq ($(with_lib64lsan),yes) + $(lib_binaries) += lib64lsan +endif +ifeq ($(with_lib32lsan),yes) + $(lib_binaries) += lib32lsan +endif +ifeq ($(with_libn32lsan),yes) + $(lib_binaries) += libn32lsan +endif +ifeq ($(with_libx32lsan),yes) + $(lib_binaries) += libx32lsan +endif +ifeq ($(with_libhflsan),yes) + $(lib_binaries) += libhflsan +endif +ifeq ($(with_libsflsan),yes) + $(lib_binaries) += libsflsan +endif + +define __do_lsan + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + dh_installdirs -p$(p_l) $(usr_lib$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) $(usr_lib$(2))/liblsan.so.* + + debian/dh_doclink -p$(p_l) $(p_lbase) + $(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase)) + + if [ -f debian/$(p_l).overrides ]; then \ + mkdir -p debian/$(p_l)/usr/share/lintian/overrides; \ + cp debian/$(p_l).overrides debian/$(p_l)/usr/share/lintian/overrides/$(p_l); \ + fi + mkdir -p debian/$(p_l)/usr/share/lintian/overrides + echo "$(p_l): unstripped-binary-or-object" \ + >> debian/$(p_l)/usr/share/lintian/overrides/$(p_l) + + $(if $(strip_sanitizer), $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,)) + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) + $(call cross_mangle_shlibs,$(p_l)) + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search, \ + $(subst lsan$(LSAN_SONAME),gcc-s$(GCC_SONAME),$(p_l)) \ + $(subst lsan$(LSAN_SONAME),stdc++$(CXX_SONAME),$(p_l)) \ + ,$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_l)) + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +# ---------------------------------------------------------------------- + +do_lsan = $(call __do_lsan,lib$(1)lsan$(LSAN_SONAME),$(1)) + +$(binary_stamp)-liblsan: $(install_stamp) + $(call do_lsan,) + +$(binary_stamp)-lib64lsan: $(install_stamp) + $(call do_lsan,64) + +$(binary_stamp)-lib32lsan: $(install_stamp) + $(call do_lsan,32) + +$(binary_stamp)-libn32lsan: $(install_stamp) + $(call do_lsan,n32) + +$(binary_stamp)-libx32lsan: $(install_stamp) + $(call do_lsan,x32) + +$(binary_stamp)-libhflsan: $(install_dependencies) + $(call do_lsan,hf) + +$(binary_stamp)-libsflsan: $(install_dependencies) + $(call do_lsan,sf) diff --git a/debian/rules.d/binary-libobjc.mk b/debian/rules.d/binary-libobjc.mk new file mode 100644 index 0000000..c270d83 --- /dev/null +++ b/debian/rules.d/binary-libobjc.mk @@ -0,0 +1,162 @@ +ifeq ($(with_libobjc),yes) + $(lib_binaries) += libobjc +endif +ifeq ($(with_objcdev),yes) + $(lib_binaries) += libobjc-dev +endif +ifeq ($(with_lib64objc),yes) + $(lib_binaries) += lib64objc +endif +ifeq ($(with_lib64objcdev),yes) + $(lib_binaries) += lib64objc-dev +endif +ifeq ($(with_lib32objc),yes) + $(lib_binaries) += lib32objc +endif +ifeq ($(with_lib32objcdev),yes) + $(lib_binaries) += lib32objc-dev +endif +ifeq ($(with_libn32objc),yes) + $(lib_binaries) += libn32objc +endif +ifeq ($(with_libn32objcdev),yes) + $(lib_binaries) += libn32objc-dev +endif +ifeq ($(with_libx32objc),yes) + $(lib_binaries) += libx32objc +endif +ifeq ($(with_libx32objcdev),yes) + $(lib_binaries) += libx32objc-dev +endif +ifeq ($(with_libhfobjc),yes) + $(lib_binaries) += libhfobjc +endif +ifeq ($(with_libhfobjcdev),yes) + $(lib_binaries) += libhfobjc-dev +endif +ifeq ($(with_libsfobjc),yes) + $(lib_binaries) += libsfobjc +endif +ifeq ($(with_libsfobjcdev),yes) + $(lib_binaries) += libsfobjc-dev +endif + +files_lobjcdev= \ + $(gcc_lib_dir)/include/objc + +files_lobjc = \ + $(usr_lib$(2))/libobjc.so.* +ifeq ($(with_objc_gc),yes) + files_lobjc += \ + $(usr_lib$(2))/libobjc_gc.so.* +endif + +define __do_libobjc + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + dh_installdirs -p$(p_l) \ + $(usr_lib$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) \ + $(files_lobjc) + + debian/dh_doclink -p$(p_l) $(p_lbase) + $(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase)) + + $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,) + rm -f debian/$(p_l).symbols + $(if $(2), + ln -sf libobjc.symbols debian/$(p_l).symbols , + fgrep -v libobjc.symbols.gc debian/libobjc.symbols > debian/$(p_l).symbols + ) + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) \ + -- -a$(call mlib_to_arch,$(2)) || echo XXXXXXXXXXXXXX ERROR $(p_l) + rm -f debian/$(p_l).symbols + $(call cross_mangle_shlibs,$(p_l)) + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search,$(subst objc$(OBJC_SONAME),gcc-s$(GCC_SONAME),$(p_l)),$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_l)) + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + + +define __do_libobjc_dev + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) + dh_installdirs -p$(p_l) \ + $(gcc_lib_dir$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) \ + $(files_lobjcdev) + + $(call install_gcc_lib,libobjc,$(OBJC_SONAME),$(2),$(p_l)) + $(if $(filter yes,$(with_objc_gc)), + $(if $(2),, + dh_link -p$(p_l) \ + /$(usr_lib$(2))/libobjc_gc.so.$(OBJC_SONAME) \ + /$(gcc_lib_dir$(2))/libobjc_gc.so + )) + + debian/dh_doclink -p$(p_l) $(p_lbase) + echo $(p_l) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + + + +# ---------------------------------------------------------------------- + +do_libobjc = $(call __do_libobjc,lib$(1)objc$(OBJC_SONAME),$(1)) +do_libobjc_dev = $(call __do_libobjc_dev,lib$(1)objc-$(BASE_VERSION)-dev,$(1)) + +$(binary_stamp)-libobjc: $(install_stamp) + $(call do_libobjc,) + +$(binary_stamp)-lib64objc: $(install_stamp) + $(call do_libobjc,64) + +$(binary_stamp)-lib32objc: $(install_stamp) + $(call do_libobjc,32) + +$(binary_stamp)-libn32objc: $(install_stamp) + $(call do_libobjc,n32) + +$(binary_stamp)-libx32objc: $(install_stamp) + $(call do_libobjc,x32) + +$(binary_stamp)-libhfobjc: $(install_stamp) + $(call do_libobjc,hf) + +$(binary_stamp)-libsfobjc: $(install_stamp) + $(call do_libobjc,sf) + + +$(binary_stamp)-libobjc-dev: $(install_stamp) + $(call do_libobjc_dev,) + +$(binary_stamp)-lib64objc-dev: $(install_stamp) + $(call do_libobjc_dev,64) + +$(binary_stamp)-lib32objc-dev: $(install_stamp) + $(call do_libobjc_dev,32) + +$(binary_stamp)-libx32objc-dev: $(install_stamp) + $(call do_libobjc_dev,x32) + +$(binary_stamp)-libn32objc-dev: $(install_stamp) + $(call do_libobjc_dev,n32) + +$(binary_stamp)-libhfobjc-dev: $(install_stamp) + $(call do_libobjc_dev,hf) + +$(binary_stamp)-libsfobjc-dev: $(install_stamp) + $(call do_libobjc_dev,sf) + diff --git a/debian/rules.d/binary-libquadmath.mk b/debian/rules.d/binary-libquadmath.mk new file mode 100644 index 0000000..1fcb744 --- /dev/null +++ b/debian/rules.d/binary-libquadmath.mk @@ -0,0 +1,69 @@ +$(lib_binaries) += libqmath +ifeq ($(with_lib64qmath),yes) + $(lib_binaries) += lib64qmath +endif +ifeq ($(with_lib32qmath),yes) + $(lib_binaries) += lib32qmath +endif +ifeq ($(with_libn32qmath),yes) + $(lib_binaries) += libn32qmath +endif +ifeq ($(with_libx32qmath),yes) + $(lib_binaries) += libx32qmath +endif +ifeq ($(with_libhfqmath),yes) + $(lib_binaries) += libhfqmath +endif +ifeq ($(with_libsfqmath),yes) + $(lib_binaries) += libsfqmath +endif + +define __do_qmath + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + dh_installdirs -p$(p_l) $(usr_lib$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) $(usr_lib$(2))/libquadmath.so.* + + debian/dh_doclink -p$(p_l) $(p_lbase) + $(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase)) + + $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,) + ln -sf libquadmath.symbols debian/$(p_l).symbols + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) + $(call cross_mangle_shlibs,$(p_l)) + $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search,,$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_l)) + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +# ---------------------------------------------------------------------- + +do_qmath = $(call __do_qmath,lib$(1)quadmath$(QUADMATH_SONAME),$(1)) + +$(binary_stamp)-libqmath: $(install_stamp) + $(call do_qmath,) + +$(binary_stamp)-lib64qmath: $(install_stamp) + $(call do_qmath,64) + +$(binary_stamp)-lib32qmath: $(install_stamp) + $(call do_qmath,32) + +$(binary_stamp)-libn32qmath: $(install_stamp) + $(call do_qmath,n32) + +$(binary_stamp)-libx32qmath: $(install_stamp) + $(call do_qmath,x32) + +$(binary_stamp)-libhfqmath: $(install_stamp) + $(call do_qmath,hf) + +$(binary_stamp)-libsfqmath: $(install_stamp) + $(call do_qmath,sf) diff --git a/debian/rules.d/binary-libssp.mk b/debian/rules.d/binary-libssp.mk new file mode 100644 index 0000000..e2c873a --- /dev/null +++ b/debian/rules.d/binary-libssp.mk @@ -0,0 +1,155 @@ +arch_binaries := $(arch_binaries) libssp +ifeq ($(with_lib64ssp),yes) + arch_binaries := $(arch_binaries) lib64ssp +endif +ifeq ($(with_lib32ssp),yes) + arch_binaries := $(arch_binaries) lib32ssp +endif +ifeq ($(with_libn32ssp),yes) + arch_binaries := $(arch_binaries) libn32ssp +endif +ifeq ($(with_libx32ssp),yes) + arch_binaries := $(arch_binaries) libx32ssp +endif + +p_ssp = libssp$(SSP_SONAME) +p_ssp32 = lib32ssp$(SSP_SONAME) +p_ssp64 = lib64ssp$(SSP_SONAME) +p_sspx32 = libx32ssp$(SSP_SONAME) +p_sspd = libssp$(SSP_SONAME)-dev + +d_ssp = debian/$(p_ssp) +d_ssp32 = debian/$(p_ssp32) +d_ssp64 = debian/$(p_ssp64) +d_sspx32 = debian/$(p_sspx32) +d_sspd = debian/$(p_sspd) + +dirs_ssp = \ + $(docdir)/$(p_base) \ + $(PF)/$(libdir) +files_ssp = \ + $(PF)/$(libdir)/libssp.so.* + +dirs_sspd = \ + $(docdir) \ + $(PF)/include \ + $(PF)/$(libdir) +files_sspd = \ + $(gcc_lib_dir)/include/ssp \ + $(PF)/$(libdir)/libssp.{a,so} \ + $(PF)/$(libdir)/libssp_nonshared.a + +ifeq ($(with_lib32ssp),yes) + dirs_sspd += $(lib32) + files_sspd += $(lib32)/libssp.{a,so} + files_sspd += $(lib32)/libssp_nonshared.a +endif +ifeq ($(with_lib64ssp),yes) + dirs_sspd += $(PF)/lib64 + files_sspd += $(PF)/lib64/libssp.{a,so} + files_sspd += $(PF)/lib64/libssp_nonshared.a +endif + +$(binary_stamp)-libssp: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_ssp) + dh_installdirs -p$(p_ssp) + + $(dh_compat2) dh_movefiles -p$(p_ssp) $(files_ssp) + debian/dh_doclink -p$(p_ssp) $(p_lbase) + + debian/dh_rmemptydirs -p$(p_ssp) + + dh_strip -p$(p_ssp) + dh_makeshlibs $(ldconfig_arg) -p$(p_ssp) -V '$(p_ssp) (>= $(DEB_SOVERSION))' + dh_shlibdeps -p$(p_ssp) + echo $(p_ssp) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +# ---------------------------------------------------------------------- +$(binary_stamp)-lib64ssp: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_ssp64) + dh_installdirs -p$(p_ssp64) \ + $(PF)/lib64 + $(dh_compat2) dh_movefiles -p$(p_ssp64) \ + $(PF)/lib64/libssp.so.* + + debian/dh_doclink -p$(p_ssp64) $(p_lbase) + + dh_strip -p$(p_ssp64) + dh_makeshlibs $(ldconfig_arg) -p$(p_ssp64) -V '$(p_ssp64) (>= $(DEB_SOVERSION))' +# dh_shlibdeps -p$(p_ssp64) + echo $(p_ssp64) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +# ---------------------------------------------------------------------- +$(binary_stamp)-lib32ssp: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_ssp32) + dh_installdirs -p$(p_ssp32) \ + $(lib32) + $(dh_compat2) dh_movefiles -p$(p_ssp32) \ + $(lib32)/libssp.so.* + + debian/dh_doclink -p$(p_ssp32) $(p_lbase) + + dh_strip -p$(p_ssp32) + dh_makeshlibs $(ldconfig_arg) -p$(p_ssp32) -V '$(p_ssp32) (>= $(DEB_SOVERSION))' +# dh_shlibdeps -p$(p_ssp32) + echo $(p_ssp32) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +# ---------------------------------------------------------------------- +$(binary_stamp)-libn32ssp: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_sspn32) + dh_installdirs -p$(p_sspn32) \ + $(PF)/$(libn32) + $(dh_compat2) dh_movefiles -p$(p_sspn32) \ + $(PF)/$(libn32)/libssp.so.* + + debian/dh_doclink -p$(p_sspn32) $(p_lbase) + + dh_strip -p$(p_sspn32) + dh_makeshlibs $(ldconfig_arg) -p$(p_sspn32) -V '$(p_sspn32) (>= $(DEB_SOVERSION))' +# dh_shlibdeps -p$(p_sspn32) + echo $(p_sspn32) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +# ---------------------------------------------------------------------- +$(binary_stamp)-libx32ssp: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_sspx32) + dh_installdirs -p$(p_sspx32) \ + $(PF)/$(libx32) + $(dh_compat2) dh_movefiles -p$(p_sspx32) \ + $(PF)/$(libx32)/libssp.so.* + + debian/dh_doclink -p$(p_sspx32) $(p_lbase) + + dh_strip -p$(p_sspx32) + dh_makeshlibs $(ldconfig_arg) -p$(p_sspx32) -V '$(p_sspx32) (>= $(DEB_SOVERSION))' +# dh_shlibdeps -p$(p_sspx32) + echo $(p_sspx32) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) diff --git a/debian/rules.d/binary-libstdcxx.mk b/debian/rules.d/binary-libstdcxx.mk new file mode 100644 index 0000000..567656e --- /dev/null +++ b/debian/rules.d/binary-libstdcxx.mk @@ -0,0 +1,540 @@ +ifeq ($(with_libcxx),yes) + $(lib_binaries) += libstdcxx +endif +ifeq ($(with_lib64cxx),yes) + $(lib_binaries) += lib64stdcxx +endif +ifeq ($(with_lib32cxx),yes) + $(lib_binaries) += lib32stdcxx +endif +ifeq ($(with_libn32cxx),yes) + $(lib_binaries) += libn32stdcxx +endif +ifeq ($(with_libx32cxx),yes) + $(lib_binaries) += libx32stdcxx +endif +ifeq ($(with_libhfcxx),yes) + $(lib_binaries) += libhfstdcxx +endif +ifeq ($(with_libsfcxx),yes) + $(lib_binaries) += libsfstdcxx +endif + +ifneq ($(DEB_STAGE),rtlibs) + ifeq ($(with_lib64cxxdev),yes) + $(lib_binaries) += lib64stdcxx-dev + endif + ifeq ($(with_lib64cxxdbg),yes) + $(lib_binaries) += lib64stdcxxdbg + endif + ifeq ($(with_lib32cxxdev),yes) + $(lib_binaries) += lib32stdcxx-dev + endif + ifeq ($(with_lib32cxxdbg),yes) + $(lib_binaries) += lib32stdcxxdbg + endif + ifeq ($(with_libn32cxxdev),yes) + $(lib_binaries) += libn32stdcxx-dev + endif + ifeq ($(with_libn32cxxdbg),yes) + $(lib_binaries) += libn32stdcxxdbg + endif + ifeq ($(with_libx32cxxdev),yes) + $(lib_binaries) += libx32stdcxx-dev + endif + ifeq ($(with_libx32cxxdbg),yes) + $(lib_binaries) += libx32stdcxxdbg + endif + ifeq ($(with_libhfcxxdev),yes) + $(lib_binaries) += libhfstdcxx-dev + endif + ifeq ($(with_libhfcxxdbg),yes) + $(lib_binaries) += libhfstdcxxdbg + endif + ifeq ($(with_libsfcxxdev),yes) + $(lib_binaries) += libsfstdcxx-dev + endif + ifeq ($(with_libsfcxxdbg),yes) + $(lib_binaries) += libsfstdcxxdbg + endif + + ifeq ($(with_cxxdev),yes) + $(lib_binaries) += libstdcxx-dev + ifneq ($(DEB_CROSS),yes) + indep_binaries := $(indep_binaries) libstdcxx-doc + endif + endif +endif + +libstdc_ext = -$(BASE_VERSION) + +p_lib = libstdc++$(CXX_SONAME)$(cross_lib_arch) +p_lib64 = lib64stdc++$(CXX_SONAME)$(cross_lib_arch) +p_lib32 = lib32stdc++$(CXX_SONAME)$(cross_lib_arch) +p_libn32= libn32stdc++$(CXX_SONAME)$(cross_lib_arch) +p_libx32= libx32stdc++$(CXX_SONAME)$(cross_lib_arch) +p_libhf = libhfstdc++$(CXX_SONAME)$(cross_lib_arch) +p_libsf = libsfstdc++$(CXX_SONAME)$(cross_lib_arch) +p_dev = libstdc++$(libstdc_ext)-dev$(cross_lib_arch) +p_pic = libstdc++$(libstdc_ext)-pic$(cross_lib_arch) +p_dbg = libstdc++$(CXX_SONAME)$(libstdc_ext)-dbg$(cross_lib_arch) +p_dbg64 = lib64stdc++$(CXX_SONAME)$(libstdc_ext)-dbg$(cross_lib_arch) +p_dbg32 = lib32stdc++$(CXX_SONAME)$(libstdc_ext)-dbg$(cross_lib_arch) +p_dbgn32= libn32stdc++$(CXX_SONAME)$(libstdc_ext)-dbg$(cross_lib_arch) +p_dbgx32= libx32stdc++$(CXX_SONAME)$(libstdc_ext)-dbg$(cross_lib_arch) +p_dbghf = libhfstdc++$(CXX_SONAME)$(libstdc_ext)-dbg$(cross_lib_arch) +p_dbgsf = libsfstdc++$(CXX_SONAME)$(libstdc_ext)-dbg$(cross_lib_arch) +p_libd = libstdc++$(libstdc_ext)-doc + +d_lib = debian/$(p_lib) +d_lib64 = debian/$(p_lib64) +d_lib32 = debian/$(p_lib32) +d_libn32= debian/$(p_libn32) +d_libx32= debian/$(p_libx32) +d_libhf = debian/$(p_libhf) +d_libsf = debian/$(p_libsf) +d_dev = debian/$(p_dev) +d_pic = debian/$(p_pic) +d_dbg = debian/$(p_dbg) +d_dbg64 = debian/$(p_dbg64) +d_dbg32 = debian/$(p_dbg32) +d_dbghf = debian/$(p_dbghf) +d_dbgsf = debian/$(p_dbgsf) +d_libd = debian/$(p_libd) + +dirs_dev = \ + $(docdir)/$(p_base)/C++ \ + $(usr_lib) \ + $(gcc_lib_dir)/include \ + $(PFL)/include/c++ + +files_dev = \ + $(PFL)/include/c++/$(BASE_VERSION) \ + $(gcc_lib_dir)/libstdc++.{a,so} \ + $(gcc_lib_dir)/libsupc++.a \ + $(gcc_lib_dir)/libstdc++fs.a \ + $(gcc_lib_dir)/libstdc++exp.a + +ifeq ($(with_multiarch_cxxheaders),yes) + dirs_dev += \ + $(PF)/include/$(DEB_TARGET_MULTIARCH)/c++/$(BASE_VERSION) + files_dev += \ + $(PF)/include/$(DEB_TARGET_MULTIARCH)/c++/$(BASE_VERSION)/{bits,ext} +endif + +dirs_dbg = \ + $(docdir) \ + $(PF)/lib/debug/$(usr_lib) \ + $(usr_lib)/debug \ + $(PF)/share/gdb/auto-load/$(usr_lib)/debug \ + $(gcc_lib_dir) +files_dbg = \ + $(usr_lib)/debug/libstdc++.{a,so*} \ + $(usr_lib)/debug/libstdc++fs.a \ + $(usr_lib)/debug/libstdc++exp.a + +dirs_pic = \ + $(docdir) \ + $(gcc_lib_dir) +files_pic = \ + $(gcc_lib_dir)/libstdc++_pic.a + +# ---------------------------------------------------------------------- + +gxx_baseline_dir = $(shell \ + sed -n '/^baseline_dir *=/s,.*= *\(.*\)$$,\1,p' \ + $(buildlibdir)/libstdc++-v3/testsuite/Makefile) +gxx_baseline_file = $(gxx_baseline_dir)/baseline_symbols.txt + +debian/README.libstdc++-baseline: + : # save the results of the libstdc++ test run, overridden by check-abi + -tar -c -f $(buildlibdir)/libstdc++-v3/testsuite/libstdc++.tar \ + -C $(buildlibdir)/libstdc++-v3/testsuite libstdc++.{log,sum} + + cat debian/README.libstdc++-baseline.in \ + > debian/README.libstdc++-baseline + + baseline_name=`basename $(gxx_baseline_dir)`; \ + baseline_parentdir=`dirname $(gxx_baseline_dir)`; \ + compat_baseline_name=""; \ + if [ -f "$(gxx_baseline_file)" ]; then \ + ( \ + echo "A baseline file for $$baseline_name was found."; \ + echo "Running the check-abi script ..."; \ + echo ""; \ + $(MAKE) -C $(buildlibdir)/libstdc++-v3/testsuite \ + check-abi; \ + ) >> debian/README.libstdc++-baseline; \ + else \ + ( \ + echo "No baseline file found for $$baseline_name."; \ + echo "Generating a new baseline file ..."; \ + echo ""; \ + ) >> debian/README.libstdc++-baseline; \ + mkdir -p $(gxx_baseline_dir); \ + $(MAKE) -C $(buildlibdir)/libstdc++-v3/testsuite new-abi-baseline; \ + if [ -f $(gxx_baseline_file) ]; then \ + cat $(gxx_baseline_file); \ + else \ + cat $$(find $(buildlibdir)/libstdc++-v3 $(srcdir)/libstdc++-v3 -name '.new') || true; \ + fi >> debian/README.libstdc++-baseline; \ + fi + + : # restore the results of the libstdc++ test run + -tar -x -f $(buildlibdir)/libstdc++-v3/testsuite/libstdc++.tar \ + -C $(buildlibdir)/libstdc++-v3/testsuite + +# ---------------------------------------------------------------------- +# FIXME: see #792204, libstdc++ symbols on sparc64, for now ignore errors +# for the 32bit multilib build + +define __do_libstdcxx + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) + + dh_installdirs -p$(p_l) \ + $(docdir) \ + $(usr_lib$(2)) \ + $(PF)/share/gdb/auto-load/$(usr_lib$(2)) + + $(if $(DEB_CROSS),,$(if $(2),, + dh_installdirs -p$(p_l) \ + $(PF)/share/gcc/python + $(dh_compat2) dh_movefiles -p$(p_l) \ + $(PF)/share/gcc/python/libstdcxx + )) + cp -p $(d)/$(usr_lib$(2))/libstdc++.so.*.py \ + $(d_l)/$(PF)/share/gdb/auto-load/$(usr_lib$(2))/. + sed -i -e "/^libdir *=/s,=.*,= '/$(usr_lib$(2))'," \ + $(d_l)/$(PF)/share/gdb/auto-load/$(usr_lib$(2))/libstdc++.so.*.py + + cp -a $(d)/$(usr_lib$(2))/libstdc++.so.*[0-9] \ + $(d_l)/$(usr_lib$(2))/. + + debian/dh_doclink -p$(p_l) $(p_lbase) + debian/dh_rmemptydirs -p$(p_l) + + $(if $(with_dbg), + dh_strip -p$(p_l) $(if $(filter rtlibs,$(DEB_STAGE)),,--dbg-package=$(1)-$(BASE_VERSION)-dbg$(cross_lib_arch)), + dh_strip -p$(p_l) $(if $(filter rtlibs,$(DEB_STAGE)),,--dbgsym-migration='$(1)-$(BASE_VERSION)-dbg$(cross_lib_arch) (<< $(v_dbg))') + ) + ln -sf libstdc++.symbols debian/$(p_l).symbols + $(if $(filter $(DEB_TARGET_ARCH), armel hppa sparc64), \ + -$(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) \ + @echo "FIXME: libstdc++ not feature complete (https://gcc.gnu.org/ml/gcc/2014-07/msg00000.html)", \ + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) \ + ) + + $(call cross_mangle_shlibs,$(p_l)) + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search,$(subst stdc++$(CXX_SONAME),gcc-s$(GCC_SONAME),$(p_l)),$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_l)) + echo $(p_l) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +define __do_libstdcxx_dbg + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_d) + dh_installdirs -p$(p_d) \ + $(PF)/lib/debug/$(usr_lib$(2)) \ + $(usr_lib$(2)) + + $(if $(with_dbg), + $(if $(filter yes,$(with_lib$(2)cxx)), + cp -a $(d)/$(usr_lib$(2))/libstdc++.so.*[0-9] \ + $(d_d)/$(usr_lib$(2))/.; + dh_strip -p$(p_d) --keep-debug; + $(if $(filter yes,$(with_common_libs)),, # if !with_common_libs + # remove the debug symbols for libstdc++ + # built by a newer version of GCC + rm -rf $(d_d)/usr/lib/debug/$(PF); + ) + rm -f $(d_d)/$(usr_lib$(2))/libstdc++.so.*[0-9] + ) + ) + + $(if $(filter yes,$(with_cxx_debug)), + mkdir -p $(d_d)/$(usr_lib$(2))/debug; + mv $(d)/$(usr_lib$(2))/debug/libstdc++* $(d_d)/$(usr_lib$(2))/debug; + rm -f $(d_d)/$(usr_lib$(2))/debug/libstdc++_pic.a + ) + + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_d) \ + $(call shlibdirs_to_search,$(subst $(pkg_ver),,$(subst stdc++$(CXX_SONAME),gcc-s$(GCC_SONAME),$(p_l))),$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_d)) + + debian/dh_doclink -p$(p_d) $(p_lbase) + debian/dh_rmemptydirs -p$(p_d) + echo $(p_d) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +define __do_libstdcxx_dev + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + mv $(d)/$(usr_lib$(2))/libsupc++.a \ + $(d)/$(gcc_lib_dir$(2))/ + + rm -rf $(d_l) + dh_installdirs -p$(p_l) $(gcc_lib_dir$(2)) + + $(dh_compat2) dh_movefiles -p$(p_l) \ + $(gcc_lib_dir$(2))/libsupc++.a \ + $(if $(with_multiarch_cxxheaders),$(PF)/include/$(DEB_TARGET_MULTIARCH)/c++/$(BASE_VERSION)/$(2)) + $(call install_gcc_lib,libstdc++,$(CXX_SONAME),$(2),$(p_l)) + + debian/dh_doclink -p$(p_l) $(p_lbase) + debian/dh_rmemptydirs -p$(p_l) + dh_strip -p$(p_l) + dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search,$(subst stdc++$(CXX_SONAME),gcc-s$(GCC_SONAME),$(p_l)),$(2)) + echo $(p_l) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +do_libstdcxx = $(call __do_libstdcxx,lib$(1)stdc++$(CXX_SONAME),$(1)) +do_libstdcxx_dbg = $(call __do_libstdcxx_dbg,lib$(1)stdc++$(CXX_SONAME)$(libstdc_ext),$(1)) +do_libstdcxx_dev = $(call __do_libstdcxx_dev,lib$(1)stdc++-$(BASE_VERSION)-dev,$(1)) + +# ---------------------------------------------------------------------- +$(binary_stamp)-libstdcxx: $(install_stamp) + $(call do_libstdcxx,) + +$(binary_stamp)-lib64stdcxx: $(install_stamp) + $(call do_libstdcxx,64) + +$(binary_stamp)-lib32stdcxx: $(install_stamp) + $(call do_libstdcxx,32) + +$(binary_stamp)-libn32stdcxx: $(install_stamp) + $(call do_libstdcxx,n32) + +$(binary_stamp)-libx32stdcxx: $(install_stamp) + $(call do_libstdcxx,x32) + +$(binary_stamp)-libhfstdcxx: $(install_stamp) + $(call do_libstdcxx,hf) + +$(binary_stamp)-libsfstdcxx: $(install_stamp) + $(call do_libstdcxx,sf) + +$(binary_stamp)-lib64stdcxxdbg: $(install_stamp) + $(call do_libstdcxx_dbg,64) + +$(binary_stamp)-lib32stdcxxdbg: $(install_stamp) + $(call do_libstdcxx_dbg,32) + +$(binary_stamp)-libn32stdcxxdbg: $(install_stamp) + $(call do_libstdcxx_dbg,n32) + +$(binary_stamp)-libx32stdcxxdbg: $(install_stamp) + $(call do_libstdcxx_dbg,x32) + +$(binary_stamp)-libhfstdcxxdbg: $(install_stamp) + $(call do_libstdcxx_dbg,hf) + +$(binary_stamp)-libsfstdcxxdbg: $(install_stamp) + $(call do_libstdcxx_dbg,sf) + +$(binary_stamp)-lib64stdcxx-dev: $(install_stamp) + $(call do_libstdcxx_dev,64) + +$(binary_stamp)-lib32stdcxx-dev: $(install_stamp) + $(call do_libstdcxx_dev,32) + +$(binary_stamp)-libn32stdcxx-dev: $(install_stamp) + $(call do_libstdcxx_dev,n32) + +$(binary_stamp)-libx32stdcxx-dev: $(install_stamp) + $(call do_libstdcxx_dev,x32) + +$(binary_stamp)-libhfstdcxx-dev: $(install_stamp) + $(call do_libstdcxx_dev,hf) + +$(binary_stamp)-libsfstdcxx-dev: $(install_stamp) + $(call do_libstdcxx_dev,sf) + +# ---------------------------------------------------------------------- +libcxxdev_deps = $(install_stamp) +ifeq ($(with_libcxx),yes) + libcxxdev_deps += $(binary_stamp)-libstdcxx +endif +ifeq ($(with_check),yes) + libcxxdev_deps += debian/README.libstdc++-baseline +endif +# FIXME: the -dev and -dbg packages are built twice ... +$(binary_stamp)-libstdcxx-dev: $(libcxxdev_deps) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_dev) $(d_pic) + dh_installdirs -p$(p_dev) $(dirs_dev) + dh_installdirs -p$(p_pic) $(dirs_pic) + dh_installdirs -p$(p_dbg) $(dirs_dbg) + + : # - correct libstdc++-v3 file locations + mv $(d)/$(usr_lib)/libsupc++.a $(d)/$(gcc_lib_dir)/ + mv $(d)/$(usr_lib)/libstdc++fs.a $(d)/$(gcc_lib_dir)/ + mv $(d)/$(usr_lib)/libstdc++exp.a $(d)/$(gcc_lib_dir)/ + mv $(d)/$(usr_lib)/libstdc++.{a,so} $(d)/$(gcc_lib_dir)/ + ln -sf ../../../$(DEB_TARGET_GNU_TYPE)/libstdc++.so.$(CXX_SONAME) \ + $(d)/$(gcc_lib_dir)/libstdc++.so + : # FIXME: update libstdc++-pic patch +# mv $(d)/$(usr_lib)/libstdc++_pic.a $(d)/$(gcc_lib_dir)/ + cp $(buildlibdir)/libstdc++-v3/src/.libs/libstdc++convenience.a \ + $(d)/$(gcc_lib_dir)/libstdc++_pic.a + + rm -f $(d)/$(usr_lib)/debug/libstdc++_pic.a + rm -f $(d)/$(usr_lib64)/debug/libstdc++_pic.a + + : # remove precompiled headers + -find $(d) -type d -name '*.gch' | xargs rm -rf + + for i in $(d)/$(PF)/include/c++/$(GCC_VERSION)/*-linux; do \ + if [ -d $$i ]; then mv $$i $$i-gnu; fi; \ + done + + $(dh_compat2) dh_movefiles -p$(p_dev) $(files_dev) + $(dh_compat2) dh_movefiles -p$(p_pic) $(files_pic) +ifeq ($(with_cxx_debug),yes) + $(dh_compat2) dh_movefiles -p$(p_dbg) $(files_dbg) +endif + + dh_link -p$(p_dev) \ + /$(usr_lib)/libstdc++.so.$(CXX_SONAME) \ + /$(gcc_lib_dir)/libstdc++.so + + debian/dh_doclink -p$(p_dev) $(p_lbase) + debian/dh_doclink -p$(p_pic) $(p_lbase) + debian/dh_doclink -p$(p_dbg) $(p_lbase) + cp -p $(srcdir)/libstdc++-v3/ChangeLog \ + $(d_dev)/$(docdir)/$(p_base)/C++/changelog.libstdc++ +ifeq ($(with_check),yes) + cp -p debian/README.libstdc++-baseline \ + $(d_dev)/$(docdir)/$(p_base)/C++/README.libstdc++-baseline.$(DEB_TARGET_ARCH) + if [ -f $(buildlibdir)/libstdc++-v3/testsuite/current_symbols.txt ]; \ + then \ + cp -p $(buildlibdir)/libstdc++-v3/testsuite/current_symbols.txt \ + $(d_dev)/$(docdir)/$(p_base)/C++/libstdc++_symbols.txt.$(DEB_TARGET_ARCH); \ + fi +endif + cp -p $(buildlibdir)/libstdc++-v3/src/libstdc++-symbols.ver \ + $(d_pic)/$(gcc_lib_dir)/libstdc++_pic.map + + cp -p $(d)/$(usr_lib)/libstdc++.so.*.py \ + $(d_dbg)/$(PF)/share/gdb/auto-load/$(usr_lib)/debug/. + sed -i -e "/^libdir *=/s,=.*,= '/$(usr_lib)'," \ + $(d_dbg)/$(PF)/share/gdb/auto-load/$(usr_lib)/debug/libstdc++.so.*.py + +ifeq ($(with_libcxx),yes) + ifeq ($(with_dbg),yes) + cp -a $(d)/$(usr_lib)/libstdc++.so.*[0-9] \ + $(d_dbg)/$(usr_lib)/ + dh_strip -p$(p_dbg) --keep-debug + rm -f $(d_dbg)/$(usr_lib)/libstdc++.so.*[0-9] + endif +endif + $(call do_strip_lib_dbg, $(p_dev), $(p_dbg), $(v_dbg),,) +ifneq ($(with_common_libs),yes) + : # remove the debug symbols for libstdc++ built by a newer version of GCC + rm -rf $(d_dbg)/usr/lib/debug/$(PF) +endif + dh_strip -p$(p_pic) + +ifeq ($(with_cxxdev),yes) + debian/dh_rmemptydirs -p$(p_dev) + debian/dh_rmemptydirs -p$(p_pic) + debian/dh_rmemptydirs -p$(p_dbg) +endif + + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_dev) -p$(p_pic) -p$(p_dbg) \ + $(call shlibdirs_to_search,,) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_dbg)) + echo $(p_dev) $(p_pic) $(p_dbg) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +# ---------------------------------------------------------------------- + +doxygen_doc_dir = $(buildlibdir)/libstdc++-v3/doc + +doxygen-docs: $(build_doxygen_stamp) +$(build_doxygen_stamp): $(build_stamp) + $(MAKE) -C $(buildlibdir)/libstdc++-v3/doc SHELL=/bin/bash doc-html-doxygen + $(MAKE) -C $(buildlibdir)/libstdc++-v3/doc SHELL=/bin/bash doc-man-doxygen + -find $(doxygen_doc_dir)/doxygen/html -name 'struct*' -empty | xargs rm -f + + touch $@ + +$(binary_stamp)-libstdcxx-doc: $(install_stamp) doxygen-docs + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_libd) + dh_installdirs -p$(p_libd) \ + $(docdir)/$(p_base)/libstdc++ \ + $(PF)/share/man + +# debian/dh_doclink -p$(p_libd) $(p_base) + dh_link -p$(p_libd) /usr/share/doc/$(p_base) /usr/share/doc/$(p_libd) + dh_installdocs -p$(p_libd) + rm -f $(d_libd)/$(docdir)/$(p_base)/copyright + + cp -a $(srcdir)/libstdc++-v3/doc/html/* \ + $(d_libd)/$(docdir)/$(p_base)/libstdc++/. + cp -a $(doxygen_doc_dir)/doxygen/html \ + $(d_libd)/$(docdir)/$(p_base)/libstdc++/user + find $(d_libd)/$(docdir)/$(p_base)/libstdc++ -name '*.md5' \ + | xargs -r rm -f + +# Broken docs ... see #766499 +# rm -f $(d_libd)/$(docdir)/$(p_base)/libstdc++/*/jquery.js +# dh_link -p$(p_libd) \ +# /usr/share/javascript/jquery/jquery.js \ +# /$(docdir)/$(p_base)/libstdc++/html/jquery.js \ +# /usr/share/javascript/jquery/jquery.js \ +# /$(docdir)/$(p_base)/libstdc++/user/jquery.js + + : FIXME: depending on the doxygen version + if [ -d $(doxygen_doc_dir)/doxygen/man/man3cxx ]; then \ + cp -a $(doxygen_doc_dir)/doxygen/man/man3cxx \ + $(d_libd)/$(PF)/share/man/man3; \ + if [ -d $(doxygen_doc_dir)/doxygen/man/man3 ]; then \ + cp -a $(doxygen_doc_dir)/doxygen/man/man3/* \ + $(d_libd)/$(PF)/share/man/man3/; \ + fi; \ + elif [ -d $(doxygen_doc_dir)/doxygen/man/man3 ]; then \ + cp -a $(doxygen_doc_dir)/doxygen/man/man3 \ + $(d_libd)/$(PF)/share/man/man3; \ + fi + + for i in $(d_libd)/$(PF)/share/man/man3/*.3; do \ + [ -f $${i} ] || continue; \ + mv $${i} $${i}cxx; \ + done + rm -f $(d_libd)/$(PF)/share/man/man3/todo.3* + + mkdir -p $(d_libd)/usr/share/lintian/overrides + cp -p debian/$(p_libd).overrides \ + $(d_libd)/usr/share/lintian/overrides/$(p_libd) + + echo $(p_libd) >> debian/indep_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) diff --git a/debian/rules.d/binary-libtsan.mk b/debian/rules.d/binary-libtsan.mk new file mode 100644 index 0000000..fd18270 --- /dev/null +++ b/debian/rules.d/binary-libtsan.mk @@ -0,0 +1,82 @@ +$(lib_binaries) += libtsan +ifeq (0,1) +ifeq ($(with_lib64tsan),yes) + $(lib_binaries) += lib64tsan +endif +ifeq ($(with_lib32tsan),yes) + $(lib_binaries) += lib32tsan +endif +ifeq ($(with_libn32tsan),yes) + $(lib_binaries) += libn32tsan +endif +ifeq ($(with_libx32tsan),yes) + $(lib_binaries) += libx32tsan +endif +ifeq ($(with_libhftsan),yes) + $(lib_binaries) += libhftsan +endif +ifeq ($(with_libsftsan),yes) + $(lib_binaries) += libsftsan +endif +endif + +define __do_tsan + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + dh_installdirs -p$(p_l) $(usr_lib$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) \ + $(usr_lib$(2))/libtsan.so.* + + debian/dh_doclink -p$(p_l) $(p_lbase) + $(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase)) + + if [ -f debian/$(p_l).overrides ]; then \ + mkdir -p debian/$(p_l)/usr/share/lintian/overrides; \ + cp debian/$(p_l).overrides debian/$(p_l)/usr/share/lintian/overrides/$(p_l); \ + fi + mkdir -p debian/$(p_l)/usr/share/lintian/overrides + echo "$(p_l): unstripped-binary-or-object" \ + >> debian/$(p_l)/usr/share/lintian/overrides/$(p_l) + + $(if $(strip_sanitizer), $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,)) + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) + $(call cross_mangle_shlibs,$(p_l)) + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search, \ + $(subst tsan$(TSAN_SONAME),gcc-s$(GCC_SONAME),$(p_l)) \ + $(subst tsan$(TSAN_SONAME),stdc++$(CXX_SONAME),$(p_l)) \ + ,$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_l)) + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +# ---------------------------------------------------------------------- + +do_tsan = $(call __do_tsan,lib$(1)tsan$(TSAN_SONAME),$(1)) + +$(binary_stamp)-libtsan: $(install_stamp) + $(call do_tsan,) + +$(binary_stamp)-lib64tsan: $(install_stamp) + $(call do_tsan,64) + +$(binary_stamp)-lib32tsan: $(install_stamp) + $(call do_tsan,32) + +$(binary_stamp)-libn32tsan: $(install_stamp) + $(call do_tsan,n32) + +$(binary_stamp)-libx32tsan: $(install_stamp) + $(call do_tsan,x32) + +$(binary_stamp)-libhftsan: $(install_dependencies) + $(call do_tsan,hf) + +$(binary_stamp)-libsftsan: $(install_dependencies) + $(call do_tsan,sf) diff --git a/debian/rules.d/binary-libubsan.mk b/debian/rules.d/binary-libubsan.mk new file mode 100644 index 0000000..7b373e0 --- /dev/null +++ b/debian/rules.d/binary-libubsan.mk @@ -0,0 +1,79 @@ +$(lib_binaries) += libubsan +ifeq ($(with_lib64ubsan),yes) + $(lib_binaries) += lib64ubsan +endif +ifeq ($(with_lib32ubsan),yes) + $(lib_binaries) += lib32ubsan +endif +ifeq ($(with_libn32ubsan),yes) + $(lib_binaries) += libn32ubsan +endif +ifeq ($(with_libx32ubsan),yes) + $(lib_binaries) += libx32ubsan +endif +ifeq ($(with_libhfubsan),yes) + $(lib_binaries) += libhfubsan +endif +ifeq ($(with_libsfubsan),yes) + $(lib_binaries) += libsfubsan +endif + +define __do_ubsan + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + dh_installdirs -p$(p_l) $(usr_lib$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) $(usr_lib$(2))/libubsan.so.* + + debian/dh_doclink -p$(p_l) $(p_lbase) + $(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase)) + + if [ -f debian/$(p_l).overrides ]; then \ + mkdir -p debian/$(p_l)/usr/share/lintian/overrides; \ + cp debian/$(p_l).overrides debian/$(p_l)/usr/share/lintian/overrides/$(p_l); \ + fi + mkdir -p debian/$(p_l)/usr/share/lintian/overrides + echo "$(p_l): unstripped-binary-or-object" \ + >> debian/$(p_l)/usr/share/lintian/overrides/$(p_l) + + $(if $(strip_sanitizer), $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,)) + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) + $(call cross_mangle_shlibs,$(p_l)) + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search, \ + $(subst ubsan$(UBSAN_SONAME),gcc-s$(GCC_SONAME),$(p_l)) \ + $(subst ubsan$(UBSAN_SONAME),stdc++$(CXX_SONAME),$(p_l)) \ + ,$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_l)) + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +# ---------------------------------------------------------------------- + +do_ubsan = $(call __do_ubsan,lib$(1)ubsan$(UBSAN_SONAME),$(1)) + +$(binary_stamp)-libubsan: $(install_stamp) + $(call do_ubsan,) + +$(binary_stamp)-lib64ubsan: $(install_stamp) + $(call do_ubsan,64) + +$(binary_stamp)-lib32ubsan: $(install_stamp) + $(call do_ubsan,32) + +$(binary_stamp)-libn32ubsan: $(install_stamp) + $(call do_ubsan,n32) + +$(binary_stamp)-libx32ubsan: $(install_stamp) + $(call do_ubsan,x32) + +$(binary_stamp)-libhfubsan: $(install_dependencies) + $(call do_ubsan,hf) + +$(binary_stamp)-libsfubsan: $(install_dependencies) + $(call do_ubsan,sf) diff --git a/debian/rules.d/binary-libvtv.mk b/debian/rules.d/binary-libvtv.mk new file mode 100644 index 0000000..27023a7 --- /dev/null +++ b/debian/rules.d/binary-libvtv.mk @@ -0,0 +1,76 @@ +$(lib_binaries) += libvtv +ifeq ($(with_lib64vtv),yes) + $(lib_binaries) += lib64vtv +endif +ifeq ($(with_lib32vtv),yes) + $(lib_binaries) += lib32vtv +endif +ifeq ($(with_libn32vtv),yes) + $(lib_binaries) += libn32vtv +endif +ifeq ($(with_libx32vtv),yes) + $(lib_binaries) += libx32vtv +endif +ifeq ($(with_libhfvtv),yes) + $(lib_binaries) += libhfvtv +endif +ifeq ($(with_libsfvtv),yes) + $(lib_binaries) += libsfvtv +endif + +define __do_vtv + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + dh_installdirs -p$(p_l) $(usr_lib$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) $(usr_lib$(2))/libvtv.so.* + + debian/dh_doclink -p$(p_l) $(p_lbase) + $(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase)) + + if [ -f debian/$(p_l).overrides ]; then \ + mkdir -p debian/$(p_l)/usr/share/lintian/overrides; \ + cp debian/$(p_l).overrides debian/$(p_l)/usr/share/lintian/overrides/$(p_l); \ + fi + + $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,) + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) + $(call cross_mangle_shlibs,$(p_l)) + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search, \ + $(subst vtv$(VTV_SONAME),gcc-s$(GCC_SONAME),$(p_l)) \ + $(subst vtv$(VTV_SONAME),stdc++$(CXX_SONAME),$(p_l)) \ + ,$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_l)) + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +# ---------------------------------------------------------------------- + +do_vtv = $(call __do_vtv,lib$(1)vtv$(VTV_SONAME),$(1)) + +$(binary_stamp)-libvtv: $(install_stamp) + $(call do_vtv,) + +$(binary_stamp)-lib64vtv: $(install_stamp) + $(call do_vtv,64) + +$(binary_stamp)-lib32vtv: $(install_stamp) + $(call do_vtv,32) + +$(binary_stamp)-libn32vtv: $(install_stamp) + $(call do_vtv,n32) + +$(binary_stamp)-libx32vtv: $(install_stamp) + $(call do_vtv,x32) + +$(binary_stamp)-libhfvtv: $(install_dependencies) + $(call do_vtv,hf) + +$(binary_stamp)-libsfvtv: $(install_dependencies) + $(call do_vtv,sf) diff --git a/debian/rules.d/binary-m2.mk b/debian/rules.d/binary-m2.mk new file mode 100644 index 0000000..8ecffb1 --- /dev/null +++ b/debian/rules.d/binary-m2.mk @@ -0,0 +1,308 @@ +ifneq ($(DEB_STAGE),rtlibs) + ifeq (0,1) + ifneq (,$(filter yes, $(biarch64) $(biarch32) $(biarchn32) $(biarchx32) $(biarchsf))) + arch_binaries := $(arch_binaries) gm2-multi + endif + endif + arch_binaries := $(arch_binaries) gm2 + + ifeq ($(with_m2dev),yes) + $(lib_binaries) += libgm2-dev + endif + ifeq ($(with_libgm2),yes) + $(lib_binaries) += libgm2 + endif + + ifneq ($(DEB_CROSS),yes) + indep_binaries := $(indep_binaries) gm2-doc + endif + + ifeq (0,1) + ifeq ($(with_lib64gm2dev),yes) + $(lib_binaries) += lib64gm2-dev + endif + ifeq ($(with_lib32gm2dev),yes) + $(lib_binaries) += lib32gm2-dev + endif + ifeq ($(with_libn32gm2dev),yes) + $(lib_binaries) += libn32gm2-dev + endif + ifeq ($(with_libx32gm2dev),yes) + $(lib_binaries) += libx32gm2-dev + endif + ifeq ($(with_libhfgm2dev),yes) + $(lib_binaries) += libhfgm2-dev + endif + ifeq ($(with_libsfgm2dev),yes) + $(lib_binaries) += libsfgm2-dev + endif + + ifeq ($(with_lib64gm2),yes) + $(lib_binaries) += lib64gm2 + endif + ifeq ($(with_lib32gm2),yes) + $(lib_binaries) += lib32gm2 + endif + ifeq ($(with_libn32gm2),yes) + $(lib_binaries) += libn32gm2 + endif + ifeq ($(with_libx32gm2),yes) + $(lib_binaries) += libx32gm2 + endif + ifeq ($(with_libhfgm2),yes) + $(lib_binaries) += libhfgm2 + endif + ifeq ($(with_libsfgm2),yes) + $(lib_binaries) += libsfgm2 + endif + endif +endif + +p_gm2 = gm2$(pkg_ver)$(cross_bin_arch) +p_gm2_m = gm2$(pkg_ver)-multilib$(cross_bin_arch) +p_libgm2 = libgm2-$(GM2_SONAME) +p_libgm2dev = libgm2$(pkg_ver)-dev +p_gm2d = gm2$(pkg_ver)-doc + +d_gm2 = debian/$(p_gm2) +d_gm2_m = debian/$(p_gm2_m) +d_libgm2 = debian/$(p_libgm2) +d_libgm2dev = debian/$(p_libgm2dev) +d_gm2d = debian/$(p_gm2d) + +dirs_gm2 = \ + $(PF)/bin \ + $(PF)/share/man/man1 \ + $(gcc_lexec_dir) \ + $(gcc_lib_dir)/plugin +#ifneq ($(DEB_CROSS),yes) +# dirs_gm2 += \ +# $(gm2_include_dir) +#endif + +files_gm2 = \ + $(PF)/bin/$(cmd_prefix)gm2$(pkg_ver) \ + $(gcc_lib_dir)/plugin/m2rte.so \ + $(gcc_lexec_dir)/cc1gm2 +ifneq ($(GFDL_INVARIANT_FREE),yes-now-pure-gfdl) + files_gm2 += \ + $(PF)/share/man/man1/$(cmd_prefix)gm2$(pkg_ver).1 +endif + +dirs_libgm2 = \ + $(PF)/lib \ + $(gm2_include_dir) \ + $(gcc_lib_dir) + +$(binary_stamp)-gm2: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_gm2) + dh_installdirs -p$(p_gm2) $(dirs_gm2) + + dh_installdocs -p$(p_gm2) + dh_installchangelogs -p$(p_gm2) src/gcc/m2/ChangeLog + + $(dh_compat2) dh_movefiles -p$(p_gm2) $(files_gm2) + +ifeq ($(unprefixed_names),yes) + ln -sf $(cmd_prefix)gm2$(pkg_ver) \ + $(d_gm2)/$(PF)/bin/gm2$(pkg_ver) + ifneq ($(GFDL_INVARIANT_FREE),yes-now-pure-gfdl) + ln -sf $(cmd_prefix)gm2$(pkg_ver).1 \ + $(d_gm2)/$(PF)/share/man/man1/gm2$(pkg_ver).1 + endif +endif + dh_installdirs -p$(p_gm2) + dh_link -p$(p_gm2) \ + /$(docdir)/$(p_xbase)/README.Bugs \ + /$(docdir)/$(p_gm2)/README.Bugs + +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTONS))) + $(DWZ) \ + $(d_gm2)/$(gcc_lexec_dir)/cc1gm2 +endif + dh_strip -p$(p_gm2) \ + $(if $(unstripped_exe),-X/cc1gm2 -X/gm2) + dh_shlibdeps -p$(p_gm2) + + mkdir -p $(d_gm2)/usr/share/lintian/overrides + echo '$(p_gm2) binary: hardening-no-pie' \ + > $(d_gm2)/usr/share/lintian/overrides/$(p_gm2) + + echo $(p_gm2) >> debian/arch_binaries + + find $(d_gm2) -type d -empty -delete + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +$(binary_stamp)-gm2-multi: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_gm2_m) + dh_installdirs -p$(p_gm2_m) $(docdir) + + debian/dh_doclink -p$(p_gm2_m) $(p_xbase) + + dh_strip -p$(p_gm2_m) + dh_shlibdeps -p$(p_gm2_m) + echo $(p_gm2_m) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +define __do_libgm2 + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + dh_installdirs -p$(p_l) \ + $(usr_lib$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) \ + $(usr_lib$(2))/libm2pim.so.* \ + $(usr_lib$(2))/libm2cor.so.* \ + $(usr_lib$(2))/libm2iso.so.* \ + $(usr_lib$(2))/libm2log.so.* \ + $(usr_lib$(2))/libm2min.so.* + + debian/dh_doclink -p$(p_l) $(p_lbase) + $(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase)) + + $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,) + : ln -sf libgm2.symbols debian/$(p_l).symbols + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) \ + -- -a$(call mlib_to_arch,$(2)) || echo XXXXXXXXXXX ERROR $(p_l) + rm -f debian/$(p_l).symbols + $(call cross_mangle_shlibs,$(p_l)) + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search, \ + $(subst gm2-$(GM2_SONAME),gcc-s$(GCC_SONAME),$(p_l)) \ + ,$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_l)) + + mkdir -p $(d_l)/usr/share/lintian/overrides; \ + ( \ + echo "$(p_l) binary: dev-pkg-without-shlib-symlink"; \ + echo "$(p_l) binary: shared-lib-without-dependency-information"; \ + echo "$(p_l) binary: package-name-doesnt-match-sonames"; \ + echo "$(p_l) binary: library-not-linked-against-libc"; \ + ) >> $(d_l)/usr/share/lintian/overrides/$(p_l) + + dh_lintian -p$(p_l) + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +# install_gm2_lib(lib,soname,flavour,package,subdir) +define install_gm2_lib + dh_link -p$(4) \ + /$(usr_lib$(3))/$(1).so.$(2) /$(gcc_lib_dir$(3))/$(5)/$(1).so \ + /$(usr_lib$(3))/$(1).so.$(2) /$(gcc_lib_dir$(3))/$(1).so + mv $(d)/$(usr_lib$(3))/$(1)*.a debian/$(4)/$(gcc_lib_dir$(3)) + rm -f $(d)/$(usr_lib$(3))/$(1)*.{la,so} +endef + +define __do_libgm2_dev + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) + dh_installdirs -p$(p_l) \ + $(gcc_lib_dir$(2)) + + : # install_gm2_lib calls needed? + + $(if $(2),, + $(dh_compat2) dh_movefiles -p$(p_l) \ + $(gcc_lib_dir)/m2 + ) + + $(call install_gm2_lib,libm2pim,$(GM2_SONAME),$(2),$(p_l),m2/m2pim) + $(call install_gm2_lib,libm2cor,$(GM2_SONAME),$(2),$(p_l),m2/m2cor) + $(call install_gm2_lib,libm2iso,$(GM2_SONAME),$(2),$(p_l),m2/m2iso) + $(call install_gm2_lib,libm2log,$(GM2_SONAME),$(2),$(p_l),m2/m2log) + $(call install_gm2_lib,libm2min,$(GM2_SONAME),$(2),$(p_l),m2/m2min) + + debian/dh_doclink -p$(p_l) \ + $(if $(filter yes,$(with_separate_gm2)),$(p_gm2),$(p_lbase)) + echo $(p_l) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +do_libgm2 = $(call __do_libgm2,lib$(1)gm2-$(GM2_SONAME),$(1)) +do_libgm2_dev = $(call __do_libgm2_dev,lib$(1)gm2-$(BASE_VERSION)-dev,$(1)) + +# ---------------------------------------------------------------------- +$(binary_stamp)-gm2-doc: $(build_html_stamp) $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_gm2d) + dh_installdirs -p$(p_gm2d) \ + $(docdir)/$(p_gm2) \ + $(docdir)/$(p_xbase)/m2 \ + $(PF)/share/info + cp -p $(builddir)/gcc/doc/m2.info $(d_gm2d)/$(PF)/share/info/gm2-$(BASE_VERSION).info + cp -p html/gm2.html $(d_gm2d)/$(docdir)/$(p_xbase)/m2/gm2-$(BASE_VERSION).html + ln -sf ../$(p_xbase)/m2/gm2-$(BASE_VERSION).html $(d_gm2d)/$(docdir)/$(p_gm2)/gm2-$(BASE_VERSION).html + + debian/dh_doclink -p$(p_gm2d) $(p_xbase) + dh_installdocs -p$(p_gm2d) + rm -f $(d_gm2d)/$(docdir)/$(p_xbase)/copyright + + echo $(p_gm2d) >> debian/indep_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + + +$(binary_stamp)-libgm2: $(install_stamp) + $(call do_libgm2,) + +$(binary_stamp)-lib64gm2: $(install_stamp) + $(call do_libgm2,64) + +$(binary_stamp)-lib32gm2: $(install_stamp) + $(call do_libgm2,32) + +$(binary_stamp)-libn32gm2: $(install_stamp) + $(call do_libgm2,n32) + +$(binary_stamp)-libx32gm2: $(install_stamp) + $(call do_libgm2,x32) + +$(binary_stamp)-libhfgm2: $(install_stamp) + $(call do_libgm2,hf) + +$(binary_stamp)-libsfgm2: $(install_stamp) + $(call do_libgm2,sf) + + +$(binary_stamp)-libgm2-dev: $(install_stamp) + $(call do_libgm2_dev,) + +$(binary_stamp)-lib64gm2-dev: $(install_stamp) + $(call do_libgm2_dev,64) + +$(binary_stamp)-lib32gm2-dev: $(install_stamp) + $(call do_libgm2_dev,32) + +$(binary_stamp)-libx32gm2-dev: $(install_stamp) + $(call do_libgm2_dev,x32) + +$(binary_stamp)-libn32gm2-dev: $(install_stamp) + $(call do_libgm2_dev,n32) + +$(binary_stamp)-libhfgm2-dev: $(install_stamp) + $(call do_libgm2_dev,hf) + +$(binary_stamp)-libsfgm2-dev: $(install_stamp) + $(call do_libgm2_dev,sf) diff --git a/debian/rules.d/binary-nof.mk b/debian/rules.d/binary-nof.mk new file mode 100644 index 0000000..fa5408a --- /dev/null +++ b/debian/rules.d/binary-nof.mk @@ -0,0 +1,51 @@ +arch_binaries := $(arch_binaries) nof + +p_nof = gcc$(pkg_ver)-nof +d_nof = debian/$(p_nof) + +dirs_nof = \ + $(docdir) \ + $(usr_lib)/nof +ifeq ($(with_cdev),yes) + dirs_nof += \ + $(gcc_lib_dir)/nof +endif + +ifeq ($(with_cdev),yes) + files_nof = \ + $(libgcc_dir)/libgcc_s_nof.so.$(GCC_SONAME) \ + $(gcc_lib_dir)/libgcc_s_nof.so \ + $(usr_lib)/nof \ + $(gcc_lib_dir)/nof +else + files_nof = \ + $(usr_lib)/libgcc_s_nof.so.$(GCC_SONAME) +endif + +# ---------------------------------------------------------------------- +$(binary_stamp)-nof: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + mv $(d)/$(usr_lib)/libgcc_s_nof.so.$(GCC_SONAME) $(d)/$(libgcc_dir)/. + rm -f $(d)/$(usr_lib)/libgcc_s_nof.so + ln -sf $(libgcc_dir)/libgcc_s_nof.so.$(GCC_SONAME) \ + $(d)/$(gcc_lib_dir)/libgcc_s_nof.so + + rm -rf $(d_nof) + dh_installdirs -p$(p_nof) $(dirs_nof) + $(dh_compat2) dh_movefiles -p$(p_nof) $(files_nof) + debian/dh_doclink -p$(p_nof) $(p_xbase) + dh_strip -p$(p_nof) + dh_shlibdeps -p$(p_nof) + + dh_makeshlibs $(ldconfig_arg) -p$(p_nof) + : # Only keep the shlibs file for the libgcc_s_nof library + fgrep libgcc_s_nof debian/$(p_nof)/DEBIAN/shlibs \ + > debian/$(p_nof)/DEBIAN/shlibs.tmp + mv -f debian/$(p_nof)/DEBIAN/shlibs.tmp debian/$(p_nof)/DEBIAN/shlibs + + echo $(p_nof) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) diff --git a/debian/rules.d/binary-nvptx.mk b/debian/rules.d/binary-nvptx.mk new file mode 100644 index 0000000..b2841b4 --- /dev/null +++ b/debian/rules.d/binary-nvptx.mk @@ -0,0 +1,97 @@ +ifeq ($(with_offload_nvptx),yes) + arch_binaries := $(arch_binaries) nvptx + ifeq ($(with_common_libs),yes) + arch_binaries := $(arch_binaries) nvptx-plugin + endif +endif + +p_nvptx = gcc$(pkg_ver)-offload-nvptx +d_nvptx = debian/$(p_nvptx) + +p_pl_nvptx = libgomp-plugin-nvptx1 +d_pl_nvptx = debian/$(p_pl_nvptx) + +dirs_nvptx = \ + $(docdir)/$(p_xbase)/ \ + $(PF)/bin \ + $(gcc_lexec_dir)/accel + +files_nvptx = \ + $(PF)/bin/$(DEB_TARGET_GNU_TYPE)-accel-nvptx-none-gcc$(pkg_ver) \ + $(gcc_lexec_dir)/accel/nvptx-none + +# not needed: libs moved, headers not needed for lto1 +# $(PF)/nvptx-none + +# are these needed? +# $(PF)/lib/gcc/nvptx-none/$(versiondir)/{include,finclude,mgomp} + +ifneq ($(GFDL_INVARIANT_FREE),yes) + files_nvptx += \ + $(PF)/share/man/man1/$(DEB_HOST_GNU_TYPE)-accel-nvptx-none-gcc$(pkg_ver).1 +endif + +$(binary_stamp)-nvptx: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_nvptx) + dh_installdirs -p$(p_nvptx) $(dirs_nvptx) + tar -c -C $(d)-nvptx -f - $(files_nvptx) \ + | tar -x -v -C $(d_nvptx) -f - + + : # re-create the symlinks as relative symlinks + dh_link -p$(p_nvptx) \ + /usr/bin/nvptx-none-ar /$(gcc_lexec_dir)/accel/nvptx-none/ar \ + /usr/bin/nvptx-none-as /$(gcc_lexec_dir)/accel/nvptx-none/as \ + /usr/bin/nvptx-none-ld /$(gcc_lexec_dir)/accel/nvptx-none/ld \ + /usr/bin/nvptx-none-ranlib /$(gcc_lexec_dir)/accel/nvptx-none/ranlib + + mkdir -p $(d_nvptx)/usr/share/lintian/overrides + ( \ + echo '$(p_nvptx) binary: hardening-no-pie'; \ + echo '$(p_nvptx) binary: no-code-sections' \ + ) > $(d_nvptx)/usr/share/lintian/overrides/$(p_nvptx) +ifeq ($(GFDL_INVARIANT_FREE),yes) + echo '$(p_nvptx) binary: binary-without-manpage' \ + >> $(d_nvptx)/usr/share/lintian/overrides/$(p_nvptx) +endif + + debian/dh_doclink -p$(p_nvptx) $(p_xbase) + + debian/dh_rmemptydirs -p$(p_nvptx) + +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTONS))) + $(DWZ) \ + $(d_nvptx)/$(gcc_lexec_dir)/accel/nvptx-none/{collect2,lto1,lto-wrapper,mkoffload} +endif + dh_strip -p$(p_nvptx) \ + $(if $(unstripped_exe),-X/lto1) + dh_shlibdeps -p$(p_nvptx) + echo $(p_nvptx) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +# ---------------------------------------------------------------------- +$(binary_stamp)-nvptx-plugin: $(install_dependencies) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_pl_nvptx) + dh_installdirs -p$(p_pl_nvptx) \ + $(docdir) \ + $(usr_lib) + $(dh_compat2) dh_movefiles -p$(p_pl_nvptx) \ + $(usr_lib)/libgomp-plugin-nvptx.so.* + + debian/dh_doclink -p$(p_pl_nvptx) $(p_xbase) + debian/dh_rmemptydirs -p$(p_pl_nvptx) + + dh_strip -p$(p_pl_nvptx) + dh_makeshlibs -p$(p_pl_nvptx) + dh_shlibdeps -p$(p_pl_nvptx) + echo $(p_pl_nvptx) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) diff --git a/debian/rules.d/binary-objc.mk b/debian/rules.d/binary-objc.mk new file mode 100644 index 0000000..743bf52 --- /dev/null +++ b/debian/rules.d/binary-objc.mk @@ -0,0 +1,69 @@ +ifneq ($(DEB_STAGE),rtlibs) + ifneq (,$(filter yes, $(biarch64) $(biarch32) $(biarchn32) $(biarchx32) $(biarchhf) $(biarchsf))) + arch_binaries := $(arch_binaries) objc-multi + endif + arch_binaries := $(arch_binaries) objc +endif + +p_objc = gobjc$(pkg_ver)$(cross_bin_arch) +d_objc = debian/$(p_objc) + +p_objc_m= gobjc$(pkg_ver)-multilib$(cross_bin_arch) +d_objc_m= debian/$(p_objc_m) + +dirs_objc = \ + $(docdir)/$(p_xbase)/ObjC \ + $(gcc_lexec_dir) + +files_objc = \ + $(gcc_lexec_dir)/cc1obj + +$(binary_stamp)-objc: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_objc) + dh_installdirs -p$(p_objc) $(dirs_objc) + $(dh_compat2) dh_movefiles -p$(p_objc) $(files_objc) + + cp -p $(srcdir)/libobjc/{README*,THREADS*} \ + $(d_objc)/$(docdir)/$(p_xbase)/ObjC/. + + cp -p $(srcdir)/libobjc/ChangeLog \ + $(d_objc)/$(docdir)/$(p_xbase)/ObjC/changelog.libobjc + + mkdir -p $(d_objc)/usr/share/lintian/overrides + echo '$(p_objc) binary: hardening-no-pie' \ + > $(d_objc)/usr/share/lintian/overrides/$(p_objc) + + debian/dh_doclink -p$(p_objc) $(p_xbase) + + debian/dh_rmemptydirs -p$(p_objc) + +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTONS))) + $(DWZ) \ + $(d_objc)/$(gcc_lexec_dir)/cc1obj +endif + dh_strip -p$(p_objc) \ + $(if $(unstripped_exe),-X/cc1obj) + dh_shlibdeps -p$(p_objc) + echo $(p_objc) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +$(binary_stamp)-objc-multi: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_objc_m) + dh_installdirs -p$(p_objc_m) $(docdir) + + debian/dh_doclink -p$(p_objc_m) $(p_xbase) + + dh_strip -p$(p_objc_m) + dh_shlibdeps -p$(p_objc_m) + echo $(p_objc_m) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) diff --git a/debian/rules.d/binary-objcxx.mk b/debian/rules.d/binary-objcxx.mk new file mode 100644 index 0000000..e750cae --- /dev/null +++ b/debian/rules.d/binary-objcxx.mk @@ -0,0 +1,62 @@ +ifneq ($(DEB_STAGE),rtlibs) + ifneq (,$(filter yes, $(biarch64) $(biarch32) $(biarchn32) $(biarchx32) $(biarchhf) $(biarchsf))) + arch_binaries := $(arch_binaries) objcxx-multi + endif + arch_binaries := $(arch_binaries) objcxx +endif + +p_objcx = gobjc++$(pkg_ver)$(cross_bin_arch) +d_objcx = debian/$(p_objcx) + +p_objcx_m = gobjc++$(pkg_ver)-multilib$(cross_bin_arch) +d_objcx_m = debian/$(p_objcx_m) + +dirs_objcx = \ + $(docdir)/$(p_xbase)/Obj-C++ \ + $(gcc_lexec_dir) + +files_objcx = \ + $(gcc_lexec_dir)/cc1objplus + +$(binary_stamp)-objcxx: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_objcx) + dh_installdirs -p$(p_objcx) $(dirs_objcx) + $(dh_compat2) dh_movefiles -p$(p_objcx) $(files_objcx) + + debian/dh_doclink -p$(p_objcx) $(p_xbase) + cp -p $(srcdir)/gcc/objcp/ChangeLog \ + $(d_objcx)/$(docdir)/$(p_xbase)/Obj-C++/changelog + + mkdir -p $(d_objcx)/usr/share/lintian/overrides + echo '$(p_objcx) binary: hardening-no-pie' \ + > $(d_objcx)/usr/share/lintian/overrides/$(p_objcx) + + debian/dh_rmemptydirs -p$(p_objcx) + +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTONS))) + $(DWZ) \ + $(d_objcx)/$(gcc_lexec_dir)/cc1objplus +endif + dh_strip -p$(p_objcx) \ + $(if $(unstripped_exe),-X/cc1objplus) + dh_shlibdeps -p$(p_objcx) + echo $(p_objcx) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +$(binary_stamp)-objcxx-multi: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + rm -rf $(d_objcx_m) + debian/dh_doclink -p$(p_objcx_m) $(p_xbase) + debian/dh_rmemptydirs -p$(p_objcx_m) + dh_strip -p$(p_objcx_m) + dh_shlibdeps -p$(p_objcx_m) + echo $(p_objcx_m) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) diff --git a/debian/rules.d/binary-rust.mk b/debian/rules.d/binary-rust.mk new file mode 100644 index 0000000..8c77ca1 --- /dev/null +++ b/debian/rules.d/binary-rust.mk @@ -0,0 +1,309 @@ +ifneq ($(DEB_STAGE),rtlibs) + ifeq (0,1) + #ifneq (,$(filter yes, $(biarch64) $(biarch32) $(biarchn32) $(biarchx32) $(biarchsf))) + # arch_binaries := $(arch_binaries) grs-multi + #endif + endif + arch_binaries := $(arch_binaries) grs + + #ifeq ($(with_rsdev),yes) + # $(lib_binaries) += libgrs-dev + #endif + #ifeq ($(with_libgrs),yes) + # $(lib_binaries) += libgrs + #endif + + #ifneq ($(DEB_CROSS),yes) + # indep_binaries := $(indep_binaries) grs-doc + #endif + + ifeq (0,1) + ifeq ($(with_lib64grsdev),yes) + $(lib_binaries) += lib64grs-dev + endif + ifeq ($(with_lib32grsdev),yes) + $(lib_binaries) += lib32grs-dev + endif + ifeq ($(with_libn32grsdev),yes) + $(lib_binaries) += libn32grs-dev + endif + ifeq ($(with_libx32grsdev),yes) + $(lib_binaries) += libx32grs-dev + endif + ifeq ($(with_libhfgrsdev),yes) + $(lib_binaries) += libhfgrs-dev + endif + ifeq ($(with_libsfgrsdev),yes) + $(lib_binaries) += libsfgrs-dev + endif + + ifeq ($(with_lib64grs),yes) + $(lib_binaries) += lib64grs + endif + ifeq ($(with_lib32grs),yes) + $(lib_binaries) += lib32grs + endif + ifeq ($(with_libn32grs),yes) + $(lib_binaries) += libn32grs + endif + ifeq ($(with_libx32grs),yes) + $(lib_binaries) += libx32grs + endif + ifeq ($(with_libhfgrs),yes) + $(lib_binaries) += libhfgrs + endif + ifeq ($(with_libsfgrs),yes) + $(lib_binaries) += libsfgrs + endif + endif +endif + +p_grs = gccrs$(pkg_ver)$(cross_bin_arch) +p_grs_m = gccrs$(pkg_ver)-multilib$(cross_bin_arch) +p_libgrs = libgrs-$(GRS_SONAME) +p_libgrsdev = libgrs$(pkg_ver)-dev +p_grsd = grs$(pkg_ver)-doc + +d_grs = debian/$(p_grs) +d_grs_m = debian/$(p_grs_m) +d_libgrs = debian/$(p_libgrs) +d_libgrsdev = debian/$(p_libgrsdev) +d_grsd = debian/$(p_grsd) + +dirs_grs = \ + $(PF)/bin \ + $(PF)/share/man/man1 \ + $(gcc_lexec_dir) +#ifneq ($(DEB_CROSS),yes) +# dirs_grs += \ +# $(grs_include_dir) +#endif + +files_grs = \ + $(PF)/bin/$(cmd_prefix)gccrs$(pkg_ver) \ + $(gcc_lexec_dir)/rust1 +# files_grs += \ +# $(PF)/share/man/man1/$(cmd_prefix)gccrs$(pkg_ver).1 + +dirs_libgrs = \ + $(PF)/lib \ + $(grs_include_dir) \ + $(gcc_lib_dir) + +$(binary_stamp)-grs: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_grs) + dh_installdirs -p$(p_grs) $(dirs_grs) + + dh_installdocs -p$(p_grs) + dh_installchangelogs -p$(p_grs) #src/gcc/rs/ChangeLog + + $(dh_compat2) dh_movefiles -p$(p_grs) $(files_grs) + +ifeq ($(unprefixed_names),yes) + ln -sf $(cmd_prefix)gccrs$(pkg_ver) \ + $(d_grs)/$(PF)/bin/gccrs$(pkg_ver) +# ln -sf $(cmd_prefix)gccrs$(pkg_ver).1 \ +# $(d_grs)/$(PF)/share/man/man1/gccrs$(pkg_ver).1 +endif + dh_installdirs -p$(p_grs) + debian/dh_doclink -p$(p_grs) $(p_xbase) + +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTONS))) + $(DWZ) \ + $(d_grs)/$(gcc_lexec_dir)/rust1 +endif + dh_strip -p$(p_grs) \ + $(if $(unstripped_exe),-X/rustcc1) + dh_shlibdeps -p$(p_grs) + + mkdir -p $(d_grs)/usr/share/lintian/overrides + echo '$(p_grs) binary: hardening-no-pie' \ + > $(d_grs)/usr/share/lintian/overrides/$(p_grs) + + echo $(p_grs) >> debian/arch_binaries + + find $(d_grs) -type d -empty -delete + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +$(binary_stamp)-grs-multi: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_grs_m) + dh_installdirs -p$(p_grs_m) $(docdir) + + debian/dh_doclink -p$(p_grs_m) $(p_xbase) + + dh_strip -p$(p_grs_m) + dh_shlibdeps -p$(p_grs_m) + echo $(p_grs_m) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + +define __do_libgrs + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) $(d_d) + dh_installdirs -p$(p_l) \ + $(usr_lib$(2)) + $(dh_compat2) dh_movefiles -p$(p_l) \ + $(usr_lib$(2))/librspim.so.* \ + $(usr_lib$(2))/librscor.so.* \ + $(usr_lib$(2))/librsiso.so.* \ + $(usr_lib$(2))/librslog.so.* \ + $(usr_lib$(2))/librsmin.so.* + + debian/dh_doclink -p$(p_l) $(p_lbase) + $(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase)) + + $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,) + : ln -sf libgrs.symbols debian/$(p_l).symbols + $(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l) \ + -- -a$(call mlib_to_arch,$(2)) || echo XXXXXXXXXXX ERROR $(p_l) + rm -f debian/$(p_l).symbols + $(call cross_mangle_shlibs,$(p_l)) + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \ + $(call shlibdirs_to_search, \ + $(subst grs-$(GRS_SONAME),gcc-s$(GCC_SONAME),$(p_l)) \ + ,$(2)) \ + $(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2)) + $(call cross_mangle_substvars,$(p_l)) + + mkdir -p $(d_l)/usr/share/lintian/overrides; \ + ( \ + echo "$(p_l) binary: dev-pkg-without-shlib-symlink"; \ + echo "$(p_l) binary: shared-lib-without-dependency-information"; \ + echo "$(p_l) binary: package-name-doesnt-match-sonames"; \ + echo "$(p_l) binary: library-not-linked-against-libc"; \ + ) >> $(d_l)/usr/share/lintian/overrides/$(p_l) + + dh_lintian -p$(p_l) + echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +# install_grs_lib(lib,soname,flavour,package,subdir) +#define install_grs_lib +# mkdir -p debian/$(4)/$(gcc_lib_dir$(3))/$(5) +# mv $(d)/$(usr_lib$(3))/$(1)*.a debian/$(4)/$(gcc_lib_dir$(3))/$(5)/. +# rm -f $(d)/$(usr_lib$(3))/$(1)*.{la,so} +# dh_link -p$(4) \ +# /$(usr_lib$(3))/$(1).so.$(2) /$(gcc_lib_dir$(3))/$(5)/$(1).so +#endef +define install_grs_lib + dh_link -p$(4) \ + /$(usr_lib$(3))/$(1).so.$(2) /$(gcc_lib_dir$(3))/$(5)/$(1).so + rm -f $(d)/$(usr_lib$(3))/$(1).so + rm -f $(d)/$(usr_lib$(3))/$(1).a +endef + +define __do_libgrs_dev + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_l) + dh_installdirs -p$(p_l) \ + $(gcc_lib_dir$(2)) + + : # install_grs_lib calls needed? + + $(if $(2),, + $(dh_compat2) dh_movefiles -p$(p_l) \ + $(gcc_lexec_dir)/rs + ) + + $(call install_grs_lib,librspim,$(GRS_SONAME),$(2),$(p_l),rs/rspim) + $(call install_grs_lib,librscor,$(GRS_SONAME),$(2),$(p_l),rs/rscor) + $(call install_grs_lib,librsiso,$(GRS_SONAME),$(2),$(p_l),rs/rsiso) + $(call install_grs_lib,librslog,$(GRS_SONAME),$(2),$(p_l),rs/rslog) + $(call install_grs_lib,librsmin,$(GRS_SONAME),$(2),$(p_l),rs/rsmin) + + : # included in grs package + rm -f $(d_l)/$(grs_include_dir)/__entrypoint.di + + debian/dh_doclink -p$(p_l) \ + $(if $(filter yes,$(with_separate_grs)),$(p_grs),$(p_lbase)) + echo $(p_l) >> debian/$(lib_binaries) + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) +endef + +do_libgrs = $(call __do_libgrs,lib$(1)grs-$(GRS_SONAME),$(1)) +do_libgrs_dev = $(call __do_libgrs_dev,lib$(1)grs-$(BASE_VERSION)-dev,$(1)) + +# ---------------------------------------------------------------------- +$(binary_stamp)-grs-doc: $(build_html_stamp) $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_grsd) + dh_installdirs -p$(p_grsd) \ + $(docdir)/$(p_grs) \ + $(docdir)/$(p_xbase)/rs \ + $(PF)/share/info + cp -p $(builddir)/gcc/doc/rs.info $(d_grsd)/$(PF)/share/info/grs.info + cp -p html/grs.html $(d_grsd)/$(docdir)/$(p_xbase)/rs/ + ln -sf ../$(p_xbase)/rs/grs.html $(d_grsd)/$(docdir)/$(p_grs)/grs.html + + debian/dh_doclink -p$(p_grsd) $(p_xbase) + dh_installdocs -p$(p_grsd) + rm -f $(d_grsd)/$(docdir)/$(p_xbase)/copyright + + echo $(p_grsd) >> debian/indep_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) + + +$(binary_stamp)-libgrs: $(install_stamp) + $(call do_libgrs,) + +$(binary_stamp)-lib64grs: $(install_stamp) + $(call do_libgrs,64) + +$(binary_stamp)-lib32grs: $(install_stamp) + $(call do_libgrs,32) + +$(binary_stamp)-libn32grs: $(install_stamp) + $(call do_libgrs,n32) + +$(binary_stamp)-libx32grs: $(install_stamp) + $(call do_libgrs,x32) + +$(binary_stamp)-libhfgrs: $(install_stamp) + $(call do_libgrs,hf) + +$(binary_stamp)-libsfgrs: $(install_stamp) + $(call do_libgrs,sf) + + +$(binary_stamp)-libgrs-dev: $(install_stamp) + $(call do_libgrs_dev,) + +$(binary_stamp)-lib64grs-dev: $(install_stamp) + $(call do_libgrs_dev,64) + +$(binary_stamp)-lib32grs-dev: $(install_stamp) + $(call do_libgrs_dev,32) + +$(binary_stamp)-libx32grs-dev: $(install_stamp) + $(call do_libgrs_dev,x32) + +$(binary_stamp)-libn32grs-dev: $(install_stamp) + $(call do_libgrs_dev,n32) + +$(binary_stamp)-libhfgrs-dev: $(install_stamp) + $(call do_libgrs_dev,hf) + +$(binary_stamp)-libsfgrs-dev: $(install_stamp) + $(call do_libgrs_dev,sf) diff --git a/debian/rules.d/binary-snapshot.mk b/debian/rules.d/binary-snapshot.mk new file mode 100644 index 0000000..c8085e7 --- /dev/null +++ b/debian/rules.d/binary-snapshot.mk @@ -0,0 +1,209 @@ +arch_binaries := $(arch_binaries) snapshot + +ifneq (,$(findstring gcc-snapshot, $(PKGSOURCE))) + p_snap = gcc-snapshot +else + $(error unknown build for single gcc package) +endif + +ifeq ($(DEB_CROSS),yes) + p_snap := $(p_snap)$(cross_bin_arch) +endif +d_snap = debian/$(p_snap) + +dirs_snap = \ + $(docdir)/$(p_snap) \ + usr/lib + +ifeq ($(with_hppa64),yes) + snapshot_depends = $(binutils_hppa64), +endif +ifeq ($(with_offload_nvptx),yes) + snapshot_depends += nvptx-tools, +endif +ifeq ($(with_offload_gcn),yes) + ifeq ($(gcn_tools_llvm_version),tools) + snapshot_depends += amdgcn-tools, + else + snapshot_depends += llvm-$(gcn_tools_llvm_version), lld-$(gcn_tools_llvm_version), + endif +endif + +common_substvars += '-Vsnap:depends=$(snapshot_depends)' '-Vsnap:recommends=$(snapshot_recommends)' + +# ---------------------------------------------------------------------- +$(binary_stamp)-snapshot: $(install_snap_stamp) \ + $(if $(filter yes, $(with_offload_nvptx)), $(install_nvptx_stamp)) \ + $(if $(filter yes, $(with_offload_gcn)), $(install_gcn_stamp)) + dh_testdir + dh_testroot + mv $(install_snap_stamp) $(install_snap_stamp)-tmp + + rm -rf $(d_snap) + dh_installdirs -p$(p_snap) $(dirs_snap) + + mv $(d)/$(PF) $(d_snap)/usr/lib/ + + find $(d_snap) -name '*.gch' -type d | xargs -r rm -rf + find $(d_snap) -name '*.la' -o -name '*.lai' | xargs -r rm -f + + : # FIXME: libbacktrace is not installed by default + for d in . 32 n32 64 sf hf; do \ + if [ -f $(buildlibdir)/$$d/libbacktrace/.libs/libbacktrace.a ]; then \ + install -m644 $(buildlibdir)/$$d/libbacktrace/.libs/libbacktrace.a \ + $(d_snap)/$(gcc_lib_dir)/$$d; \ + fi; \ + done + if [ -f $(buildlibdir)/libbacktrace/backtrace-supported.h ]; then \ + install -m644 $(buildlibdir)/libbacktrace/backtrace-supported.h \ + $(d_snap)/$(gcc_lib_dir)/include/; \ + install -m644 $(srcdir)/libbacktrace/backtrace.h \ + $(d_snap)/$(gcc_lib_dir)/include/; \ + fi + + rm -rf $(d_snap)/$(PF)/lib/nof + +ifeq ($(with_ada),yes FIXME: apply our ada patches) + dh_link -p$(p_snap) \ + $(gcc_lib_dir)/rts-sjlj/adalib/libgnat.a \ + $(gcc_lib_dir)/rts-sjlj/adalib/libgnat-$(GNAT_VERSION).a + dh_link -p$(p_snap) \ + $(gcc_lib_dir)/rts-sjlj/adalib/libgnarl.a \ + $(gcc_lib_dir)/rts-sjlj/adalib/libgnarl-$(GNAT_VERSION).a + + set -e; \ + for lib in lib{gnat,gnarl}; do \ + vlib=$$lib-$(GNAT_SONAME); \ + mv $(d_snap)/$(gcc_lib_dir)/adalib/$$vlib.so.1 $(d_snap)/$(PF)/$(libdir)/. ; \ + rm -f $(d_snap)/$(gcc_lib_dir)/adalib/$$lib.so.1; \ + dh_link -p$(p_snap) \ + /$(PF)/$(libdir)/$$vlib.so.1 /$(PF)/$(libdir)/$$vlib.so \ + /$(PF)/$(libdir)/$$vlib.so.1 /$(PF)/$(libdir)/$$lib.so \ + /$(PF)/$(libdir)/$$vlib.so.1 /$(gcc_lib_dir)/rts-native/adalib/$$lib.so; \ + done +endif + ln -sf gcc $(d_snap)/$(PF)/bin/cc +ifeq ($(with_ada),yes) + ln -sf gcc $(d_snap)/$(PF)/bin/gnatgcc +endif +ifeq ($(with_fortran),yes) + ln -sf gfortran $(d_snap)/$(PF)/bin/f77 +endif + +ifeq ($(with_offload_nvptx),yes) + tar -c -C $(d)-nvptx -f - $(PF) \ + | tar x -C $(d_snap) -f - + + rm -f $(d_snap)/$(PF)/bin/*-lto-dump + rm -f $(d_snap)/$(PF)/share/man/man1/*-accel-nvptx-none-*.1 + + : # re-create the symlinks as relative symlinks + dh_link -p$(p_snap) \ + /usr/bin/nvptx-none-ar /$(gcc_lexec_dir)/accel/nvptx-none/ar \ + /usr/bin/nvptx-none-as /$(gcc_lexec_dir)/accel/nvptx-none/as \ + /usr/bin/nvptx-none-ld /$(gcc_lexec_dir)/accel/nvptx-none/ld \ + /usr/bin/nvptx-none-ranlib /$(gcc_lexec_dir)/accel/nvptx-none/ranlib +endif + +ifeq ($(with_offload_gcn),yes) + tar -c -C $(d)-gcn -f - $(PF) \ + | tar x -C $(d_snap) -f - + + ifeq ($(gcn_tools_llvm_version),tools) + : # re-create the symlinks as relative symlinks + dh_link -p$(p_snap) \ + /usr/$(gcn_target_name)/bin/ar /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ar \ + /usr/$(gcn_target_name)/bin/as /$(gcc_lexec_dir)/accel/$(gcn_target_name)/as \ + /usr/$(gcn_target_name)/bin/ld /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ld \ + /usr/$(gcn_target_name)/bin/nm /$(gcc_lexec_dir)/accel/$(gcn_target_name)/nm \ + /usr/$(gcn_target_name)/bin/ranlib /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ranlib + else + : # re-create the symlinks as relative symlinks + dh_link -p$(p_snap) \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-ar /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ar \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-mc /$(gcc_lexec_dir)/accel/$(gcn_target_name)/as \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/lld /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ld \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-nm /$(gcc_lexec_dir)/accel/$(gcn_target_name)/nm \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-ranlib /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ranlib + + : # FIXME: are these really needed? + dh_link -p$(p_snap) \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-ar /$(PF)/bin/$(gcn_target_name)-ar \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-mc /$(PF)/bin/$(gcn_target_name)-as \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/lld /$(PF)/bin/$(gcn_target_name)-ld \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-nm /$(PF)/bin/$(gcn_target_name)-nm \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-ranlib /$(PF)/bin/$(gcn_target_name)-ranlib + rm -f $(d_snap)/$(PF)/bin/*-lto-dump + rm -f $(d_snap)/$(PF)/share/man/man1/*-accel-$(gcn_target_name)-*.1 + endif +endif + +ifeq ($(with_hppa64),yes) + : # provide as and ld links + dh_link -p $(p_snap) \ + /usr/bin/hppa64-linux-gnu-as \ + /$(PF)/lib/gcc/hppa64-linux-gnu/$(versiondir)/as \ + /usr/bin/hppa64-linux-gnu-ld \ + /$(PF)/lib/gcc/hppa64-linux-gnu/$(versiondir)/ld +endif + +ifeq ($(with_check),yes) + dh_installdocs -p$(p_snap) test-summary + cd $(d_snap) && tar xvf ../../installed-testlogs.tar + mv $(d_snap)/usr/share/doc/gcc-base/* $(d_snap)/usr/share/doc/$(p_snap)/. + rm -rf $(d_snap)/usr/share/doc/gcc-base +else + dh_installdocs -p$(p_snap) +endif + + if [ -f $(buildlibdir)/libstdc++-v3/testsuite/current_symbols.txt ]; \ + then \ + cp -p $(buildlibdir)/libstdc++-v3/testsuite/current_symbols.txt \ + $(d_snap)/$(docdir)/$(p_snap)/libstdc++6_symbols.txt; \ + fi + cp -p debian/README.snapshot \ + $(d_snap)/$(docdir)/$(p_snap)/README.Debian + cp -p debian/README.Bugs \ + $(d_snap)/$(docdir)/$(p_snap)/ + dh_installchangelogs -p$(p_snap) +ifeq ($(DEB_TARGET_ARCH),hppa) +# dh_dwz -p$(p_snap) -Xdebug -X/cgo -Xbin/go -Xbin/gofmt \ +# $(if $(unstripped_exe),$(foreach i,cc1 cc1obj cc1objplus cc1plus cc1gm2 d21 f951 go1 lto1, -X/$(i))) + dh_strip -p$(p_snap) -Xdebug -X.o -X.a -X/cgo -Xbin/go -Xbin/gofmt \ + $(if $(unstripped_exe),$(foreach i,cc1 cc1obj cc1objplus cc1plus cc1gm2 d21 f951 go1 lto1, -X/$(i))) +else +# dh_dwz -p$(p_snap) -Xdebug -X/cgo -Xbin/go -Xbin/gofmt \ +# $(if $(unstripped_exe),$(foreach i,cc1 cc1obj cc1objplus cc1plus cc1gm2 d21 f951 go1 lto1, -X/$(i))) + dh_strip -p$(p_snap) -Xdebug -X/cgo -Xbin/go -Xbin/gofmt \ + -X/lib{c,g,m,gcc,gomp,gcov,gfortran,caf_single,ssp,ssp_nonshared}.a \ + $(if $(unstripped_exe),$(foreach i,cc1 cc1obj cc1objplus cc1plus cc1gm2 d21 f951 go1 lto1, -X/$(i))) +endif + + mkdir -p $(d_snap)/usr/share/lintian/overrides + cp -p debian/gcc-snapshot.overrides \ + $(d_snap)/usr/share/lintian/overrides/$(p_snap) + + ( \ + echo 'libgcc_s $(GCC_SONAME) ${p_snap} (>= $(DEB_EVERSION))'; \ + echo 'libobjc $(OBJC_SONAME) ${p_snap} (>= $(DEB_EVERSION))'; \ + echo 'libgfortran $(FORTRAN_SONAME) ${p_snap} (>= $(DEB_EVERSION))'; \ + echo 'libgo $(GO_SONAME) ${p_snap} (>= $(DEB_EVERSION))'; \ + echo 'libgomp $(GOMP_SONAME) ${p_snap} (>= $(DEB_EVERSION))'; \ + echo 'libgnat-$(GNAT_SONAME) 1 ${p_snap} (>= $(DEB_EVERSION))'; \ + echo 'libgnarl-$(GNAT_SONAME) 1 ${p_snap} (>= $(DEB_EVERSION))'; \ + ) > debian/shlibs.local + + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) \ + dh_shlibdeps -p$(p_snap) -l$(CURDIR)/$(d_snap)/$(PF)/lib:$(CURDIR)/$(d_snap)/$(PF)/$(if $(filter $(DEB_TARGET_ARCH),amd64 ppc64),lib32,lib64):/usr/$(DEB_TARGET_GNU_TYPE)/lib + -sed -i -e 's/$(p_snap)[^,]*, //g' debian/$(p_snap).substvars + +ifeq ($(with_multiarch_lib),yes) + : # paths needed for relative lookups from startfile_prefixes + for ma in $(xarch_multiarch_names); do \ + mkdir -p $(d_snap)/lib/$$ma; \ + mkdir -p $(d_snap)/usr/lib/$$ma; \ + done +endif + echo $(p_snap) >> debian/arch_binaries.epoch + + trap '' 1 2 3 15; touch $@; mv $(install_snap_stamp)-tmp $(install_snap_stamp) diff --git a/debian/rules.d/binary-softfloat.mk b/debian/rules.d/binary-softfloat.mk new file mode 100644 index 0000000..6badfcc --- /dev/null +++ b/debian/rules.d/binary-softfloat.mk @@ -0,0 +1,31 @@ +arch_binaries := $(arch_binaries) softfloat + +p_softfloat = gcc$(pkg_ver)-soft-float +d_softfloat = debian/$(p_softfloat) + +dirs_softfloat = \ + $(PFL)/$(libdir) \ + $(gcc_lib_dir) + +files_softfloat = \ + $(PFL)/$(libdir)/soft-float \ + $(gcc_lib_dir)/soft-float + +# ---------------------------------------------------------------------- +$(binary_stamp)-softfloat: $(install_stamp) + dh_testdir + dh_testroot + mv $(install_stamp) $(install_stamp)-tmp + + rm -rf $(d_softfloat) + dh_installdirs -p$(p_softfloat) $(dirs_softfloat) + $(dh_compat2) dh_movefiles -p$(p_softfloat) $(files_softfloat) + rm -rf $(d_softfloat)/$(PFL)/$(libdir)/soft-float/libssp.so* + mv $(d_softfloat)/$(PFL)/$(libdir)/soft-float/libssp.a \ + $(d_softfloat)/$(PFL)/$(libdir)/soft-float/libssp_nonshared.a + debian/dh_doclink -p$(p_softfloat) $(p_xbase) + dh_strip -p$(p_softfloat) + dh_shlibdeps -p$(p_softfloat) + echo $(p_softfloat) >> debian/arch_binaries + + trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp) diff --git a/debian/rules.d/binary-source.mk b/debian/rules.d/binary-source.mk new file mode 100644 index 0000000..9844826 --- /dev/null +++ b/debian/rules.d/binary-source.mk @@ -0,0 +1,54 @@ +indep_binaries := $(indep_binaries) gcc-source + +ifeq ($(BACKPORT),true) + p_source = gcc$(pkg_ver)-$(GCC_VERSION)-source +else + p_source = gcc$(pkg_ver)-source +endif +d_source= debian/$(p_source) + +$(binary_stamp)-gcc-source: $(install_stamp) + dh_testdir + dh_testroot + + dh_installdocs -p$(p_source) + dh_installchangelogs -p$(p_source) + + dh_install -p$(p_source) $(gcc_tarball) usr/src/gcc$(pkg_ver) +ifneq (,$(m2_tarball)) + dh_install -p$(p_source) $(m2_tarball) usr/src/gcc$(pkg_ver) +endif + tar cf - $$(find './debian' -mindepth 1 \( \ + -name .svn -prune -o \ + -path './debian/.debhelper' -prune -o \ + -path './debian/gcc-*' -type d -prune -o \ + -path './debian/cpp-*' -type d -prune -o \ + -path './debian/*fortran*' -type d -prune -o \ + -path './debian/lib*' -type d -prune -o \ + -path './debian/patches/*' -prune -o \ + -path './debian/tmp*' -prune -o \ + -path './debian/files' -prune -o \ + -path './debian/rules.d/*' -prune -o \ + -path './debian/rules.parameters' -prune -o \ + -path './debian/soname-cache' -prune -o \ + -path './debian/*substvars*' -prune -o \ + -path './debian/gcc-snapshot*' -prune -o \ + -path './debian/*[0-9]*.p*' -prune -o \ + -path './debian/*$(pkg_ver)[.-]*' -prune -o \ + -print \) ) \ + | tar -x -C $(d_source)/usr/src/gcc$(pkg_ver) -f - + # FIXME: Remove generated files + find $(d_source)/usr/src/gcc$(pkg_ver) -name '*.debhelper.log' -o -name .svn | xargs rm -rf + rm -f $(d_source)/usr/src/gcc$(pkg_ver)/debian/patches/series + + touch $(d_source)/usr/src/gcc$(pkg_ver)/debian/rules.parameters + + dh_link -p$(p_source) \ + /usr/src/gcc$(pkg_ver)/debian/patches /usr/src/gcc$(pkg_ver)/patches + + mkdir -p $(d_source)/usr/share/lintian/overrides + cp -p debian/$(p_source).overrides \ + $(d_source)/usr/share/lintian/overrides/$(p_source) + echo $(p_source) >> debian/indep_binaries + + touch $@ diff --git a/debian/rules.d/binary-toolchain.mk b/debian/rules.d/binary-toolchain.mk new file mode 100644 index 0000000..a19d68c --- /dev/null +++ b/debian/rules.d/binary-toolchain.mk @@ -0,0 +1,210 @@ +arch_binaries := $(arch_binaries) toolchain + +ifneq (,$(findstring gcc-toolchain, $(PKGSOURCE))) + p_tc = gcc-toolchain-$(BASE_VERSION) +else + $(error unknown build for single gcc package) +endif + +ifeq ($(DEB_CROSS),yes) + p_tc := $(p_tc)$(cross_bin_arch) +endif +d_tc = debian/$(p_tc) + +dirs_tc = \ + $(docdir)/$(p_tc) \ + usr/lib + +ifeq ($(with_hppa64),yes) + snapshot_depends = $(binutils_hppa64), +endif +ifeq ($(with_offload_nvptx),yes) + snapshot_depends += nvptx-tools, +endif +ifeq ($(with_offload_gcn),yes) + ifeq ($(gcn_tools_llvm_version),tools) + snapshot_depends += amdgcn-tools, + else + snapshot_depends += llvm-$(gcn_tools_llvm_version), lld-$(gcn_tools_llvm_version), + endif +endif + +common_substvars += '-Vsnap:depends=$(snapshot_depends)' '-Vsnap:recommends=$(snapshot_recommends)' + +# ---------------------------------------------------------------------- +$(binary_stamp)-toolchain: $(install_tc_stamp) \ + $(if $(filter yes, $(with_offload_nvptx)), $(install_nvptx_stamp)) \ + $(if $(filter yes, $(with_offload_gcn)), $(install_gcn_stamp)) + dh_testdir + dh_testroot + mv $(install_tc_stamp) $(install_tc_stamp)-tmp + + rm -rf $(d_tc) + dh_installdirs -p$(p_tc) $(dirs_tc) + + mv $(d)/$(PF) $(d_tc)/usr/lib/ + + find $(d_tc) -name '*.gch' -type d | xargs -r rm -rf + find $(d_tc) -name '*.la' -o -name '*.lai' | xargs -r rm -f + + : # FIXME: libbacktrace is not installed by default + for d in . 32 n32 64 sf hf; do \ + if [ -f $(buildlibdir)/$$d/libbacktrace/.libs/libbacktrace.a ]; then \ + install -m644 $(buildlibdir)/$$d/libbacktrace/.libs/libbacktrace.a \ + $(d_tc)/$(gcc_lib_dir)/$$d; \ + fi; \ + done + if [ -f $(buildlibdir)/libbacktrace/backtrace-supported.h ]; then \ + install -m644 $(buildlibdir)/libbacktrace/backtrace-supported.h \ + $(d_tc)/$(gcc_lib_dir)/include/; \ + install -m644 $(srcdir)/libbacktrace/backtrace.h \ + $(d_tc)/$(gcc_lib_dir)/include/; \ + fi + + rm -rf $(d_tc)/$(PF)/lib/nof + +ifeq ($(with_ada),yes FIXME: apply our ada patches) + dh_link -p$(p_tc) \ + $(gcc_lib_dir)/rts-sjlj/adalib/libgnat.a \ + $(gcc_lib_dir)/rts-sjlj/adalib/libgnat-$(GNAT_VERSION).a + dh_link -p$(p_tc) \ + $(gcc_lib_dir)/rts-sjlj/adalib/libgnarl.a \ + $(gcc_lib_dir)/rts-sjlj/adalib/libgnarl-$(GNAT_VERSION).a + + set -e; \ + for lib in lib{gnat,gnarl}; do \ + vlib=$$lib-$(GNAT_SONAME); \ + mv $(d_tc)/$(gcc_lib_dir)/adalib/$$vlib.so.1 $(d_tc)/$(PF)/$(libdir)/. ; \ + rm -f $(d_tc)/$(gcc_lib_dir)/adalib/$$lib.so.1; \ + dh_link -p$(p_tc) \ + /$(PF)/$(libdir)/$$vlib.so.1 /$(PF)/$(libdir)/$$vlib.so \ + /$(PF)/$(libdir)/$$vlib.so.1 /$(PF)/$(libdir)/$$lib.so \ + /$(PF)/$(libdir)/$$vlib.so.1 /$(gcc_lib_dir)/rts-native/adalib/$$lib.so; \ + done +endif + ln -sf gcc $(d_tc)/$(PF)/bin/cc +ifeq ($(with_ada),yes) + ln -sf gcc $(d_tc)/$(PF)/bin/gnatgcc +endif +ifeq ($(with_fortran),yes) + ln -sf gfortran $(d_tc)/$(PF)/bin/f77 +endif + +ifeq ($(with_offload_nvptx),yes) + tar -c -C $(d)-nvptx -f - $(PF) \ + | tar x -C $(d_tc) -f - + + rm -f $(d_tc)/$(PF)/bin/*-lto-dump + rm -f $(d_tc)/$(PF)/share/man/man1/*-accel-nvptx-none-*.1 + + : # re-create the symlinks as relative symlinks + dh_link -p$(p_tc) \ + /usr/bin/nvptx-none-ar /$(gcc_lexec_dir)/accel/nvptx-none/ar \ + /usr/bin/nvptx-none-as /$(gcc_lexec_dir)/accel/nvptx-none/as \ + /usr/bin/nvptx-none-ld /$(gcc_lexec_dir)/accel/nvptx-none/ld \ + /usr/bin/nvptx-none-ranlib /$(gcc_lexec_dir)/accel/nvptx-none/ranlib +endif + +ifeq ($(with_offload_gcn),yes) + tar -c -C $(d)-gcn -f - $(PF) \ + | tar x -C $(d_tc) -f - + + ifeq ($(gcn_tools_llvm_version),tools) + : # re-create the symlinks as relative symlinks + dh_link -p$(p_tc) \ + /usr/$(gcn_target_name)/bin/ar /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ar \ + /usr/$(gcn_target_name)/bin/as /$(gcc_lexec_dir)/accel/$(gcn_target_name)/as \ + /usr/$(gcn_target_name)/bin/ld /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ld \ + /usr/$(gcn_target_name)/bin/nm /$(gcc_lexec_dir)/accel/$(gcn_target_name)/nm \ + /usr/$(gcn_target_name)/bin/ranlib /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ranlib + else + : # re-create the symlinks as relative symlinks + dh_link -p$(p_tc) \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-ar /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ar \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-mc /$(gcc_lexec_dir)/accel/$(gcn_target_name)/as \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/lld /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ld \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-nm /$(gcc_lexec_dir)/accel/$(gcn_target_name)/nm \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-ranlib /$(gcc_lexec_dir)/accel/$(gcn_target_name)/ranlib + + : # FIXME: are these really needed? + dh_link -p$(p_tc) \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-ar /$(PF)/bin/$(gcn_target_name)-ar \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-mc /$(PF)/bin/$(gcn_target_name)-as \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/lld /$(PF)/bin/$(gcn_target_name)-ld \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-nm /$(PF)/bin/$(gcn_target_name)-nm \ + /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-ranlib /$(PF)/bin/$(gcn_target_name)-ranlib + rm -f $(d_tc)/$(PF)/bin/*-lto-dump + rm -f $(d_tc)/$(PF)/share/man/man1/*-accel-$(gcn_target_name)-*.1 + endif +endif + +ifeq ($(with_hppa64),yes) + : # provide as and ld links + dh_link -p $(p_tc) \ + /usr/bin/hppa64-linux-gnu-as \ + /$(PF)/lib/gcc/hppa64-linux-gnu/$(versiondir)/as \ + /usr/bin/hppa64-linux-gnu-ld \ + /$(PF)/lib/gcc/hppa64-linux-gnu/$(versiondir)/ld +endif + +ifeq ($(with_check),yes) + dh_installdocs -p$(p_tc) test-summary + cd $(d_tc) && tar xvf ../../installed-testlogs.tar + mv $(d_tc)/usr/share/doc/gcc-base/* $(d_tc)/usr/share/doc/$(p_tc)/. + rm -rf $(d_tc)/usr/share/doc/gcc-base +else + dh_installdocs -p$(p_tc) +endif + cp $(binutils_srcdir)/debian/copyright $(d_tc)/usr/share/doc/copyright.binutils + + if [ -f $(buildlibdir)/libstdc++-v3/testsuite/current_symbols.txt ]; \ + then \ + cp -p $(buildlibdir)/libstdc++-v3/testsuite/current_symbols.txt \ + $(d_tc)/$(docdir)/$(p_tc)/libstdc++6_symbols.txt; \ + fi + cp -p debian/README.snapshot \ + $(d_tc)/$(docdir)/$(p_tc)/README.Debian + cp -p debian/README.Bugs \ + $(d_tc)/$(docdir)/$(p_tc)/ + dh_installchangelogs -p$(p_tc) +ifeq ($(DEB_TARGET_ARCH),hppa) +# dh_dwz -p$(p_tc) -Xdebug -X/cgo -Xbin/go -Xbin/gofmt \ +# $(if $(unstripped_exe),$(foreach i,cc1 cc1obj cc1objplus cc1plus cc1gm2 d21 f951 go1 lto1, -X/$(i))) + dh_strip -p$(p_tc) -Xdebug -X.o -X.a -X/cgo -Xbin/go -Xbin/gofmt \ + $(if $(unstripped_exe),$(foreach i,cc1 cc1obj cc1objplus cc1plus cc1gm2 d21 f951 go1 lto1, -X/$(i))) +else +# dh_dwz -p$(p_tc) -Xdebug -X/cgo -Xbin/go -Xbin/gofmt \ +# $(if $(unstripped_exe),$(foreach i,cc1 cc1obj cc1objplus cc1plus cc1gm2 d21 f951 go1 lto1, -X/$(i))) + dh_strip -p$(p_tc) -Xdebug -X/cgo -Xbin/go -Xbin/gofmt \ + -X/lib{c,g,m,gcc,gomp,gcov,gfortran,caf_single,ssp,ssp_nonshared}.a \ + $(if $(unstripped_exe),$(foreach i,cc1 cc1obj cc1objplus cc1plus cc1gm2 d21 f951 go1 lto1, -X/$(i))) +endif + + mkdir -p $(d_tc)/usr/share/lintian/overrides + cp -p debian/gcc-snapshot.overrides \ + $(d_tc)/usr/share/lintian/overrides/$(p_tc) + + ( \ + echo 'libgcc_s $(GCC_SONAME) ${p_tc} (>= $(DEB_EVERSION))'; \ + echo 'libobjc $(OBJC_SONAME) ${p_tc} (>= $(DEB_EVERSION))'; \ + echo 'libgfortran $(FORTRAN_SONAME) ${p_tc} (>= $(DEB_EVERSION))'; \ + echo 'libgo $(GO_SONAME) ${p_tc} (>= $(DEB_EVERSION))'; \ + echo 'libgomp $(GOMP_SONAME) ${p_tc} (>= $(DEB_EVERSION))'; \ + echo 'libgnat-$(GNAT_SONAME) 1 ${p_tc} (>= $(DEB_EVERSION))'; \ + echo 'libgnarl-$(GNAT_SONAME) 1 ${p_tc} (>= $(DEB_EVERSION))'; \ + ) > debian/shlibs.local + + $(ignshld)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) \ + dh_shlibdeps -p$(p_tc) -l$(CURDIR)/$(d_tc)/$(PF)/lib:$(CURDIR)/$(d_tc)/$(PF)/$(if $(filter $(DEB_TARGET_ARCH),amd64 ppc64),lib32,lib64):/usr/$(DEB_TARGET_GNU_TYPE)/lib + -sed -i -e 's/$(p_tc)[^,]*, //g' debian/$(p_tc).substvars + +ifeq ($(with_multiarch_lib),yes) + : # paths needed for relative lookups from startfile_prefixes + for ma in $(xarch_multiarch_names); do \ + mkdir -p $(d_tc)/lib/$$ma; \ + mkdir -p $(d_tc)/usr/lib/$$ma; \ + done +endif + echo $(p_tc) >> debian/arch_binaries.epoch + + trap '' 1 2 3 15; touch $@; mv $(install_tc_stamp)-tmp $(install_tc_stamp) diff --git a/debian/rules.defs b/debian/rules.defs new file mode 100644 index 0000000..48a89f9 --- /dev/null +++ b/debian/rules.defs @@ -0,0 +1,2334 @@ +# -*- makefile -*- +# definitions used in more than one Makefile / rules file + +# common vars +SHELL = /bin/bash -e # brace expansion used in rules file +srcdir = $(CURDIR)/src +builddir = $(CURDIR)/build +builddir_jit = $(CURDIR)/build-jit +builddir_nvptx = $(CURDIR)/build-nvptx +builddir_gcn = $(CURDIR)/build-gcn +builddir_hppa64 = $(CURDIR)/build-hppa64 +stampdir = stamps + +distribution := $(shell lsb_release -is) +distrelease := $(shell lsb_release -cs) +derivative := $(shell if dpkg-vendor --derives-from Ubuntu; then echo Ubuntu; \ + elif dpkg-vendor --derives-from Debian; then echo Debian; \ + else echo Unknown; fi) + +# On non official archives, "lsb_release -cs" default to "n/a". Assume +# sid in that case +ifeq ($(distrelease),n/a) +distrelease := sid +endif + +on_buildd := $(shell [ -f /CurrentlyBuilding -o "$$LOGNAME" = buildd ] && echo yes) + +# creates {srcdir,builddir}_hppa64 +$(foreach x,srcdir builddir,$(foreach target,hppa64,$(eval \ + $(x)_$(target) := $($(x))-$(target)))) + +# for architecture dependent variables and changelog vars +vafilt = $(subst $(2)=,,$(filter $(2)=%,$(1))) +# for rules.sonames +vafilt_defined = 1 + +dpkg_target_vars := $(shell (dpkg-architecture | grep -q DEB_TARGET) && echo yes) +ifeq ($(dpkg_target_vars),yes) + DEB_TARGET_ARCH= + DEB_TARGET_ARCH_BITS= + DEB_TARGET_ARCH_CPU= + DEB_TARGET_ARCH_ENDIAN= + DEB_TARGET_ARCH_OS= + DEB_TARGET_GNU_CPU= + DEB_TARGET_GNU_SYSTEM= + DEB_TARGET_GNU_TYPE= + DEB_TARGET_MULTIARCH= +endif + +DPKG_VARS := $(shell dpkg-architecture) +ifeq ($(dpkg_target_vars),yes) + DPKG_VARS := $(filter-out DEB_TARGET_%, $(DPKG_VARS)) +endif +DEB_BUILD_ARCH ?= $(call vafilt,$(DPKG_VARS),DEB_BUILD_ARCH) +DEB_BUILD_GNU_TYPE ?= $(call vafilt,$(DPKG_VARS),DEB_BUILD_GNU_TYPE) +DEB_BUILD_MULTIARCH ?= $(call vafilt,$(DPKG_VARS),DEB_BUILD_MULTIARCH) +DEB_HOST_ARCH ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH) +DEB_HOST_GNU_CPU ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_CPU) +DEB_HOST_GNU_SYSTEM ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_SYSTEM) +DEB_HOST_GNU_TYPE ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_TYPE) +DEB_HOST_MULTIARCH ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_MULTIARCH) + +ifeq ($(derivative),Ubuntu) + ifeq (,$(filter $(distrelease), precise trusty)) + ifeq ($(DEB_BUILD_GNU_TYPE),i486-linux-gnu) + DEB_BUILD_GNU_TYPE = i686-linux-gnu + endif + ifeq ($(DEB_HOST_GNU_TYPE),i486-linux-gnu) + DEB_HOST_GNU_TYPE = i686-linux-gnu + endif + endif +else + ifneq (,$(filter $(distrelease),jessie)) + ifeq ($(DEB_HOST_GNU_TYPE),i486-linux-gnu) + DEB_HOST_GNU_TYPE = i586-linux-gnu + endif + else + # stretch and newer ... + DEB_BUILD_GNU_TYPE := $(subst i586,i686,$(DEB_BUILD_GNU_TYPE)) + DEB_HOST_GNU_TYPE := $(subst i586,i686,$(DEB_HOST_GNU_TYPE)) + endif +endif + +CHANGELOG_VARS := $(shell dpkg-parsechangelog | \ + sed -n 's/ /_/g;/^[^_]/s/^\([^:]*\):_\(.*\)/\1=\2/p') + +# the name of the source package +PKGSOURCE := $(call vafilt,$(CHANGELOG_VARS),Source) +# those are required here too +SOURCE_VERSION := $(call vafilt,$(CHANGELOG_VARS),Version) +DEB_VERSION := $(strip $(shell echo $(SOURCE_VERSION) | \ + sed -e 's/.*://' -e 's/ds[0-9][0-9]*//')) +# epoch used for gcc versions up to 3.3.x, now used for some remaining +# libraries: libgcc1, libobjc1 +EPOCH := 1 +DEB_EVERSION := $(EPOCH):$(DEB_VERSION) +BASE_VERSION := $(shell echo $(DEB_VERSION) | sed -e 's/\([0-9][0-9]*\).*-.*/\1/') + +NJOBS := +USE_CPUS := 1 +ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS)))) + USE_CPUS := $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS)))) + NJOBS := -j $(USE_CPUS) + NJOBS_TESTS := -j $(USE_CPUS) +endif + +CPUS_LTOLINK := $(if $(filter 1, $(USE_CPUS)),1,$(shell expr $(USE_CPUS) / 2)) +ifeq ($(derivative)-$(DEB_BUILD_ARCH),Ubuntu-ppc64el) + CPUS_LTOLINK := 1 +else ifeq ($(derivative)-$(DEB_BUILD_ARCH),Debian-sparc64) + CPUS_LTOLINK := $(shell if test $(CPUS_LTOLINK) -gt 4; then echo 4; else echo $(CPUS_LTOLINK); fi) +endif + +ifneq (,$(findstring gcc-snapshot, $(PKGSOURCE))) + single_package = yes + trunk_build = yes +else ifneq (,$(findstring gcc-toolchain, $(PKGSOURCE))) + single_package = yes + with_binutils = yes +else + # --program-suffix=-$(BASE_VERSION) + versioned_packages := yes +endif + +# push glibc stack traces into stderr +export LIBC_FATAL_STDERR_=1 + +# --------------------------------------------------------------------------- +# set target +# - GNU triplet via DEB_TARGET_GNU_TYPE +# - Debian arch in debian/target +# - Debian arch via DEB_GCC_TARGET or GCC_TARGET +# +# alias +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) +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 +ifeq ($(dpkg_target_vars),yes) + TARGET_VARS := $(filter-out DEB_TARGET_%, $(TARGET_VARS)) +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) +DEB_TARGET_ARCH_ABI := $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_ABI) +DEB_TARGET_ARCH_BITS := $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_BITS) +DEB_TARGET_ARCH_ENDIAN := $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_ENDIAN) +DEB_TARGET_ARCH_LIBC := $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_LIBC) +export DEB_TARGET_ARCH DEB_TARGET_ARCH_ABI DEB_TARGET_ARCH_BITS \ + DEB_TARGET_ARCH_CPU DEB_TARGET_ARCH_OS DEB_TARGET_ARCH_ENDIAN \ + DEB_TARGET_ARCH_LIBC DEB_TARGET_GNU_CPU DEB_TARGET_GNU_TYPE \ + DEB_TARGET_GNU_SYSTEM DEB_TARGET_MULTIARCH + +ifneq (,$(filter $(distrelease),stretch)) + DEB_TARGET_GNU_TYPE := $(subst i586,i686,$(DEB_TARGET_GNU_TYPE)) + i586_symlinks = $(if $(findstring i686,$(DEB_TARGET_GNU_TYPE)),yes) +endif + +ifeq ($(DEB_TARGET_ARCH),) + $(error Invalid architecure.) +endif + +# Force this, people get confused about the default. See #760770. +override with_deps_on_target_arch_pkgs := + +# including unversiond symlinks for binaries +#with_unversioned = yes + +# --------------------------------------------------------------------------- +# cross-compiler config +ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) + ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_TARGET_GNU_TYPE)) + # cross building a cross compiler, untested. + DEB_CROSS = yes + build_type = cross-build-cross + else + # cross building the native compiler + build_type = cross-build-native + endif +else + ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_TARGET_GNU_TYPE)) + # cross compiler, sets WITH_SYSROOT on it's own + DEB_CROSS = yes + build_type = build-cross + else ifeq ($(FORCE_CROSS_LAYOUT),yes) + # a native build with a cross layout + DEB_CROSS = yes + build_type = build-cross + else + # native build + build_type = build-native + endif +endif + +# --------------------------------------------------------------------------- +# cross compiler support +ifeq ($(DEB_CROSS),yes) + # TARGET: Alias to DEB_TARGET_ARCH (Debian arch name) + # TP: Target Prefix. Used primarily as a prefix for cross tool + # names (e.g. powerpc-linux-gcc). + # TS: Target Suffix. Used primarily at the end of cross compiler + # package names (e.g. gcc-powerpc). + # LS: Library Suffix. Used primarily at the end of cross compiler + # library package names (e.g. libgcc-powerpc-cross). + # AQ: Arch Qualifier. Used for cross-arch dependencies + DEB_TARGET_ALIAS ?= $(DEB_TARGET_GNU_TYPE) + TARGET := $(DEB_TARGET_ARCH) + TP := $(subst _,-,$(DEB_TARGET_GNU_TYPE))- + TS := -$(subst _,-,$(DEB_TARGET_ALIAS)) + LS := -$(subst _,-,$(DEB_TARGET_ARCH))-cross + AQ := + + cross_bin_arch := -$(subst _,-,$(DEB_TARGET_ALIAS)) + cross_lib_arch := -$(subst _,-,$(DEB_TARGET_ARCH))-cross + cmd_prefix := $(DEB_TARGET_GNU_TYPE)- + + TARGET_ALIAS := $(DEB_TARGET_ALIAS) + + lib_binaries := indep_binaries + cross_shlibdeps = DEB_HOST_ARCH=$(TARGET) ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" + cross_gencontrol = DEB_HOST_ARCH=$(TARGET) + cross_makeshlibs = DEB_HOST_ARCH=$(TARGET) + cross_clean = DEB_HOST_ARCH=$(TARGET) +else + TARGET_ALIAS := $(DEB_TARGET_GNU_TYPE) + + ifeq ($(TARGET_ALIAS),i386-gnu) + TARGET_ALIAS := i586-gnu + endif + + ifeq ($(single_package),yes) + cmd_prefix := + unprefixed_names := + else + cmd_prefix := $(DEB_TARGET_GNU_TYPE)- + unprefixed_names := yes + endif + + #ifeq ($(TARGET_ALIAS),i486-linux-gnu) + # TARGET_ALIAS := i686-linux-gnu + #endif + + TARGET_ALIAS := $(subst i386,i486,$(TARGET_ALIAS)) + + # configure as linux-gnu, not linux + #ifeq ($(findstring linux,$(TARGET_ALIAS))/$(findstring linux-gnu,$(TARGET_ALIAS)),linux/) + # TARGET_ALIAS := $(TARGET_ALIAS)-gnu + #endif + + # configure as linux, not linux-gnu + #TARGET_ALIAS := $(subst linux-gnu,linux,$(TARGET_ALIAS)) + + lib_binaries := arch_binaries + cross_shlibdeps := + cross_gencontrol := + cross_makeshlibs := + # FIXME: Ignore missing symbols for a first build ... + cross_makeshlibs := - + cross_clean := +endif + +printarch: + @echo DEB_TARGET_ARCH: $(DEB_TARGET_ARCH) + @echo DEB_TARGET_ARCH_OS: $(DEB_TARGET_ARCH_OS) + @echo DEB_TARGET_ARCH_CPU: $(DEB_TARGET_ARCH_CPU) + @echo DEB_TARGET_GNU_SYSTEM: $(DEB_TARGET_GNU_SYSTEM) + @echo DEB_TARGET_MULTIARCH: $(DEB_TARGET_MULTIARCH) + @echo MULTIARCH_CONFARG: $(MULTIARCH_CONFARG) + @echo TARGET_ALIAS: $(TARGET_ALIAS) + @echo TP: $(TP) + @echo TS: $(TS) + +# reaching the 50GB limit ... +ifeq ($(derivative)-$(build_type),Ubuntu-build-native) + ifneq (,$(filter $(DEB_HOST_ARCH),amd64)) + save_disk_space = yes + endif +endif + +# ------------------------------------------------------------------- +# bootstrap options +ifdef WITH_BOOTSTRAP + # "yes" is the default and causes a 3-stage bootstrap. + # "off" runs a complete build with --disable-bootstrap + # "no" means to just build the first stage, and not create the stage1 + # directory. + # "lean" means a lean 3-stage bootstrap, i.e. delete each stage when no + # longer needed. + with_bootstrap = $(WITH_BOOTSTRAP) +endif + +# gcc-snapshot ... +ifeq ($(trunk_build),yes) + ifeq ($(build_type),build-native) + ifneq (,$(filter $(DEB_HOST_ARCH), amd64 i386 armhf arm64 powerpc ppc64 ppc64el riscv64 s390x sparc64)) + with_bootstrap := profiled + endif + endif + + # Enable LTO only for 64bit builds + ifeq ($(DEB_BUILD_ARCH_BITS)-$(DEB_HOST_ARCH_BITS),64-64) + with_lto_build := yes + endif + + # FIXME, disable LTO build for some archs + ifneq (,$(filter $(DEB_HOST_ARCH), alpha ia64 mips64el hurd-amd64)) + with_lto_build := yes + endif +endif + +ifneq ($(trunk_build),yes) + ifeq ($(build_type),build-native) + ifeq (,$(DEB_STAGE)) + ifeq (,$(filter $(distrelease), jessie stretch precise trusty xenial bionic)) + ifneq (,$(filter $(DEB_HOST_ARCH), amd64 i386 armhf arm64 powerpc ppc64 ppc64el s390x sparc64)) + with_bootstrap := profiled + endif + endif + endif + endif + + # Enable LTO only for 64bit builds + ifeq ($(DEB_BUILD_ARCH_BITS)-$(DEB_HOST_ARCH_BITS),64-64) + with_lto_build := yes + endif + + # FIXME: hppa has issues with parsing the jobs output. + # FIXME: m68k and sh4 running on simulators, don't care ... + # FIXME: buildds not powerful ebough: mips* + # FIXME: just let it build, takes too long: hurd-amd64 hurd-i386 + # FIXME: not yet tried to build: alpha + # FIXME: ia64, see https://gcc.gnu.org/PR98504 + # FIXME: mips64el requested by syq + ifneq (,$(filter $(DEB_HOST_ARCH), alpha hppa ia64 m68k mips mipsel mips64el sh4 sparc64 hurd-amd64 hurd-i386)) + with_lto_build := + endif + + # FIXME: newer binutils needed? + ifneq (,$(filter $(distrelease),stretch precise trusty xenial bionic focal)) + with_bootstrap := + with_lto_build := + endif + #with_bootstrap := + #with_lto_build := +endif + +#with_lto_build := disabled for GCC 13 + +ifneq ($(findstring nostrap, $(DEB_BUILD_OPTIONS)),) + with_bootstrap := off +endif + +ifneq ($(findstring nolto, $(DEB_BUILD_OPTIONS)),) + with_lto_build := +endif + +ifneq ($(findstring nopgo, $(DEB_BUILD_OPTIONS)),) + ifeq ($(with_bootstrap),profiled) + with_bootstrap := + endif +endif + +ifneq ($(findstring gccdebug, $(DEB_BUILD_OPTIONS)),) + with_bootstrap := off + with_lto_build := + DEB_BUILD_OPTIONS := $(DEB_BUILD_OPTIONS) nostrip + export DEB_BUILD_OPTIONS +endif + +ifeq ($(build_type),build-native) + usage_stats = yes + ifeq ($(derivative),Ubuntu) + no_usage_archs = i386 + else ifeq ($(derivative),Debian) + no_usage_archs = alpha hppa ia64 m68k mipsel mips64el sh4 sparc64 x32 \ + hurd-amd64 hurd-i386 kfreebsd-amd64 kfreebsd-i386 + endif + ifneq (,$(filter $(DEB_HOST_ARCH),$(no_usage_archs))) + usage_stats = + endif +endif +usage_stats = disabled for release builds + +# ------------------------------------------------------------------- +# stage options +ifdef DEB_STAGE + with_cdev := yes + separate_lang := yes + # "stage1" is minimal compiler with static libgcc + # "stage2" is minimal compiler with shared libgcc + # "rtlibs" is a subset of target libraries, without compilers + ifeq ($(DEB_STAGE),stage1) + with_shared_libgcc := no + endif + ifeq ($(DEB_STAGE),stage2) + with_libgcc := yes + with_shared_libgcc := yes + endif + ifeq ($(DEB_STAGE),rtlibs) + with_rtlibs := libgcc libgomp libstdc++ libgfortran libquadmath + ifeq ($(DEB_CROSS),yes) + LS := + TS := + cross_lib_arch := + endif + endif +endif + +ifeq ($(BACKPORT),true) + with_dev := no + with_source := yes + with_base_only := yes +endif + +# ------------------------------------------------------------------- +# sysroot options +ifdef WITH_SYSROOT + with_sysroot = $(WITH_SYSROOT) +endif +ifdef WITH_BUILD_SYSROOT + with_build_sysroot = $(WITH_BUILD_SYSROOT) +endif + +# ------------------------------------------------------------------- +# for components configuration + +COMMA = , +SPACE = $(EMPTY) $(EMPTY) + +# lang= overwrites all of nolang=, overwrites all of WITHOUT_LANG + +DEB_LANG_OPT := $(filter lang=%,$(DEB_BUILD_OPTIONS)) +DEB_LANG := $(strip $(subst $(COMMA), ,$(patsubst lang=%,%,$(DEB_LANG_OPT)))) +DEB_NOLANG_OPT := $(filter nolang=%,$(DEB_BUILD_OPTIONS)) +DEB_NOLANG := $(strip $(subst $(COMMA), ,$(patsubst nolang=%,%,$(DEB_NOLANG_OPT)))) +lfilt = $(strip $(if $(DEB_LANG), \ + $(if $(filter $(1) $(2),$(DEB_LANG)),yes),$(3))) +nlfilt = $(strip $(if $(DEB_NOLANG), \ + $(if $(filter $(1) $(2),$(DEB_NOLANG)),disabled by $(DEB_NOLANG_OPT),$(3)))) +wlfilt = $(strip $(if $(filter $(1) $(2), $(subst $(COMMA), ,$(WITHOUT_LANG))), \ + disabled by WITHOUT_LANG=$(WITHOUT_LANG),$(3))) +envfilt = $(strip $(or $(call lfilt,$(1),$(2)),$(call nlfilt,$(1),$(3)),$(call wlfilt,$(1),$(3)),$(4))) + +# ------------------------------------------------------------------- +# architecture specific config + +ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 arm64 i386 ppc64 ppc64el s390x x32)) + with_async_unwind = yes +endif + +ifeq ($(derivative),Ubuntu) + ifeq (,$(filter $(distrelease),precise trusty xenial bionic)) + ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 arm64 i386 ppc64 ppc64el s390x x32)) + with_stack_clash := yes + endif + endif + ifeq (,$(filter $(distrelease),precise trusty xenial bionic)) + ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 i386 x32)) + with_cf_protection := yes + endif + endif +endif + +ifeq ($(DEB_TARGET_ARCH),armhf) + ifeq ($(distribution),Raspbian) + with_arm_thumb := no + else + with_arm_thumb := yes + endif +else + ifeq ($(derivative)-$(DEB_TARGET_ARCH),Ubuntu-armel) + ifneq (,$(filter $(distrelease), precise)) + with_arm_thumb := yes + endif + endif +endif + +# build using fsf or the ibm branch +ifeq ($(distribution),Ubuntu) + ifneq (,$(findstring $(DEB_TARGET_ARCH),ppc64el)) + #with_ibm_branch = yes + endif +endif + +ifneq (,$(findstring gcc-snapshot, $(PKGSOURCE))) + with_ibm_branch = +endif + +# check if we're building for armel or armhf +ifneq (,$(filter %eabihf,$(DEB_TARGET_GNU_SYSTEM))) + float_abi := hard +else ifneq (,$(filter $(distribution)-$(DEB_TARGET_ARCH), Ubuntu-armel)) + ifneq (,$(filter $(distrelease), precise)) + float_abi := softfp + else + float_abi := soft + endif +else ifneq (,$(filter $(DEB_TARGET_ARCH), arm armel)) + float_abi := soft +endif + +# ------------------------------------------------------------------- +# basic config + +# allows to wrote backtraces for ICEs +unstripped_exe = +#ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 armel armhf arm64 mipsel mips64el ppc64el s390x)) +# unstripped_exe = yes +#endif + +# common things --------------- +# build common packages, where package names don't differ in different +# gcc versions (fixincludes, ...) +with_common_pkgs := yes +# ... and some libraries, which do not change (libgcc1, libssp0). +with_common_libs := yes +# XXX: should with_common_libs be "yes" only if this is the default compiler +# version on the targeted arch? + +# build -dbg packages (with_dbg is empty when -dbg package are not built) +ifneq (,$(filter $(distrelease), jessie stretch buster precise trusty xenial bionic)) + with_dbg = yes +else + ifeq ($(derivative),Ubuntu) + v_dbg = 9.2.1-21ubuntu1 + else ifeq ($(derivative),Debian) + v_dbg = 9.2.1-21 + else + $(error unknown version for -dbgsym package migration) + endif +endif + +# is this a multiarch-enabled build? +#ifneq (,$(filter $(distrelease), FIXME when removing multilib)) + with_multiarch_lib := yes +#endif + +ifeq ($(with_multiarch_lib),yes) + ifneq ($(single_package),yes) + ifneq ($(DEB_CROSS),yes) + with_multiarch_cxxheaders := yes + endif + endif +endif + +multiarch_stage1 := yes + +MIPS_R6_ENABLED = no +ifeq (,$(filter $(distrelease), jessie precise trusty xenial)) + MIPS_R6_ENABLED = yes +endif + +# mapping for the non-default biarch multilib / multiarch names +multiarch_xarch_map = \ + amd64=i386-linux-gnu,x86_64-linux-gnux32 \ + armel=arm-linux-gnueabi \ + armhf=arm-linux-gnueabihf \ + i386=x86_64-linux-gnu,x86_64-linux-gnux32 \ + powerpc=powerpc64-linux-gnu \ + ppc64=powerpc-linux-gnu \ + sparc=sparc64-linux-gnu \ + sparc64=sparc-linux-gnu \ + s390=s390x-linux-gnu \ + s390x=s390-linux-gnu \ + mips=mips64-linux-gnuabin32,mips64-linux-gnuabi64 \ + mipsel=mips64el-linux-gnuabin32,mips64el-linux-gnuabi64 \ + mipsn32=mips-linux-gnu,mips64-linux-gnuabi64 \ + mipsn32el=mipsel-linux-gnu,mips64el-linux-gnuabi64 \ + mips64=mips-linux-gnu,mips64-linux-gnuabin32 \ + mips64el=mipsel-linux-gnu,mips64el-linux-gnuabin32 \ + mipsr6=mipsisa64r6-linux-gnuabin32,mipsisa64r6-linux-gnuabi64 \ + mipsr6el=mipsisa64r6el-linux-gnuabin32,mipsisa64r6el-linux-gnuabi64 \ + mipsn32r6=mipsisa32r6-linux-gnu,mipsisa64r6-linux-gnuabi64 \ + mipsn32r6el=mipsisa32r6el-linux-gnu,mipsisa64r6el-linux-gnuabi64 \ + mips64r6=mipsisa32r6-linux-gnu,mipsisa64r6-linux-gnuabin32 \ + mips64r6el=mipsisa32r6el-linux-gnu,mipsisa64r6el-linux-gnuabin32 \ + x32=x86_64-linux-gnu,i386-linux-gnu \ + kfreebsd-amd64=i386-kfreebsd-gnu +xarch_multiarch_names = $(subst $(COMMA),$(SPACE),$(patsubst $(DEB_TARGET_ARCH)=%,%, \ + $(filter $(DEB_TARGET_ARCH)=%,$(multiarch_xarch_map)))) + +multilib_multiarch_map = \ + $(DEB_TARGET_ARCH)/=$(DEB_TARGET_MULTIARCH) \ + amd64/32=i386-linux-gnu \ + amd64/x32=x86_64-linux-gnux32 \ + armel/hf=arm-linux-gnueabihf \ + armhf/sf=arm-linux-gnueabi \ + i386/64=x86_64-linux-gnu \ + i386/x32=x86_64-linux-gnux32 \ + powerpc/64=powerpc64-linux-gnu \ + ppc64/32=powerpc-linux-gnu \ + sparc/64=sparc64-linux-gnu \ + sparc64/32=sparc-linux-gnu \ + s390/64=s390x-linux-gnu \ + s390x/32=s390-linux-gnu \ + mips/n32=mips64-linux-gnuabin32 \ + mips/64=mips64-linux-gnuabi64 \ + mipsel/n32=mips64el-linux-gnuabin32 \ + mipsel/64=mips64el-linux-gnuabi64 \ + mipsn32/32=mips-linux-gnu \ + mipsn32/64=mips64-linux-gnuabi64 \ + mipsn32el/32=mipsel-linux-gnu \ + mipsn32el/64=mips64el-linux-gnuabi64 \ + mips64/32=mips-linux-gnu \ + mips64/n32=mips64-linux-gnuabin32 \ + mips64el/32=mipsel-linux-gnu \ + mips64el/n32=mips64el-linux-gnuabin32 \ + mipsr6/n32=mipsisa64r6-linux-gnuabin32 \ + mipsr6/64=mipsisa64r6-linux-gnuabi64 \ + mipsr6el/n32=mipsisa64r6el-linux-gnuabin32 \ + mipsr6el/64=mipsisa64r6el-linux-gnuabi64 \ + mipsn32r6/32=mipsisa32r6-linux-gnu \ + mipsn32r6/64=mipsisa64r6-linux-gnuabi64 \ + mipsn32r6el/32=mipsisa32r6el-linux-gnu \ + mipsn32r6el/64=mipsisa64r6el-linux-gnuabi64 \ + mips64r6/32=mipsisa32r6-linux-gnu \ + mips64r6/n32=mipsisa64r6-linux-gnuabin32 \ + mips64r6el/32=mipsisa32r6el-linux-gnu \ + mips64r6el/n32=mipsisa64r6el-linux-gnuabin32 \ + x32/32=i386-linux-gnu \ + x32/64=x86_64-linux-gnu \ + kfreebsd-amd64/32=i386-kfreebsd-gnu +# $(call mlib_to_march,<empty>|32|64|n32|x32|hf|sf) +mlib_to_march = $(patsubst $(DEB_TARGET_ARCH)/$(1)=%,%, \ + $(filter $(DEB_TARGET_ARCH)/$(1)=%,$(multilib_multiarch_map))) + +multilib_arch_map = \ + $(DEB_TARGET_ARCH)/=$(DEB_TARGET_ARCH) \ + amd64/32=i386 \ + amd64/x32=x32 \ + armel/hf=armhf \ + armhf/sf=armel \ + i386/64=amd64 \ + i386/x32=x32 \ + powerpc/64=ppc64 \ + ppc64/32=powerpc \ + sparc/64=sparc64 \ + sparc64/32=sparc \ + s390/64=s390x \ + s390x/32=s390 \ + mips/n32=mipsn32 \ + mips/64=mips64 \ + mipsel/n32=mipsn32el \ + mipsel/64=mips64el \ + mipsn32/32=mips \ + mipsn32/64=mips64 \ + mipsn32el/32=mipsel \ + mipsn32el/64=mips64el \ + mips64/32=mips \ + mips64/n32=mipsn32 \ + mips64el/32=mipsel \ + mips64el/n32=mipsn32el \ + mipsr6/n32=mipsn32r6 \ + mipsr6/64=mips64r6 \ + mipsr6el/n32=mipsn32r6el \ + mipsr6el/64=mips64r6el \ + mipsn32r6/32=mipsr6 \ + mipsn32r6/64=mips64r6 \ + mipsn32r6el/32=mipsr6el \ + mipsn32r6el/64=mips64r6el \ + mips64r6/32=mipsr6 \ + mips64r6/n32=mipsn32r6 \ + mips64r6el/32=mipsr6el \ + mips64r6el/n32=mipsn32r6el \ + x32/32=i386 \ + x32/64=amd64 \ + kfreebsd-amd64/32=kfreebsd-i386 +# $(call mlib_to_arch,<empty>|32|64|n32|x32|hf|sf) +mlib_to_arch = $(patsubst $(DEB_TARGET_ARCH)/$(1)=%,%, \ + $(filter $(DEB_TARGET_ARCH)/$(1)=%,$(multilib_arch_map))) + +# build -base packages +with_gccbase := yes +ifeq ($(build_type),build-cross) + ifneq ($(DEB_STAGE),rtlibs) + with_gcclbase := yes + endif +endif + +# build dev packages. +ifneq ($(DEB_STAGE),rtlibs) + with_dev := yes +endif + +with_cpp := yes + +# set lang when built from a different source package. +separate_lang := no + +#no_dummy_cpus := ia64 i386 hppa s390 sparc +#ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(no_dummy_cpus))) +# with_base_only := no +# with_common_libs := yes +# with_common_pkgs := yes +#else +# with_base_only := yes +# with_common_libs := no +# with_common_pkgs := no +# with_dev := no +#endif + +ifeq ($(versioned_packages),yes) + pkg_ver := -$(BASE_VERSION) + PV := $(pkg_ver) +endif + +# ------------------------------------------------------------------- +# configure languages + +# C --------------------------- +enabled_languages := c + +with_jit = yes + +# FIXME: compiler bug +# m68k: PR 95381 +jit_no_cpus := ia64 + +ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(jit_no_cpus))) + with_jit := disabled for cpu $(DEB_TARGET_ARCH_CPU) +endif +# FIXME: see #994035, strange tar behavior +ifneq (,$(filter $(DEB_TARGET_ARCH_OS), kfreebsd)) + with_jit := disabled for os $(DEB_TARGET_ARCH_OS) +endif +ifneq (,$(with_rtlibs)) + with_jit := disabled for rtlibs stage +endif +ifneq ($(findstring nojit, $(DEB_BUILD_OPTIONS)),) + with_jit := disabled by DEB_BUILD_OPTIONS +endif +with_jit := $(call envfilt, jit, , , $(with_jit)) + +ifeq (,$(findstring gcc-,$(PKGSOURCE))) + with_jit := +endif + +# this fails when installing the jit build +# libtool: install: /home/packages/gcc/13/tc/gcc-toolchain-13-13.2.0+2.41/build-jit/./binutils/ranlib /home/packages/gcc/13/tc/gcc-toolchain-13-13.2.0+2.41/debian/tmp-jit/usr/lib/gcc-toolchain-13/lib/../lib/libgomp.a +# /home/packages/gcc/13/tc/gcc-toolchain-13-13.2.0+2.41/build-jit/binutils/.libs/ranlib: error while loading shared libraries: /home/packages/gcc/13/tc/gcc-toolchain-13-13.2.0+2.41/build-jit/bfd/.libs/libbfd-2.41-tc13.so: file too short +# /home/packages/gcc/13/tc/gcc-toolchain-13-13.2.0+2.41/build-jit/binutils/.libs/ranlib: error while loading shared libraries: /home/packages/gcc/13/tc/gcc-toolchain-13-13.2.0+2.41/build-jit/bfd/.libs/libbfd-2.41-tc13.so: file too short + +ifneq (,$(findstring gcc-toolchain,$(PKGSOURCE))) + with_jit := disabled for $(PKGSOURCE) builds +endif + +ifneq (,$(findstring build-cross, $(build_type))) + with_jit := disabled for cross builds +endif + +ifeq ($(with_jit),yes) + ifeq ($(with_common_libs),yes) + with_libgccjit := yes + endif +endif + +nvptx_archs := amd64 arm64 ppc64el +# arm64, see PR target/96265 +ifneq (,$(filter $(DEB_TARGET_ARCH),$(nvptx_archs))) + offload_targets += nvptx-none + with_offload_nvptx := yes +endif +ifneq (,$(filter $(distrelease), precise)) + offload_targets := + with_offload_nvptx := +endif +ifneq (,$(findstring build-cross, $(build_type))) + offload_targets := + with_offload_nvptx := disabled for cross builds +endif + +ifeq ($(single_package),yes) + ifneq ($(trunk_build),yes) + offload_targets := + with_offload_nvptx := disabled for $(PKGSOURCE) builds + endif +endif +ifneq ($(findstring nonvptx, $(DEB_BUILD_OPTIONS)),) + offload_targets := + with_offload_nvptx := disabled by DEB_BUILD_OPTIONS +endif +with_offload_nvptx := $(call envfilt, nvptx, , , $(with_offload_nvptx)) +#with_offload_nvptx := not yet built for GCC 13 + +gcn_archs := amd64 +gcn_target_name = amdgcn-amdhsa + +ifneq (,$(filter $(distrelease),buster xenial bionic focal groovy)) + gcn_tools_llvm_version = 9 +else ifneq (,$(filter $(distrelease),focal groovy)) + gcn_tools_llvm_version = 11 +else + gcn_tools_llvm_version = tools +endif + +ifneq (,$(filter $(DEB_TARGET_ARCH),$(gcn_archs))) + offload_targets += $(gcn_target_name) + with_offload_gcn := yes +endif +ifneq (,$(filter $(distrelease), precise bionic focal)) + offload_targets := $(filter-out $(gcn_target_name), $(offload_targets)) + with_offload_gcn := +endif +ifneq (,$(findstring build-cross, $(build_type))) + offload_targets := $(filter-out $(gcn_target_name), $(offload_targets)) + with_offload_gcn := disabled for cross builds +endif + +ifeq ($(single_package),yes) + ifneq ($(trunk_build),yes) + offload_targets := $(filter-out $(gcn_target_name), $(offload_targets)) + with_offload_gcn := disabled for $(PKGSOURCE) builds + endif +endif +ifneq ($(findstring nogcn, $(DEB_BUILD_OPTIONS)),) + offload_targets := $(filter-out $(gcn_target_name), $(offload_targets)) + with_offload_gcn := disabled by DEB_BUILD_OPTIONS +endif +with_offload_gcn := $(call envfilt, gcn, , , $(with_offload_gcn)) +#with_offload_gcn := not yet built for GCC 13 + +with_cc1 := yes +with_cc1 := $(call envfilt, cc1, , , $(with_cc1)) + +ifeq ($(with_cc1),yes) + ifeq ($(with_common_libs),yes) + with_libcc1 := yes + endif + with_libcc1_plugin := yes +endif + +ifneq (,$(with_rtlibs)) + with_libcc1 := disabled for rtlibs stage + with_libcc1_plugin := disabled for rtlibs stage +endif +ifneq (,$(findstring build-cross, $(build_type))) + with_libcc1 := disabled for cross builds +endif + +# Build all packages needed for C development +ifneq ($(with_base_only),yes) + ifeq ($(with_dev),yes) + with_cdev := yes + endif +endif + +ifeq (,$(filter $(DEB_STAGE),stage1 stage2)) +# Ada -------------------- +ada_no_cpus := arc ia64 loong64 sh3 sh3eb sh4eb +ada_no_systems := +ada_no_cross := no +ada_no_snap := no +#ifeq ($(single_package),yes) +# ifneq (,$(filter $(DEB_TARGET_ARCH),alpha)) +# ada_no_snap := yes +# endif +#endif +#ifeq ($(DEB_CROSS),yes) +# ifneq (,$(filter $(DEB_TARGET_ARCH),alpha)) +# ada_no_cross := yes +# endif +#endif + +ifeq ($(with_dev),yes) + ifneq ($(separate_lang),yes) + with_ada := yes + endif +endif +ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(ada_no_cpus))) + with_ada := disabled for cpu $(DEB_TARGET_ARCH_CPU) +endif +ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(ada_no_systems))) + with_ada := disabled for system $(DEB_TARGET_GNU_SYSTEM) +endif +ifeq ($(ada_no_cross)-$(DEB_CROSS),yes-yes) + with_ada := disabled for cross compiler package +endif +ifeq ($(ada_no_snap)-$(single_package),yes-yes) + with_ada := disabled for snapshot build +endif +ifneq (,$(findstring gccgo,$(PKGSOURCE))) + with_ada := +endif +ifneq (,$(filter $(distrelease), precise)) + with_ada := +endif +with_ada := $(call envfilt, ada, , , $(with_ada)) + +ifeq ($(DEB_STAGE)-$(filter libgnat, $(with_rtlibs)),rtlibs-) + with_ada := disabled for rtlibs stage +endif +#with_ada := disabled for GCC 13 + +#ifneq ($(single_package),yes) +# with_separate_gnat := yes +#endif + +ifneq ($(with_separate_gnat),yes) + ifeq ($(with_ada),yes) + ifneq (,$(filter $(distrelease), precise)) + with_ada := + endif + endif +endif + +ifeq ($(with_ada)-$(with_separate_gnat),yes-yes) + ifneq (,$(findstring gnat,$(PKGSOURCE))) + languages := c + separate_lang := yes + with_mudflap := no + with_gccbase := no + with_cdev := no + with_cc1 := no + with_libcc1 := no + else + debian_extra_langs += ada + with_ada := built from separate source + with_libgnat := built from separate source + endif +endif + +ifeq ($(with_ada),yes) + enabled_languages += ada + with_libgnat := yes + #with_gnatsjlj := yes +endif + +# C++ ------------------------- +cxx_no_cpus := avr +ifneq ($(with_base_only),yes) + ifneq ($(separate_lang),yes) + with_cxx := yes + endif +endif +ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(cxx_no_cpus))) + with_cxx := disabled for cpu $(DEB_TARGET_ARCH_CPU) +endif +with_cxx := $(call envfilt, c++, obj-c++, , $(with_cxx)) + +# Set the default libstdc++ ABI. libstdc++ provides both ABI's. +# Existing code still runs with the new c++11 ABI, however link +# errors are seen when one object is compiled with the new std::string in scope, +# another object is compiled with the old std::string in scope. both can link +# to libstdc++.so but not to each other. +# two objects (which might be some system library and a user's program) need to +# agree on the version of std::string they're using + +libstdcxx_abi = new +# backports default to the old ABI +ifneq (,$(filter $(distrelease), jessie precise trusty)) + libstdcxx_abi = gcc4-compatible +endif + +# Build all packages needed for C++ development +ifeq ($(with_cxx),yes) + ifeq ($(with_dev),yes) + with_cxxdev := yes + with_libcxxdbg := yes + endif + ifeq ($(with_common_libs),yes) + with_libcxx := yes + endif + + # debugging versions of libstdc++ + ifneq (,$(findstring gcc-, $(PKGSOURCE))) + ifeq ($(with_cxxdev),yes) + with_cxx_debug := yes + debug_no_cpus := + ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(debug_no_cpus))) + with_cxx_debug := disabled for cpu $(DEB_TARGET_GNU_CPU) + endif + endif + endif + with_cxx_debug := $(call envfilt, debug, , , $(with_cxx_debug)) + + enabled_languages += c++ +endif + +# Go ------------------- +# - To build a standalone gccgo package (with no corresponding gcc +# package): with_separate_libgo=yes, with_standalone_go=yes +# - To build the go packages from the gcc source package: +# with_separate_libgo=no, with_standalone_go=no +# - To build gcc and go from separate sources: +# with_separate_libgo=yes, with_standalone_go=no + +go_no_cross := yes +go_no_cross := no + +ifneq (,$(findstring gccgo, $(PKGSOURCE))) + with_separate_libgo := yes + with_standalone_go := yes + with_cc1 := + with_libcc1 := +endif + +go_no_cpus := arc avr hppa loong64 +go_no_cpus += m68k # See PR 79281 / PR 83314 +go_no_systems := kfreebsd-gnu +ifneq (,$(filter $(distrelease),precise)) + go_no_cpus = armhf + go_no_archs = armhf +endif +# Debian #969221 +go_no_cpus += sh4 +go_no_archs += sh4 + +ifneq ($(with_base_only),yes) + ifneq ($(separate_lang),yes) + with_go := yes + endif +endif +ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(go_no_cpus))) + with_go := disabled for cpu $(DEB_TARGET_ARCH_CPU) +endif +ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),$(go_no_systems))) + with_go := disabled for system $(DEB_TARGET_GNU_SYSTEM) +endif +ifneq (,$(filter $(DEB_TARGET_ARCH),$(go_no_archs))) + with_go := disabled for architecture $(DEB_TARGET_ARCH) +endif +ifeq ($(go_no_cross)-$(DEB_CROSS),yes-yes) + with_go := disabled for cross compiler package +endif +ifeq ($(DEB_STAGE)-$(filter libgo, $(with_rtlibs)),rtlibs-) + with_go := disabled for rtlibs stage +endif +with_go := $(call envfilt, go, , , $(with_go)) + +# Build all packages needed for Go development +ifneq (,$(findstring gcc, $(PKGSOURCE))) + ifeq ($(with_go),yes) + ifeq ($(with_dev),yes) + with_godev := yes + endif + with_libgo := yes + enabled_languages += go + endif +endif + +ifeq ($(with_go)-$(with_separate_libgo),yes-yes) + ifneq (,$(findstring gccgo, $(PKGSOURCE))) + languages := c c++ go + separate_lang := yes + with_libgcc := yes + with_shared_libgcc := yes + else + debian_extra_langs += go + with_go := built from separate source + with_libgo := buit from separate source + endif +endif + +# D --------------------------- +d_no_cross := yes +d_no_snap := +d_no_cpus := alpha arc ia64 loong64 m68k sh4 s390 sparc64 +d_no_systems := gnu kfreebsd-gnu + +ifneq ($(single_package),yes) + with_separate_gdc := yes +endif +with_separate_gdc := no + +ifneq ($(separate_lang),yes) + with_d := yes +endif + +ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(d_no_cpus))) + with_d := disabled for cpu $(DEB_TARGET_ARCH_CPU) +endif +ifneq (,$(filter $(DEB_TARGET_GNU_SYSTEM),$(d_no_systems))) + with_d := disabled for system $(DEB_TARGET_GNU_SYSTEM) +endif +ifneq (,$(filter $(DEB_TARGET_ARCH),$(d_no_archs))) + with_d := disabled for architecture $(DEB_TARGET_ARCH) +endif +ifeq ($(d_no_snap)-$(single_package),yes-yes) + with_d := disabled for snapshot build +endif +ifeq ($(DEB_STAGE)-$(filter libphobos, $(with_rtlibs)),rtlibs-) + with_d := disabled for rtlibs stage +endif +ifeq ($(GENERATE_DFSG_TARBALL),yes) + with_d := disabled while generating the dfsg tarball +endif +with_d := $(call envfilt, d, , , $(with_d)) +#with_d := not yet built for GCC 13 + +ifeq ($(with_base_only),yes) + with_d := no +endif + +ifeq ($(with_d)-$(with_separate_gdc),yes-yes) + ifneq (,$(findstring gdc,$(PKGSOURCE))) + languages := c c++ + separate_lang := yes + + # FIXME: language selection needs improvement. + with_go := disabled for d + else + debian_extra_langs += d + with_d := built from separate source + endif +endif + +ifeq ($(with_d),yes) + druntime_only_archs = powerpc ppc64 ppc64el + phobos_archs = amd64 arm64 armel armhf i386 x32 + phobos_archs += hppa + phobos_archs += mips mips64 mipsel mips64el + phobos_archs += mipsn32 mipsn32el + phobos_archs += mipsr6 mipsr6el mipsn32r6 mipsn32r6el mips64r6 mips64r6el + phobos_archs += riscv64 s390x + phobos_archs += $(druntime_only_archs) + #phobos_archs += kfreebsd-amd64 kfreebsd-i386 + ifneq (,$(filter $(DEB_TARGET_ARCH), $(phobos_archs))) + with_phobos := yes + endif + + phobos_no_systems := gnu kfreebsd-gnu + ifneq (,$(filter $(DEB_TARGET_GNU_SYSTEM),$(phobos_no_systems))) + with_phobos := disabled for system $(DEB_TARGET_GNU_SYSTEM) + endif + with_libphobosdev := $(with_phobos) + + enabled_languages += d +endif + +# Fortran 95 ------------------- +fortran_no_cross := yes +fortran_no_cross := no + +ifneq ($(with_base_only),yes) + ifneq ($(separate_lang),yes) + with_fortran := yes + endif +endif +ifeq ($(fortran_no_cross)-$(DEB_CROSS),yes-yes) + with_fortran := disabled for cross compiler package +endif +ifeq ($(DEB_STAGE)-$(filter libgfortran libquadmath, $(with_rtlibs)),rtlibs-) + with_fortran := disabled for rtlibs stage +endif + +with_fortran := $(call envfilt, fortran, , , $(with_fortran)) + +# Build all packages needed for Fortran development +ifeq ($(with_fortran),yes) + ifeq ($(with_dev),yes) + ifneq ($(DEB_STAGE)-$(filter libgfortran libquadmath, $(with_rtlibs)),rtlibs-) + with_fdev := yes + endif + endif + ifeq ($(with_common_libs),yes) + with_libgfortran := yes + endif + enabled_languages += fortran +endif + +# libquadmath ------------------- + +quadmath_targets = amd64 ia64 i386 x32 \ + hurd-amd64 hurd-i386 kfreebsd-i386 kfreebsd-amd64 \ + ppc64el +# powerpc and ppc64 don't have power7 CPU defaults ... +ifneq (,$(filter $(DEB_TARGET_ARCH), $(quadmath_targets))) + # FIXME: upstream build tied to gfortran build + ifeq ($(with_fortran),yes) + with_qmath := yes + ifneq (,$(findstring gcc-13,$(PKGSOURCE))) + ifeq ($(with_common_libs),yes) + with_libqmath := yes + endif + endif + endif +endif + +# ObjC ------------------------ +objc_no_cross := no + +ifneq ($(with_base_only),yes) + ifneq ($(separate_lang),yes) + with_objc := yes + objc_no_archs = + ifneq (,$(filter $(DEB_TARGET_ARCH),$(objc_no_archs))) + with_objc := + endif + endif +endif +ifeq ($(objc_no_cross)-$(DEB_CROSS),yes-yes) + with_objc := disabled for cross compiler package +endif +ifeq ($(DEB_STAGE)-$(filter libobjc, $(with_rtlibs)),rtlibs-) + with_objc := disabled for rtlibs stage +endif +with_objc := $(call envfilt, objc, obj-c++, , $(with_objc)) + +ifeq ($(with_objc),yes) + # the ObjC runtime with garbage collection enabled needs the Boehm GC + with_objc_gc := yes + + # disable ObjC garbage collection library (needs libgc) + libgc_no_cpus := avr + libgc_no_systems := knetbsd-gnu + ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(libgc_no_cpus))) + with_objc_gc := disabled for cpu $(DEB_TARGET_ARCH_CPU) + endif + ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(libgc_no_systems))) + with_objc_gc := disabled for system $(DEB_TARGET_GNU_SYSTEM) + endif + ifneq (,$(findstring build-cross, $(build_type))) + with_objc_gc := disabled for cross builds + endif + # Build all packages needed for Objective-C development + ifeq ($(with_dev),yes) + with_objcdev := yes + endif + ifeq ($(with_common_libs),yes) + with_libobjc := yes + endif + + enabled_languages += objc +endif + +# ObjC++ ---------------------- +objcxx_no_cross := no + +ifeq ($(with_objc),yes) + ifneq ($(with_base_only),yes) + ifneq ($(separate_lang),yes) + with_objcxx := yes + endif + endif +endif +ifeq ($(objcxx_no_cross)-$(DEB_CROSS),yes-yes) + with_objcxx := disabled for cross compiler package +endif +with_objcxx := $(call envfilt, obj-c++, , c++ objc, $(with_objcxx)) + +ifeq ($(with_objcxx),yes) + enabled_languages += obj-c++ +endif + +# Modula-2 ------------------- +m2_no_cross := yes +m2_no_cross := no + +ifneq ($(with_base_only),yes) + ifneq ($(separate_lang),yes) + with_m2 := yes + endif +endif +m2_no_cpus = loong64 powerpc ppc64 sh4 +m2_no_systems = gnu kfreebsd-gnu +ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(m2_no_cpus))) + with_m2 := disabled for cpu $(DEB_TARGET_ARCH_CPU) +endif +ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),$(m2_no_systems))) + with_m2 := disabled for system $(DEB_TARGET_GNU_SYSTEM) +endif +ifeq ($(m2_no_cross)-$(DEB_CROSS),yes-yes) + with_m2 := disabled for cross compiler package +endif +ifeq ($(DEB_STAGE)-$(filter libgm2, $(with_rtlibs)),rtlibs-) + with_m2 := disabled for rtlibs stage +endif +ifneq (,$(filter $(distrelease),precise)) + with_m2 := disabled for $(distrelease) backport +endif +#with_m2 := disabled for GCC 13 + +with_m2 := $(call envfilt, m2, , , $(with_m2)) + +# Build all packages needed for Modula-2 development +ifeq ($(with_m2),yes) + ifeq ($(with_dev),yes) + with_m2dev := yes + endif + ifeq ($(with_common_libs),yes) + with_libgm2 := yes + endif + enabled_languages += m2 +endif + +# Rust ------------------- +rs_no_cross := yes +rs_no_cross := no + +ifneq ($(with_base_only),yes) + ifneq ($(separate_lang),yes) + with_rs := yes + endif +endif +#rs_no_cpus = s390x +ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(rs_no_cpus))) + with_rs := disabled for cpu $(DEB_TARGET_ARCH) +endif +ifeq ($(rs_no_cross)-$(DEB_CROSS),yes-yes) + with_rs := disabled for cross compiler package +endif +#ifeq ($(DEB_STAGE)-$(filter libgrs, $(with_rtlibs)),rtlibs-) +# with_rs := disabled for rtlibs stage +#endif + +ifneq (,$(filter $(distrelease),lunar)) + with_rs := yes +else + with_rs := disabled for GCC 13 +endif +#with_rs := disabled for GCC 13 + +with_rs := $(call envfilt, rust, , , $(with_rs)) + +# Build all packages needed for Rust development +ifeq ($(with_rs),yes) + ifeq ($(with_dev),yes) + with_rsdev := yes + endif + ifeq ($(with_common_libs),yes) + with_libgrs := yes + endif + enabled_languages += rust +endif + +# ------------------------------------------------------------------- +# other config + +# not built from the main source package +ifeq (,$(findstring gcc-,$(PKGSOURCE))) + extra_package := yes +endif + +with_nls := yes +ifeq ($(trunk_build),yes) + with_nls := no +endif +with_nls := $(call envfilt, nls, , , $(with_nls)) + +# powerpc nof libraries ----- +with_libnof := no + +ifneq (,$(findstring gcc-13,$(PKGSOURCE))) + ifeq (,$(with_rtlibs)) + with_source := yes + endif +endif +with_source := $(call envfilt, source, , , $(with_source)) + +ifeq ($(with_cdev),yes) + +# ssp & libssp ------------------------- +with_ssp := yes +ssp_no_archs = alpha hppa ia64 m68k +ifneq (, $(filter $(DEB_TARGET_ARCH),$(ssp_no_archs) $(ssp_no_archs:%=uclibc-%))) + with_ssp := not available on $(DEB_TARGET_ARCH) +endif +with_ssp := $(call envfilt, ssp, , , $(with_ssp)) + +ifeq ($(with_ssp),yes) + ifneq ($(derivative),Debian) + ifneq (,$(findstring gcc-13, $(PKGSOURCE))) + with_ssp_default := yes + endif + endif +endif + +# gomp -------------------- +with_gomp := yes +with_gomp := $(call envfilt, gomp, , , $(with_gomp)) +gomp_no_archs = +ifneq (,$(filter $(DEB_TARGET_ARCH),$(gomp_no_archs))) + with_gomp := +endif + +# itm -------------------- +itm_archs = alpha amd64 arm64 i386 x32 ppc64 ppc64el s390x sh4 sparc64 +ifneq (,$(filter $(DEB_TARGET_ARCH),$(itm_archs))) + with_itm := yes +endif +with_itm := $(call envfilt, itm, , , $(with_itm)) + +# atomic -------------------- +with_atomic := yes +atomic_no_archs = +ifneq (,$(filter $(DEB_TARGET_ARCH),$(atomic_no_archs))) + with_atomic := +endif + +# backtrace -------------------- +with_backtrace := yes +backtrace_no_archs = m68k +ifneq (,$(filter $(DEB_TARGET_ARCH),$(backtrace_no_archs))) + with_backtrace := +endif + +strip_sanitizer = +ifneq (,$(filter $(distrelease),jessie stretch buster precise xenial bionic)) + strip_sanitizer = yes +endif + +# asan / sanitizer -------------------- +with_asan := +with_asan := $(call envfilt, asan, , , $(with_asan)) +asan_archs = amd64 armel armhf arm64 i386 powerpc ppc64 ppc64el \ + riscv64 s390x sparc sparc64 x32 +ifneq (,$(filter $(DEB_TARGET_ARCH),$(asan_archs))) + with_asan := yes +endif + +# lsan / sanitizer -------------------- +with_lsan := +with_lsan := $(call envfilt, lsan, , , $(with_lsan)) +lsan_archs = arm64 amd64 ppc64 ppc64el +ifneq (,$(filter $(DEB_TARGET_ARCH),$(lsan_archs))) + with_lsan := yes +endif + +# tsan / sanitizer -------------------- +with_tsan := +with_tsan := $(call envfilt, tsan, , , $(with_tsan)) +tsan_archs = arm64 amd64 ppc64 ppc64el +ifneq (,$(filter $(DEB_TARGET_ARCH),$(tsan_archs))) + with_tsan := yes +endif + +# hwasan / sanitizer -------------------- +with_hwasan := +with_hwasan := $(call envfilt, hwasan, , , $(with_hwasan)) +hwasan_archs = amd64 arm64 +ifneq (,$(filter $(DEB_TARGET_ARCH),$(hwasan_archs))) + with_hwasan := yes +endif + +# ubsan / sanitizer -------------------- +with_ubsan := +with_ubsan := $(call envfilt, ubsan, , , $(with_ubsan)) +ubsan_archs = amd64 armel armhf arm64 i386 powerpc ppc64 ppc64el x32 \ + s390x sparc sparc64 +ifneq (,$(filter $(DEB_TARGET_ARCH),$(ubsan_archs))) + with_ubsan := yes +endif + +endif # with_cdev + +# libvtv -------------------- +with_vtv := +with_vtv := $(call envfilt, vtv, , , $(with_vtv)) +vtv_archs = amd64 i386 x32 +ifneq (,$(filter $(DEB_TARGET_ARCH),$(vtv_archs))) + with_vtv := yes + with_libvtv := yes +endif +# libvtv builds a modified libstdc++, don't enable it by default +with_vtv := +with_libvtv := + +# pie by default -------------------- +with_pie := +ifeq ($(distribution),Debian) + ifeq (,$(filter $(distrelease), jessie)) + pie_archs = amd64 arm64 armel armhf i386 \ + mips mipsel mips64 mips64el mipsn32 mipsn32el \ + mipsr6 mipsr6el mips64r6 mips64r6el mipsn32r6 mipsn32r6el \ + ppc64el s390x sparc sparc64 kfreebsd-amd64 kfreebsd-i386 \ + hurd-amd64 hurd-i386 riscv64 loong64 + endif + ifeq (,$(filter $(distrelease), jessie stretch)) + pie_archs += powerpc ppc64 + endif +else ifeq ($(distribution),Ubuntu) + ifeq (,$(filter $(distrelease), precise trusty)) + pie_archs = s390x + endif + ifeq (,$(filter $(distrelease), precise trusty xenial)) + pie_archs += amd64 ppc64el + endif + ifeq (,$(filter $(distrelease), precise trusty xenial)) + pie_archs += armhf arm64 i386 + endif + pie_archs += riscv64 +endif +ifneq (,$(filter $(DEB_TARGET_ARCH),$(pie_archs))) + with_pie := yes +endif +ifeq ($(trunk_build),yes) + with_pie := disabled for trunk builds +endif + +# gold -------------------- +# armel with binutils 2.20.51 only +gold_archs = amd64 armel armhf i386 powerpc ppc64 ppc64el s390x sparc sparc64 x32 hurd-amd64 hurd-i386 +ifneq (,$(filter $(DEB_TARGET_ARCH),$(gold_archs))) + with_gold := yes +endif + +# plugins -------------------- +with_plugins := yes +ifneq (,$(with_rtlibs)) + with_plugins := disabled for rtlibs stage +endif + +endif # ifeq (,$(filter $(DEB_STAGE),stage1 stage2)) + +# Don't include docs with GFDL invariant sections +GFDL_INVARIANT_FREE := yes +ifeq ($(derivative),Ubuntu) + GFDL_INVARIANT_FREE := no +endif + +# ------------------------------------------------------------------- +# non-extra config +ifeq ($(extra_package),yes) + ifeq ($(with_separate_libgo),yes) + # package stuff + with_gccbase := yes + with_cdev := no + with_cxx := no + with_cxxdev := no + endif +else + # libssp ------------------ + ifeq ($(with_ssp)-$(with_common_libs),yes-yes) + #ifneq ($(DEB_CROSS),yes) + with_libssp := $(if $(wildcard $(builddir)/gcc/auto-host.h),$(shell if grep -qs '^\#define TARGET_LIBC_PROVIDES_SSP 1' $(builddir)/gcc/auto-host.h; then echo 'libc provides ssp'; else echo 'yes'; fi)) + #endif + with_libssp := libc provides ssp + endif + + # libgomp ----------------- + ifeq ($(with_gomp)-$(with_common_libs),yes-yes) + with_libgomp := yes + endif + + # libitm ----------------- + ifeq ($(with_itm)-$(with_common_libs),yes-yes) + with_libitm := yes + endif + + # libatomic ----------------- + ifeq ($(with_atomic)-$(with_common_libs),yes-yes) + with_libatomic := yes + endif + + # libbacktrace ----------------- + ifeq ($(with_backtrace)-$(with_common_libs),yes-yes) + # currently not a shared library + #with_libbacktrace := yes + endif + + # libasan ----------------- + ifeq ($(with_asan)-$(with_common_libs),yes-yes) + ifeq ($(with_asan),yes) + with_libasan := yes + endif + endif + + # liblsan ----------------- + ifeq ($(with_lsan)-$(with_common_libs),yes-yes) + #ifneq ($(DEB_CROSS),yes) + with_liblsan := yes + #endif + endif + + # libtsan ----------------- + ifeq ($(with_tsan)-$(with_common_libs),yes-yes) + with_libtsan := yes + endif + + # libubsan ----------------- + ifeq ($(with_ubsan)-$(with_common_libs),yes-yes) + ifeq ($(with_ubsan),yes) + with_libubsan := yes + endif + endif + + # libhwasan ----------------- + ifeq ($(with_hwasan)-$(with_common_libs),yes-yes) + ifeq ($(with_hwasan),yes) + with_libhwasan := yes + endif + endif + + # libvtv ----------------- + ifeq ($(with_vtv)-$(with_common_libs),yes-yes) + with_libvtv := yes + endif + + # libquadmath ----------------- + ifeq ($(with_qmath)-$(with_common_libs),yes-yes) + with_libqmath := yes + endif + + # libunwind ----------------- + with_internal_libunwind = + ifeq ($(DEB_HOST_ARCH),ia64) + ifeq ($(DEB_STAGE),stage1) + ifeq ($(DEB_CROSS),yes) + with_internal_libunwind = yes + endif + endif + endif + + # Shared libgcc -------------------- + ifneq ($(DEB_STAGE),stage1) + with_shared_libgcc := yes + ifeq ($(with_common_libs),yes) + with_libgcc := yes + ifneq (,$(filter $(distrelease), jessie stretch buster lucid precise trusty xenial bionic focal)) + ifneq (,$(filter $(build_type), build-native cross-build-native)) + with_libcompatgcc := yes + endif + endif + endif + endif + + # libphobos ----------------- + #ifeq ($(with_common_libs),yes) + ifeq ($(with_phobos),yes) + with_libphobos := yes + endif + #endif + + # libgcc-math -------------------- + with_libgmath := no + ifneq (,$(findstring i486,$(DEB_TARGET_ARCH))) + #with_libgccmath := yes + #with_lib64gmath := yes + #with_libgmathdev := yes + endif + ifeq ($(DEB_TARGET_ARCH),amd64) + #with_libgccmath := yes + #with_lib32gmath := yes + #with_libgmathdev := yes + endif + + # hppa64 build ---------------- + hppa64_no_snap := no + hppa64_archs := hppa + ifneq (,$(filter $(build_type), build-native cross-build-native)) + ifneq (,$(filter $(distrelease), jessie precise trusty)) + binutils_hppa64 := binutils-hppa64 + else + ifneq ($(single_package),yes) + hppa64_archs += amd64 i386 x32 + endif + binutils_hppa64 := binutils-hppa64-linux-gnu + endif + ifneq (,$(filter $(DEB_TARGET_ARCH),$(hppa64_archs))) + with_hppa64 := yes + endif + endif + ifneq (,$(findstring gcc-toolchain, $(PKGSOURCE))) + with_hppa64 := disabled for backports/toolchain builds + endif + ifeq ($(hppa64_no_snap)-$(trunk_build),yes-yes) + with_hppa64 := disabled for snapshot build + endif + ifneq ($(findstring nohppa64, $(DEB_BUILD_OPTIONS)),) + with_hppa64 := disabled by DEB_BUILD_OPTIONS + endif + with_hppa64 := $(call envfilt, hppa64, , , $(with_hppa64)) + + ifeq ($(DEB_STAGE),rtlibs) + with_libasan := disabled for rtlibs stage + with_liblsan := disabled for rtlibs stage + with_libtsan := disabled for rtlibs stage + with_libubsan := disabled for rtlibs stage + with_libhwasan := disabled for rtlibs stage + with_hppa64 := disabled for rtlibs stage + endif +endif + +# run testsuite --------------- +with_check := yes +# if you don't want to run the gcc testsuite, uncomment the next line +#with_check := disabled by hand +ifeq ($(with_base_only),yes) + with_check := no +endif +ifeq ($(DEB_CROSS),yes) + with_check := disabled for cross compiler package +endif +ifneq (,$(findstring cross-build-,$(build_type))) + with_check := disabled for cross building the compiler +endif +ifneq (,$(with_rtlibs)) + with_check := disabled for rtlibs stage +endif +#check_no_cpus := m68k +check_no_systems := # gnu kfreebsd-gnu +ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(check_no_cpus))) + with_check := disabled for cpu $(DEB_TARGET_ARCH_CPU) +endif +#ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(check_no_systems))) +# with_check := disabled for system $(DEB_TARGET_GNU_SYSTEM) +#endif +ifneq (,$(findstring gdc,$(PKGSOURCE))) + with_check := disabled for D +endif +with_check := $(call envfilt, check, , , $(with_check)) +ifdef WITHOUT_CHECK + with_check := disabled by environment +endif +ifneq ($(findstring nocheck, $(DEB_BUILD_OPTIONS)),) + with_check := disabled by DEB_BUILD_OPTIONS +endif +ifneq (,$(filter $(DEB_HOST_ARCH), mipsel mips64el)) + ifneq ($(single_package),yes) + with_check := disabled for $(DEB_HOST_ARCH), testsuite timeouts + endif +endif +# override the Debian porters, we need to know about the test results +ifeq ($(distribution),Debian) + ifneq (,$(filter $(DEB_HOST_ARCH), m68k sh4)) +# with_check := yes + endif +endif +ifeq ($(distribution)-$(DEB_HOST_ARCH),Ubuntu-riscv64) + with_check := disabled for $(DEB_HOST_ARCH) on Ubuntu, qemu builders +endif +with_check := disabled for this upload + +# not a dependency on all archs, but if available, use it for the testsuite +ifneq (,$(wildcard /usr/bin/localedef)) + locale_data = generate +endif +# try to b-d on locales-all +locale_data = + +ifneq (,$(filter $(build_type), build-cross cross-build-cross)) + ldconfig_arg = --noscripts +endif + +all_enabled_languages := $(enabled_languages) +languages_without_lang_opt := c++ objc obj-c++ + +debian_extra_langs := $(subst obj-c++,objcp,$(debian_extra_langs)) +export debian_extra_langs + +# multilib +biarch_map := i686=x86_64 powerpc=powerpc64 sparc=sparc64 sparc64=sparc s390=s390x s390x=s390 \ + x86_64=i686 powerpc64=powerpc mips=mips64 mipsel=mips64el \ + mips64=mips mips64el=mipsel mipsn32=mips mipsn32el=mipsel \ + mipsr6=mips64r6 mipsr6el=mips64r6el mips64r6=mipsr6 mips64r6el=mipsr6el \ + mipsn32r6=mipsr6 mipsn32r6el=mipsr6el +# FIXME: why still? +biarch_map := $(subst i686=,i486=,$(biarch_map)) + +ifeq ($(derivative),Ubuntu) + ifneq (,$(filter $(distrelease), precise trusty xenial bionic focal groovy hirsute)) + biarch_map += arm=arm + endif +endif +biarch_cpu := $(strip $(patsubst $(DEB_TARGET_GNU_CPU)=%,%, \ + $(filter $(DEB_TARGET_GNU_CPU)=%,$(biarch_map)))) + +biarch64 := no +biarch32 := no +biarchn32 := no +biarchx32 := no +biarchhf := no +biarchsf := no +flavours := +define gen_biarch + ifneq (yes,$$(call envfilt, biarch, , ,yes)) + biarch$1archs := + endif + ifneq (,$$(findstring /$$(DEB_TARGET_ARCH)/,$$(biarch$1archs))) + biarch$1 := yes + flavours += $1 + #biarch$1subdir = $$(biarch_cpu)-$$(DEB_TARGET_GNU_SYSTEM) + biarch$1subdir = $1 + ifeq ($$(with_libgcc),yes) + with_lib$1gcc := yes + endif + ifeq ($$(with_cdev),yes) + with_lib$1gccdev := yes + endif + ifeq ($$(with_libcxx),yes) + with_lib$1cxx := yes + endif + ifeq ($$(with_libcxxdbg),yes) + with_lib$1cxxdbg := yes + endif + ifeq ($$(with_cxxdev),yes) + with_lib$1cxxdev := yes + endif + ifeq ($$(with_libobjc),yes) + with_lib$1objc := yes + endif + ifeq ($$(with_objcdev),yes) + with_lib$1objcdev := yes + endif + ifeq ($$(with_libgfortran),yes) + with_lib$1gfortran := yes + endif + ifeq ($$(with_fdev),yes) + with_lib$1gfortrandev := yes + endif + ifeq (,$(filter $1, hf)) + ifeq ($$(with_libphobos),yes) + with_lib$1phobos := yes + endif + ifeq ($$(with_libphobosdev),yes) + with_lib$1phobosdev := yes + endif + endif + ifeq ($$(with_libssp),yes) + with_lib$1ssp := yes + endif + ifeq ($$(with_libgomp),yes) + with_lib$1gomp:= yes + endif + ifeq ($$(with_libitm),yes) + with_lib$1itm:= yes + endif + ifeq ($$(with_libatomic),yes) + with_lib$1atomic:= yes + endif + ifeq ($$(with_libbacktrace),yes) + with_lib$1backtrace:= yes + endif + ifeq ($$(with_libasan),yes) + with_lib$1asan:= yes + endif + ifeq ($$(with_liblsan),yes) + ifneq (,$$(filter $$(distrelease),lunar jammy focal)) + with_lib$1lsan := yes + endif + endif + ifeq ($$(with_libtsan),yes) + with_lib$1tsan:= yes + endif + ifeq ($$(with_libubsan),yes) + with_lib$1ubsan := yes + endif + ifeq ($$(with_libhwasan),yes) + ifeq ($$(DEB_TARGET_ARCH)-$1,i386-64) + with_lib$1hwasan:= yes + endif + ifeq ($$(DEB_TARGET_ARCH)-$1,x32-64) + with_lib$1hwasan:= yes + endif + endif + ifeq ($$(with_libvtv),yes) + with_lib$1vtv := yes + endif + ifeq ($$(with_libqmath),yes) + with_lib$1qmath := yes + endif + ifeq ($$(with_libgo),yes) + with_lib$1go := yes + endif + ifeq ($$(with_godev),yes) + with_lib$1godev := yes + endif + + biarch_multidir_names = libiberty libgcc libbacktrace libatomic libgomp + ifneq (,$$(findstring gcc-, $$(PKGSOURCE))) + biarch_multidir_names += libstdc++-v3 libobjc libgfortran libssp \ + zlib libitm libsanitizer + ifeq ($$(with_objc_gc),yes) + biarch_multidir_names += boehm-gc + endif + endif + ifneq (,$(findstring yes, $(with_go))) + biarch_multidir_names += libffi + endif + ifeq ($(with_fortran),yes) + biarch_multidir_names += libquadmath + endif + ifeq ($(with_go),yes) + biarch_multidir_names += libgo + endif + ifeq ($(with_phobos),yes) + ifeq (,$(filter $1, hf)) + biarch_multidir_names += libphobos + endif + endif + # FIXME: it now builds, but installs everything into the same $libdir + #ifeq ($(with_m2),yes) + # biarch_multidir_names += libgm2 + #endif + ifneq (,$$(findstring 32,$1)) + TARGET64_MACHINE := $$(strip $$(subst $$(DEB_TARGET_GNU_CPU),$$(biarch_cpu), \ + $$(TARGET_ALIAS))) + TARGET32_MACHINE := $$(TARGET_ALIAS) + else + TARGET64_MACHINE := $$(TARGET_ALIAS) + TARGET64_MACHINE := $$(strip $$(subst $$(DEB_TARGET_GNU_CPU),$$(biarch_cpu), \ + $$(TARGET_ALIAS))) + endif + export TARGET32_MACHINE + export TARGET64_MACHINE + endif +endef +biarch32archs := /amd64/ppc64/kfreebsd-amd64/s390x/sparc64/x32/mipsn32/mipsn32el/mips64/mips64el/ +biarch64archs := /i386/powerpc/sparc/s390/mips/mipsel/mipsn32/mipsn32el/ +biarchn32archs := /mips/mipsel/mips64/mips64el/ +ifeq (yes,$(MIPS_R6_ENABLED)) + biarch32archs += /mipsn32r6/mipsn32r6el/mips64r6/mips64r6el/ + biarch64archs += /mipsr6/mipsr6el/mipsn32r6/mipsn32r6el/x32/ + biarchn32archs += /mipsr6/mipsr6el/mips64r6/mips64r6el/ +endif + +ifeq ($(derivative),Ubuntu) + ifneq (,$(filter $(distrelease),precise xenial bionic focal groovy hirsute)) + biarchhfarchs := /armel/ + biarchsfarchs := /armhf/ + endif + ifeq (,$(filter $(distrelease), precise)) + biarchx32archs := /amd64/i386/ + endif +else ifeq ($(derivative),Debian) + biarchx32archs := /amd64/i386/ +endif +$(foreach x,32 64 n32 x32 hf sf,$(eval $(call gen_biarch,$(x)))) + +ifeq ($(DEB_TARGET_ARCH),sh4) + biarch_multidir_names=none +endif +export biarch_multidir_names + +#ifeq ($(trunk_build),yes) +# no_biarch_libs := yes +#endif +no_biarch_libs := + +ifeq ($(no_biarch_libs),yes) + with_lib64gcc := no + with_lib64cxx := no + with_lib64cxxdbg := no + with_lib64objc := no + with_lib64ffi := no + with_lib64gfortran := no + with_lib64ssp := no + with_lib64go := no + with_lib64gomp := no + with_lib64itm := no + with_lib64qmath := no + with_lib64atomic := no + with_lib64backtrace := no + with_lib64asan := no + with_lib64lsan := no + with_lib64tsan := no + with_lib64ubsan := no + with_lib64hwasan := no + with_lib64vtv := no + with_lib64gccdev := no + with_lib64cxxdev := no + with_lib64objcdev := no + with_lib64gfortrandev := no + with_lib64phobosdev := no + + with_lib32gcc := no + with_lib32cxx := no + with_lib32cxxdbg := no + with_lib32objc := no + with_lib32ffi := no + with_lib32gfortran := no + with_lib32ssp := no + with_lib32go := no + with_lib32gomp := no + with_lib32itm := no + with_lib32qmath := no + with_lib32atomic := no + with_lib32backtrace := no + with_lib32asan := no + with_lib32lsan := no + with_lib32tsan := no + with_lib32ubsan := no + with_lib32hwasan := no + with_lib32vtv := no + with_lib32gccdev := no + with_lib32cxxdev := no + with_lib32objcdev := no + with_lib32gfortrandev := no + with_lib32phobosdev := no + + with_libn32gcc := no + with_libn32cxx := no + with_libn32cxxdbg := no + with_libn32objc := no + with_libn32ffi := no + with_libn32gfortran := no + with_libn32ssp := no + with_libn32go := no + with_libn32gomp := no + with_libn32itm := no + with_libn32qmath := no + with_libn32atomic := no + with_libn32backtrace := no + with_libn32asan := no + with_libn32lsan := no + with_libn32tsan := no + with_libn32ubsan := no + with_libn32hwasan := no + with_libn32gccdev := no + with_libn32cxxdev := no + with_libn32objcdev := no + with_libn32gfortrandev:= no + with_libn32phobosdev := no + + with_libx32gcc := no + with_libx32cxx := no + with_libx32cxxdbg := no + with_libx32objc := no + with_libx32ffi := no + with_libx32gfortran := no + with_libx32ssp := no + with_libx32go := no + with_libx32gomp := no + with_libx32itm := no + with_libx32qmath := no + with_libx32atomic := no + with_libx32backtrace := no + with_libx32asan := no + with_libx32lsan := no + with_libx32tsan := no + with_libx32ubsan := no + with_libx32hwasan := no + with_libx32vtv := no + with_libx32gccdev := no + with_libx32cxxdev := no + with_libx32objcdev := no + with_libx32gfortrandev:= no + with_libx32phobosdev := no + + with_libhfgcc := no + with_libhfcxx := no + with_libhfcxxdbg := no + with_libhfobjc := no + with_libhfffi := no + with_libhfgfortran := no + with_libhfssp := no + with_libhfgo := no + with_libhfgomp := no + with_libhfitm := no + with_libhfqmath := no + with_libhfatomic := no + with_libhfbacktrace := no + with_libhfasan := no + with_libhflsan := no + with_libhftsan := no + with_libhfubsan := no + with_libhfhwasan := no + with_libhfgccdev := no + with_libhfcxxdev := no + with_libhfobjcdev := no + with_libhfgfortrandev := no + with_libhfphobosdev := no + + with_libsfgcc := no + with_libsfcxx := no + with_libsfcxxdbg := no + with_libsfobjc := no + with_libsfffi := no + with_libsfgfortran := no + with_libsfssp := no + with_libsfgo := no + with_libsfgomp := no + with_libsfitm := no + with_libsfqmath := no + with_libsfatomic := no + with_libsfbacktrace := no + with_libsfasan := no + with_libsflsan := no + with_libsftsan := no + with_libsfubsan := no + with_libsfhwasan := no + with_libsfgccdev := no + with_libsfcxxdev := no + with_libsfobjcdev := no + with_libsfgfortrandev := no + with_libsfphobosdev := no + + ifeq ($(with_ada)-$(with_separate_gnat),yes-yes) + biarchhf := disabled for Ada + biarchsf := disabled for Ada + endif + +endif + +ifneq (,$(filter yes,$(biarch32) $(biarch64) $(biarchn32) $(biarchx32) $(biarchhf) $(biarchsf))) + multilib := yes +endif + +multilib_archs = $(sort $(subst /, , $(biarch64archs) $(biarch32archs) $(biarchn32archs) $(biarchx32archs) $(biarchhfarchs) $(biarchsfarchs))) + +biarchsubdirs := \ + $(if $(filter yes,$(biarch64)),$(biarch64subdir),) \ + $(if $(filter yes,$(biarch32)),$(biarch32subdir),) \ + $(if $(filter yes,$(biarchn32)),$(biarchn32subdir),) \ + $(if $(filter yes,$(biarchx32)),$(biarchx32subdir),) \ + $(if $(filter yes,$(biarchhf)),$(biarchhfsubdir),) \ + $(if $(filter yes,$(biarchsf)),$(biarchsfsubdir),) +biarchsubdirs := {$(strip $(shell echo $(biarchsubdirs) | tr " " ","))} + +# GNU locales +force_gnu_locales := yes +locale_no_cpus := +locale_no_systems := +ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(locale_no_systems))) + force_gnu_locales := disabled for system $(DEB_TARGET_GNU_SYSTEM) +endif + +gcc_tarpath := $(firstword $(wildcard gcc-*.tar.* /usr/src/gcc-13/gcc-*.tar.*)) +gcc_tarball := $(notdir $(gcc_tarpath)) +gcc_srcdir := $(subst -dfsg,,$(patsubst %.tar.xz,%,$(patsubst %.tar.lzma,%,$(patsubst %.tar.gz,%,$(gcc_tarball:.tar.bz2=))))) + +binutils_dsc := $(notdir $(firstword $(wildcard binutils_*.dsc))) +binutils_srcdir := $(shell echo $(binutils_dsc) | sed 's/-.*//;s/_/-/') + +ifneq (,$(filter yes, $(with_offload_nvptx) $(with_offload_gcn))) + newlib_tarpath := $(firstword $(wildcard newlib-*.tar.* /usr/src/gcc-$(BASE_VERSION)/newlib-*.tar.*)) + newlib_tarball := $(notdir $(newlib_tarpath)) + newlib_srcdir := $(patsubst %.tar.xz,%,$(patsubst %.tar.lzma,%,$(patsubst %.tar.gz,%,$(newlib_tarball:.tar.bz2=)))) +endif + +# NOTE: This is not yet used. when building gdc or gnat using the +# gcc-source package, we don't require an exact binary dependency. +ifneq ($(dir $(gcc_tarpath)),./) + built_using_external_source := yes +else + built_using_external_source := +endif +ifeq ($(DEB_CROSS),yes) + add_built_using = yes +endif +ifeq ($(with_ada)-$(with_separate_gnat),yes-yes) + add_built_using = yes +endif + +unpack_stamp := $(stampdir)/01-unpack-stamp +pre_patch_stamp := $(stampdir)/02-pre-patch-stamp +patch_stamp := $(stampdir)/02-patch-stamp +control_stamp := $(stampdir)/03-control-stamp +configure_stamp := $(stampdir)/04-configure-stamp +build_stamp := $(stampdir)/05-build-stamp +build_arch_stamp := $(stampdir)/05-build-arch-stamp +build_indep_stamp := $(stampdir)/05-build-indep-stamp +build_html_stamp := $(stampdir)/05-build-html-stamp +build_locale_stamp := $(stampdir)/05-build-locale-stamp +build_doxygen_stamp := $(stampdir)/05-build-doxygen-stamp +build_gnatdoc_stamp := $(stampdir)/05-build-gnatdoc-stamp +check_stamp := $(stampdir)/06-check-stamp +check_inst_stamp := $(stampdir)/06-check-inst-stamp +install_stamp := $(stampdir)/07-install-stamp +install_snap_stamp := $(stampdir)/07-install-snap-stamp +install_tc_stamp := $(stampdir)/07-install-tc-stamp +binary_stamp := $(stampdir)/08-binary-stamp + +configure_dummy_stamp := $(stampdir)/04-configure-dummy-stamp +build_dummy_stamp := $(stampdir)/05-build-dummy-stamp +install_dummy_stamp := $(stampdir)/07-install-dummy-stamp + +configure_jit_stamp := $(stampdir)/04-configure-jit-stamp +build_jit_stamp := $(stampdir)/05-build-jit-stamp +install_jit_stamp := $(stampdir)/07-install-jit-stamp + +# installation of the offload compilers is required for the check target +# name it 06-install-*-stamp +configure_nvptx_stamp := $(stampdir)/04-configure-nvptx-stamp +build_nvptx_stamp := $(stampdir)/05-build-nvptx-stamp +install_nvptx_stamp := $(stampdir)/06-install-nvptx-stamp + +configure_gcn_stamp := $(stampdir)/04-configure-gcn-stamp +build_gcn_stamp := $(stampdir)/05-build-gcn-stamp +install_gcn_stamp := $(stampdir)/06-install-gcn-stamp + +configure_hppa64_stamp := $(stampdir)/04-configure-hppa64-stamp +build_hppa64_stamp := $(stampdir)/05-build-hppa64-stamp +install_hppa64_stamp := $(stampdir)/07-install-hppa64-stamp + +control_dependencies := $(patch_stamp) + +ifeq ($(single_package),yes) + ifneq (,$(findstring gcc-snapshot, $(PKGSOURCE))) + configure_dependencies = $(configure_stamp) + build_dependencies = $(build_stamp) + install_dependencies = $(install_snap_stamp) + ifeq ($(with_check),yes) + check_dependencies += $(check_stamp) + endif + else ifneq (,$(findstring gcc-toolchain, $(PKGSOURCE))) + configure_dependencies = $(configure_stamp) + build_dependencies = $(build_stamp) + install_dependencies = $(install_tc_stamp) + ifeq ($(with_check),yes) + check_dependencies += $(check_stamp) + endif + else + $(error Unknown single-package $(PKGSOURCE)) + endif +else + ifeq ($(with_base_only),yes) + configure_dependencies = $(configure_dummy_stamp) + build_dependencies = $(build_dummy_stamp) + install_dependencies = $(install_dummy_stamp) + else + configure_dependencies = $(configure_stamp) + build_dependencies = $(build_stamp) + install_dependencies = $(install_stamp) + ifeq ($(with_check),yes) + check_dependencies += $(check_stamp) + endif + endif +endif + +ifeq ($(with_jit),yes) + build_dependencies += $(build_jit_stamp) + install_dependencies += $(install_jit_stamp) +endif + +ifeq ($(with_offload_nvptx),yes) + build_dependencies += $(build_nvptx_stamp) + install_dependencies += $(install_nvptx_stamp) +endif + +ifeq ($(with_offload_gcn),yes) + build_dependencies += $(build_gcn_stamp) + install_dependencies += $(install_gcn_stamp) +endif + +ifeq ($(with_hppa64),yes) + build_dependencies += $(build_hppa64_stamp) + ifneq ($(trunk_build),yes) + install_dependencies += $(install_hppa64_stamp) + endif +endif + +build_dependencies += $(check_dependencies) + +build_arch_dependencies = $(build_dependencies) +build_indep_dependencies = $(build_dependencies) + +ifneq (,$(findstring build-native, $(build_type))) + ifneq ($(single_package),yes) + build_indep_dependencies += $(build_html_stamp) + ifeq ($(with_cxx),yes) + build_indep_dependencies += $(build_doxygen_stamp) + endif + ifeq ($(with_ada),yes) + build_indep_dependencies += $(build_gnatdoc_stamp) + endif + endif +endif + +stamp-dir: + mkdir -p $(stampdir) + +ifeq ($(DEB_CROSS),yes) + define cross_mangle_shlibs + if [ -f debian/$(1)/DEBIAN/shlibs ]; then \ + sed -i s/$(cross_lib_arch)/:$(DEB_TARGET_ARCH)/g debian/$(1)/DEBIAN/shlibs; \ + fi + endef + define cross_mangle_substvars + if [ -f debian/$(1).substvars ]; then \ + sed -i \ + -e 's/:$(DEB_TARGET_ARCH)/$(cross_lib_arch)/g' \ + -e 's/\(libc[.0-9]*-[^:]*\):\([a-z0-9-]*\)/\1-\2-cross/g' \ + $(if $(filter armel,$(DEB_TARGET_ARCH)),-e 's/:armhf/-armhf-cross/g') \ + $(if $(filter armhf,$(DEB_TARGET_ARCH)),-e 's/:armel/-armel-cross/g') \ + debian/$(1).substvars; \ + fi + endef +else + define cross_mangle_shlibs + endef + define cross_mangle_substvars + endef + # precise's dh_shlibdeps doesn't work well for ARM multilibs + # and dh_shlibdeps doesn't work well for cross builds, see #698881. + ifneq (,$(filter $(distrelease),precise quantal raring)) + ifneq (,$(filter $(DEB_TARGET_ARCH), armel armhf arm64)) + ignshld = - + endif + endif + # FIXME: don't stop at the first shlibdeps failure ... + ignshld = - +endif +ifeq ($(DEB_STAGE),rtlibs) + define cross_mangle_shlibs + endef + define cross_mangle_substvars + endef +endif + +# takes a *list* of package names as $1, the multilib dirname as $2 +_shlibdirs = \ + $(if $(strip $(1)), \ + $(shell find $(foreach p,$(1),$(CURDIR)/debian/$(p)) \ + -name '*.so.*' -printf '%h ' | uniq)) \ + $(with_build_sysroot)/lib/$(call mlib_to_march,$(2)) \ + $(with_build_sysroot)/usr/lib/$(call mlib_to_march,$(2)) \ + $(with_build_sysroot)$(subst /usr,,/$(usr_lib$(2))) \ + $(with_build_sysroot)/$(usr_lib$(2)) \ + $(if $(findstring mips64,$(DEB_TARGET_ARCH)), \ + $(with_build_sysroot)/$(usr_lib64)) \ + $(if $(findstring mipsn32,$(DEB_TARGET_ARCH)), \ + $(with_build_sysroot)/$(usr_libn32)) \ + $(if $(filter sparc64,$(DEB_TARGET_ARCH)), \ + $(with_build_sysroot)/$(usr_lib64)) \ + $(if $(filter yes,$(biarchsf) $(biarchhf)), \ + $(with_build_sysroot)/usr/$(call mlib_to_march,$(2))/lib) \ + $(if $(filter yes, $(with_common_libs)),, \ + $(CURDIR)/$(d)/$(usr_lib$(2)) \ + $(CURDIR)/$(d)/usr/$(call mlib_to_march,$(2))/lib) +shlibdirs_to_search = -l$(subst $(SPACE),:,$(foreach d,$(_shlibdirs),$(d))) diff --git a/debian/rules.parameters b/debian/rules.parameters new file mode 100644 index 0000000..3d142e0 --- /dev/null +++ b/debian/rules.parameters @@ -0,0 +1,41 @@ +# configuration parameters taken from upstream source files +GCC_VERSION := 13.2.0 +NEXT_GCC_VERSION := 13.2.1 +BASE_VERSION := 13 +SOURCE_VERSION := 13.2.0-10 +DEB_VERSION := 13.2.0-10 +DEB_EVERSION := 1:13.2.0-10 +DEB_GDC_VERSION := 13.2.0-10 +DEB_SOVERSION := 5 +DEB_SOEVERSION := 1:5 +DEB_LIBGCC_SOVERSION := +DEB_LIBGCC_VERSION := 13.2.0-10 +DEB_STDCXX_SOVERSION := 5 +DEB_GOMP_SOVERSION := 5 +GCC_SONAME := 1 +CXX_SONAME := 6 +FORTRAN_SONAME := 5 +OBJC_SONAME := 4 +GDC_VERSION := 13 +GNAT_VERSION := 13 +GNAT_SONAME := 13 +FFI_SONAME := 9 +SSP_SONAME := 0 +GOMP_SONAME := 1 +ITM_SONAME := 1 +ATOMIC_SONAME := 1 +BTRACE_SONAME := 1 +ASAN_SONAME := 8 +LSAN_SONAME := 0 +TSAN_SONAME := 2 +UBSAN_SONAME := 1 +HWASAN_SONAME := 0 +VTV_SONAME := 0 +QUADMATH_SONAME := 0 +GO_SONAME := 22 +CC1_SONAME := 0 +GCCJIT_SONAME := 0 +GPHOBOS_SONAME := 4 +GDRUNTIME_SONAME := 4 +GM2_SONAME := 18 +LIBC_DEP := libc6 diff --git a/debian/rules.patch b/debian/rules.patch new file mode 100644 index 0000000..5b4fcb9 --- /dev/null +++ b/debian/rules.patch @@ -0,0 +1,386 @@ +# -*- makefile -*- +# rules to patch the unpacked files in the source directory +# --------------------------------------------------------------------------- +# various rules to unpack addons and (un)apply patches. +# - patch / apply-patches +# - unpatch / reverse-patches + +.NOTPARALLEL: + +patchdir ?= debian/patches +series_file ?= $(patchdir)/series + +# which patches should be applied? + +debian_patches = \ + git-updates \ + +# git-updates \ + +ifneq ($(GFDL_INVARIANT_FREE),yes) + debian_patches += \ + git-doc-updates \ + rename-info-files \ + +# git-doc-updates \ + +else +endif +debian_patches += \ + gcc-gfdl-build + +# libstdc++-pic \ + +debian_patches += \ + gcc-textdomain \ + gcc-distro-specs \ + gcc-driver-extra-langs \ + gcc-hash-style-gnu \ + libstdc++-doclink \ + libstdc++-man-3cxx \ + libstdc++-test-installed \ + libstdc++-doxygen-SOURCE_DATE_EPOCH \ + alpha-no-ev4-directive \ + note-gnu-stack \ + libgomp-omp_h-multilib \ + libgo-testsuite \ + libgo-cleanfiles \ + gcc-target-include-asm \ + libgo-revert-timeout-exp \ + libgo-setcontext-config \ + gcc-auto-build \ + libitm-no-fortify-source \ + sparc64-biarch-long-double-128 \ + pr66368 \ + pr67590 \ + libffi-race-condition \ + cuda-float128 \ + t-libunwind-elf-Wl-z-defs \ + gcc-force-cross-layout \ + gcc-search-prefixed-as-ld \ + kfreebsd-decimal-float \ + pr87808 \ + pr94253 \ + gcc-arm-disable-guality-tests \ + musl-ssp \ + pr79724-revert \ + pr104290-followup \ + arc-stddef \ + pr107475 \ + gccrs-bootstrap-mipsel \ + pr110066 \ + pr88552 \ + hppa64-libgcov-fallback \ + toplevel-add-gprofng \ + toplevel-add-libsframe \ + libiberty-sha1-1 \ + libiberty-sha1-2 \ + +ifneq (,$(filter $(distrelease),lunar)) + debian_patches += rust-enabled +endif + +ifneq (,$(filter $(distrelease),precise xenial bionic focal groovy hirsute)) + debian_patches += pr100067-revert +endif + +ifneq (,$(filter $(distrelease), jessie stretch buster bullseye precise trusty xenial bionic focal groovy hirsute)) + debian_patches += dwarf5-revert-default + ifneq ($(GFDL_INVARIANT_FREE),yes) + debian_patches += dwarf5-revert-default-doc + endif +endif + +# TODO: +# pr81829 \ + +# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \ +# libstdc++-nothumb-check \ + +hardening_patches = +ifneq (,$(filter $(derivative),Ubuntu)) + ifneq (,$(findstring gcc-13, $(PKGSOURCE))) + hardening_patches += \ + gcc-distro-specs-ubuntu-doc \ + testsuite-hardening-format \ + testsuite-hardening-printf-types \ + testsuite-hardening-updates \ + testsuite-glibc-warnings + endif +else ifneq (,$(filter $(derivative),Debian)) + ifneq (,$(findstring gcc-13, $(PKGSOURCE))) +# ifneq ($(with_pie),yes) +# hardening_patches += \ +# ignore-pie-specs-when-not-enabled +# endif + endif +endif + +# FIXME 4.5: Drop and adjust symbols files +ifneq (,$(findstring 4.4, $(PKGSOURCE))) + debian_patches += pr39491 +endif + +# Patches for non-core languages. + +ifeq ($(GFDL_INVARIANT_FREE),yes) + debian_patches += gm2-texinfo +endif + +# Most of the time, it would be safe to apply them whether the +# language is selected or not. But when working on a new GCC version, +# it is convenient to concentrate on core languages, and refresh them +# later when working on the specific language. +ifeq ($(with_ada),yes) + debian_patches += ada-gcc-name + debian_patches += ada-verbose + ifeq ($(biarch64),yes) + debian_patches += ada-nobiarch-check + endif + debian_patches += ada-link-lib + debian_patches += ada-gnattools-cross + ifeq ($(with_gnatsjlj),yes) + debian_patches += ada-sjlj + endif + debian_patches += ada-lib-info-source-date-epoch + # FIXME: debian_patches += ada-749574 + debian_patches += ada-perl-shebang +endif + +# FIXME: still relevant? +# gdc-multiarch + +ifeq ($(GFDL_INVARIANT_FREE),yes) + debian_patches += gdc-texinfo +endif +ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386 armhf)) + debian_patches += disable-gdc-tests +endif + +debian_patches += alpha-ieee +ifneq ($(GFDL_INVARIANT_FREE),yes) + debian_patches += alpha-ieee-doc +endif + +# all patches below this line are applied for gcc-snapshot builds as well + +ifneq (,$(findstring gcc-snapshot, $(PKGSOURCE))) + debian_patches = +endif + +debian_patches += \ + sys-auxv-header \ + gdc-dynamic-link-phobos \ + ia64-disable-selective-scheduling \ + libstdc++-pythondir \ + gcc-verbose-lto-link \ + +ifeq ($(with_ada),yes) + debian_patches += \ + ada-armel-libatomic \ + ada-kfreebsd +endif + +ifeq ($(with_ibm_branch),yes) + debian_patches += ibm-branch +endif + +ifeq ($(with_softfloat),yes) + debian_patches += arm-multilib-soft-float +else ifeq ($(multilib),yes) + ifneq (,$(biarchhfarchs)$(biarchsfarchs)) + ifneq (,$(filter $(distrelease), precise)) + debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross) + else + debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross) + endif + endif +endif +ifneq (,$(filter $(distrelease), precise trusty xenial bionic focal groovy hirsute)) + debian_patches += arm-multilib-defaults +endif + +ifeq ($(DEB_CROSS),yes) + debian_patches += cross-fixes + debian_patches += cross-install-location +endif + +debian_patches += hurd-amd64 +debian_patches += hurd-multiarch +debian_patches += hurd-multilib-multiarch +ifeq ($(DEB_TARGET_ARCH_OS),hurd) + debian_patches += hurd-changes + # FIXME: #1005297, PR 104660 + debian_patches += libgo-hurd-hack +endif + +debian_patches += gcc-ice-dump +debian_patches += gcc-ice-apport +debian_patches += skip-bootstrap-multilib +debian_patches += libffi-ro-eh_frame_sect + +# sigaction on sparc changed between glibc 2.19 and 2.21 +ifeq (,$(filter 2.1%, $(shell dpkg-query -l libc-bin | awk '/^.i/ {print $$3}'))) + # keep it, gets remove in GCC from time to time + #debian_patches += pr67899 +endif + +debian_patches += gcc-multiarch +debian_patches += config-ml +ifneq ($(single_package),yes) + ifeq ($(with_multiarch_cxxheaders),yes) + debian_patches += g++-multiarch-incdir + debian_patches += canonical-cpppath + endif +endif +ifneq (,$(filter $(build_type), build-cross cross-build-cross)) + debian_patches += cross-no-locale-include + debian_patches += cross-biarch +endif +debian_patches += gcc-multilib-multiarch + +ifneq ($(trunk_build),yes) +ifneq (,$(filter $(derivative),Ubuntu)) + debian_patches += gcc-as-needed + ifeq (,$(filter $(distrelease), precise trusty xenial)) + debian_patches += gcc-as-needed-gold + endif +else # Debian + ifeq (,$(filter $(distrelease), jessie stretch)) + debian_patches += gcc-as-needed gcc-as-needed-gold + endif +endif +endif + +debian_patches += libgomp-kfreebsd-testsuite +debian_patches += go-testsuite + +# don't remove, this is regularly overwritten, see PR sanitizer/63958. +#debian_patches += libasan-sparc + +series_stamp = $(stampdir)/02-series-stamp +series: $(series_stamp) +$(series_stamp): + echo $(strip $(addsuffix .diff,$(debian_patches))) \ + | sed -r 's/ +/ /g' | tr " " "\n" > $(series_file) +ifneq (,$(strip $(hardening_patches))) + ifneq ($(trunk_build),yes) + echo $(strip $(addsuffix .diff,$(hardening_patches))) \ + | sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file) + endif +endif + sed -r 's/(.)$$/\1 -p1/' -i $(series_file) + touch $@ + +autoconf_files = $(shell lsdiff --no-filename $(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \ + | sed -rn '/(configure\.ac|acinclude.m4)$$/s:[^/]+/src/:src/:p' | sort -u) +autoconf_dirs = $(sort $(dir $(autoconf_files))) + +automake_files = $(addprefix ./, $(filter-out none, \ + $(shell lsdiff --no-filename $(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \ + | sed -rn '/Makefile\.(am|in)$$/s:[^/]+/src/:src/:p' | sort -u))) + +autoconf_version = 2.69 +ifneq (,$(filter $(distrelease),stretch buster trusty xenial bionic focal groovy)) + autoconf_version = +endif +ifeq ($(trunk_build),yes) + # The actual version depends on the build-dependencies set by + # variable AUTO_BUILD_DEP in rules.conf. Here, we assume the + # correct version is installed. + #autoconf_version = +endif + +# FIXME: the auto* stuff is done every time for every subdir, which +# leads to build errors. Idea: record the auto* calls in the patch +# files (AUTO <dir> <auto-command with options>) and run them separately, +# maybe only once per directory). +$(patch_stamp): $(unpack_stamp) $(series_stamp) + sync + QUILT_PATCHES=$(patchdir) QUILT_PATCH_OPTS='-E' \ + quilt --quiltrc /dev/null push -a || test $$? = 2 + + : # only needed when we have changes, and currently fails with autogen 5.18 + : #cd $(srcdir)/fixincludes && ./genfixes + + sync + echo -n $(autoconf_dirs) | xargs -d ' ' -L 1 -P $(USE_CPUS) -I{} \ + sh -c 'echo "Running autoconf$(autoconf_version) in {}..." ; \ + cd $(CURDIR)/{} && rm -f configure && \ + AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version)' + + for i in $(debian_patches) $(hardening_patches); do \ + echo -e "\n$$i:" >> pxxx; \ + sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \ + done +# -$(srcdir)/move-if-change pxxx $@ + + : # generate the distro-defaults.h header + rm -f $(srcdir)/gcc/distro-defaults.h + ( \ + echo '/* distro specific configuration injected by the distro build. */'; \ + echo ''; \ + echo '#ifndef ACCEL_COMPILER' \ + ) >> $(srcdir)/gcc/distro-defaults.h +ifeq ($(with_async_unwind),yes) + echo '#define DIST_DEFAULT_ASYNC_UNWIND 1' \ + >> $(srcdir)/gcc/distro-defaults.h +endif +ifeq ($(with_ssp)-$(with_ssp_default),yes-yes) + echo '#define DIST_DEFAULT_SSP 1' \ + >> $(srcdir)/gcc/distro-defaults.h + ifeq (,$(filter $(distrelease), precise trusty)) + echo '#define DIST_DEFAULT_SSP_STRONG 1' \ + >> $(srcdir)/gcc/distro-defaults.h + endif + echo '#define DIST_DEFAULT_FORMAT_SECURITY 1' \ + >> $(srcdir)/gcc/distro-defaults.h +endif +ifneq (,$(filter $(derivative),Ubuntu)) + ifneq (,$(filter $(distrelease),lucid precise trusty xenial bionic focal jammy kinetic lunar mantic)) + echo '#define DIST_DEFAULT_FORTIFY_SOURCE 2' \ + >> $(srcdir)/gcc/distro-defaults.h + else + echo '#define DIST_DEFAULT_FORTIFY_SOURCE 3' \ + >> $(srcdir)/gcc/distro-defaults.h + endif + echo '#define DIST_DEFAULT_RELRO 1' \ + >> $(srcdir)/gcc/distro-defaults.h + echo '#define DIST_DEFAULT_BIND_NOW 1' \ + >> $(srcdir)/gcc/distro-defaults.h + ifneq (,$(findstring gcc-13, $(PKGSOURCE))) +# FIXME: this is directly patched +# echo '#define DIST_DEFAULT_FORTIFY_SOURCE 1' \ +# >> $(srcdir)/gcc/distro-defaults.h + endif + ifeq ($(with_stack_clash),yes) + echo '#define DIST_DEFAULT_STACK_CLASH 1' \ + >> $(srcdir)/gcc/distro-defaults.h + endif + ifeq ($(with_cf_protection),yes) + echo '#define DIST_DEFAULT_CF_PROTECTION 1' \ + >> $(srcdir)/gcc/distro-defaults.h + endif +else ifneq (,$(filter $(derivative),Debian)) + ifneq (,$(findstring gcc-13, $(PKGSOURCE))) + endif +endif + echo '#endif' \ + >> $(srcdir)/gcc/distro-defaults.h + + mv pxxx $@ + +unpatch: + QUILT_PATCHES=$(patchdir) \ + quilt --quiltrc /dev/null pop -a -R || test $$? = 2 + rm -rf .pc + +update-patches: $(series_stamp) + export QUILT_PATCHES=$(patchdir); \ + quilt pop -a; \ + export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \ + export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \ + while quilt push; do quilt refresh --no-timestamps --no-index -pab; done + +patch: $(patch_stamp) +.PHONY: patch series quilt autotools diff --git a/debian/rules.sonames b/debian/rules.sonames new file mode 100644 index 0000000..1e12c6d --- /dev/null +++ b/debian/rules.sonames @@ -0,0 +1,94 @@ +ifneq ($(vafilt_defined),1) + $(error rules.defs must be included before rules.sonames) +endif + +ifeq (,$(wildcard debian/soname-cache)) + SONAME_VARS := $(shell \ + cache=debian/soname-cache; \ + rm -f $$cache; \ + v=`awk -F= '/^libtool_VERSION/ {split($$2,v,":"); print v[1]}' \ + $(srcdir)/libstdc++-v3/acinclude.m4`; \ + echo CXX_SONAME=$$v >> $$cache; \ + v=`awk -F= '/^VERSION/ {split($$2,v,":"); print v[1]}' \ + $(srcdir)/libobjc/configure.ac`; \ + echo OBJC_SONAME=$$v >> $$cache; \ + v=`tail -1 $(srcdir)/libgfortran/libtool-version | cut -d: -f1`; \ + echo FORTRAN_SONAME=$$v >> $$cache; \ + v=`tail -1 $(srcdir)/libssp/libtool-version | cut -d: -f1`; \ + echo SSP_SONAME=$$v >> $$cache; \ + v=`tail -1 $(srcdir)/libffi/libtool-version | cut -d: -f1`; \ + echo FFI_SONAME=$$v >> $$cache; \ + v=`awk -F= '/^libtool_VERSION/ {split($$2,v,":"); print v[1]}' \ + $(srcdir)/libgomp/configure.ac`; \ + echo GOMP_SONAME=$$v >> $$cache; \ + v=`tail -1 $(srcdir)/libsanitizer/asan/libtool-version | cut -d: -f1`; \ + echo ASAN_SONAME=$$v >> $$cache; \ + v=`tail -1 $(srcdir)/libsanitizer/lsan/libtool-version | cut -d: -f1`; \ + echo LSAN_SONAME=$$v >> $$cache; \ + v=`tail -1 $(srcdir)/libsanitizer/tsan/libtool-version | cut -d: -f1`; \ + echo TSAN_SONAME=$$v >> $$cache; \ + v=`tail -1 $(srcdir)/libsanitizer/ubsan/libtool-version | cut -d: -f1`; \ + echo UBSAN_SONAME=$$v >> $$cache; \ + v=`tail -1 $(srcdir)/libsanitizer/hwasan/libtool-version | cut -d: -f1`; \ + echo HWASAN_SONAME=$$v >> $$cache; \ + v=`awk -F= '/^libtool_VERSION/ {split($$2,v,":"); print v[1]}' \ + $(srcdir)/libatomic/configure.ac`; \ + v=1; \ + echo ATOMIC_SONAME=$$v >> $$cache; \ + v=`awk -F= '/^libtool_VERSION/ {split($$2,v,":"); print v[1]}' \ + $(srcdir)/libbacktrace/configure.ac`; \ + echo BTRACE_SONAME=$$v >> $$cache; \ + v=`tail -1 $(srcdir)/libquadmath/libtool-version | cut -d: -f1`; \ + echo QUADMATH_SONAME=$$v >> $$cache; \ + v=`grep '[^_]Library_Version.*:' $(srcdir)/gcc/ada/gnatvsn.ads \ + | sed -e 's/.*"\([^"]*\)".*/\1/'`; \ + echo GNAT_SONAME=$$v >> $$cache; \ + v=`awk -F= '/^libtool_VERSION/ {split($$2,v,":"); print v[1]}' \ + $(srcdir)/libgo/configure.ac`; \ + echo GO_SONAME=$$v >> $$cache; \ + echo ITM_SONAME=1 >> $$cache; \ + v=`awk -F= '/^libtool_VERSION/ {split($$2,v,":"); print v[1]}' \ + $(srcdir)/libvtv/configure.ac`; \ + v=0; \ + echo VTV_SONAME=$$v >> $$cache; \ + echo CC1_SONAME=0 >> $$cache; \ + echo GCCJIT_SONAME=0 >> $$cache; \ + v=`awk -F= '/^libtool_VERSION/ {split($$2,v,":"); print v[1]}' \ + $(srcdir)/libphobos/configure.ac`; \ + echo GPHOBOS_SONAME=$$v >> $$cache; \ + echo GDRUNTIME_SONAME=$$v >> $$cache; \ + v=`awk -F= '/^libtool_VERSION/ {split($$2,v,":"); print v[1]}' \ + $(srcdir)/libgm2/configure.ac`; \ + echo GM2_SONAME=$$v >> $$cache; \ + cat $$cache) +else + SONAME_VARS := $(shell cat debian/soname-cache) +endif +CXX_SONAME = $(call vafilt,$(SONAME_VARS),CXX_SONAME) +OBJC_SONAME = $(call vafilt,$(SONAME_VARS),OBJC_SONAME) +FORTRAN_SONAME = $(call vafilt,$(SONAME_VARS),FORTRAN_SONAME) +SSP_SONAME = $(call vafilt,$(SONAME_VARS),SSP_SONAME) +FFI_SONAME = $(call vafilt,$(SONAME_VARS),FFI_SONAME) +GOMP_SONAME = $(call vafilt,$(SONAME_VARS),GOMP_SONAME) +ATOMIC_SONAME = $(call vafilt,$(SONAME_VARS),ATOMIC_SONAME) +BTRACE_SONAME = $(call vafilt,$(SONAME_VARS),BTRACE_SONAME) +ASAN_SONAME = $(call vafilt,$(SONAME_VARS),ASAN_SONAME) +LSAN_SONAME = $(call vafilt,$(SONAME_VARS),LSAN_SONAME) +TSAN_SONAME = $(call vafilt,$(SONAME_VARS),TSAN_SONAME) +UBSAN_SONAME = $(call vafilt,$(SONAME_VARS),UBSAN_SONAME) +VTV_SONAME = $(call vafilt,$(SONAME_VARS),VTV_SONAME) +CILKRTS_SONAME = $(call vafilt,$(SONAME_VARS),CILKRTS_SONAME) +QUADMATH_SONAME = $(call vafilt,$(SONAME_VARS),QUADMATH_SONAME) +GNAT_SONAME = $(call vafilt,$(SONAME_VARS),GNAT_SONAME) +GO_SONAME = $(call vafilt,$(SONAME_VARS),GO_SONAME) +ITM_SONAME = $(call vafilt,$(SONAME_VARS),ITM_SONAME) +CC1_SONAME = $(call vafilt,$(SONAME_VARS),CC1_SONAME) +GCCJIT_SONAME = $(call vafilt,$(SONAME_VARS),GCCJIT_SONAME) +GPHOBOS_SONAME = $(call vafilt,$(SONAME_VARS),GPHOBOS_SONAME) +GDRUNTIME_SONAME= $(call vafilt,$(SONAME_VARS),GDRUNTIME_SONAME) +GM2_SONAME = $(call vafilt,$(SONAME_VARS),GM2_SONAME) +HWASAN_SONAME = $(call vafilt,$(SONAME_VARS),HWASAN_SONAME) + +# alias +GFORTRAN_SONAME = $(FORTRAN_SONAME) +STDC++_SONAME = $(CXX_SONAME) diff --git a/debian/rules.source b/debian/rules.source new file mode 100644 index 0000000..a11b595 --- /dev/null +++ b/debian/rules.source @@ -0,0 +1,15 @@ +SOURCE_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +patchdir = $(SOURCE_DIR)/patches + +include $(SOURCE_DIR)/debian/rules.defs +include $(SOURCE_DIR)/debian/rules.patch +include $(SOURCE_DIR)/debian/rules.unpack + +patch-source: $(patch_stamp) + +clean-source: + rm -rf $(stampdir) + rm -rf $(gcc_srcdir) $(gdc_srcdir) + rm -rf bin + rm -rf $(srcdir) + diff --git a/debian/rules.unpack b/debian/rules.unpack new file mode 100644 index 0000000..48f0221 --- /dev/null +++ b/debian/rules.unpack @@ -0,0 +1,210 @@ +# -*- makefile -*- +# rules to unpack the source tarballs in $(srcdir); if the source dir already +# exists, the rule exits with an error to prevent deletion of modified +# source files. It has to be deleted manually. + +tarballs = $(gcc_tarball) +ifneq (,$(filter yes, $(with_offload_nvptx) $(with_offload_gcn))) + tarballs += $(newlib_tarball) +endif +ifeq ($(with_binutils),yes) + tarballs += $(binutils_dsc) +endif + +unpack_stamps = $(foreach i,$(tarballs),$(unpack_stamp)-$(i)) + +unpack: stamp-dir $(unpack_stamp) debian-chmod +$(unpack_stamp): $(unpack_stamps) +$(unpack_stamp): $(foreach p,$(debian_tarballs),unpacked-$(p)) + echo -e "\nBuilt from Debian source package $(PKGSOURCE)-$(SOURCE_VERSION)" \ + > pxxx + echo -e "Integrated upstream packages in this version:\n" >> pxxx + for i in $(tarballs); do echo " $$i" >> pxxx; done + mv -f pxxx $@ + +debian-chmod: + @chmod 755 debian/dh_* + +# --------------------------------------------------------------------------- + +gfdl_texinfo_files = \ + gcc/doc/analyzer.texi \ + gcc/doc/avr-mmcu.texi \ + gcc/doc/bugreport.texi \ + gcc/doc/cfg.texi \ + gcc/doc/collect2.texi \ + gcc/doc/compat.texi \ + gcc/doc/configfiles.texi \ + gcc/doc/configterms.texi \ + gcc/doc/contrib.texi \ + gcc/doc/contribute.texi \ + gcc/doc/cpp.texi \ + gcc/doc/cppdiropts.texi \ + gcc/doc/cppenv.texi \ + gcc/doc/cppinternals.texi \ + gcc/doc/cppopts.texi \ + gcc/doc/cppwarnopts.texi \ + gcc/doc/extend.texi \ + gcc/doc/fragments.texi \ + gcc/doc/frontends.texi \ + gcc/doc/gccint.texi \ + gcc/doc/gcov.texi \ + gcc/doc/gcov-dump.texi \ + gcc/doc/gcov-tool.texi \ + gcc/doc/generic.texi \ + gcc/doc/gimple.texi \ + gcc/doc/gnu.texi \ + gcc/doc/gty.texi \ + gcc/doc/headerdirs.texi \ + gcc/doc/hostconfig.texi \ + gcc/doc/implement-c.texi \ + gcc/doc/implement-cxx.texi \ + gcc/doc/install-old.texi \ + gcc/doc/install.texi \ + gcc/doc/interface.texi \ + gcc/doc/invoke.texi \ + gcc/doc/languages.texi \ + gcc/doc/libgcc.texi \ + gcc/doc/loop.texi \ + gcc/doc/lto.texi \ + gcc/doc/makefile.texi \ + gcc/doc/match-and-simplify.texi \ + gcc/doc/md.texi \ + gcc/doc/objc.texi \ + gcc/doc/optinfo.texi \ + gcc/doc/options.texi \ + gcc/doc/passes.texi \ + gcc/doc/plugins.texi \ + gcc/doc/poly-int.texi \ + gcc/doc/portability.texi \ + gcc/doc/rtl.texi \ + gcc/doc/service.texi \ + gcc/doc/sourcebuild.texi \ + gcc/doc/standards.texi \ + gcc/doc/tm.texi.in \ + gcc/doc/tm.texi \ + gcc/doc/tree-ssa.texi \ + gcc/doc/trouble.texi \ + gcc/doc/ux.texi \ + gcc/doc/include/gcc-common.texi \ + gcc/doc/include/funding.texi \ + gcc/fortran/gfc-internals.texi \ + gcc/fortran/invoke.texi \ + gcc/fortran/intrinsic.texi \ + + +gfdl_toplevel_texinfo_files = \ + gcc/doc/gcc.texi \ + gcc/doc/lto-dump.texi \ + gcc/ada/gnat-style.texi \ + gcc/ada/gnat_rm.texi \ + gcc/ada/gnat_ugn.texi \ + gcc/fortran/gfortran.texi \ + gcc/go/gccgo.texi \ + libgomp/libgomp.texi \ + libquadmath/libquadmath.texi \ + +gfdl_manpages = \ + gcc/doc/cpp.1 \ + gcc/doc/g++.1 \ + gcc/doc/gc-analyze.1 \ + gcc/doc/gcc.1 \ + gcc/doc/gccgo.1 \ + gcc/doc/gcov.1 \ + gcc/doc/gcov-dump.1 \ + gcc/doc/gcov-tool.1 \ + gcc/doc/gfortran.1 \ + gcc/lto/lto-dump.1 \ + gcc/doc/fsf-funding.7 \ + +# --------------------------------------------------------------------------- +$(unpack_stamp)-$(gcc_tarball): $(gcc_tarpath) + @echo "Build environment: derivative=$(derivative), release=$(distrelease)" + : # unpack gcc tarball + mkdir -p $(stampdir) + if [ -d $(srcdir) ]; then \ + echo >&2 "Source directory $(srcdir) exists. Delete by hand"; \ + false; \ + fi + rm -rf $(gcc_srcdir) + tar -x -f $(gcc_tarpath) + mv $(gcc_srcdir) $(srcdir) + ln -sf libsanitizer $(srcdir)/libasan +ifeq (0,1) + cd $(srcdir) && tar cfj ../gcc-4.1.1-doc.tar.bz2 \ + $(gfdl_texinfo_files) \ + $(gfdl_toplevel_texinfo_files) \ + $(gfdl_manpages) +endif +ifeq ($(GFDL_INVARIANT_FREE),yes) + ifneq ($(single_package),yes) + rm -f $(srcdir)/gcc/doc/*.1 + rm -f $(srcdir)/gcc/doc/fsf-funding.7 + rm -f $(srcdir)/gcc/doc/*.info + rm -f $(srcdir)/gcc/fortran/*.info + rm -f $(srcdir)/libgomp/*.info + rm -f $(srcdir)/libquadmath/*.info + for i in $(gfdl_texinfo_files); do \ + if [ -f $(srcdir)/$$i ]; then \ + cp $(SOURCE_DIR)debian/dummy.texi $(srcdir)/$$i; \ + else \ + cp $(SOURCE_DIR)debian/dummy.texi $(srcdir)/$$i; \ + echo >&2 "$$i does not exist, fix debian/rules.unpack"; \ + fi; \ + done + ( \ + echo '@include gcc-vers.texi'; \ + echo '@macro versionsubtitle'; \ + echo '@subtitle For @sc{gcc} version @value{version-GCC}'; \ + echo '@vskip 0pt plus 1filll'; \ + echo '@end macro'; \ + ) > $(srcdir)/gcc/doc/include/gcc-common.texi + for i in $(gfdl_toplevel_texinfo_files); do \ + n=$$(basename $$i .texi); \ + if [ -f $(srcdir)/$$i ]; then \ + sed "s/@name@/$$n/g" $(SOURCE_DIR)debian/gcc-dummy.texi \ + > $(srcdir)/$$i; \ + else \ + sed "s/@name@/$$n/g" $(SOURCE_DIR)debian/gcc-dummy.texi \ + > $(srcdir)/$$i; \ + echo >&2 "$$i does not exist, fix debian/rules.unpack"; \ + fi; \ + done + for i in $(gfdl_manpages); do \ + touch $(srcdir)/$$i; \ + done + rm -f $(srcdir)/INSTALL/*.html + rm -f $(srcdir)/zlib/contrib/dotzlib/DotZLib.chm + endif +endif + echo "$(gcc_tarball) unpacked." > $@ + +# --------------------------------------------------------------------------- +ifneq (,$(newlib_tarball)) +$(unpack_stamp)-$(newlib_tarball): $(newlib_tarpath) $(unpack_stamp)-$(gcc_tarball) + : # unpack newlib-nvptx tarball + mkdir -p $(stampdir) + : # rm -rf $(newlib_srcdir) + tar -x -f $(newlib_tarpath) + echo "$(newlib_tarball) unpacked." > $@ +endif + +# --------------------------------------------------------------------------- +ifneq (,$(binutils_dsc)) +$(unpack_stamp)-$(binutils_dsc): $(binutils_tarpath) $(unpack_stamp)-$(gcc_tarball) + : # unpack binutils package + mkdir -p $(stampdir) + : # rm -rf $(binutils_srcdir) + dpkg-source -x $(binutils_dsc) + + : # symlink binutilds toplevel dirs into the gcc tree + for d in $(binutils_srcdir)/*; do \ + [ -d $$d ] || continue; \ + b=$$(basename $$d); \ + if [ ! -e $(srcdir)/$$b ]; then \ + ln -s ../$(binutils_srcdir)/$$b $(srcdir)/$$b; \ + fi; \ + done + + echo "$(binutils_dsc) unpacked." > $@ +endif diff --git a/debian/rules2 b/debian/rules2 new file mode 100644 index 0000000..9eeeab7 --- /dev/null +++ b/debian/rules2 @@ -0,0 +1,3061 @@ +#! /usr/bin/make -f +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +.SUFFIXES: + +include debian/rules.defs +include debian/rules.parameters + +ifneq (,$(findstring gcc-toolchain, $(PKGSOURCE))) + -include $(binutils_srcdir)/debian/rules.defs +endif + +dh_compat2 := $(shell dpkg --compare-versions "$$(dpkg-query -f '$${Version}' -W debhelper)" lt 9.20150811ubuntu2 \ + && echo DH_COMPAT=2) + +# some tools +SHELL = /bin/bash -e # brace expansion in rules file +IR = install -m 644 # Install regular file +IP = install -m 755 # Install program +IS = install -m 755 # Install script + +DWZ = dwz +ifneq (,$(filter $(distrelease),jessie stretch trusty xenial)) + DWZ = : dwz +endif + +# dwz: debian/gccgo-11/usr/lib/gcc/mips64el-linux-gnuabi64/11/go1: Found two copies of .debug_line_str section +ifneq (,$(filter $(DEB_HOST_ARCH),mips64el)) + DWZ = : dwz +endif + +# kernel-specific ulimit hack +ifeq ($(findstring linux,$(DEB_HOST_GNU_SYSTEM)),linux) + ULIMIT_M = if [ -e /proc/meminfo ]; then \ + m=`awk '/^((Mem|Swap)Free|Cached)/{m+=$$2}END{print int(m*.9)}' \ + /proc/meminfo`; \ + else \ + m=`vmstat --free --swap-free --kilobytes|awk '{m+=$$2}END{print int(m*.9)}'`; \ + fi; \ + echo "Limiting memory for test runs to $${m}kB"; \ + if ulimit -m $$m; then \ + echo " limited to `ulimit -m`kB"; \ + else \ + echo " failed"; \ + fi +else + ULIMIT_M = true +endif + +#time_command = /usr/bin/time -v +ifeq ($(usage_stats),yes) + time_command += $(CURDIR)/debian/usage-wrapper.py $(NJOBS) --base-memory -m 2.0 -o usage-$(shell echo $@ | sed 's/.*0[1-9]-//;s/-stamp//').svg +endif + +ifeq ($(locale_data),generate) + SET_LOCPATH = LOCPATH=$(CURDIR)/locales +endif + +SET_PATH = PATH=$(CURDIR)/bin:/usr/$(libdir)/gcc/bin:$$PATH +ifeq ($(trunk_build),yes) + ifneq (,$(findstring sparc64-linux,$(DEB_TARGET_GNU_TYPE))) + SET_PATH = PATH=/usr/lib/gcc-snapshot/bin:$(CURDIR)/bin:/usr/$(libdir)/gcc/bin:$$PATH + endif + ifneq (,$(findstring ppc64-linux,$(DEB_TARGET_GNU_TYPE))) + SET_PATH = PATH=/usr/lib/gcc-snapshot/bin:$(CURDIR)/bin:/usr/$(libdir)/gcc/bin:$$PATH + endif +endif + +# the recipient for the test summaries. Send with: debian/rules mail-summary +S_EMAIL = gcc@packages.debian.org gcc-testresults@gcc.gnu.org + +# build not yet prepared to take variables from the environment +define unsetenv + unexport $(1) + $(1) = +endef +$(foreach v, CPPFLAGS CFLAGS CXXFLAGS DFLAGS FFLAGS FCFLAGS LDFLAGS OBJCFLAGS OBJCXXFLAGS, $(if $(filter environment,$(origin $(v))),$(eval $(call unsetenv, $(v))))) + +CC = $(notdir $(firstword $(wildcard \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gcc-13 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gcc-12 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gcc-11 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gcc-10 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gcc-9 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gcc-8 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gcc))) +CXX = $(notdir $(firstword $(wildcard \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-g++-13 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-g++-12 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-g++-11 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-g++-10 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-g++-9 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-g++-8 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-g++))) +GDC = $(notdir $(firstword $(wildcard \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gdc-13 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gdc-12 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gdc-11 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gdc-10 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gdc-9 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gdc))) +ifeq ($(with_ada),yes) + GNAT = $(notdir $(firstword $(wildcard \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gnat-13 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gnat-12 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gnat-11 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gnat-10 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gnat-9 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gnat-8 \ + /usr/bin/$(DEB_HOST_GNU_TYPE)-gnat /usr/bin/gnatgcc))) + ifeq ($(GNAT),gnatgcc) + CC := $(shell readlink /usr/bin/gnatgcc) + else ifneq (,$(GNAT)) + CC = $(subst gnat,gcc,$(GNAT)) + else ifneq (,$(filter $(distrelease), trusty)) + CC = gcc-4.8 + else ifneq (,$(wildcard /usr/bin/$(DEB_HOST_GNU_TYPE)-gcc)) + CC = $(DEB_HOST_GNU_TYPE)-gcc + else + CC = gcc + endif + CXX = $(subst gcc,g++,$(CC)) + GDC = $(subst gcc,gdc,$(CC)) +endif + +ifneq (,$(filter $(build_type),cross-build-native cross-build-cross)) + SET_TARGET_TOOLS = \ + CC_FOR_TARGET=$(DEB_TARGET_GNU_TYPE)-gcc-$(BASE_VERSION) \ + CXX_FOR_TARGET=$(DEB_TARGET_GNU_TYPE)-g++-$(BASE_VERSION) \ + GFORTRAN_FOR_TARGET=$(DEB_TARGET_GNU_TYPE)-gfortran-$(BASE_VERSION) \ + GOC_FOR_TARGET=$(DEB_TARGET_GNU_TYPE)-gccgo-$(BASE_VERSION) \ + GNAT_FOR_TARGET=$(DEB_TARGET_GNU_TYPE)-gnat-$(BASE_VERSION) \ + GDC_FOR_TARGET=$(DEB_TARGET_GNU_TYPE)-gdc-$(BASE_VERSION) \ + GM2_FOR_TARGET=$(DEB_TARGET_GNU_TYPE)-gm2-$(BASE_VERSION) +endif + +ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_TARGET_GNU_TYPE)) + CC_FOR_TARGET = $(builddir)/gcc/xgcc -B$(builddir)/gcc/ +else + CC_FOR_TARGET = $(DEB_TARGET_GNU_TYPE)-gcc +endif + +ifneq ($(derivative),Ubuntu) + ifneq (,$(filter $(DEB_TARGET_ARCH), arm armel mips mipsel)) + STAGE1_CFLAGS = -g -O2 + endif +endif + +ifeq ($(with_ssp_default),yes) + STAGE1_CFLAGS = -g + ifeq (,$(BOOT_CFLAGS)) + BOOT_CFLAGS = -g -O2 + endif + LIBCFLAGS = -g -O2 + LIBCXXFLAGS = -g -O2 -fno-implicit-templates + # Only use -fno-stack-protector when known to the stage1 compiler. + cc-fno-stack-protector := $(shell if $(CC) $(CFLAGS) -fno-stack-protector \ + -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \ + then echo "-fno-stack-protector"; fi;) + $(foreach var,STAGE1_CFLAGS BOOT_CFLAGS LIBCFLAGS LIBCXXFLAGS,$(eval \ + $(var) += $(cc-fno-stack-protector))) +endif + +# FIXME: passing LDFLAGS for native doesn't do anything +ifneq (,$(filter $(build_type), build-cross cross-build-cross)) + CFLAGS = -g -O2 + LDFLAGS = -Wl,-z,relro + ifeq ($(DEB_TARGET_ARCH),alpha) + LDFLAGS += -Wl,--no-relax + endif +else + BOOT_LDFLAGS = -Wl,-z,relro + ifeq ($(DEB_TARGET_ARCH),alpha) + BOOT_LDFLAGS += -Wl,--no-relax + endif +endif +LDFLAGS_FOR_TARGET = -Wl,-z,relro +ifeq ($(DEB_TARGET_ARCH),alpha) + LDFLAGS := $(filter-out -Wl$(COMMA)--no-relax, $(LDFLAGS)) -Wl,--no-relax +endif + +ifneq (,$(findstring static,$(DEB_BUILD_OPTIONS))) + LDFLAGS += -static +endif + +ifneq ($(findstring gccdebug, $(DEB_BUILD_OPTIONS)),) + CFLAGS = -O0 -g3 -fno-inline + CXXFLAGS = -O0 -g3 -fno-inline + CFLAGS_FOR_BUILD = -O0 -g3 -fno-inline + CXXFLAGS_FOR_BUILD = -O0 -g3 -fno-inline + CFLAGS_FOR_TARGET = -O0 -g3 -fno-inline + CXXFLAGS_FOR_TARGET = -O0 -g3 -fno-inline + BOOT_CFLAGS = + BOOT_LDFLAGS = + STAGE1_CFLAGS = + STAGE1_LDFLAGS = +endif + +# set CFLAGS/LDFLAGS for the configure step only, maybe be modifed for some target +# all other flags are passed to the make step. +pass_vars = $(foreach v,$(1),$(if $($(v)),$(v)="$($(v))")) +flags_to_pass := CFLAGS CXXFLAGS LIBCFLAGS LIBCXXFLAGS LDFLAGS + +docdir = usr/share/doc + +# no prefix for regular builds, would disable searching for as / ld +binutils_prefix = +ifneq (,$(with_build_sysroot)) + binutils_prefix = $(with_build_sysroot)/usr/bin +endif + +CONFARGS = -v \ + --with-pkgversion='$(distribution)$(if $(with_ibm_branch),/IBM)___$(DEB_VERSION)' \ + --with-bugurl='file:///usr/share/doc/$(PKGSOURCE)/README.Bugs' + +CONFARGS += \ + --enable-languages=$(subst $(SPACE),$(COMMA),$(enabled_languages)) \ + --prefix=/$(PF) \ + --with-gcc-major-version-only \ + +ifneq (,$(with_build_sysroot)) + CONFARGS += \ + --with-as=$(binutils_prefix)/$(DEB_TARGET_GNU_TYPE)-as \ + --with-ld=$(binutils_prefix)/$(DEB_TARGET_GNU_TYPE)-ld +endif + +ifeq ($(versioned_packages),yes) + CONFARGS += --program-suffix=-$(BASE_VERSION) +endif +ifneq (,$(filter $(build_type),build-native cross-build-native)) + CONFARGS += --program-prefix=$(cmd_prefix) +endif + +ifneq (,$(filter $(DEB_STAGE),stage1 stage2)) + CONFARGS += \ + --disable-decimal-float \ + --disable-libatomic \ + --disable-libgomp \ + --disable-libssp \ + --disable-libquadmath \ + --disable-libsanitizer \ + --disable-threads \ + --disable-bootstrap \ + --libexecdir=/$(libexecdir) \ + --libdir=/$(PF)/$(configured_libdir) \ + $(if $(with_build_sysroot),--with-build-sysroot=$(with_build_sysroot)) \ + $(if $(findstring build-cross, $(build_type)), \ + $(if $(with_sysroot),--with-sysroot=$(with_sysroot))) \ + --enable-linker-build-id + + ifeq ($(with_multiarch_lib),yes) + CONFARGS += \ + --enable-multiarch + endif + + ifeq ($(DEB_STAGE),stage1) + CONFARGS += \ + --disable-shared \ + --with-newlib \ + --without-headers + else + # stage2 + CONFARGS += \ + --enable-shared + endif +else + CONFARGS += \ + --enable-shared \ + --enable-linker-build-id \ + +ifneq ($(single_package),yes) + CONFARGS += \ + --libexecdir=/$(libexecdir) \ + --without-included-gettext \ + --enable-threads=posix \ + --libdir=/$(PF)/$(configured_libdir) +endif + +ifneq ($(with_cpp),yes) + CONFARGS += --disable-cpp +endif + +ifeq ($(with_nls),yes) + CONFARGS += --enable-nls +else + CONFARGS += --disable-nls +endif + +ifeq ($(with_bootstrap),off) + CONFARGS += --disable-bootstrap +else ifneq ($(with_bootstrap),) + CONFARGS += --enable-bootstrap +endif + +ifneq ($(with_sysroot),) + CONFARGS += --with-sysroot=$(with_sysroot) +endif +ifneq ($(with_build_sysroot),) + CONFARGS += --with-build-sysroot=$(with_build_sysroot) +endif + +ifeq ($(force_gnu_locales),yes) + CONFARGS += --enable-clocale=gnu +endif + +ifeq ($(with_cxx)-$(with_cxx_debug),yes-yes) + CONFARGS += --enable-libstdcxx-debug +endif +CONFARGS += --enable-libstdcxx-time=yes +CONFARGS += --with-default-libstdcxx-abi=$(libstdcxx_abi) +ifeq ($(libstdcxx_abi),gcc4-compatible) + CONFARGS += --disable-libstdcxx-dual-abi +endif +CONFARGS += --enable-libstdcxx-backtrace + +ifeq (,$(filter $(DEB_TARGET_ARCH), hurd-amd64 hurd-i386 kfreebsd-amd64 kfreebsd-i386)) + CONFARGS += --enable-gnu-unique-object +endif + +ifneq ($(with_ssp),yes) + CONFARGS += --disable-libssp +endif + +ifneq ($(with_gomp),yes) + CONFARGS += --disable-libgomp +endif + +ifneq ($(with_itm),yes) + CONFARGS += --disable-libitm +endif + +ifneq ($(with_atomic),yes) + CONFARGS += --disable-libatomic +endif + +ifneq (,$(filter $(DEB_TARGET_ARCH),$(vtv_archs))) + ifeq ($(with_vtv),yes) + CONFARGS += --enable-vtable-verify + else + CONFARGS += --disable-vtable-verify + endif +endif + +ifneq ($(with_asan),yes) + CONFARGS += --disable-libsanitizer +endif + +ifneq ($(with_qmath),yes) + CONFARGS += --disable-libquadmath --disable-libquadmath-support +endif + +ifeq ($(with_plugins),yes) + CONFARGS += --enable-plugin +endif + +#ifeq ($(with_gold),yes) +# CONFARGS += --enable-gold --enable-ld=default +#endif + +#CONFARGS += --with-plugin-ld=ld.gold +#CONFARGS += --with-plugin-ld + +# enable pie-by-default on pie_archs +ifeq ($(with_pie),yes) + CONFARGS += --enable-default-pie +endif + +endif # !DEB_STAGE + +CONFARGS += --with-system-zlib + +ifeq ($(with_phobos),yes) + CONFARGS += --enable-libphobos-checking=release + ifeq ($(DEB_CROSS),yes) + CONFARGS += --without-target-system-zlib + else + CONFARGS += --with-target-system-zlib=auto + endif +endif + +ifeq ($(with_d),yes) + ifneq (,$(filter $(DEB_TARGET_ARCH), $(druntime_only_archs))) + CONFARGS += --with-libphobos-druntime-only=yes + else ifneq ($(with_phobos),yes) + CONFARGS += --disable-libphobos + endif +endif + +ifeq ($(with_objc)-$(with_objc_gc),yes-yes) + CONFARGS += --enable-objc-gc=auto +endif + +ifneq (,$(filter $(DEB_TARGET_GNU_TYPE), i486-linux-gnu i586-linux-gnu i686-linux-gnu)) + ifeq ($(multilib),yes) + ifeq ($(biarch64),yes) + CONFARGS += --enable-targets=all + endif + endif +endif + +ifneq (,$(filter $(DEB_TARGET_GNU_TYPE), x86_64-linux-gnu x86_64-linux-gnux32 x86_64-gnu x86_64-kfreebsd-gnu s390x-linux-gnu sparc64-linux-gnu)) + ifneq ($(biarch32),yes) + CONFARGS += --disable-multilib + endif +endif + +ifneq (,$(filter $(DEB_TARGET_GNU_TYPE), powerpc-linux-gnu powerpc-linux-gnuspe)) + CONFARGS += --enable-secureplt + ifeq ($(biarch64),yes) + CONFARGS += --disable-softfloat --with-cpu=default32 + ifeq ($(multilib),yes) + CONFARGS += --disable-softfloat \ + --enable-targets=powerpc-linux,powerpc64-linux + endif + else + CONFARGS += --disable-multilib + endif +endif + +ifneq (,$(findstring powerpc64le-linux,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --enable-secureplt + ifeq ($(derivative),Ubuntu) + ifneq (,$(filter $(distrelease), jessie trusty)) + CONFARGS += --with-cpu=power7 --with-tune=power8 + else ifneq (,$(filter $(distrelease), xenial bionic focal hirsute impish)) + CONFARGS += --with-cpu=power8 + else + CONFARGS += --with-cpu=power9 + endif + endif + CONFARGS += --enable-targets=powerpcle-linux + CONFARGS += --disable-multilib +endif + +ifneq (,$(findstring powerpc64-linux,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --enable-secureplt + ifeq ($(biarch32),yes) + ifeq ($(multilib),yes) + CONFARGS += --disable-softfloat --enable-targets=powerpc64-linux,powerpc-linux + endif + else + CONFARGS += --disable-multilib + endif + ifeq ($(derivative),Ubuntu) + CONFARGS += --with-cpu-32=power7 --with-cpu-64=power7 + endif +endif + +# FIXME: only needed for isl-0.13 for now +#CONFARGS += --disable-isl-version-check + +ifneq (,$(findstring cross-build-,$(build_type))) + # FIXME: requires isl headers for the target + #CONFARGS += --without-isl + # FIXME: build currently fails build the precompiled headers + CONFARGS += --disable-libstdcxx-pch +endif + +ifeq ($(with_multiarch_lib),yes) + CONFARGS += --enable-multiarch +endif + +ifneq (,$(findstring alpha,$(DEB_TARGET_GNU_CPU))) + CONFARGS += --with-cpu=ev56 +endif + +ifneq (,$(findstring aarch64,$(DEB_TARGET_GNU_CPU))) + # requires binutils 2.25.90 or newer + ifeq (,$(filter $(distrelease), precise trusty)) + CONFARGS += --enable-fix-cortex-a53-843419 + endif +endif + +ifneq (,$(findstring softfloat,$(DEB_TARGET_GNU_CPU))) + CONFARGS += --with-float=soft +endif + +ifneq (,$(findstring arc-linux,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --disable-multilib +endif + +ifneq (,$(findstring arm-vfp,$(DEB_TARGET_GNU_CPU))) + CONFARGS += --with-fpu=vfp +endif + +ifneq (,$(findstring arm, $(DEB_TARGET_GNU_CPU))) + ifeq ($(multilib),yes) + CONFARGS += --enable-multilib + endif + CONFARGS += --disable-sjlj-exceptions + ifneq (,$(filter %armhf,$(DEB_TARGET_ARCH))) + ifeq ($(distribution),Raspbian) + with_arm_arch = armv6+fp + else + ifneq (,$(filter $(distrelease), jessie stretch buster bullseye xenial bionic focal hirsute)) + with_arm_fpu = vfpv3-d16 + with_arm_arch = armv7-a + else + with_arm_fpu = + with_arm_arch = armv7-a+fp + endif + endif + else + # armel + ifeq ($(derivative),Debian) + ifneq (,$(filter $(distrelease), jessie stretch)) + with_arm_arch = armv4t + else + with_arm_arch = armv5te + endif + else ifneq (,$(filter $(distrelease), precise)) + with_arm_arch = armv7-a+fp + else + with_arm_arch = armv5t # starting with quantal + CONFARGS += --with-specs='%{mfloat-abi=hard:-march=armv7-a___-mcpu=generic-armv7-a___-mfloat-abi=hard}' + endif + endif + CONFARGS += --with-arch=$(with_arm_arch) + ifneq (,$(with_arm_fpu)) + CONFARGS += --with-fpu=$(with_arm_fpu) + endif + CONFARGS += --with-float=$(float_abi) + ifeq ($(with_arm_thumb),yes) + CONFARGS += --with-mode=thumb + endif +endif + +ifeq ($(DEB_TARGET_GNU_CPU),$(findstring $(DEB_TARGET_GNU_CPU),m68k)) + CONFARGS += --disable-werror +endif +# FIXME: correct fix-warnings.dpatch +ifeq ($(derivative),Ubuntu) + CONFARGS += --disable-werror +else ifeq ($(derivative),Debian) + CONFARGS += --disable-werror +endif + +ifneq (,$(findstring sparc-linux,$(DEB_TARGET_GNU_TYPE))) + ifeq ($(biarch64),yes) + CONFARGS += --enable-targets=all + CONFARGS += --with-cpu-32=ultrasparc + else + CONFARGS += --with-cpu=ultrasparc + endif +endif + +ifneq (,$(findstring sparc64-linux,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --with-cpu-32=ultrasparc + ifeq ($(biarch32),yes) + CONFARGS += --enable-targets=all + endif +endif + +ifneq (,$(findstring ia64-linux,$(DEB_TARGET_GNU_TYPE))) + ifneq ($(with_internal_libunwind),yes) + CONFARGS += --with-system-libunwind + endif +endif + +ifneq (,$(findstring sh4-linux,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --with-cpu=sh4 --with-multilib-list=m4,m4-nofpu +endif + +ifneq (,$(findstring m68k-linux,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --disable-multilib +endif + +ifneq (,$(findstring riscv64-linux,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --disable-multilib + CONFARGS += --with-arch=rv64gc --with-abi=lp64d +endif + +ifneq (,$(findstring s390x-linux,$(DEB_TARGET_GNU_TYPE))) + ifeq ($(derivative),Ubuntu) + ifneq (,$(filter $(distrelease),xenial bionic focal)) + CONFARGS += --with-arch=zEC12 + else ifneq (,$(filter $(distrelease),jammy kinetic)) + CONFARGS += --with-arch=z13 --with-tune=z15 + else + CONFARGS += --with-arch=z13 --with-tune=z16 + endif + else # Debian + CONFARGS += --with-arch=z196 + endif + ifneq (,$(filter $(distrelease),stretch buster bullseye bookworm xenial bionic focal jammy lunar mantic)) + CONFARGS += --enable-s390-excess-float-precision + else + CONFARGS += --disable-s390-excess-float-precision + endif +endif + +ifeq ($(DEB_TARGET_ARCH_OS),linux) + ifneq (,$(findstring $(DEB_TARGET_ARCH), alpha powerpc ppc64 ppc64el s390 s390x sparc sparc64)) + CONFARGS += --with-long-double-128 + endif +endif + +ifneq (,$(filter $(derivative),Ubuntu)) + ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 i386 x32)) + ifneq (,$(filter $(distrelease),precise xenial bionic)) + CONFARGS += --disable-cet + else + CONFARGS += --enable-cet + endif + endif +else ifneq (,$(filter $(derivative),Debian)) + ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 x32)) + ifneq (,$(filter $(distrelease),jessie stretch buster bullseye)) + CONFARGS += --disable-cet + else + CONFARGS += --enable-cet + endif + endif +endif + +ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 i386 kfreebsd-i386 kfreebsd-amd64)) + ifneq (,$(filter $(derivative),Ubuntu)) + CONFARGS += --with-arch-32=i686 + else # Debian + ifneq (,$(filter $(distrelease), jessie)) + CONFARGS += --with-arch-32=i586 + else + CONFARGS += --with-arch-32=i686 + endif + endif +endif + +ifeq ($(DEB_TARGET_ARCH),amd64) + CONFARGS += --with-abi=m64 +endif +ifeq ($(DEB_TARGET_ARCH),x32) + CONFARGS += --with-abi=mx32 +endif +ifeq ($(multilib),yes) + ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 i386)) + CONFARGS += --with-multilib-list=m32,m64$(if $(filter yes,$(biarchx32)),$(COMMA)mx32) + else ifeq ($(DEB_TARGET_ARCH),x32) + CONFARGS += --with-multilib-list=mx32,m64,m32 + endif + CONFARGS += --enable-multilib +endif + +ifneq (,$(filter $(DEB_TARGET_ARCH), hurd-i386)) + CONFARGS += --with-arch=i686 +endif + +ifneq (,$(filter $(DEB_TARGET_ARCH), hurd-amd64)) + CONFARGS += --disable-multilib +endif + +ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 i386 hurd-amd64 hurd-i386 kfreebsd-i386 kfreebsd-amd64)) + CONFARGS += --with-tune=generic +endif + +ifneq (,$(findstring mips-linux,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --with-arch-32=mips32r2 --with-fp-32=xx + CONFARGS += --with-lxc1-sxc1=no + ifeq ($(multilib),yes) + ifeq ($(biarchn32)-$(biarch64),yes-yes) + CONFARGS += --enable-targets=all + CONFARGS += --with-arch-64=mips64r2 + endif + endif +endif + +ifneq (,$(findstring mipsel-linux,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --with-arch-32=mips32r2 --with-fp-32=xx + CONFARGS += --with-madd4=no + CONFARGS += --with-lxc1-sxc1=no + ifeq ($(multilib),yes) + ifeq ($(biarchn32)-$(biarch64),yes-yes) + CONFARGS += --enable-targets=all + CONFARGS += --with-arch-64=mips64r2 + endif + endif +endif + +#FIXME: howto for mipsn32? +ifneq (,$(findstring mips64el-linux-gnuabin32,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --with-madd4=no + ifeq ($(multilib),yes) + ifeq ($(biarch64)-$(biarch32),yes-yes) + CONFARGS += --enable-targets=all + CONFARGS += --with-arch-64=mips64r2 + CONFARGS += --with-arch-32=mips32r2 --with-fp-32=xx + endif + endif +endif + +ifneq (,$(findstring mips64-linux-gnuabin32,$(DEB_TARGET_GNU_TYPE))) + ifeq ($(multilib),yes) + ifeq ($(biarch64)-$(biarch32),yes-yes) + CONFARGS += --enable-targets=all + CONFARGS += --with-arch-64=mips64r2 + CONFARGS += --with-arch-32=mips32r2 --with-fp-32=xx + endif + endif +endif + +ifneq (,$(findstring mips64el-linux-gnuabi64,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --with-mips-plt + CONFARGS += --with-arch-64=mips64r2 + CONFARGS += --with-madd4=no + ifeq ($(multilib),yes) + ifeq ($(biarchn32)-$(biarch32),yes-yes) + CONFARGS += --enable-targets=all + CONFARGS += --with-arch-32=mips32r2 --with-fp-32=xx + endif + endif +endif + +ifneq (,$(findstring mips64-linux-gnuabi64,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --with-mips-plt + CONFARGS += --with-arch-64=mips64r2 + ifeq ($(multilib),yes) + ifeq ($(biarchn32)-$(biarch32),yes-yes) + CONFARGS += --enable-targets=all + CONFARGS += --with-arch-32=mips32r2 --with-fp-32=xx + endif + endif +endif + +ifneq (,$(findstring mipsisa32r6-linux,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --with-arch-32=mips32r6 --with-tune-32=mips32r6 + ifeq ($(multilib),yes) + ifeq ($(biarchn32)-$(biarch64),yes-yes) + CONFARGS += --enable-targets=all + CONFARGS += --with-arch-64=mips64r6 --with-tune-64=mips64r6 + endif + endif +endif + +ifneq (,$(findstring mipsisa32r6el-linux,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --with-arch-32=mips32r6 --with-tune-32=mips32r6 + ifeq ($(multilib),yes) + ifeq ($(biarchn32)-$(biarch64),yes-yes) + CONFARGS += --enable-targets=all + CONFARGS += --with-arch-64=mips64r6 --with-tune-64=mips64r6 + endif + endif +endif + +#FIXME: howto for mipsn32? +ifneq (,$(findstring mipsisa64r6el-linux-gnuabin32,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --with-mips-plt + ifeq ($(multilib),yes) + ifeq ($(biarch64)-$(biarch32),yes-yes) + CONFARGS += --enable-targets=all + CONFARGS += --with-arch-64=mips64r6 --with-tune-64=mips64r6 + CONFARGS += --with-arch-32=mips32r6 --with-tune-32=mips32r6 + endif + endif +endif + +ifneq (,$(findstring mipsisa64r6-linux-gnuabin32,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --with-mips-plt + ifeq ($(multilib),yes) + ifeq ($(biarch64)-$(biarch32),yes-yes) + CONFARGS += --enable-targets=all + CONFARGS += --with-arch-64=mips64r6 --with-tune-64=mips64r6 + CONFARGS += --with-arch-32=mips32r6 --with-tune-32=mips32r6 + endif + endif +endif + +ifneq (,$(findstring mipsisa64r6el-linux-gnuabi64,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --with-mips-plt + CONFARGS += --with-arch-64=mips64r6 --with-tune-64=mips64r6 + ifeq ($(multilib),yes) + ifeq ($(biarchn32)-$(biarch32),yes-yes) + CONFARGS += --enable-targets=all + CONFARGS += --with-arch-32=mips32r6 --with-tune-32=mips32r6 + endif + endif +endif + +ifneq (,$(findstring mipsisa64r6-linux-gnuabi64,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --with-mips-plt + CONFARGS += --with-arch-64=mips64r6 --with-tune-64=mips64r6 + ifeq ($(multilib),yes) + ifeq ($(biarchn32)-$(biarch32),yes-yes) + CONFARGS += --enable-targets=all + CONFARGS += --with-arch-32=mips32r6 --with-tune-32=mips32r6 + endif + endif +endif + +ifneq (,$(findstring mips,$(DEB_TARGET_GNU_TYPE))) + ifeq (,$(filter yes,$(biarch32) $(biarchn32) $(biarch64))) + CONFARGS += --disable-multilib + endif +endif + +ifneq (,$(findstring s390-linux,$(DEB_TARGET_GNU_TYPE))) + ifeq ($(multilib),yes) + ifeq ($(biarch64),yes) + CONFARGS += --enable-targets=all + endif + endif +endif + +ifneq (,$(findstring hppa-linux,$(DEB_TARGET_GNU_TYPE))) + CONFARGS += --disable-libstdcxx-pch +endif + +ifneq (,$(offload_targets)) + ifneq (,$(filter nvptx-none, $(offload_targets))) + offload_opt = nvptx-none=$(CURDIR)/$(d)-nvptx/$(PF) + endif + ifneq (,$(filter $(gcn_target_name), $(offload_targets))) + offload_opt += $(gcn_target_name)=$(CURDIR)/$(d)-gcn/$(PF) + endif + CONFARGS += \ + --enable-offload-targets=$(subst $(SPACE),$(COMMA),$(strip $(offload_opt))) \ + --enable-offload-defaulted + ifeq ($(with_offload_nvptx),yes) + CONFARGS += --without-cuda-driver + endif +endif + +ifneq (,$(findstring gdc, $(PKGSOURCE))) + CONFARGS += --disable-libquadmath +endif + +ifeq ($(trunk_build),yes) + ifeq ($(findstring --disable-werror, $(CONFARGS)),) + CONFARGS += --disable-werror + endif + enable_checking = yes + ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 arm64 mips64el ppc64 ppc64el s390x)) + enable_checking = yes,extra,rtl + endif +else + enable_checking = yes + ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 arm64 mips64el ppc64 ppc64el s390x)) + enable_checking = yes,extra,rtl + endif + enable_checking = release +endif +CONFARGS += --enable-checking=$(enable_checking) + +ifneq (,$(findstring gcc-toolchain, $(PKGSOURCE))) + CONFARGS += $(BINUTILS_GCCCONF) +endif + +CONFARGS += \ + --build=$(DEB_BUILD_GNU_TYPE) \ + --host=$(DEB_HOST_GNU_TYPE) \ + --target=$(TARGET_ALIAS) + +ifeq ($(DEB_CROSS),yes) + CONFARGS += \ + --program-prefix=$(TARGET_ALIAS)- \ + --includedir=/$(PFL)/include +endif + +ifeq ($(with_bootstrap),off) + bootstrap_target = +else ifeq ($(with_bootstrap),profiled) + bootstrap_target = profiledbootstrap + bootstrap_target = profiledbootstrap-lean +else ifeq ($(with_bootstrap),) + ifneq (, $(filter $(PKGSOURCE),gcc-$(BASE_VERSION) gnat-$(BASE_VERSION) gcc-snapshot)) + bootstrap_target = bootstrap + endif + ifneq (,$(DEB_STAGE)) + bootstrap_target = bootstrap + endif +endif + +ifeq ($(with_lto_build),yes) + CONFARGS += \ + --with-build-config=bootstrap-lto-lean \ + --enable-link-serialization=$(CPUS_LTOLINK) +endif + +# this is the default, set in /usr/share/dejagnu/remote.exp +# by a local dejagnu patch. +DEJAGNU_TIMEOUT=300 +# Increase the timeout for one testrun on slow architectures +ifeq ($(derivative),Debian) + ifneq (,$(findstring $(DEB_TARGET_ARCH),armel armhf arm64)) + DEJAGNU_TIMEOUT=300 + else ifneq (,$(findstring $(DEB_TARGET_ARCH),hppa m68k riscv64 sparc)) + DEJAGNU_TIMEOUT=600 + else ifneq (,$(findstring $(DEB_TARGET_GNU_CPU),x86_64 i386 i486 i586 i686)) + DEJAGNU_TIMEOUT=180 + endif + ifeq ($(DEB_TARGET_GNU_SYSTEM),gnu) + DEJAGNU_TIMEOUT=900 + endif +else ifeq ($(derivative),Ubuntu) + ifneq (,$(findstring $(DEB_TARGET_ARCH), armel armhf arm64)) + DEJAGNU_TIMEOUT=300 + else ifneq (,$(findstring $(DEB_TARGET_ARCH), riscv64)) + DEJAGNU_TIMEOUT=600 + else ifneq (,$(findstring $(DEB_TARGET_GNU_CPU),x86_64 i386 i486 i586 i686 power)) + DEJAGNU_TIMEOUT=180 + endif +endif + +DEJAGNU_RUNS = +ifneq ($(trunk_build),yes) +ifeq ($(with_ssp),yes) + # the buildds are just slow ... don't check the non-default + ifneq (,$(findstring $(DEB_TARGET_GNU_CPU),hppa m68k mips sh4)) + DEJAGNU_RUNS = + else ifneq (,$(filter $(DEB_TARGET_ARCH),armel)) + DEJAGNU_RUNS = + else + ifneq ($(single_package),yes) + DEJAGNU_RUNS += $(if $(filter yes,$(with_ssp_default)),-fno-stack-protector,-fstack-protector) + endif + endif +endif +endif + +ifeq ($(derivative),Ubuntu) + ifneq (,$(findstring arm, $(DEB_TARGET_GNU_CPU))) + ifeq ($(with_arm_thumb),yes) + #DEJAGNU_RUNS += -marm + else + DEJAGNU_RUNS += -mthumb + endif + endif +endif + +# no b-d on g++-multilib, this is run by the built compiler +abi_run_check = $(strip $(if $(wildcard build/runcheck$(1).out), \ + $(shell cat build/runcheck$(1).out), \ + $(shell CC="$(builddir)/gcc/xg++ -B$(builddir)/gcc/ -static-libgcc $(1)" bash debian/runcheck.sh))) +ifeq ($(biarch32),yes) + DEJAGNU_RUNS += $(call abi_run_check,$(if $(filter $(DEB_TARGET_ARCH_CPU),mips64 mips64el mipsn32 mipsn32el),-mabi=32,-m32)) +endif +ifeq ($(biarch64),yes) + DEJAGNU_RUNS += $(call abi_run_check,$(if $(filter $(DEB_TARGET_ARCH_CPU),mips mipsel),-mabi=64,-m64)) +endif +ifeq ($(biarchn32),yes) + DEJAGNU_RUNS += $(call abi_run_check,-mabi=n32) +endif +ifeq ($(biarchx32),yes) + DEJAGNU_RUNS += $(call abi_run_check,-mx32) +endif + +# gdc is not multilib'd +ifneq (,$(findstring gdc, $(PKGSOURCE))) + DEJAGNU_RUNS = +endif + +# neither is gnat +ifneq (,$(findstring gnat, $(PKGSOURCE))) + DEJAGNU_RUNS = +endif + +ifneq (,$(strip $(value DEJAGNU_RUNS))) + RUNTESTFLAGS = RUNTESTFLAGS="--target_board=unix\{,$(subst $(SPACE),$(COMMA),$(strip $(DEJAGNU_RUNS)))\}" +endif + +# PF is the installation prefix for the package without the leading slash. +# It's "usr" for gcc releases. +ifneq (,$(PF)) + # use value set in the environment +else ifneq (,$(findstring gcc-snapshot, $(PKGSOURCE))) + PF = usr/lib/gcc-snapshot +else ifneq (,$(findstring gcc-toolchain, $(PKGSOURCE))) + PF = usr/lib/gcc-toolchain-$(BASE_VERSION) +else + PF = usr +endif + +# PFL is the installation prefix with DEB_TARGET_GNU_TYPE attached for cross builds +PFL = $(PF) +# RPF is the base prefix or installation prefix with DEB_TARGET_GNU_TYPE attached for cross builds +# DEP17: move to /usr in trixie and noble +ifneq (,$(filter $(distrelease),jessie stretch buster bullseye bookworm precise trusty xenial bionic focal groovy hirsute impish jammy kinetic lunar mantic)) + RPF = +else + RPF = $(PF) +endif + +ifeq ($(DEB_CROSS),yes) +ifneq ($(DEB_STAGE),rtlibs) + PFL = $(PF)/$(DEB_TARGET_GNU_TYPE) + RPF = $(PF)/$(DEB_TARGET_GNU_TYPE) +endif +endif + +ifeq ($(with_multiarch_lib),yes) + ifeq ($(DEB_CROSS),yes) + libdir = lib + else + libdir = lib/$(DEB_TARGET_MULTIARCH) + endif +else + libdir = lib +endif +configured_libdir = lib + +hppa64libexecdir= $(PF)/libexec + +# /usr/libexec doesn't follow the FHS +ifeq ($(single_package),yes) + libdir = lib + libexecdir = $(PF)/libexec + versiondir = $(BASE_VERSION) +else + libexecdir = $(PF)/$(configured_libdir) + libexecdir = $(PF)/libexec + versiondir = $(BASE_VERSION) +endif +buildlibdir = $(builddir)/$(TARGET_ALIAS) + +# install cross compilers in /usr/lib/gcc-cross, native ones in /usr/lib/gcc +gcc_subdir_name = gcc +ifneq ($(single_package),yes) + ifeq ($(DEB_CROSS),yes) + gcc_subdir_name = gcc-cross + endif +endif + +gcc_lib_dir = $(PF)/$(configured_libdir)/$(gcc_subdir_name)/$(TARGET_ALIAS)/$(versiondir) +gcc_lexec_dir = $(libexecdir)/$(gcc_subdir_name)/$(TARGET_ALIAS)/$(versiondir) + +lib32loc = lib32 +ifneq (,$(findstring mips,$(DEB_TARGET_GNU_TYPE))) +lib32loc = libo32 +endif +lib32 = $(PF)/$(lib32loc) +lib64 = lib64 +libn32 = lib32 +libx32 = libx32 + +p_l= $(1)$(cross_lib_arch) +p_d= $(1)-dbg$(cross_lib_arch) +d_l= debian/$(p_l) +d_d= debian/$(p_d) + +ifeq ($(DEB_CROSS),yes) + usr_lib = $(PFL)/lib +else + usr_lib = $(PFL)/$(libdir) +endif +usr_lib32 = $(PFL)/$(lib32loc) +usr_libn32 = $(PFL)/lib32 +usr_libx32 = $(PFL)/libx32 +usr_lib64 = $(PFL)/lib64 +# FIXME: Move to the new location for native builds too +ifeq ($(DEB_CROSS),yes) + usr_libhf = $(PFL)/libhf + usr_libsf = $(PFL)/libsf +else + usr_libhf = $(PFL)/lib/arm-linux-gnueabihf + usr_libsf = $(PFL)/lib/arm-linux-gnueabi +endif + +ifeq ($(DEB_STAGE)-$(DEB_CROSS),rtlibs-yes) + libdir = lib/$(DEB_TARGET_MULTIARCH) + usr_lib = $(PF)/lib/$(DEB_TARGET_MULTIARCH) +endif + +gcc_lib_dir32 = $(gcc_lib_dir)/$(biarch32subdir) +gcc_lib_dirn32 = $(gcc_lib_dir)/$(biarchn32subdir) +gcc_lib_dirx32 = $(gcc_lib_dir)/$(biarchx32subdir) +gcc_lib_dir64 = $(gcc_lib_dir)/$(biarch64subdir) +gcc_lib_dirhf = $(gcc_lib_dir)/$(biarchhfsubdir) +gcc_lib_dirsf = $(gcc_lib_dir)/$(biarchsfsubdir) + +libgcc_dir = $(RPF)/$(libdir) +# yes, really; lib32gcc_s ends up in usr +libgcc_dir32 = $(PFL)/$(lib32loc) +libgcc_dirn32 = $(RPF)/lib32 +# libx32gcc_s also ends up in usr +libgcc_dirx32 = $(PFL)/libx32 +libgcc_dir64 = $(RPF)/lib64 +# FIXME: Move to the new location for native builds too +ifeq ($(DEB_CROSS),yes) + libgcc_dirhf = $(RPF)/libhf + libgcc_dirsf = $(RPF)/libsf +else + libgcc_dirhf = $(RPF)/lib/arm-linux-gnueabihf + libgcc_dirsf = $(RPF)/lib/arm-linux-gnueabi +endif + +# install_gcc_lib(lib,soname,flavour,package) +define install_gcc_lib + mv $(d)/$(usr_lib$(3))/$(1)*.a debian/$(4)/$(gcc_lib_dir$(3))/ + rm -f $(d)/$(usr_lib$(3))/$(1)*.{la,so} + dh_link -p$(4) \ + /$(usr_lib$(3))/$(1).so.$(2) /$(gcc_lib_dir$(3))/$(1).so +endef + +# do_strip_lib_dbg(pkg,pkg_dbg,version,excludes) +define do_strip_lib_dbg + dh_strip -p$(strip $(1)) $(4) \ + $(if $(with_dbg),--dbg-package=$(strip $(2)),--dbgsym-migration='$(strip $(2)) (<< $(strip $(3)))') +endef + +checkdirs = $(builddir) +ifeq ($(with_separate_go),yes) + ifeq ($(PKGSOURCE),gccgo-$(BASE_VERSION)) + checkdirs = $(buildlibdir)/libgo + endif +endif +ifeq ($(with_separate_gnat),yes) + ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION)) + checkdirs = $(builddir)/gcc + endif +endif + +# FIXME: MULTIARCH_DIRNAME needed for g++-multiarch-incdir.diff +MULTIARCH_DIRNAME := $(DEB_TARGET_MULTIARCH) +export MULTIARCH_DIRNAME + +default: build + +configure: $(configure_dependencies) + +$(configure_dummy_stamp): + touch $(configure_dummy_stamp) + +$(configure_stamp): + dh_testdir + : # give information about the build process + @echo "------------------------ Build process variables ------------------------" + @echo "Memory on this machine:" + @egrep '^(Mem|Swap)' /proc/meminfo || true + @echo "Number of parallel processes used for the build: $(USE_CPUS)" + @echo "DEB_BUILD_OPTIONS: $$DEB_BUILD_OPTIONS" + @echo "Package source: $(PKGSOURCE)" + @echo "GCC version: $(GCC_VERSION)" + @echo "Base Debian version: $(BASE_VERSION)" + @echo -e "Configured with: $(subst ___, ,$(foreach i,$(CONFARGS),$(i)\n\t))" +ifeq ($(DEB_CROSS),yes) + @echo "Building cross compiler for $(DEB_TARGET_ARCH)" +endif + @echo "Using shell $(SHELL)" + @echo "Architecture: $(DEB_TARGET_ARCH) (GNU: $(TARGET_ALIAS))" + @echo "CPPFLAGS: $(CPPFLAGS)" + @echo "CFLAGS: $(CFLAGS)" + @echo "LDFLAGS: $(LDFLAGS)" + @echo "BOOT_CFLAGS: $(BOOT_CFLAGS)" + @echo "DEBIAN_BUILDARCH: $(DEBIAN_BUILDARCH)" + @echo "Install prefix: /$(PF)" +ifeq ($(biarchn32)-$(biarch64),yes-yes) + @echo "Will build the triarch compilers (o32/n32/64, defaulting to o32)" +else ifeq ($(biarchn32)-$(biarch32),yes-yes) + @echo "Will build the triarch compilers (o32/n32/64, defaulting to 64)" +else ifeq ($(biarch64)-$(biarch32),yes-yes) + @echo "Will build the triarch compilers (x32/64/32, defaulting to x32)" +else ifeq ($(biarch64)-$(biarchx32),yes-yes) + @echo "Will build the triarch compilers (32/64/x32, defaulting to 32bit)" +else ifeq ($(biarch32)-$(biarchx32),yes-yes) + @echo "Will build the triarch compilers (64/32/x32, defaulting to 64bit)" +else + ifeq ($(biarch64),yes) + @echo "Will build the biarch compilers (32/64, defaulting to 32bit)" + else + ifeq ($(biarch32),yes) + @echo "Will build the biarch compilers (64/32, defaulting to 64bit)" + else + @echo "Will not build the biarch compilers" + endif + endif +endif + +ifeq ($(with_cxx),yes) + @echo "Will build the C++ compiler" +else + @echo "Will not build the C++ compiler: $(with_cxx)" +endif +ifeq ($(with_objc),yes) + @echo "Will build the ObjC compiler." + ifeq ($(with_objc_gc),yes) + @echo "Will build the extra ObjC runtime for garbage collection." + else + @echo "Will not build the extra ObjC runtime for garbage collection." + endif +else + @echo "Will not build the ObjC compiler: $(with_objc)" +endif +ifeq ($(with_objcxx),yes) + @echo "Will build the Obj-C++ compiler" +else + @echo "Will not build the Obj-C++ compiler: $(with_objcxx)" +endif +ifeq ($(with_fortran),yes) + @echo "Will build the Fortran 95 compiler." +else + @echo "Will not build the Fortran 95 compiler: $(with_fortran)" +endif +ifeq ($(with_ada),yes) + @echo "Will build the Ada compiler." + ifeq ($(with_libgnat),yes) + @echo "Will build the shared Ada libraries." + else + @echo "Will not build the shared Ada libraries." + endif +else + @echo "Will not build the Ada compiler: $(with_ada)" +endif +ifeq ($(with_go),yes) + @echo "Will build the Go compiler." +else + @echo "Will not build the Go compiler: $(with_go)" +endif +ifeq ($(with_d),yes) + @echo "Will build the D compiler" + ifeq ($(with_phobos),yes) + @echo "Will build the phobos D runtime library." + else + @echo "Will not build the phobos D runtime library: $(with_phobos)" + endif +else + @echo "Will not build the D compiler: $(with_d)" +endif +ifeq ($(with_m2),yes) + @echo "Will build the Modula-2 compiler." +else + @echo "Will not build the Modula-2 compiler: $(with_m2)" +endif +ifneq (,$(offload_targets)) + @echo "Will build with offload compilers: $(offload_targets)." +else + @echo "Will build without offload compilers: $(with_offload_nvptx) / $(with_offload_gcn)" +endif +ifeq ($(with_ssp),yes) + @echo "Will build with SSP support." +else + @echo "Will build without SSP support: $(with_ssp)" +endif +ifeq ($(with_check),yes) + @echo "Will run the testsuite." +else + @echo "Will not run the testsuite: $(with_check)" +endif +ifeq ($(with_nls),yes) + @echo "Will enable national language support." +else + @echo "Will disable national language support: $(with_nls)" +endif + @echo "-----------------------------------------------------------------------------" + @echo "" +ifeq ($(with_check),yes) + @if echo "spawn true" | /usr/bin/expect -f - >/dev/null; then \ + : ; \ + else \ + echo "expect is failing on your system with the above error, which means the GCC"; \ + echo "testsuite will fail. Please resolve the above issues and retry the build."; \ + echo "-----------------------------------------------------------------------------"; \ + exit 1; \ + fi +endif + rm -f $(configure_stamp) $(build_stamp) + cat debian/README.Debian $(patch_stamp) > debian/README.Debian.$(DEB_TARGET_ARCH) + + rm -rf $(builddir) + mkdir $(builddir) + +ifneq (,$(filter musl-%,$(DEB_TARGET_ARCH))) + # We have to unconditionally link -lssp_nonshared on musl (see + # musl-ssp.diff). While gcc provides it, it comes a little late in the + # build for bootstrapping so we provide an empty one. + mkdir $(builddir)/gcc + ar rcs $(builddir)/gcc/libssp_nonshared.a +endif + + : # some tools like gettext are built with a newer libstdc++ + mkdir -p bin + for i in msgfmt; do \ + install -m755 debian/bin-wrapper.in bin/$$i; \ + done + + : # configure + cd $(builddir) \ + && $(SET_PATH) \ + $(call pass_vars, CC CXX GDC $(flags_to_pass) \ + CFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD \ + CFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET LDFLAGS_FOR_TARGET) \ + $(SET_SHELL) $(SET_TARGET_TOOLS) \ + $(call SET_BINUTILS_MULTIARCH_ENV,$(DEB_TARGET_ARCH)) $(BINUTILS_GCCENV) \ + ../src/configure $(subst ___, ,$(CONFARGS)) + + : # multilib builds without b-d on gcc-multilib (used in FLAGS_FOR_TARGET) + if [ -d /usr/include/$(DEB_TARGET_MULTIARCH)/asm ]; then \ + mkdir -p $(builddir)/sys-include; \ + ln -sf /usr/include/$(DEB_TARGET_MULTIARCH)/asm $(builddir)/sys-include/asm; \ + fi + + touch $(configure_stamp) + +build: $(sort $(build_arch_dependencies) $(build_indep_dependencies)) +build-arch: $(build_arch_dependencies) +build-indep: $(build_indep_dependencies) + +$(build_dummy_stamp): + touch $(build_dummy_stamp) + +$(build_locale_stamp): +ifeq ($(locale_data)-$(with_cxx),generate-yes) + : # build locales needed by libstdc++ testsuite + rm -rf locales + mkdir locales + -USE_CPUS=$(USE_CPUS) sh debian/locale-gen +endif + touch $(build_locale_stamp) + +MAX_BUILD_TRIES = 1 +ifeq ($(distribution)-$(DEB_HOST_ARCH),Ubuntu-armhf) + MAX_BUILD_TRIES = 3 +endif + +$(build_stamp): $(configure_stamp) $(build_locale_stamp) + @echo === START $@ === + dh_testdir + rm -f bootstrap-protocol* + @echo TTTTT $$(date -R) +ifeq ($(build_type),build-native) + : # build native compiler + set +e; \ + set -o pipefail; \ + try=0; \ + while [ $$try -lt $(MAX_BUILD_TRIES) ]; do \ + try=$$(expr $$try + 1); \ + echo "=========== BUILD ($$try) =========="; \ + $(SET_PATH) \ + $(SET_SHELL) \ + $(SET_LOCPATH) \ + $(call SET_BINUTILS_MULTIARCH_ENV,$(DEB_TARGET_ARCH)) $(BINUTILS_GCCENV) \ + $(time_command) $(MAKE) $(NJOBS) -C $(builddir) $(bootstrap_target) \ + $(call pass_vars, CC $(flags_to_pass) \ + STAGE1_CFLAGS STAGE1_LDFLAGS \ + BOOT_CFLAGS BOOT_LDFLAGS \ + CFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD \ + CFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET LDFLAGS_FOR_TARGET) \ + 2>&1 | tee bootstrap-protocol$$try \ + ; \ + status=$$?; \ + echo $$status > status; \ + echo === TIME $@ ===; \ + if [ $$status -eq 0 ] || [ $$try -eq $(MAX_BUILD_TRIES) ]; then \ + exit $$status; \ + fi; \ + done +else ifneq (,$(filter $(build_type),build-cross cross-build-native cross-build-cross)) + : # build cross compiler for $(TARGET_ALIAS) + ( \ + set +e; \ + $(SET_PATH) \ + $(SET_LOCPATH) \ + $(time_command) $(MAKE) $(NJOBS) -C $(builddir) \ + $(call pass_vars, BOOT_CFLAGS BOOT_LDFLAGS \ + CFLAGS_FOR_TARGET LDFLAGS_FOR_TARGET) \ + ; \ + echo $$? > status; \ + echo === TIME $@ ===; \ + ) 2>&1 | tee bootstrap-protocol +endif + @echo TTTTT $$(date -R) + s=`cat status`; rm -f status; \ + if [ $$s -ne 0 ] && [ -z "$$NO_CONFIG_LOG_DUMP$$NO_CONFIG_LOG_DUMPS" ]; then \ + for log in $$(find $(builddir) -name config.log); do \ + case "$$log" in */build/build-*|*/stage1-*|*/prev-*) continue; esac; \ + echo LOGFILE START $$log; \ + cat $$log; \ + echo LOGFILE END $$log; \ + done; \ + fi; \ + test $$s -eq 0 + + for h in $$(find $(builddir) -name omp.h); do \ + echo "=================== OMP_H HEADER $$h ====================== "; \ + cat $$h; \ + done + + if [ -f $(srcdir)/contrib/warn_summary ]; then \ + rm -f bootstrap-summary; \ + /bin/sh $(srcdir)/contrib/warn_summary $$(ls bootstrap-protocol* | head -1) \ + > bootstrap-summary; \ + fi + + touch $(build_stamp) + @echo === END $@ === + +ifneq ($(build_type),build-native) + BUILT_CC = $(CC) + BUILT_CXX = $(CXX) +else + BUILT_CC = $(builddir)/gcc/xgcc -B$(builddir)/gcc/ + BUILT_CXX = $(builddir)/gcc/xg++ -B$(builddir)/gcc/ \ + -B$(builddir)/$(TARGET_ALIAS)/libatomic/.libs \ + -B$(builddir)/$(TARGET_ALIAS)/libstdc++-v3/src/.libs \ + -B$(builddir)/$(TARGET_ALIAS)/libstdc++-v3/libsupc++/.libs \ + -I$(builddir)/$(TARGET_ALIAS)/libstdc++-v3/include \ + -I$(builddir)/$(TARGET_ALIAS)/libstdc++-v3/include/$(TARGET_ALIAS) \ + -I$(srcdir)/libstdc++-v3/libsupc++ \ + -L$(builddir)/$(TARGET_ALIAS)/libatomic/.libs \ + -L$(builddir)/$(TARGET_ALIAS)/libstdc++-v3/src/.libs \ + -L$(builddir)/$(TARGET_ALIAS)/libstdc++-v3/libsupc++/.libs +endif + +CONFARGS_JIT := \ + $(filter-out --enable-languages=% \ + --enable-libstdcxx-debug %bootstrap,\ + $(CONFARGS)) \ + --enable-languages=c++,jit \ + --enable-host-shared \ + --disable-bootstrap + +# are other libs also safe to disable? +CONFARGS_JIT += \ + --disable-libada \ + --disable-libgfortran \ + --disable-libgm2 \ + --disable-libgo \ + --disable-libphobos \ + --disable-libquadmath \ + +$(configure_jit_stamp): $(build_stamp) + @echo === START $@ === + dh_testdir + rm -f $(configure_jit_stamp) $(build_jit_stamp) + rm -rf $(builddir_jit) + mkdir $(builddir_jit) + + : # configure jit + cd $(builddir_jit) && \ + $(SET_PATH) \ + $(SET_SHELL) \ + CC="$(BUILT_CC)" \ + CXX="$(BUILT_CXX)" \ + $(call SET_BINUTILS_MULTIARCH_ENV,$(DEB_TARGET_ARCH)) $(BINUTILS_GCCENV) \ + ../src/configure $(subst ___, ,$(CONFARGS_JIT)) + touch $(configure_jit_stamp) + +$(build_jit_stamp): $(configure_jit_stamp) + @echo === START $@ === + dh_testdir + ( \ + set +e; \ + $(SET_PATH) \ + $(SET_SHELL) \ + $(SET_LOCPATH) \ + $(call SET_BINUTILS_MULTIARCH_ENV,$(DEB_TARGET_ARCH)) $(BINUTILS_GCCENV) \ + LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(builddir)/gcc \ + biarch_multidir_names=none \ + $(time_command) $(MAKE) $(NJOBS) -C $(builddir_jit) \ + $(call pass_vars, BOOT_CFLAGS BOOT_LDFLAGS \ + CFLAGS_FOR_TARGET LDFLAGS_FOR_TARGET) \ + ; \ + echo $$? > status; \ + echo === TIME $@ ===; \ + ) 2>&1 | tee jit-protocol + + s=`cat status`; rm -f status; \ + if [ $$s -ne 0 ] && [ -z "$$NO_CONFIG_LOG_DUMP$$NO_CONFIG_LOG_DUMPS" ]; then \ + for log in $$(find $(builddir_jit) -name config.log); do \ + case "$$log" in */build/build-*|*/stage1-*|*/prev-*) continue; esac; \ + echo LOGFILE START $$log; \ + cat $$log; \ + echo LOGFILE END $$log; \ + done; \ + fi; \ + test $$s -eq 0 + +ifeq ($(with_check),yes) + # FIXME: #782444 + ifeq (,$(filter $(DEB_TARGET_ARCH), kfreebsd-i386 kfreebsd-amd64)) + -DEB_BUILD_OPTIONS='$(DEB_BUILD_OPTIONS) gcc-ice=nodump,norepro' \ + $(MAKE) -C $(builddir_jit)/gcc check-jit \ + RUNTESTFLAGS="-v -v" + mkdir -p $(builddir)/gcc/testsuite/jit + cp -p $(builddir_jit)/gcc/testsuite/jit/jit.{log,sum} \ + $(builddir)/gcc/testsuite/jit/. + endif +endif + + : # do the install in the build target, to save disk space + rm -rf $(d)-jit + mkdir -p $(d)-jit/$(PF) + + $(SET_PATH) \ + biarch_multidir_names=none \ + $(MAKE) -C $(builddir_jit) \ + CC="$(CC_FOR_TARGET)" \ + $(call pass_vars, $(flags_to_pass)) \ + DESTDIR=$(CURDIR)/$(d)-jit \ + install + + find $(d)-jit ! -type d + + mkdir -p $(d)-jit/$(usr_lib) + mkdir -p $(d)-jit/$(gcc_lib_dir)/include + mv $(d)-jit/$(PF)/include/libgccjit*.h \ + $(d)-jit/$(gcc_lib_dir)/include/. +ifneq ($(PF)/lib,$(usr_lib)) + mv $(d)-jit/$(PF)/lib/libgccjit.so* \ + $(d)-jit/$(usr_lib)/. +endif + cd $(d)-jit && tar cvfJ ../../installed-jit.tar.xz \ + $(gcc_lib_dir)/include/libgccjit*.h \ + $(usr_lib)/libgccjit.so* \ + $(PF)/share/info/libgccjit* + rm -rf $(d)-jit + +ifeq ($(save_disk_space),yes) + rm -rf $(builddir_jit) +endif + + touch $(build_jit_stamp) + @echo === END $@ === + +CONFARGS_NVPTX := \ + --prefix=/$(PF) \ + --libexecdir=/$(libexecdir) \ + --with-gcc-major-version-only \ + --disable-bootstrap \ + --disable-sjlj-exceptions \ + --enable-newlib-io-long-long \ + --target=nvptx-none \ + --enable-as-accelerator-for=$(DEB_TARGET_GNU_TYPE) \ + --enable-languages=c,c++,fortran,lto \ + --enable-checking=release \ + --with-system-zlib \ + --without-isl + +# --with-build-time-tools=/$(PF)/nvptx-none/bin + +CONFARGS_NVPTX += --program-prefix=nvptx-none- +ifeq ($(versioned_packages),yes) + CONFARGS_NVPTX += --program-suffix=-$(BASE_VERSION) +endif + +# FIXME: must not be run in parallel with jit and hppa64 builds ... +$(configure_nvptx_stamp): $(build_stamp) \ + $(if $(filter yes, $(with_jit)), $(build_jit_stamp)) \ + $(if $(filter yes, $(with_hppa64)), $(build_hppa64_stamp)) + @echo === START $@ === + dh_testdir + rm -f $(configure_nvptx_stamp) $(build_nvptx_stamp) + rm -rf src-nvptx $(builddir_nvptx) + cp -al src src-nvptx + rm -rf src-nvptx/newlib + cp -a $(newlib_srcdir)/newlib src-nvptx/newlib + mkdir $(builddir_nvptx) + + : # configure nvptx offload + cd $(builddir_nvptx) && \ + $(SET_PATH) \ + $(SET_SHELL) \ + CC="$(BUILT_CC)" \ + CXX="$(BUILT_CXX)" \ + ../src-nvptx/configure $(subst ___, ,$(CONFARGS_NVPTX)) + touch $(configure_nvptx_stamp) + +$(build_nvptx_stamp): $(configure_nvptx_stamp) \ + $(if $(filter yes, $(with_jit)), $(build_jit_stamp)) \ + $(if $(filter yes, $(with_hppa64)), $(build_hppa64_stamp)) + @echo === START $@ === + ln -sf ../$(newlib_srcdir)/newlib $(srcdir)/newlib + ( \ + set +e; \ + $(SET_PATH) \ + $(SET_SHELL) \ + $(SET_LOCPATH) \ + LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(builddir)/gcc \ + biarch_multidir_names=none \ + $(time_command) $(MAKE) $(NJOBS) -C $(builddir_nvptx) \ + $(call pass_vars, BOOT_CFLAGS BOOT_LDFLAGS \ + CFLAGS_FOR_TARGET) \ + ; \ + echo $$? > status; \ + echo === TIME $@ ===; \ + ) 2>&1 | tee nvptx-protocol + + s=`cat status`; rm -f status; \ + if [ $$s -ne 0 ] && [ -z "$$NO_CONFIG_LOG_DUMP$$NO_CONFIG_LOG_DUMPS" ]; then \ + for log in $$(find $(builddir_nvptx) -name config.log); do \ + case "$$log" in */build/build-*|*/stage1-*|*/prev-*) continue; esac; \ + echo LOGFILE START $$log; \ + cat $$log; \ + echo LOGFILE END $$log; \ + done; \ + fi; \ + test $$s -eq 0 + + rm -f $(srcdir)/newlib + touch $(build_nvptx_stamp) + @echo === END $@ === + +CONFARGS_GCN := \ + --prefix=/$(PF) \ + --libexecdir=/$(libexecdir) \ + --with-gcc-major-version-only \ + --disable-bootstrap \ + --disable-sjlj-exceptions \ + --enable-newlib-io-long-long \ + --target=$(gcn_target_name) \ + --enable-as-accelerator-for=$(DEB_TARGET_GNU_TYPE) \ + --enable-languages=c,fortran,lto \ + --enable-checking=release \ + --disable-libstdcxx-pch \ + --disable-libquadmath-support \ + --with-system-zlib \ + --without-isl \ + --without-gnu-as \ + --without-gnu-ld \ + --with-build-time-tools=$(CURDIR)/bin-gcn + +# --without-headers \ + +CONFARGS_GCN += --program-prefix=$(gcn_target_name)- +ifeq ($(versioned_packages),yes) + CONFARGS_GCN += --program-suffix=-$(BASE_VERSION) +endif + +# FIXME: must not be run in parallel with jit and hppa64 builds ... +$(configure_gcn_stamp): $(build_stamp) \ + $(if $(filter yes, $(with_jit)), $(build_jit_stamp)) \ + $(if $(filter yes, $(with_hppa64)), $(build_hppa64_stamp)) \ + $(if $(filter yes, $(with_offload_nvptx)), $(build_nvptx_stamp)) + @echo === START $@ === + dh_testdir + + rm -rf bin-gcn +ifeq ($(gcn_tools_llvm_version),tools) + ln -s /usr/$(gcn_target_name)/bin bin-gcn +else + mkdir bin-gcn + ln -sf /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-ar bin-gcn/ar + ln -sf /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-mc bin-gcn/as + ln -sf /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/lld bin-gcn/ld + ln -sf /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-nm bin-gcn/nm + ln -sf /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-ranlib bin-gcn/ranlib +endif + ls -l / + ls -l /usr + -ls -l usr/$(gcn_target_name) + -ls -l usr/$(gcn_target_name)/bin + ls -l bin-gcn + ls -lL bin-gcn + bin-gcn/as --version + bin-gcn/ld --version + + rm -f $(configure_gcn_stamp) $(build_gcn_stamp) + rm -rf src-gcn $(builddir_gcn) + cp -al src src-gcn + rm -rf src-gcn/newlib + cp -a $(newlib_srcdir)/newlib src-gcn/newlib + mkdir $(builddir_gcn) + + : # configure gcn offload + cd $(builddir_gcn) && \ + $(SET_PATH) \ + $(SET_SHELL) \ + CC="$(BUILT_CC)" \ + CXX="$(BUILT_CXX)" \ + ../src-gcn/configure $(subst ___, ,$(CONFARGS_GCN)) + touch $(configure_gcn_stamp) + +$(build_gcn_stamp): $(configure_gcn_stamp) \ + $(if $(filter yes, $(with_jit)), $(build_jit_stamp)) \ + $(if $(filter yes, $(with_hppa64)), $(build_hppa64_stamp)) \ + $(if $(filter yes, $(with_offload_nvptx)), $(build_nvptx_stamp)) + @echo === START $@ === + ln -sf ../$(newlib_srcdir)/newlib $(srcdir)/newlib + ( \ + set +e; \ + $(SET_PATH) \ + $(SET_SHELL) \ + $(SET_LOCPATH) \ + LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(builddir)/gcc \ + biarch_multidir_names=none \ + $(time_command) $(MAKE) $(NJOBS) -C $(builddir_gcn) \ + $(call pass_vars, BOOT_CFLAGS BOOT_LDFLAGS \ + CFLAGS_FOR_TARGET) \ + ; \ + echo $$? > status; \ + echo === TIME $@ ===; \ + ) 2>&1 | tee amdgcn-protocol + + s=`cat status`; rm -f status; \ + if [ $$s -ne 0 ] && [ -z "$$NO_CONFIG_LOG_DUMP$$NO_CONFIG_LOG_DUMPS" ]; then \ + for log in $$(find $(builddir_gcn) -name config.log); do \ + case "$$log" in */build/build-*|*/stage1-*|*/prev-*) continue; esac; \ + echo LOGFILE START $$log; \ + cat $$log; \ + echo LOGFILE END $$log; \ + done; \ + fi; \ + test $$s -eq 0 + + rm -f $(srcdir)/newlib + touch $(build_gcn_stamp) + @echo === END $@ === + +ifeq ($(versioned_packages),yes) + hppa64_configure_flags += --program-suffix=-$(BASE_VERSION) +endif + +$(configure_hppa64_stamp): $(build_stamp) \ + $(if $(filter yes, $(with_jit)), $(build_jit_stamp)) + @echo === START $@ === + dh_testdir + rm -f $(configure_hppa64_stamp) $(build_hppa64_stamp) + rm -rf $(builddir_hppa64) + mkdir $(builddir_hppa64) + : # configure hppa64 + cd $(builddir_hppa64) && \ + $(SET_PATH) \ + $(SET_SHELL) \ + CC="$(BUILT_CC)" \ + CXX="$(BUILT_CXX)" \ + $(call pass_vars, $(flags_to_pass)) \ + ../src/configure \ + --enable-languages=c \ + --prefix=/$(PF) \ + --libexecdir=/$(hppa64libexecdir) \ + --with-gcc-major-version-only \ + --disable-shared \ + --disable-nls \ + --disable-threads \ + --disable-libatomic \ + --disable-libgomp \ + --disable-libitm \ + --disable-libssp \ + --disable-libquadmath \ + --enable-plugin \ + --with-system-zlib \ + --with-as=/usr/bin/hppa64-linux-gnu-as \ + --with-ld=/usr/bin/hppa64-linux-gnu-ld \ + --includedir=/usr/hppa64-linux-gnu/include \ + --build=$(DEB_BUILD_GNU_TYPE) \ + --host=$(DEB_HOST_GNU_TYPE) \ + --target=hppa64-linux-gnu + touch $(configure_hppa64_stamp) + +$(build_hppa64_stamp): $(configure_hppa64_stamp) \ + $(if $(filter yes, $(with_jit)), $(build_jit_stamp)) + @echo === START $@ === + if [ -f $(srcdir)/gcc/distro-defaults.h ]; then \ + if [ ! -f $(srcdir)/gcc/distro-defaults.h.saved ]; then \ + mv $(srcdir)/gcc/distro-defaults.h $(srcdir)/gcc/distro-defaults.h.saved; \ + fi; \ + echo '/* Empty distro-defaults for hppa64 cross build */' \ + > $(srcdir)/gcc/distro-defaults.h; \ + fi + $(SET_PATH) \ + $(SET_SHELL) \ + $(SET_LOCPATH) \ + LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(builddir)/gcc \ + $(time_command) $(MAKE) $(NJOBS) -C $(builddir_hppa64) \ + $(call pass_vars, \ + CFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET LDFLAGS_FOR_TARGET) + if [ -f $(srcdir)/gcc/distro-defaults.h.saved ]; then \ + mv -f $(srcdir)/gcc/distro-defaults.h.saved $(srcdir)/gcc/distro-defaults.h; \ + fi + + : # do the install in the build target, to save disk space + rm -rf $(d_hppa64) + mkdir -p $(d_hppa64)/$(PF) + + $(SET_PATH) \ + $(MAKE) -C $(builddir_hppa64) \ + $(call pass_vars, CC $(flags_to_pass)) \ + DESTDIR=$(CURDIR)/$(d_hppa64) \ + install + + : # remove files not needed + rm -rf $(d_hppa64)/$(PF)/info $(d_hppa64)/$(PF)/share/info + rm -rf $(d_hppa64)/$(PF)/man $(d_hppa64)/$(PF)/share/man + rm -rf $(d_hppa64)/$(PF)/lib/gcc/hppa64-linux-gnu/$(BASE_VERSION)/plugin + rm -f $(d_hppa64)/$(PF)/lib/libiberty.a + rm -f $(d_hppa64)/$(PF)/lib/libcc1.* + rm -f $(d_hppa64)/$(PF)/bin/*{gcov,gcov-dump,gcov-tool,gccbug,gcc,lto-dump} + + rm -rf $(d_hppa64)/$(PF)/hppa64-linux-gnu + rm -rf $(d_hppa64)/$(PF)/lib/gcc/hppa64-linux-gnu/$(BASE_VERSION)/install-tools + rm -rf $(d_hppa64)/$(PF)/lib/gcc/hppa64-linux-gnu/$(BASE_VERSION)/g++-mapper-server + rm -rf $(d_hppa64)/$(PF)/lib/gcc/hppa64-linux-gnu/$(BASE_VERSION)/include-fixed + +ifeq ($(versioned_packages),yes) + for i in cpp gcc-ar gcc-nm gcc-ranlib; do \ + mv -f $(d_hppa64)/$(PF)/bin/hppa64-linux-gnu-$$i \ + $(d_hppa64)/$(PF)/bin/hppa64-linux-gnu-$$i$(pkg_ver); \ + done +endif + mkdir -p $(d_hppa64)/$(PF)/share/man/man1 + for i in gcc-ar gcc-nm gcc-ranlib; do \ + ln -sf $$i$(pkg_ver).1.gz \ + $(d_hppa64)/$(PF)/share/man/man1/hppa64-linux-gnu-$$i$(pkg_ver).1.gz; \ + done +ifneq ($(GFDL_INVARIANT_FREE),yes) + for i in cpp gcc; do \ + ln -sf $$i$(pkg_ver).1.gz \ + $(d_hppa64)/$(PF)/share/man/man1/hppa64-linux-gnu-$$i$(pkg_ver).1.gz; \ + done +endif + + : # remove '*.la' and '*.lai' files, not shipped in any package. + find $(d_hppa64) -name '*.la' -o -name '*.lai' | xargs -r rm -f + + : # remove rpath settings from binaries and shared libs + for i in $$(chrpath -k $(d_hppa64)/$(PF)/bin/* $(d_hppa64)/$(PFL)/lib*/lib*.so.* \ + $(d_hppa64)/$(gcc_lib_dir)/plugin/* \ + $(if $(filter $(with_multiarch_lib),yes), \ + $(d_hppa64)/$(PF)/lib/$(DEB_TARGET_MULTIARCH)/lib*.so.*) \ + 2>/dev/null | awk -F: '/R(UN)?PATH=/ {print $$1}'); \ + do \ + [ -h $$i ] && continue; \ + chrpath --delete $$i; \ + echo "removed RPATH/RUNPATH: $$i"; \ + done + + : # fix permissions of liblto_plugin.so + chmod 644 $(d_hppa64)/$(PF)/libexec/gcc/hppa64-linux-gnu/$(BASE_VERSION)/liblto_plugin.so + + cd $(d_hppa64) && tar cvfJ ../../installed-hppa64.tar.xz usr + rm -rf $(d_hppa64) + +ifeq ($(save_disk_space),yes) + rm -rf $(builddir_hppa64) +endif + touch $(build_hppa64_stamp) + @echo === END $@ === + +ifeq ($(with_ada),yes) + MANUALS = \ + $(srcdir)/gcc/ada/gnat_ugn.texi \ + $(srcdir)/gcc/ada/gnat_rm.texi +endif +MANUALS += \ + $(srcdir)/gcc/doc/gccint.texi \ + $(srcdir)/gcc/doc/gcc.texi \ + $(srcdir)/gcc/doc/cpp.texi \ + $(srcdir)/gcc/doc/cppinternals.texi +ifeq ($(with_fortran),yes) + MANUALS += $(srcdir)/gcc/fortran/gfortran.texi +endif +ifeq ($(with_ada),yes) + MANUALS += $(srcdir)/gcc/ada/gnat-style.texi +endif +ifeq ($(with_gomp),yes) + MANUALS += $(srcdir)/libgomp/libgomp.texi +endif +ifeq ($(with_itm),yes) + MANUALS += $(srcdir)/libitm/libitm.texi +endif +ifeq ($(with_qmath),yes) + MANUALS += $(srcdir)/libquadmath/libquadmath.texi +endif +ifeq ($(with_go),yes) + MANUALS += $(srcdir)/gcc/go/gccgo.texi +endif +ifeq ($(with_d),yes) + MANUALS += $(srcdir)/gcc/d/gdc.texi +endif +ifeq ($(with_m2),yes) + MANUALS += $(srcdir)/gcc/doc/gm2.texi +endif + +html-docs: $(build_html_stamp) +#$(build_html_stamp): $(stampdir)/05-build-html-split +$(build_html_stamp): $(stampdir)/05-build-html-nosplit + +html-makeinfo-split: $(stampdir)/05-build-html-split +$(stampdir)/05-build-html-split: $(build_stamp) + mkdir -p html + rm -f html/*.html + cd $(builddir)/gcc; \ + echo -n $(MANUALS) | xargs -d ' ' -L 1 -P $(USE_CPUS) -I{} \ + sh -c 'outname=`basename {} .texi`.html; \ + outname=`basename {} .texi`; \ + echo "generating $$outname ..."; \ + makeinfo --html --number-sections \ + -I $(srcdir)/gcc/doc/include -I `dirname {}` \ + -I $(srcdir)/gcc/p/doc \ + -I $(srcdir)/gcc/p/doc/generated \ + -I $(builddir)/gcc \ + -I $(builddir)/gcc/m2 \ + -I $(buildlibdir)/libquadmath \ + -o $${outname} \ + {}' + touch $@ + +html-makeinfo-nosplit: $(stampdir)/05-build-html-nosplit +$(stampdir)/05-build-html-nosplit: $(build_stamp) + mkdir -p html + rm -f html/*.html + cd $(builddir)/gcc; \ + echo -n $(MANUALS) | xargs -d ' ' -L 1 -P $(USE_CPUS) -I{} \ + sh -c 'outname=`basename {} .texi`.html; \ + echo "generating $$outname ..."; \ + makeinfo --html --number-sections --no-split \ + -I $(srcdir)/gcc/doc/include -I `dirname {}` \ + -I $(srcdir)/gcc/p/doc \ + -I $(srcdir)/gcc/p/doc/generated \ + -I $(builddir)/gcc \ + -I $(builddir)/gcc/m2 \ + -I $(buildlibdir)/libquadmath \ + -o $(CURDIR)/html/$${outname} \ + {}' + touch $@ + +# start the script only on architectures known to have slow autobuilders ... +logwatch_archs := alpha arm m68k mips mipsel mips64el riscv64 sparc +ifeq ($(DEB_HOST_GNU_CPU), $(findstring $(DEB_HOST_GNU_CPU),$(logwatch_archs))) + start_logwatch = yes +endif +ifeq ($(DEB_HOST_GNU_SYSTEM),gnu) + start_logwatch = yes +endif + +check: $(check_stamp) +$(check_stamp): $(filter $(build_stamp) $(build_jit_stamp) $(build_hppa64_stamp) $(build_nvptx_stamp) $(build_gcn_stamp), $(build_dependencies)) \ + $(if $(filter nvptx-none, $(offload_targets)), $(install_nvptx_stamp)) \ + $(if $(filter $(gcn_target_name), $(offload_targets)), $(install_gcn_stamp)) + @echo === START $@ === + rm -f test-protocol + rm -f $(builddir)/runcheck* + + -chmod 755 $(srcdir)/contrib/test_summary + + : # needed for the plugin tests to succeed + ln -sf gcc $(builddir)/prev-gcc + ln -sf $(DEB_TARGET_GNU_TYPE) $(builddir)/prev-$(DEB_TARGET_GNU_TYPE) + +ifneq ($(with_common_libs),yes) + ifeq ($(with_cxx),yes) + ifeq (,$(filter $(DEB_TARGET_ARCH), armel armhf mipsel mips64el)) + : # libstdc++6 built from newer gcc-X source, run testsuite against the installed lib + + : # jit test results should not end up in the libstdc++-test-summary report + if [ -f $(builddir)/gcc/testsuite/jit/jit.sum ]; then \ + mv $(builddir)/gcc/testsuite/jit/jit.log $(builddir)/gcc/testsuite/jit/jit.LOG; \ + mv $(builddir)/gcc/testsuite/jit/jit.sum $(builddir)/gcc/testsuite/jit/jit.SUM; \ + fi + + sed 's/-L[^ "]*//g' $(buildlibdir)/libstdc++-v3/scripts/testsuite_flags \ + > $(buildlibdir)/libstdc++-v3/scripts/testsuite_flags.installed + -$(ULIMIT_M); \ + set +e; \ + for d in $(buildlibdir)/libstdc++-v3/testsuite; do \ + echo "Running testsuite in $$d ..."; \ + TEST_INSTALLED=1 \ + $(SET_SHELL) \ + $(SET_LOCPATH) \ + $(SET_PATH) \ + DEJAGNU_TIMEOUT=$(DEJAGNU_TIMEOUT) \ + DEB_GCC_NO_O3=1 \ + $(MAKE) -k -C $$d $(NJOBS_TESTS) check $(RUNTESTFLAGS); \ + done 2>&1 | tee test-protocol2 + + cd $(builddir); \ + BOOT_CFLAGS="$(BOOT_CFLAGS)" \ + $(srcdir)/contrib/test_summary -m "$(S_EMAIL)" > ../raw-test-summary + -( \ + sed -n '/^Mail/s/.*"\([^"][^"]*\)".*/\1/p' raw-test-summary; \ + awk '/^cat/, /^EOF/' raw-test-summary | grep -v EOF; \ + ) > libstdc++-test-summary + echo 'BEGIN installed libstdc++-v3 test-summary' + cat libstdc++-test-summary + echo 'END installed libstdc++-v3 test-summary' + find $(buildlibdir)/libstdc++-v3/testsuite -name '*.log' -o -name '*.sum' \ + | xargs -r rm -f + + if [ -f $(builddir)/gcc/testsuite/jit/jit.SUM ]; then \ + mv $(builddir)/gcc/testsuite/jit/jit.LOG $(builddir)/gcc/testsuite/jit/jit.log; \ + mv $(builddir)/gcc/testsuite/jit/jit.SUM $(builddir)/gcc/testsuite/jit/jit.sum; \ + fi + endif + endif +endif + +ifeq ($(start_logwatch),yes) + : # start logwatch script for regular output during test runs + chmod +x debian/logwatch.sh + -debian/logwatch.sh -t 900 -p $(builddir)/logwatch.pid \ + -m '\ntestsuite still running ...\n' \ + test-protocol \ + $(builddir)/gcc/testsuite/gcc/gcc.log \ + $(builddir)/gcc/testsuite/g++/g++.log \ + $(builddir)/gcc/testsuite/gfortran/gfortran.log \ + $(builddir)/gcc/testsuite/objc/objc.log \ + $(builddir)/gcc/testsuite/obj-c++/obj-c++.log \ + $(builddir)/gcc/testsuite/gnat/gnat.log \ + $(builddir)/gcc/testsuite/ada/acats/acats.log \ + $(builddir)/gcc/testsuite/gfortran/gfortran.log \ + $(builddir)/gcc/p/test/test_log \ + $(buildlibdir)/libstdc++-v3/testsuite/libstdc++.log \ + $(buildlibdir)/libgomp/testsuite/libgomp.log \ + $(buildlibdir)/libffi/testsuite/libffi.log \ + & +endif + + : # FIXME: https://gcc.gnu.org/PR103944 + rm -f $(srcdir)/libphobos/testsuite/libphobos.gc/forkgc2.d + + -$(ULIMIT_M); \ + set +e; \ + for d in $(checkdirs); do \ + echo "Running testsuite in $$d ..."; \ + $(SET_SHELL) \ + $(SET_LOCPATH) \ + $(SET_PATH) \ + EXTRA_TEST_PFLAGS=-g0 \ + DEJAGNU_TIMEOUT=$(DEJAGNU_TIMEOUT) \ + DEB_BUILD_OPTIONS='$(DEB_BUILD_OPTIONS) gcc-ice=nodump,norepro' \ + DEB_GCC_NO_O3=1 \ + $(time_command) $(MAKE) -k -C $$d $(NJOBS_TESTS) check $(RUNTESTFLAGS); \ + done 2>&1 | tee test-protocol + + -ps aux | fgrep logwatch | fgrep -v fgrep + -if [ -f $(builddir)/logwatch.pid ]; then \ + kill -1 `cat $(builddir)/logwatch.pid`; \ + sleep 1; \ + kill -9 `cat $(builddir)/logwatch.pid`; \ + rm -f $(builddir)/logwatch.pid; \ + fi + -ps aux | fgrep logwatch | fgrep -v fgrep + +ifeq ($(with_ada),yes) + -if [ -f $(builddir)/acats-killer.pid ]; then \ + kill -1 `cat $(builddir)/acats-killer.pid`; \ + sleep 1; \ + kill -9 `cat $(builddir)/acats-killer.pid`; \ + rm -f $(builddir)/acats-killer.pid; \ + fi +endif + + if [ -x $(srcdir)/contrib/test_summary ]; then \ + rm -f test-summary; \ + ( \ + cd $(builddir); \ + echo '' > ts-include; \ + echo '' >> ts-include; \ + if [ -f $(builddir)/gcc/.bad_compare ]; then \ + echo 'Bootstrap comparison failure:' >> ts-include; \ + cat $(builddir)/gcc/.bad_compare >> ts-include; \ + echo '' >> ts-include; \ + echo '' >> ts-include; \ + fi; \ + echo "Build Dependencies:" >> ts-include; \ + dpkg -l g++-* binutils* `echo '$(LIBC_DEP)' | awk '{print $$1}'` \ + libgmp*-dev libmpfr-dev libmpc-dev libisl-dev \ + | fgrep -v '<none>' >> ts-include; \ + echo '' >> ts-include; \ + cat ../$(patch_stamp) >> ts-include; \ + BOOT_CFLAGS="$(BOOT_CFLAGS)" \ + $(srcdir)/contrib/test_summary \ + -i ts-include -m "$(S_EMAIL)" \ + ) > raw-test-summary; \ + if [ -n "$(testsuite_tarball)" ]; then \ + echo "Test suite used: $(testsuite_srcdir)" > test-summary; \ + echo " Do not interpret the results on its own" >> test-summary; \ + echo " but compare them with the results from" >> test-summary; \ + echo " the gcc-snapshot package." >> test-summary; \ + fi; \ + sed -n '/^Mail/s/.*"\([^"][^"]*\)".*/\1/p' raw-test-summary \ + >> test-summary; \ + awk '/^cat/, /^EOF/' raw-test-summary | grep -v EOF >> test-summary; \ + if [ -f bootstrap-summary -a "$(bootstrap_target)" != profiledbootstrap ]; then \ + echo '' >> test-summary; \ + cat bootstrap-summary >> test-summary; \ + fi; \ + echo 'BEGIN test-summary'; \ + cat test-summary; \ + echo 'END test-summary'; \ + fi +ifeq ($(with_d),yes) + : # the D test failures for the non-default multilibs are known, ignore them + egrep -v '^(FAIL|UNRESOLVED): (runnable|fail_c|comp)' test-summary > test-summary.tmp + mv -f test-summary.tmp test-summary +endif + + : # prepare the inclusion of the test results + rm -rf $(d_tst) + mkdir -p $(d_tst)/$(docdir)/$(p_xbase)/test + echo "TEST COMPARE BEGIN" + for i in test-summary testsuite-comparision; do \ + [ -f $$i ] || continue; \ + cp -p $$i $(d_tst)/$(docdir)/$(p_xbase)/$$i; \ + done +# more than one libgo.sum, avoid it + cp -p $$(find $(builddir)/gcc/testsuite -maxdepth 2 \( -name '*.sum' -o -name '*.log' \)) \ + $$(find $(buildlibdir)/*/testsuite -maxdepth 1 \( -name '*.sum' -o -name '*.log' \) ! -name 'libgo.*') \ + $(d_tst)/$(docdir)/$(p_xbase)/test/ +ifeq ($(with_go),yes) + cp -p $(buildlibdir)/libgo/libgo.sum \ + $(d_tst)/$(docdir)/$(p_xbase)/test/ +endif +ifeq (0,1) + cd $(builddir); \ + for i in $(CURDIR)/$(d_tst)/$(docdir)/$(p_xbase)/test/*.sum; do \ + b=$$(basename $$i); \ + if [ -f /usr/share/doc/$(p_xbase)/test/$$b.gz ]; then \ + zcat /usr/share/doc/$(p_xbase)/test/$$b.gz > /tmp/$$b; \ + if sh $(srcdir)/contrib/test_summary /tmp/$$b $$i; then \ + echo "$$b: OK"; \ + else \ + echo "$$b: FAILURES"; \ + fi; \ + rm -f /tmp/$$b; \ + else \ + echo "Test summary for $$b is not available"; \ + fi; \ + done +endif + echo "TEST COMPARE END" + +ifneq ($(with_common_libs),yes) + if [ -f libstdc++-test-summary ]; then \ + cp libstdc++-test-summary \ + $(d_tst)/$(docdir)/$(p_xbase)/libstdc++-installed-test-summary; \ + fi + if [ -f $(buildlibdir)/libstdc++-v3/testsuite/libstdc++-installed.LOG ]; then \ + cp $(buildlibdir)/libstdc++-v3/testsuite/libstdc++-installed.LOG \ + $(d_tst)/$(docdir)/$(p_xbase)/test/libstdc++-installed.log; \ + cp $(buildlibdir)/libstdc++-v3/testsuite/libstdc++-installed.SUM \ + $(d_tst)/$(docdir)/$(p_xbase)/test/libstdc++-installed.sum; \ + fi +endif + + if which xz 2>&1 >/dev/null; then \ + echo -n $(d_tst)/$(docdir)/$(p_xbase)/test/* \ + | xargs -d ' ' -L 1 -P $(USE_CPUS) xz -9v; \ + fi + + -cp usage-*.svg $(d_tst)/$(docdir)/$(p_xbase)/. + -if which xz 2>&1 >/dev/null; then \ + echo -n $(d_tst)/$(docdir)/$(p_xbase)/*.svg \ + | xargs -d ' ' -L 1 -P $(USE_CPUS) xz -9v; \ + fi + + cd $(d_tst) && tar cvf ../../installed-testlogs.tar usr + rm -rf $(d_tst) + +ifeq ($(save_disk_space),yes) + rm -rf $(builddir)/gcc/testsuite/* + rm -f usage-*.svg +endif + touch $(check_stamp) + +$(check_inst_stamp): $(check_stamp) + rm -f test-inst-protocol + @echo === START $@ === + +ifeq ($(start_logwatch),yes) + : # start logwatch script for regular output during test runs + chmod +x debian/logwatch.sh + -debian/logwatch.sh -t 900 -p $(builddir)/logwatch-inst.pid \ + -m '\ntestsuite (3.3) still running ...\n' \ + test-inst-protocol \ + check-inst/{gcc,g++,g77,objc}.log \ + & +endif + + rm -rf check-inst + mkdir check-inst + + echo "Running testsuite ..." + -$(ULIMIT_M) ; \ + $(SET_SHELL) \ + $(SET_LOCPATH) \ + EXTRA_TEST_PFLAGS=-g0 \ + DEJAGNU_TIMEOUT=$(DEJAGNU_TIMEOUT) \ + DEB_BUILD_OPTIONS='$(DEB_BUILD_OPTIONS) gcc-ice=nodump,norepro' \ + cd check-inst && $(srcdir)/contrib/test_installed \ + --with-gcc=gcc-$(CC) --with-g++=$(CXX) --with-g77=$(subst gcc,gfortran,$(CC)) \ + 2>&1 | tee test-inst-protocol + + -ps aux | fgrep logwatch | fgrep -v fgrep + if [ -f $(builddir)/logwatch-inst.pid ]; then \ + kill -1 `cat $(builddir)/logwatch-inst.pid`; \ + else \ + true; \ + fi + -ps aux | fgrep logwatch | fgrep -v fgrep + + -chmod 755 $(srcdir)/contrib/test_summary + if [ -x $(srcdir)/contrib/test_summary ]; then \ + rm -f test-inst-summary; \ + ( \ + cd check-inst; \ + echo '' > ts-include; \ + echo '' >> ts-include; \ + echo "Build Dependencies:" >> ts-include; \ + dpkg -l g++-* binutils* `echo '$(LIBC_DEP)' | awk '{print $$1}'` \ + libgmp*-dev libmpfr-dev libmpc-dev libisl*-dev \ + | fgrep -v '<none>' >> ts-include; \ + echo '' >> ts-include; \ + echo 'Results for the installed GCC-3.3 compilers' >> ts-include; \ + $(srcdir)/contrib/test_summary \ + -i ts-include -m "$(S_EMAIL)" \ + ) > raw-test-inst-summary; \ + sed -n '/^Mail/s/.*"\([^"][^"]*\)".*/\1/p' raw-test-inst-summary \ + >> test-inst-summary; \ + awk '/^cat/, /^EOF/' raw-test-inst-summary \ + | grep -v EOF >> test-inst-summary; \ + echo 'BEGIN test-installed-summary'; \ + cat test-inst-summary; \ + echo 'END test-installed-summary'; \ + fi + + chmod 755 debian/reduce-test-diff.awk + if diff -u test-inst-summary test-summary \ + | debian/reduce-test-diff.awk > diff-summary; \ + then \ + mv -f diff-summary testsuite-comparision; \ + else \ + ( \ + echo "WARNING: New failures in gcc-3.4 compared to gcc-3.3"; \ + echo ''; \ + cat diff-summary; \ + ) > testsuite-comparision; \ + rm -f diff-summary; \ + fi + touch $(check_inst_stamp) + +clean: debian/control + dh_testdir + rm -f pxxx status + rm -f *-summary *-protocol testsuite-comparision summary-diff + rm -f $(srcdir)/gcc/po/*.gmo + rm -rf src-nvptx src-gcn + rm -f debian/lib{gcc,objc,stdc++}{-v3,[0-9]}*.{{pre,post}{inst,rm},shlibs} + fs=`echo debian/*BV* debian/*CXX* debian/*LC* debian/*MF* | sort -u`; \ + for f in $$fs; do \ + [ -f $$f ] || continue; \ + f2=$$(echo $$f \ + | sed 's/BV/$(BASE_VERSION)/;s/CXX/$(CXX_SONAME)/;s/LC/$(GCC_SONAME)/;s/-CRB/$(cross_bin_arch)/;s/\.in$$//'); \ + rm -f $$f2; \ + done + rm -f debian/lib*gcc-s1.symbols + rm -f debian/lib*{atomic$(ATOMIC_SONAME),gfortran$(FORTRAN_SONAME),gomp$(GOMP_SONAME),itm$(ITM_SONAME),quadmath$(QUADMATH_SONAME),stdc++$(CXX_SONAME)}.symbols + find debian -maxdepth 1 -name '*-cross.symbols' -type l | xargs -r rm -f + rm -f debian/gcc-{XX,ar,nm,ranlib}-$(BASE_VERSION).1 + rm -f debian/shlibs.local debian/shlibs.common* debian/substvars.local + rm -f debian/*.debhelper + -[ -d debian/bugs ] && $(MAKE) -C debian/bugs clean + rm -f debian/README.libstdc++-baseline debian/README.Bugs debian/README.Debian.$(DEB_TARGET_ARCH) + rm -f debian/arch_binaries* debian/indep_binaries* + rm -rf bin bin-gcn locales share + rm -rf check-inst + rm -f usage-*.svg + rm -f installed-*.tar* + dh_clean +ifneq (,$(filter $(build_type), build-cross cross-build-cross)) + $(cross_clean) dh_clean +endif + +# ----------------------------------------------------------------------------- +# some abbrevations for the package names and directories; +# p_XXX is the package name, d_XXX is the package directory +# these macros are only used in the binary-* targets. + +ifeq ($(versioned_packages),yes) + pkg_ver := -$(BASE_VERSION) +endif + +# if native or rtlibs build +ifeq ($(if $(filter yes,$(DEB_CROSS)),$(if $(filter rtlibs,$(DEB_STAGE)),native,cross),native),native) + p_base = gcc$(pkg_ver)-base + p_lbase = $(p_base) + p_xbase = gcc$(pkg_ver)-base + p_gcc = gcc$(pkg_ver) + p_cpp = cpp$(pkg_ver) + p_cppd = cpp$(pkg_ver)-doc + p_cxx = g++$(pkg_ver) + p_doc = gcc$(pkg_ver)-doc +else + # only triggered if DEB_CROSS set + p_base = gcc$(pkg_ver)$(cross_bin_arch)-base + p_lbase = gcc$(pkg_ver)-cross-base$(GCC_PORTS_BUILD) + p_xbase = gcc$(pkg_ver)$(cross_bin_arch)-base + p_cpp = cpp$(pkg_ver)$(cross_bin_arch) + p_gcc = gcc$(pkg_ver)$(cross_bin_arch) + p_cxx = g++$(pkg_ver)$(cross_bin_arch) +endif +p_hppa64 = gcc$(pkg_ver)-hppa64-linux-gnu + +# needed for shlibs.common* generation +ifeq (,$(p_lgcc)) + p_lgcc = libgcc-s$(GCC_SONAME)$(cross_lib_arch) +endif +ifeq (,$(p_lib)) + p_lib = libstdc++$(CXX_SONAME)$(cross_lib_arch) +endif +p_tst = gcc$(pkg_ver)-test-results + +d = debian/tmp +d_base = debian/$(p_base) +d_xbase = debian/$(p_xbase) +d_gcc = debian/$(p_gcc) +d_cpp = debian/$(p_cpp) +d_cppd = debian/$(p_cppd) +d_cxx = debian/$(p_cxx) +d_doc = debian/$(p_doc) +d_lgcc = debian/$(p_lgcc) +d_hppa64= debian/$(p_hppa64) +d_tst = debian/$(p_tst) + +common_substvars = \ + $(shell awk "{printf \"'-V%s' \", \$$0}" debian/substvars.local) + +ifeq ($(DEB_CROSS),yes) + lib_binaries := indep_binaries +else + lib_binaries := arch_binaries +endif + +# --------------------------------------------------------------------------- + +ifneq (,$(findstring gcc-snapshot, $(PKGSOURCE))) + include debian/rules.d/binary-snapshot.mk +else ifneq (,$(findstring gcc-toolchain, $(PKGSOURCE))) + include debian/rules.d/binary-toolchain.mk +else + +ifneq ($(with_base_only),yes) +ifneq ($(DEB_CROSS),yes) +ifeq ($(with_source),yes) + include debian/rules.d/binary-source.mk +endif +endif +endif + +ifneq ($(BACKPORT),true) + +ifeq ($(with_gccbase),yes) + include debian/rules.d/binary-base.mk +endif + +ifneq ($(with_base_only),yes) + +# always include to get some definitions +include debian/rules.d/binary-libgcc.mk + +ifeq ($(with_libqmath),yes) + include debian/rules.d/binary-libquadmath.mk +endif + +ifeq ($(with_libgmath),yes) + include debian/rules.d/binary-libgccmath.mk +endif + +ifeq ($(with_libgomp),yes) + include debian/rules.d/binary-libgomp.mk +endif + +ifeq ($(with_libitm),yes) + include debian/rules.d/binary-libitm.mk +endif + +ifeq ($(with_libatomic),yes) + include debian/rules.d/binary-libatomic.mk +endif + +ifeq ($(with_libbacktrace),yes) + include debian/rules.d/binary-libbacktrace.mk +endif + +ifeq ($(with_cdev),yes) + include debian/rules.d/binary-cpp.mk +endif + +ifeq ($(with_libssp),yes) + include debian/rules.d/binary-libssp.mk +endif + +ifeq ($(with_objcxx),yes) + include debian/rules.d/binary-objcxx.mk +endif + +ifeq ($(with_objc),yes) + include debian/rules.d/binary-objc.mk + include debian/rules.d/binary-libobjc.mk +endif + +ifeq ($(with_go),yes) + include debian/rules.d/binary-go.mk +endif + +ifeq ($(with_cxxdev),yes) + include debian/rules.d/binary-cxx.mk +endif +ifeq ($(with_cxx),yes) + include debian/rules.d/binary-libstdcxx.mk +endif + +ifeq ($(with_libasan),yes) + include debian/rules.d/binary-libasan.mk +endif + +ifeq ($(with_liblsan),yes) + include debian/rules.d/binary-liblsan.mk +endif + +ifeq ($(with_libtsan),yes) + include debian/rules.d/binary-libtsan.mk +endif + +ifeq ($(with_libubsan),yes) + include debian/rules.d/binary-libubsan.mk +endif + +ifeq ($(with_libhwasan),yes) + include debian/rules.d/binary-libhwasan.mk +endif + +ifeq ($(with_libvtv),yes) + include debian/rules.d/binary-libvtv.mk +endif + +ifeq ($(with_f77),yes) + include debian/rules.d/binary-f77.mk +endif + +ifeq ($(with_fortran),yes) + include debian/rules.d/binary-fortran.mk +endif + +ifeq ($(with_ada),yes) + include debian/rules.d/binary-ada.mk +endif + +ifeq ($(with_d),yes) + include debian/rules.d/binary-d.mk +endif + +ifeq ($(with_m2),yes) + include debian/rules.d/binary-m2.mk +endif + +ifeq ($(with_rs),yes) + include debian/rules.d/binary-rust.mk +endif + +ifeq ($(with_libcc1),yes) + include debian/rules.d/binary-libcc1.mk +endif + +ifeq ($(with_jit),yes) + include debian/rules.d/binary-libgccjit.mk +endif + +ifeq ($(with_offload_nvptx),yes) + include debian/rules.d/binary-nvptx.mk +endif + +ifeq ($(with_offload_gcn),yes) + include debian/rules.d/binary-gcn.mk +endif + +ifeq ($(with_libnof),yes) + ifeq ($(DEB_TARGET_GNU_CPU),powerpc) + include debian/rules.d/binary-nof.mk + endif +endif + +ifeq ($(with_softfloat),yes) + include debian/rules.d/binary-softfloat.mk +endif + +# gcc must be moved/built after g77 and g++ +ifeq ($(with_cdev),yes) + include debian/rules.d/binary-gcc.mk +endif + +ifeq ($(with_hppa64),yes) + include debian/rules.d/binary-hppa64.mk +endif + +endif # with_base_only +endif # BACKPORT +endif # ($(single_package),yes) + +# ---------------------------------------------------------------------- +install: $(install_dependencies) + +$(install_dummy_stamp): $(build_dummy_stamp) + @echo === START $@ === + touch $(install_dummy_stamp) + +$(install_snap_stamp): $(build_dependencies) + @echo === START $@ === + dh_testdir + dh_testroot + dh_prep + + : # Install directories + rm -rf $(d) + mkdir -p $(d)/$(PF) + +ifeq ($(with_hppa64),yes) + : # install files prepared in the hppa64 build target + cd $(d) && tar xvf ../../installed-hppa64.tar.xz +endif + + : # Install everything + $(SET_PATH) \ + $(SET_SHELL) \ + $(MAKE) -C $(builddir) \ + $(call pass_vars, $(flags_to_pass)) \ + DESTDIR=$(CURDIR)/$(d) \ + infodir=/$(PF)/share/info \ + mandir=/$(PF)/share/man \ + install + + ls -l $(d)/$(PF)/bin + + for i in ar nm ranlib; do \ + cp debian/gcc-$$i-$(BASE_VERSION).1 \ + $(d)/$(PF)/share/man/man1/$(cmd_prefix)gcc-$$i.1; \ + done + + if [ ! -x $(d)/$(PF)/bin/$(TARGET_ALIAS)-gcc ]; then \ + mv $(d)/$(PF)/bin/$(TARGET_ALIAS)-gcc-13* $(d)/$(PF)/bin/$(TARGET_ALIAS)-gcc; \ + else \ + rm -f $(d)/$(PF)/bin/$(TARGET_ALIAS)-gcc-13*; \ + fi + rm -rf $(d)/$(gcc_lib_dir)/include-fixed + +ifneq ($(configured_libdir),$(libdir)) + for i in ada debug go pkgconfig '*.so' '*.so.*' '*.a' '*.la' '*.py' '*.spec'; do \ + mv $(d)/$(PF)/$(configured_libdir)/$$i \ + $(d)/$(PF)/$(libdir)/. || true; \ + done +endif + +ifeq ($(with_jit),yes) + : # install files prepared in the jit build target + cd $(d) && tar xvf ../../installed-jit.tar.xz +endif + + -ls -l $(d)/usr + if [ -d $(d)/usr/man/man1 ]; then \ + mv $(d)/usr/man/man1/* $(d)/usr/share/man/man1/; \ + fi + + chmod 755 debian/dh_* + touch $(install_snap_stamp) + + +$(install_tc_stamp): $(build_dependencies) + @echo === START $@ === + dh_testdir + dh_testroot + dh_prep + + : # Install directories + rm -rf $(d) + mkdir -p $(d)/$(PF) + +ifeq ($(with_hppa64),yes) + : # install files prepared in the hppa64 build target + cd $(d) && tar xvf ../../installed-hppa64.tar.xz +endif + + : # Install everything + $(SET_PATH) \ + $(SET_SHELL) \ + $(MAKE) -C $(builddir) \ + $(call pass_vars, $(flags_to_pass)) \ + DESTDIR=$(CURDIR)/$(d) \ + infodir=/$(PF)/share/info \ + mandir=/$(PF)/share/man \ + install + + ls -l $(d)/$(PF)/bin + + for i in ar nm ranlib; do \ + cp debian/gcc-$$i-$(BASE_VERSION).1 \ + $(d)/$(PF)/share/man/man1/$(cmd_prefix)gcc-$$i.1; \ + done + + if [ ! -x $(d)/$(PF)/bin/$(TARGET_ALIAS)-gcc ]; then \ + mv $(d)/$(PF)/bin/$(TARGET_ALIAS)-gcc-13* $(d)/$(PF)/bin/$(TARGET_ALIAS)-gcc; \ + else \ + rm -f $(d)/$(PF)/bin/$(TARGET_ALIAS)-gcc-13*; \ + fi + rm -rf $(d)/$(gcc_lib_dir)/include-fixed + +ifneq ($(configured_libdir),$(libdir)) + for i in ada debug go pkgconfig '*.so' '*.so.*' '*.a' '*.la' '*.py' '*.spec'; do \ + mv $(d)/$(PF)/$(configured_libdir)/$$i \ + $(d)/$(PF)/$(libdir)/. || true; \ + done +endif + +ifeq ($(with_jit),yes) + : # install files prepared in the jit build target + cd $(d) && tar xvf ../../installed-jit.tar.xz +endif + + -ls -l $(d)/usr + if [ -d $(d)/usr/man/man1 ]; then \ + mv $(d)/usr/man/man1/* $(d)/usr/share/man/man1/; \ + fi + + chmod 755 debian/dh_* + touch $(install_tc_stamp) + + +$(install_stamp): $(build_stamp) + @echo === START $@ === + dh_testdir + dh_testroot + dh_prep $(if $(filter yes,$(with_hppa64)),-N$(p_hppa64)) + + if [ -f $(binary_stamp)-hppa64 ]; then \ + mv $(binary_stamp)-hppa64 saved-stamp-hppa64; \ + fi + rm -f $(binary_stamp)* + if [ -f saved-stamp-hppa64 ]; then \ + mv saved-stamp-hppa64 $(binary_stamp)-hppa64; \ + fi + + : # Install directories + rm -rf $(d) + mkdir -p $(d)/$(libdir) $(d)/$(PF) $(d)/$(PF)/$(libdir)/debug +ifeq ($(biarch32),yes) + mkdir -p $(d)/$(PF)/$(lib32loc)/debug +endif +ifeq ($(biarch64),yes) + mkdir -p $(d)/$(PF)/lib64/debug +endif +ifeq ($(biarchn32),yes) + mkdir -p $(d)/$(PF)/$(libn32)/debug +endif +ifeq ($(biarchx32),yes) + mkdir -p $(d)/$(PF)/libx32/debug +endif + +ifneq (,$(filter $(DEB_TARGET_GNU_CPU),x86_64 sparc64 s390x powerpc64)) +ifneq ($(DEB_TARGET_ARCH),x32) + : # link lib to lib64 and $(PF)/lib to $(PF)/lib64 + : # (this works when CONFARGS contains '--disable-multilib') + ln -s $(configured_libdir) $(d)/lib64 + mkdir -p $(d)/$(PF)/$(configured_libdir) + ln -s $(configured_libdir) $(d)/$(PF)/lib64 +endif +endif +ifeq ($(DEB_TARGET_ARCH),x32) + : # link lib to libx32 and $(PF)/lib to $(PF)/libx32 + ln -s $(configured_libdir) $(d)/libx32 + mkdir -p $(d)/$(PF)/$(configured_libdir) + ln -s $(configured_libdir) $(d)/$(PF)/libx32 +endif + + : # Install everything + $(SET_PATH) \ + $(SET_SHELL) \ + $(MAKE) -C $(builddir) \ + $(call pass_vars, $(flags_to_pass)) \ + DESTDIR=$(CURDIR)/$(d) \ + infodir=/$(PF)/share/info \ + mandir=/$(PF)/share/man \ + install + + @echo III: =============== upstream install $(DEB_TARGET_ARCH) =============== + find $(d) ! -type d + @echo III: =============== end upstream install $(DEB_TARGET_ARCH) =============== + +ifeq ($(with_m2),yes) + ifneq (,$(filter $(build_type), build-cross cross-build-cross)) + : # FIXME: libm2 libs are installed wrong for libgm2 + for i in $(d)/$(PF)/lib/libm2*; do \ + test -e $$i || continue; \ + echo mv $$i $(d)/$(PFL)/lib/. ; \ + mv $$i $(d)/$(PFL)/lib/. ; \ + done + endif +endif + + rm -rf $(d)/$(gcc_lib_dir)/include-fixed + +ifeq ($(DEB_STAGE)-$(DEB_CROSS),rtlibs-yes) + @echo configured_libdir=$(configured_libdir) / libdir=$(libdir) / usr_lib=$(usr_lib) + ls $(d)/$(PF)/$(TARGET_ALIAS)/lib + set -x; \ + if [ -d $(d)/$(PF)/$(TARGET_ALIAS)/lib ]; then \ + cp -a $(d)/$(PF)/$(TARGET_ALIAS)/lib/* $(d)/$(PF)/lib/$(DEB_TARGET_MULTIARCH)/.; \ + fi + for d in $$(cd $(d)/$(PF)/$(TARGET_ALIAS); echo lib?*); do \ + [ -d $(d)/$(PF)/$(TARGET_ALIAS)/$$d ] || continue; \ + cp -a $(d)/$(PF)/$(TARGET_ALIAS)/$$d/* $(d)/$(PF)/$$d/.; \ + done +else + ifneq ($(configured_libdir),$(libdir)) + for i in ada debug go pkgconfig '*.so' '*.so.*' '*.a' '*.la' '*.o' '*.py' '*.spec'; do \ + mv $(d)/$(PF)/$(configured_libdir)/$$i \ + $(d)/$(PF)/$(libdir)/. || true; \ + done + endif +endif + +ifneq (,$(cmd_prefix)) + for i in $(d)/$(PF)/share/info/$(cmd_prefix)*; do \ + [ -f "$$i" ] || continue; \ + mv $$i $$(echo $$i | sed 's/$(cmd_prefix)//'); \ + done +endif + +ifeq ($(with_libcxxdbg),yes) + : # FIXME: the libstdc++ gdb.py file is installed with a wrong name + for i in $$(find $(d)/$(PF) -name libstdc++_pic.a-gdb.py); do \ + [ -f $$i ] || continue; \ + d=$$(dirname $$i); \ + b=$$(basename $$i); \ + t=$$(cd $$d; echo libstdc++.so.*.*.*)-gdb.py; \ + mv $$i $$d/$$t; \ + done +endif + + : # fix permissions of liblto_plugin.so + chmod 644 $(d)/$(gcc_lexec_dir)/liblto_plugin.so + + : # remove rpath settings from binaries and shared libs + for i in $$(chrpath -k $(d)/$(PF)/bin/* $(d)/$(PFL)/lib*/lib*.so.* \ + $(d)/$(gcc_lib_dir)/plugin/* \ + $(if $(filter $(with_multiarch_lib),yes), \ + $(d)/$(PF)/lib/$(DEB_TARGET_MULTIARCH)/lib*.so.*) \ + 2>/dev/null | awk -F: '/R(UN)?PATH=/ {print $$1}'); \ + do \ + case "$$i" in ecj1|*gij-*|*libjawt*|*libjvm*) continue; esac; \ + [ -h $$i ] && continue; \ + chrpath --delete $$i; \ + echo "removed RPATH/RUNPATH: $$i"; \ + done + + : # remove '*.la' and '*.lai' files, not shipped in any package. + find $(d) -name '*.la' -o -name '*.lai' | xargs -r rm -f + +ifeq ($(GFDL_INVARIANT_FREE),yes) + for i in gcc gcov; do \ + I=`echo $$i | tr a-z A-Z`; \ + sed -e "s/@NAME@/$$I$(pkg_ver)/g" -e "s/@name@/$$i$(pkg_ver)/g" \ + debian/dummy-man.1 > $(d)/$(PF)/share/man/man1/$$i.1; \ + done + + ifeq ($(with_fortran),yes) + for i in g77; do \ + I=`echo $$i | tr a-z A-Z`; \ + sed -e "s/@NAME@/$$I$(pkg_ver)/g" -e "s/@name@/$$i$(pkg_ver)/g" \ + debian/dummy-man.1 > $(d)/$(PF)/share/man/man1/$$i.1; \ + done + endif +endif + +ifneq ($(with_libgnat),yes) + rm -f $(d)/$(gcc_lib_dir)/adalib/lib*.so* +endif + +# ifeq ($(with_ada),yes) +# : # rename files (versioned ada binaries) +# for i in ; do \ +# mv $(d)/$(PF)/bin/$$i $(d)/$(PF)/bin/$$i-$(GNAT_VERSION); \ +# mv $(d)/$(PF)/share/man/man1/$$i.1 \ +# $(d)/$(PF)/share/man/man1/$$i-$(GNAT_VERSION).1; \ +# done +# for i in $(GNAT_TOOLS); do \ +# mv $(d)/$(PF)/bin/$$i $(d)/$(PF)/bin/$$i-$(GNAT_VERSION); \ +# done +# endif + + for i in ar nm ranlib; do \ + cp debian/gcc-$$i-$(BASE_VERSION).1 \ + $(d)/$(PF)/share/man/man1/$(cmd_prefix)gcc-$$i$(pkg_ver).1; \ + done + + chmod 755 debian/dh_* + +ifneq ($(with_common_libs),yes) +# for native builds, the default ml libs are always available; no need for a placeholder +# apparently this changed with newer dpkg versions (1.18.7?) ... + echo 'libgcc_s $(GCC_SONAME) $(p_lgcc)' > debian/shlibs.common + echo 'libstdc++ $(CXX_SONAME) $(p_lib)' >> debian/shlibs.common + echo 'libquadmath $(QUADMATH_SONAME) libquadmath$(QUADMATH_SONAME)$(cross_lib_arch)' >> debian/shlibs.common + echo 'libatomic $(ATOMIC_SONAME) libatomic$(ATOMIC_SONAME)$(cross_lib_arch)' >> debian/shlibs.common + $(foreach ml,32 64 n32 x32 hf sf, \ + echo 'libgcc_s $(GCC_SONAME) $(subst lib,lib$(ml),$(p_lgcc))' > debian/shlibs.common$(ml); \ + echo 'libstdc++ $(CXX_SONAME) $(subst lib,lib$(ml),$(p_lib))' >> debian/shlibs.common$(ml); \ + echo 'libquadmath $(QUADMATH_SONAME) lib$(ml)quadmath$(QUADMATH_SONAME)$(cross_lib_arch)' >> debian/shlibs.common$(ml); \ + echo 'libatomic $(ATOMIC_SONAME) lib$(ml)atomic$(ATOMIC_SONAME)$(cross_lib_arch)' >> debian/shlibs.common$(ml); \ + ) +endif + + @echo III: =============== fixed install $(DEB_TARGET_ARCH) =============== + find $(d) ! -type d -print + @echo III: =============== end fixed install $(DEB_TARGET_ARCH) =============== + touch $(install_stamp) + +$(install_jit_stamp): $(build_jit_stamp) $(install_stamp) + @echo === START $@ === + dh_testdir + dh_testroot + + : # install files prepared in the jit build target + cd $(d) && tar xvf ../../installed-jit.tar.xz + + @echo XXXXX `date -R` + touch $(install_jit_stamp) + +$(install_nvptx_stamp): $(build_nvptx_stamp) + @echo === START $@ === + dh_testdir + ln -sf ../$(newlib_srcdir)/newlib $(srcdir)/newlib + rm -rf $(d)-nvptx + mkdir -p $(d)-nvptx/$(PF) + + $(SET_PATH) \ + biarch_multidir_names=none \ + $(MAKE) -C $(builddir_nvptx) \ + CC="$(CC_FOR_TARGET)" \ + $(call pass_vars, $(flags_to_pass)) \ + DESTDIR=$(CURDIR)/$(d)-nvptx \ + install + + find $(d)-nvptx + @echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + rm -rf $(d)-nvptx/$(libexecdir)/$(gcc_subdir_name)/nvptx-none/$(versiondir)/install-tools + rm -rf $(d)-nvptx/$(libexecdir)/$(gcc_subdir_name)/$(DEB_HOST_GNU_TYPE)/$(versiondir)/accel/nvptx-none/{install-tools,plugin,cc1,cc1plus,f951} + rm -rf $(d)-nvptx/$(PF)/share/{info,man/man7,locale} + rm -rf $(d)-nvptx/$(PF)/share/man/man1/*-{gcov,gfortran,g++,cpp}.1 + rm -rf $(d)-nvptx/$(PF)/lib/gcc/nvptx-none/$(versiondir)/{install-tools,plugin} + rm -rf $(d)-nvptx/$(PF)/lib/gcc/$(DEB_HOST_GNU_TYPE)/$(versiondir)/accel/nvptx-none/{install-tools,plugin,include-fixed} + rm -rf $(d)-nvptx/$(PF)/lib/libc[cp]1* + rm -rf $(d)-nvptx/$(PF)/lib{32,64,n32,x32} + + mv -f $(d)-nvptx/$(PF)/nvptx-none/lib/*.{a,spec} \ + $(d)-nvptx/$(PF)/lib/gcc/$(DEB_HOST_GNU_TYPE)/$(versiondir)/accel/nvptx-none/ + mv -f $(d)-nvptx/$(PF)/nvptx-none/lib/mgomp/*.{a,spec} \ + $(d)-nvptx/$(PF)/lib/gcc/$(DEB_HOST_GNU_TYPE)/$(versiondir)/accel/nvptx-none/mgomp/ + mv -f $(d)-nvptx/$(PF)/lib/gcc/nvptx-none/$(versiondir)/*.a \ + $(d)-nvptx/$(PF)/lib/gcc/$(DEB_HOST_GNU_TYPE)/$(versiondir)/accel/nvptx-none/ + mv -f $(d)-nvptx/$(PF)/lib/gcc/nvptx-none/$(versiondir)/mgomp/*.a \ + $(d)-nvptx/$(PF)/lib/gcc/$(DEB_HOST_GNU_TYPE)/$(versiondir)/accel/nvptx-none/mgomp/ + find $(d)-nvptx -name \*.la | xargs rm -f + rm -rf $(d)-nvptx/$(PF)/nvptx-none/include + -find $(d)-nvptx -type d -empty -delete + + : # a complete compiler installation needed for running the tests +ifneq ($(single_package),yes) + ln -sf lib $(d)-nvptx/$(PF)/libexec +endif + ln -sf /usr/bin/nvptx-none-ar $(d)-nvptx/$(gcc_lexec_dir)/accel/nvptx-none/ar + ln -sf /usr/bin/nvptx-none-as $(d)-nvptx/$(gcc_lexec_dir)/accel/nvptx-none/as + ln -sf /usr/bin/nvptx-none-ld $(d)-nvptx/$(gcc_lexec_dir)/accel/nvptx-none/ld + ln -sf /usr/bin/nvptx-none-ranlib $(d)-nvptx/$(gcc_lexec_dir)/accel/nvptx-none/ranlib + + @echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + find $(d)-nvptx + @echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + + rm -f $(srcdir)/newlib + @echo XXXXX `date -R` + touch $(install_nvptx_stamp) + +$(install_gcn_stamp): $(build_gcn_stamp) + @echo === START $@ === + dh_testdir + ln -sf ../$(newlib_srcdir)/newlib $(srcdir)/newlib + rm -rf $(d)-gcn + mkdir -p $(d)-gcn/$(PF) + + $(SET_PATH) \ + biarch_multidir_names=none \ + $(MAKE) -C $(builddir_gcn) \ + CC="$(CC_FOR_TARGET)" \ + $(call pass_vars, $(flags_to_pass)) \ + DESTDIR=$(CURDIR)/$(d)-gcn \ + install + + find $(d)-gcn + @echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + rm -rf $(d)-gcn/$(libexecdir)/$(gcc_subdir_name)/$(gcn_target_name)/$(versiondir)/install-tools + rm -rf $(d)-gcn/$(libexecdir)/$(gcc_subdir_name)/$(DEB_HOST_GNU_TYPE)/$(versiondir)/accel/$(gcn_target_name)/{install-tools,plugin,cc1,cc1plus,f951} + rm -rf $(d)-gcn/$(PF)/share/{info,man/man7,locale} + rm -rf $(d)-gcn/$(PF)/bin/*-{gcov*,lto-dump}-$(versiondir) + rm -rf $(d)-gcn/$(PF)/share/man/man1/*-{cpp,gcov*,gfortran,g++,lto-dump}-$(versiondir).1 + rm -rf $(d)-gcn/$(PF)/lib/gcc/$(gcn_target_name)/$(versiondir)/{install-tools,plugin} + rm -rf $(d)-gcn/$(PF)/lib/gcc/$(DEB_HOST_GNU_TYPE)/$(versiondir)/accel/$(gcn_target_name)/{install-tools,plugin,include-fixed} + rm -rf $(d)-gcn/$(PF)/lib/libc[cp]1* + rm -rf $(d)-gcn/$(PF)/lib{32,64,n32,x32} + + mv -f $(d)-gcn/$(PF)/$(gcn_target_name)/lib/*.{a,spec} \ + $(d)-gcn/$(PF)/lib/gcc/$(DEB_HOST_GNU_TYPE)/$(versiondir)/accel/$(gcn_target_name)/ + mv -f $(d)-gcn/$(PF)/$(gcn_target_name)/lib/gfx900/*.{a,spec} \ + $(d)-gcn/$(PF)/lib/gcc/$(DEB_HOST_GNU_TYPE)/$(versiondir)/accel/$(gcn_target_name)/gfx900/. + mv -f $(d)-gcn/$(PF)/$(gcn_target_name)/lib/gfx906/*.{a,spec} \ + $(d)-gcn/$(PF)/lib/gcc/$(DEB_HOST_GNU_TYPE)/$(versiondir)/accel/$(gcn_target_name)/gfx906/. + mv -f $(d)-gcn/$(PF)/lib/gcc/$(gcn_target_name)/$(versiondir)/*.a \ + $(d)-gcn/$(PF)/lib/gcc/$(DEB_HOST_GNU_TYPE)/$(versiondir)/accel/$(gcn_target_name)/ + mv -f $(d)-gcn/$(PF)/lib/gcc/$(gcn_target_name)/$(versiondir)/gfx900/*.a \ + $(d)-gcn/$(PF)/lib/gcc/$(DEB_HOST_GNU_TYPE)/$(versiondir)/accel/$(gcn_target_name)/gfx900/. + mv -f $(d)-gcn/$(PF)/lib/gcc/$(gcn_target_name)/$(versiondir)/gfx906/*.a \ + $(d)-gcn/$(PF)/lib/gcc/$(DEB_HOST_GNU_TYPE)/$(versiondir)/accel/$(gcn_target_name)/gfx906/. + find $(d)-gcn -name \*.la | xargs rm -f + rm -rf $(d)-gcn/$(PF)/$(gcn_target_name)/include + rm -rf $(d)-gcn/$(PF)/lib/gcc/$(DEB_HOST_GNU_TYPE)/$(versiondir)/include + rm -rf $(d)-gcn/$(PF)/lib/gcc/$(DEB_HOST_GNU_TYPE)/$(versiondir)/gfx900 + + : # a complete compiler installation needed for running the tests +ifneq ($(single_package),yes) + ln -sf lib $(d)-gcn/$(PF)/libexec +endif + ln -sf /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-ar \ + $(d)-gcn/$(gcc_lexec_dir)/accel/$(gcn_target_name)/ar + ln -sf /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-mc \ + $(d)-gcn/$(gcc_lexec_dir)/accel/$(gcn_target_name)/as + ln -sf /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/lld \ + $(d)-gcn/$(gcc_lexec_dir)/accel/$(gcn_target_name)/ld + ln -sf /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-nm \ + $(d)-gcn/$(gcc_lexec_dir)/accel/$(gcn_target_name)/nm + ln -sf /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-ranlib \ + $(d)-gcn/$(gcc_lexec_dir)/accel/$(gcn_target_name)/ranlib + + : # fix permissions of liblto_plugin.so + chmod 644 $(d)-gcn/$(gcc_lexec_dir)/accel/$(gcn_target_name)/liblto_plugin.so + + -find $(d)-gcn -type d -empty -delete + @echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + find $(d)-gcn + @echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + + rm -f $(srcdir)/newlib + @echo XXXXX `date -R` + touch $(install_gcn_stamp) + +$(install_hppa64_stamp): $(build_hppa64_stamp) + @echo === START $@ === + dh_testdir + dh_testroot + rm -rf $(d_hppa64) + mkdir -p $(d_hppa64)/$(PF) + + : # install files prepared in the hppa64 build target + cd $(d_hppa64) && tar xvf ../../installed-hppa64.tar.xz + + touch $(install_hppa64_stamp) + +# ---------------------------------------------------------------------- +# Build architecture-dependent files here. +debian/arch_binaries.all: $(foreach i,$(arch_binaries),$(binary_stamp)-$(i)) + cd debian; xargs -r du -s < arch_binaries | sort -nr | awk '{print $$2}' \ + > arch_binaries.tmp + mv debian/arch_binaries.tmp debian/arch_binaries + sed -i 's/ /\n/g' debian/arch_binaries.epoch || touch debian/arch_binaries.epoch + cat debian/arch_binaries debian/arch_binaries.epoch > debian/arch_binaries.all + +# see #879054 for the "test ! -s" tests, needed for the rtlibs stage +binary-arch: $(foreach i,$(arch_binaries),$(binary_stamp)-$(i)) debian/arch_binaries.all + test ! -s debian/arch_binaries.all || \ + dh_compress $(foreach p,$(shell echo `cat debian/arch_binaries.all`),-p$(p)) \ + -X.log.xz -X.sum.xz -X.c -X.txt -X.tag -X.map -XREADME.Bugs +ifeq ($(i586_symlinks),yes) + cd debian; \ + test ! -s arch_binaries || \ + for x in $$(find `cat arch_binaries` -type l -name 'i686-*'); do \ + link=$$(echo $$x | sed 's/i686-/i586-/'); \ + tgt=$$(basename $$x); \ + echo "Adding symlink: $$link -> $$tgt"; \ + rm -f $$link; cp -a $$x $$link; \ + done +endif + test ! -s debian/arch_binaries.all || \ + dh_fixperms -Xliblto_plugin.so $(foreach p,$(shell echo `cat debian/arch_binaries.all`),-p$(p)) +ifeq ($(with_ada),yes) + find $$(ls -d $(d_gnat) $(d_gnatsjlj) $(d_snap) 2>/dev/null) \ + -name '*.ali' | xargs -r chmod 444 +endif + test ! -s debian/arch_binaries || \ + dh_gencontrol $(foreach p,$(shell echo `cat debian/arch_binaries`),-p$(p)) \ + -- -v$(DEB_VERSION) $(common_substvars) $(shell debian/ada/libgnat_alihash) + @set -e; \ + pkgs='$(strip $(foreach p,$(shell echo `cat debian/arch_binaries.epoch`),-p$(p)))'; \ + if [ -n "$$pkgs" ]; then \ + echo dh_gencontrol $$pkgs -- -v$(DEB_EVERSION) $(common_substvars); \ + dh_gencontrol $$pkgs -- -v$(DEB_EVERSION) $(common_substvars); \ + fi +ifneq ($(single_package),yes) + ifeq ($(with_libcompatgcc),yes) + cp -p debian/.debhelper/generated/$(p_lgcc)/triggers \ + debian/.debhelper/generated/$(subst gcc-s,gcc,$(p_lgcc))/. + endif +endif + test ! -s debian/arch_binaries.all || \ + dh_installdeb $(foreach p,$(shell echo `cat debian/arch_binaries.all`),-p$(p)) + test ! -s debian/arch_binaries.all || \ + dh_md5sums $(foreach p,$(shell echo `cat debian/arch_binaries.all`),-p$(p)) + test ! -s debian/arch_binaries.all || \ + dh_builddeb $(foreach p,$(shell echo `cat debian/arch_binaries.all`),-p$(p)) +ifeq ($(with_check),yes) + @echo Done +# : # Send Email about sucessfull build. +# # cat raw-test-summary | sh; echo "Sent mail to $(S_EMAIL)" +endif + +ifneq ($(single_package),yes) + : # remove empty directories, when all components are in place + -find $(d) -type d -empty -delete + + @echo "Listing installed files not included in any package:" + -find $(d) ! -type d +endif + -du -s -BM . + -du -s -BM .. + @echo XXXXX `date -R` + +# ---------------------------------------------------------------------- +# Build architecture-independent files here. +debian/indep_binaries.all: $(foreach i,$(indep_binaries),$(binary_stamp)-$(i)) + cd debian; xargs -r du -s < indep_binaries | sort -nr | awk '{print $$2}' \ + > indep_binaries.tmp + mv debian/indep_binaries.tmp debian/indep_binaries + sed -i 's/ /\n/g' debian/indep_binaries.epoch || touch debian/indep_binaries.epoch + cat debian/indep_binaries debian/indep_binaries.epoch > debian/indep_binaries.all + +binary-indep: $(foreach i,$(indep_binaries),$(binary_stamp)-$(i)) debian/indep_binaries.all + find debian -name _formulas.log -delete -print + dh_compress $(foreach p,$(shell echo `cat debian/indep_binaries.all`),-p$(p)) \ + -X.log.xz -X.sum.xz -X.c -X.txt -X.tag -X.map -XREADME.Bugs + dh_fixperms $(foreach p,$(shell echo `cat debian/indep_binaries.all`),-p$(p)) + : # the export should be harmless for the binary indep packages of a native build + export DEB_HOST_ARCH=$(TARGET); \ + dh_gencontrol $(foreach p,$(shell echo `cat debian/indep_binaries`),-p$(p)) \ + -- -v$(DEB_VERSION) $(common_substvars) + @set -e; \ + export DEB_HOST_ARCH=$(TARGET); \ + pkgs='$(strip $(foreach p,$(shell echo `cat debian/indep_binaries.epoch`),-p$(p)))'; \ + if [ -n "$$pkgs" ]; then \ + echo dh_gencontrol $$pkgs -- -v$(DEB_EVERSION) $(common_substvars); \ + dh_gencontrol $$pkgs -- -v$(DEB_EVERSION) $(common_substvars); \ + fi + +ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel mips64 mips64el mipsn32 mipsn32el)) + for p in `cat debian/indep_binaries debian/indep_binaries.epoch`; do \ + p=$${p#-p*}; \ + case "$$p" in \ + lib64*) echo mangle $$p; sed -i -r '/^(Dep|Rec|Sug)/s/libn?32[^,]+(, *|$$)//g;/^(Dep|Rec|Sug)/s/$(p_lgcc)/$(p_l64gcc)/;/^(Dep|Rec|Sug)/s/ *, *$$//' debian/$$p/DEBIAN/control;; \ + libn32*) echo mangle $$p; sed -i -r '/^(Dep|Rec|Sug)/s/lib64[^,]+(, *|$$)//g;/^(Dep|Rec|Sug)/s/$(p_lgcc)/$(p_ln32gcc)/;/^(Dep|Rec|Sug)/s/ *, *$$//' debian/$$p/DEBIAN/control;; \ + esac; \ + done +endif + + dh_installdeb $(foreach p,$(shell echo `cat debian/indep_binaries.all`),-p$(p)) + dh_md5sums $(foreach p,$(shell echo `cat debian/indep_binaries.all`),-p$(p)) + dh_builddeb $(foreach p,$(shell echo `cat debian/indep_binaries.all`),-p$(p)) + + @echo XXXXX `date -R` + +source diff: + @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false + +binary: binary-indep binary-arch +.PHONY: build build-indep build-arch clean binary-indep binary-arch binary +.PRECIOUS: $(stampdir)/%-stamp debian/indep_binaries.all debian/arch_binaries.all +.NOTPARALLEL: |