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-revert) \
18
$(if $(with_linaro_branch),gcc-linaro) \
20
# svn-updates$(if $(with_linaro_branch),-linaro) \
22
ifeq ($(with_java),yes)
27
ifneq ($(GFDL_INVARIANT_FREE),yes)
30
$(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
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
$(if $(with_linaro_branch),,arm-sanitizer) \
74
libgo-setcontext-config \
88
gdb_depends := $(shell dpkg -s gdb | grep '^Depends:.*libpython3')
89
ifneq (,$(findstring libpython3,$(gdb_depends)))
90
debian_patches += libstdc++-python3
93
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
94
# libstdc++-nothumb-check \
100
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
101
hardening_patches += gcc-default-ssp
102
hardening_patches += gcc-default-format-security
104
ifeq ($(distribution),Ubuntu)
105
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
106
hardening_patches += \
107
gcc-default-fortify-source \
109
testsuite-hardening-format \
110
testsuite-hardening-printf-types \
111
testsuite-hardening-updates
115
# FIXME 4.5: Drop and adjust symbols files
116
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
117
debian_patches += pr39491
120
ifeq ($(with_ada),yes)
124
ada-default-project-path \
125
ada-symbolic-tracebacks \
126
ada-library-project-files-soname
128
ifeq ($(biarch64),yes)
133
ifeq ($(with_libgnat),yes)
139
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
145
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
146
debian_patches += ada-kfreebsd-gnu \
150
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
152
gcc_ada_gcc-interface_Makefile.in \
153
ada-s-osinte-gnu.adb \
154
ada-s-osinte-gnu.ads \
170
ifneq ($(GFDL_INVARIANT_FREE),yes)
171
debian_patches += gdc-4.8-doc
173
debian_patches += gdc-texinfo
175
ifeq ($(with_libphobos),yes)
176
debian_patches += gdc-libphobos-build
178
debian_patches += gdc-driver-nophobos
180
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
181
debian_patches += disable-gdc-tests
184
debian_patches += gcc-d-lang
187
ifeq ($(DEB_TARGET_ARCH),alpha)
188
ifneq ($(GFDL_INVARIANT_FREE),yes)
189
debian_patches += alpha-ieee-doc
193
ifeq ($(DEB_TARGET_ARCH_CPU),amd64)
194
debian_patches += libjava-testsuite
197
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
198
debian_patches += libjava-armel-unwind
201
ifeq ($(DEB_TARGET_ARCH),armhf)
202
debian_patches += gcj-arm-mode
203
else ifeq ($(DEB_TARGET_ARCH),armel)
204
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
205
debian_patches += gcj-arm-mode
209
#ifeq ($(DEB_TARGET_ARCH),m68k)
210
debian_patches += m68k-ada
211
debian_patches += m68k-revert-pr45144
212
debian_patches += pr52714
213
debian_patches += pr58369
214
debian_patches += pr52306
217
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
218
debian_patches += powerpc_remove_many
219
debian_patches += powerpc_nofprs
220
debian_patches += gcc-powerpcspe-ldbl-fix
223
ifeq ($(DEB_TARGET_ARCH),ppc64)
224
ifeq ($(distribution),Ubuntu)
225
#debian_patches += ibm-branch
229
ifeq ($(with_ibm_branch),yes)
230
debian_patches += gcc-ppc64el
231
ifneq ($(GFDL_INVARIANT_FREE),yes)
232
debian_patches += gcc-ppc64el-doc
235
# this will cause all the configure files to be updated once libtool is patched
237
./src/gnattools/configure.ac \
238
./src/libobjc/configure.ac \
239
./src/libatomic/configure.ac \
240
./src/libstdc++-v3/configure.ac \
241
./src/libgfortran/configure.ac \
242
./src/boehm-gc/configure.ac \
243
./src/libsanitizer/configure.ac \
244
./src/fixincludes/configure.ac \
245
./src/lto-plugin/configure.ac \
246
./src/libgcc/configure.ac \
247
./src/libiberty/configure.ac \
248
./src/libffi/configure.ac \
249
./src/zlib/configure.ac \
250
./src/libbacktrace/configure.ac \
251
./src/libjava/classpath/configure.ac \
252
./src/libjava/libltdl/configure.ac \
253
./src/libjava/configure.ac \
254
./src/libitm/configure.ac \
255
./src/intl/configure.ac \
256
./src/libquadmath/configure.ac \
257
./src/libada/configure.ac \
258
./src/libdecnumber/configure.ac \
259
./src/gcc/configure.ac \
260
./src/libgo/configure.ac \
261
./src/libcpp/configure.ac \
263
./src/libssp/configure.ac \
264
./src/libmudflap/configure.ac \
265
./src/libgomp/configure.ac
268
#debian_patches += link-libs
270
# all patches below this line are applied for gcc-snapshot builds as well
272
ifeq ($(single_package),yes)
276
debian_patches += gcc-sysroot
277
debian_patches += goarch-aarch64
278
debian_patches += libgo-explicit-reservation
282
ifeq ($(with_softfloat),yes)
283
debian_patches += arm-multilib-soft-float
284
else ifeq ($(multilib),yes)
285
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
286
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
288
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
291
debian_patches += arm-multilib-defaults
293
ifeq ($(DEB_CROSS),yes)
294
debian_patches += cross-fixes
295
ifeq ($(with_deps_on_target_arch_pkgs),yes)
296
debian_patches += cross-ma-install-location
298
debian_patches += cross-install-location
302
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
303
debian_patches += hurd-changes
306
debian_patches += gcc-ice-hack gcc-ice-apport
308
#debian_patches += gold-and-ld
310
debian_patches += libjava-fixed-symlinks
311
debian_patches += libstdc++-arm-wno-abi
313
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
314
# timeouts on the buildd's, Debian
315
debian_patches += libstdc++-no-testsuite
316
else ifeq ($(distribution),Ubuntu)
317
# timeouts on the buildd's, Ubuntu only
318
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
319
debian_patches += libstdc++-no-testsuite
322
debian_patches += ada-mips
323
debian_patches += libffi-ro-eh_frame_sect
325
debian_patches += gcc-multiarch
326
ifeq ($(with_multiarch_lib),yes)
327
ifneq ($(single_package),yes)
328
debian_patches += libjava-multiarch
331
debian_patches += libjava-nobiarch-check
332
debian_patches += config-ml
333
ifneq ($(single_package),yes)
334
ifeq ($(with_multiarch_cxxheaders),yes)
335
debian_patches += g++-multiarch-incdir
338
ifeq ($(DEB_CROSS),yes)
339
debian_patches += cross-no-locale-include
341
ifeq ($(biarch64),yes)
342
ifeq ($(DEB_CROSS),yes)
343
debian_patches += cross-biarch
346
debian_patches += gcc-multilib-multiarch
347
ifneq ($(trunk_build),yes)
348
ifeq ($(with_ibm_branch),yes)
349
debian_patches += powerpc64le-multilib-definitions
353
ifneq (,$(filter $(derivative),Ubuntu))
354
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
355
debian_patches += gcc-as-needed
358
#debian_patches += gcc-as-needed
360
debian_patches += mips-fix-loongson2f-nop
361
ifeq ($(derivative),Ubuntu)
362
ifeq ($(DEB_TARGET_ARCH),ppc64)
363
debian_patches += gcc-ppc64-O3
366
debian_patches += libgomp-kfreebsd-testsuite
368
series_stamp = $(stampdir)/02-series-stamp
369
series: $(series_stamp)
371
echo $(strip $(addsuffix .diff,$(debian_patches))) \
372
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
373
ifneq (,$(strip $(hardening_patches)))
374
ifneq ($(trunk_build),yes)
375
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
376
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
379
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
382
autotools_files += $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
383
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
384
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
385
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
387
autoconf_version = 2.64
388
ifeq ($(trunk_build),yes)
389
# The actual version depends on the build-dependencies set by
390
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
391
# correct version is installed.
395
# FIXME: the auto* stuff is done every time for every subdir, which
396
# leads to build errors. Idea: record the auto* calls in the patch
397
# files (AUTO <dir> <auto-command with options>) and run them separately,
398
# maybe only once per directory).
399
$(patch_stamp): $(unpack_stamp) $(series_stamp)
400
QUILT_PATCHES=$(patchdir) \
401
quilt --quiltrc /dev/null push -a || test $$? = 2
403
ifneq (,$(filter svn-updates, $(debian_patches)))
404
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
405
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
408
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
410
cd $(srcdir)/fixincludes && ./genfixes
412
for f in $(autotools_files) ; \
414
*/classpath/m4/acinclude.m4) \
416
*/configure.*|*/acinclude.m4) \
417
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
418
then echo "Skipping already regenerated file $$f." ; \
420
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
421
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
422
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
424
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
427
*) echo "Unknown file: $$f"; false; \
431
for i in $(debian_patches); do \
432
echo -e "\n$$i:" >> pxxx; \
433
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
435
# -$(srcdir)/move-if-change pxxx $@
439
QUILT_PATCHES=$(patchdir) \
440
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
442
for f in $(autotools_files); do \
443
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
446
update-patches: $(series_stamp)
447
export QUILT_PATCHES=$(patchdir); \
448
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
449
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
450
while quilt push; do quilt refresh; done
452
patch: $(patch_stamp)
453
.PHONY: patch series quilt autotools