2
# rules to patch the unpacked files in the source directory
3
# ---------------------------------------------------------------------------
4
# various rules to unpack addons and (un)apply patches.
5
# - patch / apply-patches
6
# - unpatch / reverse-patches
10
patchdir ?= debian/patches
11
series_file ?= $(patchdir)/series
13
# which patches should be applied?
17
$(if $(with_linaro_branch),gcc-linaro) \
18
$(if $(with_linaro_branch),gcc-linaro-no-macros) \
22
ifeq ($(with_java),yes)
27
ifneq ($(GFDL_INVARIANT_FREE),yes)
29
$(if $(with_linaro_branch),gcc-linaro-doc) \
33
# $(if $(with_linaro_branch),,svn-doc-updates) \
40
# boehm-gc-nocheck: seems to work on the buildds \
44
gcc-driver-extra-langs$(if $(with_linaro_branch),-linaro)
46
ifneq (,$(filter $(distrelease),etch lenny squeeze wheezy dapper hardy intrepid jaunty karmic lucid))
47
debian_patches += gcc-hash-style-both
49
debian_patches += gcc-hash-style-gnu
56
libstdc++-test-installed \
60
libjava-disable-plugin \
61
alpha-no-ev4-directive \
64
libgomp-omp_h-multilib \
71
gcc-target-include-asm \
72
libgo-revert-timeout-exp \
73
libgo-setcontext-config \
78
libitm-no-fortify-source \
79
sparc64-biarch-long-double-128 \
80
gcc-ia64-bootstrap-ignore \
94
# this is still needed on powerpc, e.g. firefox and insighttoolkit4 will ftbfs.
95
ifneq (,$(filter $(DEB_TARGET_ARCH),powerpc))
96
debian_patches += pr65913-workaround
99
ifeq ($(libstdcxx_abi),new)
100
debian_patches += libstdc++-functexcept
103
# don't apply yet, test it first ...
104
# go-escape-analysis \
105
# go-escape-analysis2 \
106
# go-escape-analysis3 \
107
# go-escape-analysis4 \
108
# go-escape-analysis5 \
109
# go-escape-analysis6 \
111
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
112
# libstdc++-nothumb-check \
118
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
119
hardening_patches += gcc-default-ssp
120
hardening_patches += gcc-default-format-security
121
ifeq (,$(filter $(distrelease),dapper hardy lucid maverick natty oneiric precise quantal raring saucy trusty))
122
hardening_patches += gcc-default-ssp-strong
125
ifeq ($(distribution),Ubuntu)
126
ifneq (,$(findstring gcc-5, $(PKGSOURCE)))
127
hardening_patches += \
128
gcc-default-fortify-source \
130
testsuite-hardening-format \
131
testsuite-hardening-printf-types \
132
testsuite-hardening-updates \
133
testsuite-glibc-warnings
137
# FIXME 4.5: Drop and adjust symbols files
138
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
139
debian_patches += pr39491
142
debian_patches += ada-arm
143
debian_patches += ada-hurd
144
debian_patches += ada-kfreebsd
145
debian_patches += ada-revert-pr63225
147
ifeq ($(with_ada),yes)
151
ada-default-project-path \
152
ada-library-project-files-soname
154
# FIXME: needs update
155
#ada-symbolic-tracebacks \
157
ifeq ($(biarch64),yes)
162
ifeq ($(with_libgnat),yes)
167
ada-gnattools-cross \
169
#ifneq (,$(filter $(build_type), build-cross cross-build-cross))
170
debian_patches += libgnatprj-cross-hack
172
ifneq (,$(filter $(distrelease),lucid precise))
177
ifeq ($(with_gnatsjlj),yes)
182
debian_patches += ada-link-shlib
195
ifneq ($(GFDL_INVARIANT_FREE),yes)
196
debian_patches += gdc-5-doc
198
debian_patches += gdc-texinfo
200
ifeq ($(with_libphobos),yes)
201
debian_patches += gdc-libphobos-build
203
debian_patches += gdc-driver-nophobos
205
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
206
debian_patches += disable-gdc-tests
209
debian_patches += gcc-d-lang
212
ifeq ($(DEB_TARGET_ARCH),alpha)
213
debian_patches += alpha-ieee
214
ifneq ($(GFDL_INVARIANT_FREE),yes)
215
debian_patches += alpha-ieee-doc
219
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
220
debian_patches += libjava-armel-unwind
223
ifeq ($(DEB_TARGET_ARCH),armhf)
224
debian_patches += gcj-arm-mode
225
else ifeq ($(DEB_TARGET_ARCH),armel)
226
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
227
debian_patches += gcj-arm-mode
231
ifeq ($(DEB_TARGET_ARCH),m68k)
232
debian_patches += m68k-ada
233
debian_patches += m68k-revert-pr45144
236
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
237
debian_patches += powerpc_remove_many
238
debian_patches += powerpc_nofprs
239
# fix-powerpcspe.diff only partially applied upstream
240
debian_patches += fix-powerpcspe
243
#debian_patches += link-libs
245
# all patches below this line are applied for gcc-snapshot builds as well
247
ifeq ($(single_package),yes)
251
debian_patches += gcc-sysroot
257
ifeq ($(with_softfloat),yes)
258
debian_patches += arm-multilib-soft-float
259
else ifeq ($(multilib),yes)
260
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
261
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
263
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
266
debian_patches += arm-multilib-defaults
268
ifeq ($(DEB_CROSS),yes)
269
debian_patches += cross-fixes
270
debian_patches += cross-install-location
272
debian_patches += gdc-cross-install-location
276
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
277
debian_patches += hurd-changes
280
debian_patches += gcc-ice-dump
281
debian_patches += gcc-ice-apport
283
debian_patches += libjava-fixed-symlinks
285
debian_patches += libffi-ro-eh_frame_sect
287
debian_patches += gcc-multiarch
288
ifeq ($(with_multiarch_lib),yes)
289
ifneq ($(single_package),yes)
290
debian_patches += libjava-multiarch
293
debian_patches += libjava-nobiarch-check
294
debian_patches += config-ml
295
ifneq ($(single_package),yes)
296
ifeq ($(with_multiarch_cxxheaders),yes)
297
debian_patches += g++-multiarch-incdir
298
debian_patches += canonical-cpppath
301
ifneq (,$(filter $(build_type), build-cross cross-build-cross))
302
debian_patches += cross-no-locale-include
303
debian_patches += cross-biarch
305
debian_patches += gdc-cross-biarch
308
debian_patches += gcc-multilib-multiarch
310
ifneq (,$(filter $(derivative),Ubuntu))
311
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
312
debian_patches += gcc-as-needed
315
#debian_patches += gcc-as-needed
317
ifeq ($(DEB_TARGET_ARCH),mipsel)
318
debian_patches += mips-fix-loongson2f-nop
320
ifneq (,$(filter $(DEB_TARGET_ARCH), mips64 mips64el))
321
debian_patches += pr67736
324
debian_patches += libgomp-kfreebsd-testsuite
325
debian_patches += go-testsuite
326
# FIXME: Still relevant?
327
#debian_patches += pr61106
329
# Ada patches needed for both the stable package and snapshot builds
330
debian_patches += ada-749574
331
debian_patches += ada-mips
332
debian_patches += ada-ppc64
333
debian_patches += ada-mips64
334
debian_patches += ada-bootstrap-compare
336
# don't remove, this is regularly overwritten, see PR sanitizer/63958.
337
#debian_patches += libasan-sparc
339
series_stamp = $(stampdir)/02-series-stamp
340
series: $(series_stamp)
342
echo $(strip $(addsuffix .diff,$(debian_patches))) \
343
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
344
ifneq (,$(strip $(hardening_patches)))
345
ifneq ($(trunk_build),yes)
346
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
347
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
350
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
353
autotools_files += $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
354
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
355
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
356
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
358
autoconf_version = 2.64
359
ifeq ($(trunk_build),yes)
360
# The actual version depends on the build-dependencies set by
361
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
362
# correct version is installed.
366
# FIXME: the auto* stuff is done every time for every subdir, which
367
# leads to build errors. Idea: record the auto* calls in the patch
368
# files (AUTO <dir> <auto-command with options>) and run them separately,
369
# maybe only once per directory).
370
$(patch_stamp): $(unpack_stamp) $(series_stamp)
371
QUILT_PATCHES=$(patchdir) \
372
quilt --quiltrc /dev/null push -a || test $$? = 2
374
ifneq (,$(filter svn-updates, $(debian_patches)))
375
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
376
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
379
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
381
: # only needed when we have changes, and currently fails with autogen 5.18
382
#cd $(srcdir)/fixincludes && ./genfixes
384
for f in $(autotools_files) ; \
386
*/classpath/m4/acinclude.m4) \
388
*/configure.*|*/acinclude.m4) \
389
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
390
then echo "Skipping already regenerated file $$f." ; \
392
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
393
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
394
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
396
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
399
*) echo "Unknown file: $$f"; false; \
403
for i in $(debian_patches) $(hardening_patches); do \
404
echo -e "\n$$i:" >> pxxx; \
405
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
407
# -$(srcdir)/move-if-change pxxx $@
411
QUILT_PATCHES=$(patchdir) \
412
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
414
for f in $(autotools_files); do \
415
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
418
update-patches: $(series_stamp)
419
export QUILT_PATCHES=$(patchdir); \
420
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
421
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
422
while quilt push; do quilt refresh; done
424
patch: $(patch_stamp)
425
.PHONY: patch series quilt autotools