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-local) \
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) \
37
$(if $(with_linaro_branch),gcc-dfsg-linaro-doc)
42
# boehm-gc-nocheck: seems to work on the buildds \
46
gcc-driver-extra-langs
48
ifneq (,$(filter $(distrelease),etch lenny squeeze wheezy dapper hardy intrepid jaunty karmic lucid))
49
debian_patches += gcc-hash-style-both
51
debian_patches += gcc-hash-style-gnu
58
libstdc++-test-installed \
62
libjava-disable-plugin \
63
alpha-no-ev4-directive \
66
libgomp-omp_h-multilib \
73
gcc-target-include-asm \
74
libgo-revert-timeout-exp \
75
$(if $(with_linaro_branch),,arm-sanitizer) \
76
libgo-setcontext-config \
89
$(if $(with_linaro_branch),pr59744) \
90
$(if $(with_linaro_branch),aarch64-call-frame-info) \
91
$(if $(with_linaro_branch),aarch64-abi-fix) \
92
fix-ffi_call_VFP-with-no-VFP-argument \
94
$(if $(with_linaro_branch),pr60034) \
96
gdb_depends := $(shell dpkg -s gdb | grep '^Depends:.*libpython3')
97
ifneq (,$(findstring libpython3,$(gdb_depends)))
98
debian_patches += libstdc++-python3
101
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
102
# libstdc++-nothumb-check \
108
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
109
hardening_patches += gcc-default-ssp
110
hardening_patches += gcc-default-format-security
112
ifeq ($(distribution),Ubuntu)
113
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
114
hardening_patches += \
115
gcc-default-fortify-source \
117
testsuite-hardening-format \
118
testsuite-hardening-printf-types \
119
testsuite-hardening-updates
123
# FIXME 4.5: Drop and adjust symbols files
124
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
125
debian_patches += pr39491
128
ifeq ($(with_ada),yes)
132
ada-default-project-path \
133
ada-symbolic-tracebacks \
134
ada-library-project-files-soname \
137
ifeq ($(biarch64),yes)
142
ifeq ($(with_libgnat),yes)
148
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
154
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
156
gcc_ada_gcc-interface_Makefile.in \
157
ada-s-osinte-gnu.adb \
158
ada-s-osinte-gnu.ads \
174
ifneq ($(GFDL_INVARIANT_FREE),yes)
175
debian_patches += gdc-4.8-doc
177
debian_patches += gdc-texinfo
179
ifeq ($(with_libphobos),yes)
180
debian_patches += gdc-libphobos-build
182
debian_patches += gdc-driver-nophobos
184
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
185
debian_patches += disable-gdc-tests
188
debian_patches += gcc-d-lang
191
ifeq ($(DEB_TARGET_ARCH),alpha)
192
debian_patches += alpha-ieee
193
ifneq ($(GFDL_INVARIANT_FREE),yes)
194
debian_patches += alpha-ieee-doc
198
ifeq ($(DEB_TARGET_ARCH_CPU),amd64)
199
debian_patches += libjava-testsuite
202
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
203
debian_patches += libjava-armel-unwind
206
ifeq ($(DEB_TARGET_ARCH),armhf)
207
debian_patches += gcj-arm-mode
208
else ifeq ($(DEB_TARGET_ARCH),armel)
209
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
210
debian_patches += gcj-arm-mode
214
ifeq ($(DEB_TARGET_ARCH),m68k)
215
debian_patches += m68k-ada
216
debian_patches += m68k-revert-pr45144
217
debian_patches += pr52714
218
debian_patches += pr58369
219
debian_patches += pr52306
222
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
223
debian_patches += powerpc_remove_many
224
debian_patches += powerpc_nofprs
227
ifeq ($(with_ibm_branch),yes)
228
debian_patches += gcc-ppc64el
229
ifneq ($(GFDL_INVARIANT_FREE),yes)
230
debian_patches += gcc-ppc64el-doc
232
debian_patches += gcc-rs6000-update
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$(if $(with_ibm_branch),-ibm)
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$(if $(with_ibm_branch),-ibm)
347
ifneq (,$(filter $(derivative),Ubuntu))
348
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
349
debian_patches += gcc-as-needed
352
#debian_patches += gcc-as-needed
354
debian_patches += mips-fix-loongson2f-nop
355
ifeq ($(derivative),Ubuntu)
356
ifeq ($(DEB_TARGET_ARCH),ppc64)
357
debian_patches += gcc-ppc64-O3
360
debian_patches += libgomp-kfreebsd-testsuite
362
series_stamp = $(stampdir)/02-series-stamp
363
series: $(series_stamp)
365
echo $(strip $(addsuffix .diff,$(debian_patches))) \
366
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
367
ifneq (,$(strip $(hardening_patches)))
368
ifneq ($(trunk_build),yes)
369
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
370
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
373
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
376
autotools_files += $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
377
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
378
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
379
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
381
autoconf_version = 2.64
382
ifeq ($(trunk_build),yes)
383
# The actual version depends on the build-dependencies set by
384
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
385
# correct version is installed.
389
# FIXME: the auto* stuff is done every time for every subdir, which
390
# leads to build errors. Idea: record the auto* calls in the patch
391
# files (AUTO <dir> <auto-command with options>) and run them separately,
392
# maybe only once per directory).
393
$(patch_stamp): $(unpack_stamp) $(series_stamp)
394
QUILT_PATCHES=$(patchdir) \
395
quilt --quiltrc /dev/null push -a || test $$? = 2
397
ifneq (,$(filter svn-updates, $(debian_patches)))
398
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
399
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
402
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
404
cd $(srcdir)/fixincludes && ./genfixes
406
for f in $(autotools_files) ; \
408
*/classpath/m4/acinclude.m4) \
410
*/configure.*|*/acinclude.m4) \
411
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
412
then echo "Skipping already regenerated file $$f." ; \
414
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
415
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
416
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
418
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
421
*) echo "Unknown file: $$f"; false; \
425
for i in $(debian_patches) $(hardening_patches); do \
426
echo -e "\n$$i:" >> pxxx; \
427
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
429
# -$(srcdir)/move-if-change pxxx $@
433
QUILT_PATCHES=$(patchdir) \
434
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
436
for f in $(autotools_files); do \
437
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
440
update-patches: $(series_stamp)
441
export QUILT_PATCHES=$(patchdir); \
442
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
443
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
444
while quilt push; do quilt refresh; done
446
patch: $(patch_stamp)
447
.PHONY: patch series quilt autotools