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),aarch64-libatomic) \
19
$(if $(with_linaro_branch),gcc-aarch64-frame-down) \
21
# svn-updates$(if $(with_linaro_branch),-linaro) \
23
ifeq ($(with_java),yes)
28
ifneq ($(GFDL_INVARIANT_FREE),yes)
31
$(if $(with_linaro_branch),gcc-linaro-doc) \
34
# $(if $(with_linaro_branch),,svn-doc-updates) \
41
# boehm-gc-nocheck: seems to work on the buildds \
45
gcc-driver-extra-langs
47
ifneq (,$(filter $(distrelease),etch lenny squeeze wheezy dapper hardy intrepid jaunty karmic lucid))
48
debian_patches += gcc-hash-style-both
50
debian_patches += gcc-hash-style-gnu
57
libstdc++-test-installed \
61
libjava-disable-plugin \
62
alpha-no-ev4-directive \
65
libgomp-omp_h-multilib \
72
gcc-target-include-asm \
73
libgo-revert-timeout-exp \
74
$(if $(with_linaro_branch),,arm-sanitizer) \
76
libgo-setcontext-config \
93
gdb_depends := $(shell dpkg -s gdb | grep '^Depends:.*libpython3')
94
ifneq (,$(findstring libpython3,$(gdb_depends)))
95
debian_patches += libstdc++-python3
98
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
99
# libstdc++-nothumb-check \
105
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
106
hardening_patches += gcc-default-ssp
107
hardening_patches += gcc-default-format-security
109
ifeq ($(distribution),Ubuntu)
110
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
111
hardening_patches += \
112
gcc-default-fortify-source \
114
testsuite-hardening-format \
115
testsuite-hardening-printf-types \
116
testsuite-hardening-updates
120
# FIXME 4.5: Drop and adjust symbols files
121
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
122
debian_patches += pr39491
125
ifeq ($(with_ada),yes)
129
ada-default-project-path \
130
ada-symbolic-tracebacks \
131
ada-library-project-files-soname
133
ifeq ($(biarch64),yes)
138
ifeq ($(with_libgnat),yes)
144
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
150
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
151
debian_patches += ada-kfreebsd-gnu \
155
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
157
gcc_ada_gcc-interface_Makefile.in \
158
ada-s-osinte-gnu.adb \
159
ada-s-osinte-gnu.ads \
175
ifneq ($(GFDL_INVARIANT_FREE),yes)
176
debian_patches += gdc-4.8-doc
178
debian_patches += gdc-texinfo
180
ifeq ($(with_libphobos),yes)
181
debian_patches += gdc-libphobos-build
183
debian_patches += gdc-driver-nophobos
185
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
186
debian_patches += disable-gdc-tests
189
debian_patches += gcc-d-lang
192
ifeq ($(DEB_TARGET_ARCH),alpha)
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 ($(DEB_TARGET_ARCH),ppc64)
228
ifeq ($(distribution),Ubuntu)
229
#debian_patches += ibm-branch
233
ifeq ($(with_ibm_branch),yes)
234
debian_patches += gcc-ppc64el libffi-ppc64el
235
ifneq ($(GFDL_INVARIANT_FREE),yes)
236
debian_patches += gcc-ppc64el-doc
239
# this will cause all the configure files to be updated once libtool is patched
241
./src/gnattools/configure.ac \
242
./src/libobjc/configure.ac \
243
./src/libatomic/configure.ac \
244
./src/libstdc++-v3/configure.ac \
245
./src/libgfortran/configure.ac \
246
./src/boehm-gc/configure.ac \
247
./src/libsanitizer/configure.ac \
248
./src/fixincludes/configure.ac \
249
./src/lto-plugin/configure.ac \
250
./src/libgcc/configure.ac \
251
./src/libiberty/configure.ac \
252
./src/libffi/configure.ac \
253
./src/zlib/configure.ac \
254
./src/libbacktrace/configure.ac \
255
./src/libjava/classpath/configure.ac \
256
./src/libjava/libltdl/configure.ac \
257
./src/libjava/configure.ac \
258
./src/libitm/configure.ac \
259
./src/intl/configure.ac \
260
./src/libquadmath/configure.ac \
261
./src/libada/configure.ac \
262
./src/libdecnumber/configure.ac \
263
./src/gcc/configure.ac \
264
./src/libgo/configure.ac \
265
./src/libcpp/configure.ac \
267
./src/libssp/configure.ac \
268
./src/libmudflap/configure.ac \
269
./src/libgomp/configure.ac
272
#debian_patches += link-libs
274
# all patches below this line are applied for gcc-snapshot builds as well
276
ifeq ($(single_package),yes)
280
debian_patches += gcc-sysroot
281
debian_patches += goarch-aarch64
285
ifeq ($(with_softfloat),yes)
286
debian_patches += arm-multilib-soft-float
287
else ifeq ($(multilib),yes)
288
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
289
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
291
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
294
debian_patches += arm-multilib-defaults
296
ifeq ($(DEB_CROSS),yes)
297
debian_patches += cross-fixes
298
ifeq ($(with_deps_on_target_arch_pkgs),yes)
299
debian_patches += cross-ma-install-location
301
debian_patches += cross-install-location
305
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
306
debian_patches += hurd-changes
309
debian_patches += gcc-ice-hack gcc-ice-apport
311
#debian_patches += gold-and-ld
313
debian_patches += libjava-fixed-symlinks
314
debian_patches += libstdc++-arm-wno-abi
316
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
317
# timeouts on the buildd's, Debian
318
debian_patches += libstdc++-no-testsuite
319
else ifeq ($(distribution),Ubuntu)
320
# timeouts on the buildd's, Ubuntu only
321
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
322
debian_patches += libstdc++-no-testsuite
325
debian_patches += ada-mips
326
debian_patches += libffi-ro-eh_frame_sect
328
debian_patches += gcc-multiarch
329
ifeq ($(with_multiarch_lib),yes)
330
ifneq ($(single_package),yes)
331
debian_patches += libjava-multiarch
334
debian_patches += libjava-nobiarch-check
335
debian_patches += config-ml
336
ifneq ($(single_package),yes)
337
ifeq ($(with_multiarch_cxxheaders),yes)
338
debian_patches += g++-multiarch-incdir
341
ifeq ($(DEB_CROSS),yes)
342
debian_patches += cross-no-locale-include
344
ifeq ($(biarch64),yes)
345
ifeq ($(DEB_CROSS),yes)
346
debian_patches += cross-biarch
349
debian_patches += gcc-multilib-multiarch
350
ifeq ($(with_ibm_branch),yes)
351
debian_patches += powerpc64le-multilib-definitions
354
ifneq (,$(filter $(derivative),Ubuntu))
355
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
356
debian_patches += gcc-as-needed
359
#debian_patches += gcc-as-needed
361
debian_patches += mips-fix-loongson2f-nop
362
ifeq ($(derivative),Ubuntu)
363
ifeq ($(DEB_TARGET_ARCH),ppc64)
364
debian_patches += gcc-ppc64-O3
367
debian_patches += libgomp-kfreebsd-testsuite
369
series_stamp = $(stampdir)/02-series-stamp
370
series: $(series_stamp)
372
echo $(strip $(addsuffix .diff,$(debian_patches))) \
373
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
374
ifneq (,$(strip $(hardening_patches)))
375
ifneq ($(trunk_build),yes)
376
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
377
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
380
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
383
autotools_files += $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
384
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
385
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
386
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
388
autoconf_version = 2.64
389
ifeq ($(trunk_build),yes)
390
# The actual version depends on the build-dependencies set by
391
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
392
# correct version is installed.
396
# FIXME: the auto* stuff is done every time for every subdir, which
397
# leads to build errors. Idea: record the auto* calls in the patch
398
# files (AUTO <dir> <auto-command with options>) and run them separately,
399
# maybe only once per directory).
400
$(patch_stamp): $(unpack_stamp) $(series_stamp)
401
QUILT_PATCHES=$(patchdir) \
402
quilt --quiltrc /dev/null push -a || test $$? = 2
404
ifneq (,$(filter svn-updates, $(debian_patches)))
405
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
406
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
409
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
411
cd $(srcdir)/fixincludes && ./genfixes
413
for f in $(autotools_files) ; \
415
*/classpath/m4/acinclude.m4) \
417
*/configure.*|*/acinclude.m4) \
418
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
419
then echo "Skipping already regenerated file $$f." ; \
421
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
422
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
423
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
425
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
428
*) echo "Unknown file: $$f"; false; \
432
for i in $(debian_patches); do \
433
echo -e "\n$$i:" >> pxxx; \
434
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
436
# -$(srcdir)/move-if-change pxxx $@
440
QUILT_PATCHES=$(patchdir) \
441
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
443
for f in $(autotools_files); do \
444
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
447
update-patches: $(series_stamp)
448
export QUILT_PATCHES=$(patchdir); \
449
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
450
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
451
while quilt push; do quilt refresh; done
453
patch: $(patch_stamp)
454
.PHONY: patch series quilt autotools