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) \
19
# svn-updates$(if $(with_linaro_branch),-linaro) \
21
ifeq ($(with_java),yes)
26
ifneq ($(GFDL_INVARIANT_FREE),yes)
29
$(if $(with_linaro_branch),gcc-linaro-doc) \
32
# $(if $(with_linaro_branch),,svn-doc-updates) \
39
# boehm-gc-nocheck: seems to work on the buildds \
43
gcc-driver-extra-langs
45
ifneq (,$(filter $(distrelease),etch lenny squeeze wheezy dapper hardy intrepid jaunty karmic lucid))
46
debian_patches += gcc-hash-style-both
48
debian_patches += gcc-hash-style-gnu
55
libstdc++-test-installed \
59
libjava-disable-plugin \
60
alpha-no-ev4-directive \
63
libgomp-omp_h-multilib \
70
gcc-target-include-asm \
71
libgo-revert-timeout-exp \
72
$(if $(with_linaro_branch),,arm-sanitizer) \
73
libgo-setcontext-config \
87
gdb_depends := $(shell dpkg -s gdb | grep '^Depends:.*libpython3')
88
ifneq (,$(findstring libpython3,$(gdb_depends)))
89
debian_patches += libstdc++-python3
92
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
93
# libstdc++-nothumb-check \
99
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
100
hardening_patches += gcc-default-ssp
101
hardening_patches += gcc-default-format-security
103
ifeq ($(distribution),Ubuntu)
104
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
105
hardening_patches += \
106
gcc-default-fortify-source \
108
testsuite-hardening-format \
109
testsuite-hardening-printf-types \
110
testsuite-hardening-updates
114
# FIXME 4.5: Drop and adjust symbols files
115
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
116
debian_patches += pr39491
119
ifeq ($(with_ada),yes)
123
ada-default-project-path \
124
ada-symbolic-tracebacks \
125
ada-library-project-files-soname
127
ifeq ($(biarch64),yes)
132
ifeq ($(with_libgnat),yes)
138
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
144
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
145
debian_patches += ada-kfreebsd-gnu \
149
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
151
gcc_ada_gcc-interface_Makefile.in \
152
ada-s-osinte-gnu.adb \
153
ada-s-osinte-gnu.ads \
169
ifneq ($(GFDL_INVARIANT_FREE),yes)
170
debian_patches += gdc-4.8-doc
172
debian_patches += gdc-texinfo
174
ifeq ($(with_libphobos),yes)
175
debian_patches += gdc-libphobos-build
177
debian_patches += gdc-driver-nophobos
179
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
180
debian_patches += disable-gdc-tests
183
debian_patches += gcc-d-lang
186
ifeq ($(DEB_TARGET_ARCH),alpha)
187
ifneq ($(GFDL_INVARIANT_FREE),yes)
188
debian_patches += alpha-ieee-doc
192
ifeq ($(DEB_TARGET_ARCH_CPU),amd64)
193
debian_patches += libjava-testsuite
196
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
197
debian_patches += libjava-armel-unwind
200
ifeq ($(DEB_TARGET_ARCH),armhf)
201
debian_patches += gcj-arm-mode
202
else ifeq ($(DEB_TARGET_ARCH),armel)
203
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
204
debian_patches += gcj-arm-mode
208
#ifeq ($(DEB_TARGET_ARCH),m68k)
209
debian_patches += m68k-ada
210
debian_patches += m68k-revert-pr45144
211
debian_patches += pr52714
212
debian_patches += pr58369
213
debian_patches += pr52306
216
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
217
debian_patches += powerpc_remove_many
218
debian_patches += powerpc_nofprs
219
debian_patches += gcc-powerpcspe-ldbl-fix
222
ifeq ($(DEB_TARGET_ARCH),ppc64)
223
ifeq ($(distribution),Ubuntu)
224
#debian_patches += ibm-branch
228
ifeq ($(with_ibm_branch),yes)
229
debian_patches += gcc-ppc64el
230
ifneq ($(GFDL_INVARIANT_FREE),yes)
231
debian_patches += gcc-ppc64el-doc
234
# this will cause all the configure files to be updated once libtool is patched
236
./src/gnattools/configure.ac \
237
./src/libobjc/configure.ac \
238
./src/libatomic/configure.ac \
239
./src/libstdc++-v3/configure.ac \
240
./src/libgfortran/configure.ac \
241
./src/boehm-gc/configure.ac \
242
./src/libsanitizer/configure.ac \
243
./src/fixincludes/configure.ac \
244
./src/lto-plugin/configure.ac \
245
./src/libgcc/configure.ac \
246
./src/libiberty/configure.ac \
247
./src/libffi/configure.ac \
248
./src/zlib/configure.ac \
249
./src/libbacktrace/configure.ac \
250
./src/libjava/classpath/configure.ac \
251
./src/libjava/libltdl/configure.ac \
252
./src/libjava/configure.ac \
253
./src/libitm/configure.ac \
254
./src/intl/configure.ac \
255
./src/libquadmath/configure.ac \
256
./src/libada/configure.ac \
257
./src/libdecnumber/configure.ac \
258
./src/gcc/configure.ac \
259
./src/libgo/configure.ac \
260
./src/libcpp/configure.ac \
262
./src/libssp/configure.ac \
263
./src/libmudflap/configure.ac \
264
./src/libgomp/configure.ac
267
#debian_patches += link-libs
269
# all patches below this line are applied for gcc-snapshot builds as well
271
ifeq ($(single_package),yes)
275
debian_patches += gcc-sysroot
276
debian_patches += goarch-aarch64
277
debian_patches += libgo-explicit-reservation
281
ifeq ($(with_softfloat),yes)
282
debian_patches += arm-multilib-soft-float
283
else ifeq ($(multilib),yes)
284
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
285
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
287
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
290
debian_patches += arm-multilib-defaults
292
ifeq ($(DEB_CROSS),yes)
293
debian_patches += cross-fixes
294
ifeq ($(with_deps_on_target_arch_pkgs),yes)
295
debian_patches += cross-ma-install-location
297
debian_patches += cross-install-location
301
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
302
debian_patches += hurd-changes
305
debian_patches += gcc-ice-hack gcc-ice-apport
307
#debian_patches += gold-and-ld
309
debian_patches += libjava-fixed-symlinks
310
debian_patches += libstdc++-arm-wno-abi
312
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
313
# timeouts on the buildd's, Debian
314
debian_patches += libstdc++-no-testsuite
315
else ifeq ($(distribution),Ubuntu)
316
# timeouts on the buildd's, Ubuntu only
317
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
318
debian_patches += libstdc++-no-testsuite
321
debian_patches += ada-mips
322
debian_patches += libffi-ro-eh_frame_sect
324
debian_patches += gcc-multiarch
325
ifeq ($(with_multiarch_lib),yes)
326
ifneq ($(single_package),yes)
327
debian_patches += libjava-multiarch
330
debian_patches += libjava-nobiarch-check
331
debian_patches += config-ml
332
ifneq ($(single_package),yes)
333
ifeq ($(with_multiarch_cxxheaders),yes)
334
debian_patches += g++-multiarch-incdir
337
ifeq ($(DEB_CROSS),yes)
338
debian_patches += cross-no-locale-include
340
ifeq ($(biarch64),yes)
341
ifeq ($(DEB_CROSS),yes)
342
debian_patches += cross-biarch
345
debian_patches += gcc-multilib-multiarch
346
ifneq ($(trunk_build),yes)
347
ifeq ($(with_ibm_branch),yes)
348
debian_patches += powerpc64le-multilib-definitions
352
ifneq (,$(filter $(derivative),Ubuntu))
353
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
354
debian_patches += gcc-as-needed
357
#debian_patches += gcc-as-needed
359
debian_patches += mips-fix-loongson2f-nop
360
ifeq ($(derivative),Ubuntu)
361
ifeq ($(DEB_TARGET_ARCH),ppc64)
362
debian_patches += gcc-ppc64-O3
365
debian_patches += libgomp-kfreebsd-testsuite
367
series_stamp = $(stampdir)/02-series-stamp
368
series: $(series_stamp)
370
echo $(strip $(addsuffix .diff,$(debian_patches))) \
371
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
372
ifneq (,$(strip $(hardening_patches)))
373
ifneq ($(trunk_build),yes)
374
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
375
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
378
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
381
autotools_files += $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
382
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
383
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
384
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
386
autoconf_version = 2.64
387
ifeq ($(trunk_build),yes)
388
# The actual version depends on the build-dependencies set by
389
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
390
# correct version is installed.
394
# FIXME: the auto* stuff is done every time for every subdir, which
395
# leads to build errors. Idea: record the auto* calls in the patch
396
# files (AUTO <dir> <auto-command with options>) and run them separately,
397
# maybe only once per directory).
398
$(patch_stamp): $(unpack_stamp) $(series_stamp)
399
QUILT_PATCHES=$(patchdir) \
400
quilt --quiltrc /dev/null push -a || test $$? = 2
402
ifneq (,$(filter svn-updates, $(debian_patches)))
403
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
404
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
407
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
409
cd $(srcdir)/fixincludes && ./genfixes
411
for f in $(autotools_files) ; \
413
*/classpath/m4/acinclude.m4) \
415
*/configure.*|*/acinclude.m4) \
416
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
417
then echo "Skipping already regenerated file $$f." ; \
419
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
420
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
421
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
423
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
426
*) echo "Unknown file: $$f"; false; \
430
for i in $(debian_patches); do \
431
echo -e "\n$$i:" >> pxxx; \
432
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
434
# -$(srcdir)/move-if-change pxxx $@
438
QUILT_PATCHES=$(patchdir) \
439
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
441
for f in $(autotools_files); do \
442
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
445
update-patches: $(series_stamp)
446
export QUILT_PATCHES=$(patchdir); \
447
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
448
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
449
while quilt push; do quilt refresh; done
451
patch: $(patch_stamp)
452
.PHONY: patch series quilt autotools