# -*- 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 = \ svn-updates \ $(if $(with_linaro_branch),gcc-linaro) \ $(if $(with_linaro_branch),gcc-linaro-no-macros) \ # svn-updates \ ifeq ($(with_java),yes) # debian_patches += \ # svn-class-updates endif ifneq ($(GFDL_INVARIANT_FREE),yes) debian_patches += \ $(if $(with_linaro_branch),gcc-linaro-doc) \ rename-info-files \ # svn-doc-updates \ # $(if $(with_linaro_branch),,svn-doc-updates) \ else endif debian_patches += \ gcc-gfdl-build # boehm-gc-nocheck: seems to work on the buildds \ debian_patches += \ gcc-textdomain \ gcc-driver-extra-langs ifneq (,$(filter $(distrelease),etch lenny squeeze wheezy dapper hardy intrepid jaunty karmic lucid)) debian_patches += gcc-hash-style-both else debian_patches += gcc-hash-style-gnu endif debian_patches += \ libstdc++-pic \ libstdc++-doclink \ libstdc++-man-3cxx \ libstdc++-test-installed \ libjava-stacktrace \ libjava-jnipath \ libjava-sjlj \ libjava-disable-plugin \ alpha-no-ev4-directive \ boehm-gc-getnprocs \ note-gnu-stack \ libgomp-omp_h-multilib \ sparc-force-cpu \ gccgo-version \ pr47818 \ pr49944 \ gcc-base-version \ libgo-testsuite \ gcc-target-include-asm \ libgo-revert-timeout-exp \ libgo-setcontext-config \ gcc-auto-build \ kfreebsd-unwind \ kfreebsd-boehm-gc \ hurd-boehm-gc \ libitm-no-fortify-source \ sparc64-biarch-long-double-128 \ gcc-ia64-bootstrap-ignore \ gotools-configury \ go-escape-analysis \ go-escape-analysis2 \ go-escape-analysis3 \ go-escape-analysis4 \ go-escape-analysis5 \ go-escape-analysis6 \ gccgo-sendfile-fix \ pr66368 \ pr67280 \ pr67508 \ pr67143 \ pr67589 \ pr67590 \ ifneq (,$(filter $(distrelease),squeeze wheezy dapper lucid precise quantal raring saucy trusty)) debian_patches += pr65913-workaround-old else debian_patches += pr65913-workaround endif ifeq ($(libstdcxx_abi),new) debian_patches += libstdc++-functexcept endif # don't apply yet, test it first ... # go-escape-analysis \ # go-escape-analysis2 \ # go-escape-analysis3 \ # go-escape-analysis4 \ # go-escape-analysis5 \ # go-escape-analysis6 \ # $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \ # libstdc++-nothumb-check \ # TODO: update ... # gcc-cloog-dl \ # libjava-rpath \ hardening_patches = ifeq ($(with_ssp)-$(with_ssp_default),yes-yes) hardening_patches += gcc-default-ssp hardening_patches += gcc-default-format-security ifeq (,$(filter $(distrelease),dapper hardy lucid maverick natty oneiric precise quantal raring saucy trusty)) hardening_patches += gcc-default-ssp-strong endif endif ifeq ($(distribution),Ubuntu) ifneq (,$(findstring gcc-5, $(PKGSOURCE))) hardening_patches += \ gcc-default-fortify-source \ gcc-default-relro \ testsuite-hardening-format \ testsuite-hardening-printf-types \ testsuite-hardening-updates \ testsuite-glibc-warnings endif endif # FIXME 4.5: Drop and adjust symbols files ifneq (,$(findstring 4.4, $(PKGSOURCE))) debian_patches += pr39491 endif debian_patches += ada-arm debian_patches += ada-hurd debian_patches += ada-kfreebsd debian_patches += ada-revert-pr63225 ifeq ($(with_ada),yes) debian_patches += \ ada-driver-check \ ada-gcc-name \ ada-default-project-path \ ada-library-project-files-soname # FIXME: needs update #ada-symbolic-tracebacks \ ifeq ($(biarch64),yes) debian_patches += \ ada-nobiarch-check endif ifeq ($(with_libgnat),yes) debian_patches += \ ada-link-lib \ ada-libgnatvsn \ ada-libgnatprj \ ada-gnattools-cross \ ada-acats #ifneq (,$(filter $(build_type), build-cross cross-build-cross)) debian_patches += libgnatprj-cross-hack #endif ifneq (,$(filter $(distrelease),lucid precise)) debian_patches += \ libgnatprj-link endif endif ifeq ($(with_gnatsjlj),yes) debian_patches += \ ada-sjlj endif debian_patches += ada-link-shlib endif ifeq ($(with_d),yes) debian_patches += \ gdc-5 \ gdc-versym-cpu \ gdc-versym-os \ gdc-frontend-posix \ gdc-config-ml \ gdc-base-version # gdc-updates # gdc-multiarch ifneq ($(GFDL_INVARIANT_FREE),yes) debian_patches += gdc-5-doc else debian_patches += gdc-texinfo endif ifeq ($(with_libphobos),yes) debian_patches += gdc-libphobos-build else debian_patches += gdc-driver-nophobos endif ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386)) debian_patches += disable-gdc-tests endif else debian_patches += gcc-d-lang endif ifeq ($(DEB_TARGET_ARCH),alpha) debian_patches += alpha-ieee ifneq ($(GFDL_INVARIANT_FREE),yes) debian_patches += alpha-ieee-doc endif endif ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf)) debian_patches += libjava-armel-unwind endif ifeq ($(DEB_TARGET_ARCH),armhf) debian_patches += gcj-arm-mode else ifeq ($(DEB_TARGET_ARCH),armel) ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise)) debian_patches += gcj-arm-mode endif endif ifeq ($(DEB_TARGET_ARCH),m68k) debian_patches += m68k-ada debian_patches += m68k-revert-pr45144 endif ifeq ($(DEB_TARGET_ARCH),powerpcspe) debian_patches += powerpc_remove_many debian_patches += powerpc_nofprs # fix-powerpcspe.diff only partially applied upstream debian_patches += fix-powerpcspe endif #debian_patches += link-libs # all patches below this line are applied for gcc-snapshot builds as well ifeq ($(single_package),yes) debian_patches = endif debian_patches += gcc-sysroot debian_patches += \ sys-auxv-header \ libcilkrts-targets \ go-use-gold \ ifeq ($(with_softfloat),yes) debian_patches += arm-multilib-soft-float else ifeq ($(multilib),yes) ifneq (,$(filter $(distrelease),lucid maverick natty oneiric 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 debian_patches += arm-multilib-defaults ifeq ($(DEB_CROSS),yes) debian_patches += cross-fixes debian_patches += cross-install-location ifeq ($(with_d),yes) debian_patches += gdc-cross-install-location endif endif ifeq ($(DEB_TARGET_ARCH_OS),hurd) debian_patches += hurd-changes endif debian_patches += gcc-ice-dump debian_patches += gcc-ice-apport debian_patches += libjava-fixed-symlinks debian_patches += libffi-ro-eh_frame_sect debian_patches += gcc-multiarch$(if $(with_linaro_branch),-linaro) ifeq ($(with_multiarch_lib),yes) ifneq ($(single_package),yes) debian_patches += libjava-multiarch endif endif debian_patches += libjava-nobiarch-check 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 ifeq ($(with_d),yes) debian_patches += gdc-cross-biarch endif endif debian_patches += gcc-multilib-multiarch ifneq (,$(filter $(derivative),Ubuntu)) ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick)) debian_patches += gcc-as-needed endif else # Debian #debian_patches += gcc-as-needed endif ifeq ($(DEB_TARGET_ARCH),mipsel) debian_patches += mips-fix-loongson2f-nop endif debian_patches += libgomp-kfreebsd-testsuite debian_patches += go-testsuite # FIXME: Still relevant? #debian_patches += pr61106 # Ada patches needed for both the stable package and snapshot builds debian_patches += ada-749574 debian_patches += ada-mips debian_patches += ada-ppc64 debian_patches += ada-mips64 debian_patches += ada-bootstrap-compare ifeq ($(DEB_TARGET_ARCH_OS), illumos) debian_patches += illumos-multiarch debian_patches += illumos-spec debian_patches += illumos-use_libgcj_bc debian_patches += illumos-pragma-align debian_patches += illumos-fclone-functions debian_patches += illumos-strict-calling-conventions debian_patches += illumos-boehm-gc endif # 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 $@ autotools_files += $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \ $(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \ | sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \ | egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4'))) autoconf_version = 2.64 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 ) and run them separately, # maybe only once per directory). $(patch_stamp): $(unpack_stamp) $(series_stamp) QUILT_PATCHES=$(patchdir) \ quilt --quiltrc /dev/null push -a || test $$? = 2 ifneq (,$(filter svn-updates, $(debian_patches))) awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \ $(patchdir)/svn-updates.diff > src/LAST_UPDATED endif if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi : # only needed when we have changes, and currently fails with autogen 5.18 #cd $(srcdir)/fixincludes && ./genfixes for f in $(autotools_files) ; \ do case $$f in \ */classpath/m4/acinclude.m4) \ : ;; \ */configure.*|*/acinclude.m4) \ if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \ then echo "Skipping already regenerated file $$f." ; \ else \ echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \ dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \ && AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \ && cd $$dir \ && echo "$$(md5sum $$f)" >> stamps/autotools_files ; \ fi ;; \ */Makefile.*) ;; \ *) echo "Unknown file: $$f"; false; \ esac; \ done 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 $@ mv pxxx $@ unpatch: QUILT_PATCHES=$(patchdir) \ quilt --quiltrc /dev/null pop -a -R || test $$? = 2 rm -rf .pc for f in $(autotools_files); do \ rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \ done update-patches: $(series_stamp) export QUILT_PATCHES=$(patchdir); \ export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \ export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \ while quilt push; do quilt refresh; done patch: $(patch_stamp) .PHONY: patch series quilt autotools