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 \
95
gdb_depends := $(shell dpkg -s gdb | grep '^Depends:.*libpython3')
96
ifneq (,$(findstring libpython3,$(gdb_depends)))
97
debian_patches += libstdc++-python3
100
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
101
# libstdc++-nothumb-check \
107
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
108
hardening_patches += gcc-default-ssp
109
hardening_patches += gcc-default-format-security
111
ifeq ($(distribution),Ubuntu)
112
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
113
hardening_patches += \
114
gcc-default-fortify-source \
116
testsuite-hardening-format \
117
testsuite-hardening-printf-types \
118
testsuite-hardening-updates
122
# FIXME 4.5: Drop and adjust symbols files
123
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
124
debian_patches += pr39491
127
ifeq ($(with_ada),yes)
131
ada-default-project-path \
132
ada-symbolic-tracebacks \
133
ada-library-project-files-soname \
136
ifeq ($(biarch64),yes)
141
ifeq ($(with_libgnat),yes)
147
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
153
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
155
gcc_ada_gcc-interface_Makefile.in \
156
ada-s-osinte-gnu.adb \
157
ada-s-osinte-gnu.ads \
173
ifneq ($(GFDL_INVARIANT_FREE),yes)
174
debian_patches += gdc-4.8-doc
176
debian_patches += gdc-texinfo
178
ifeq ($(with_libphobos),yes)
179
debian_patches += gdc-libphobos-build
181
debian_patches += gdc-driver-nophobos
183
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
184
debian_patches += disable-gdc-tests
187
debian_patches += gcc-d-lang
190
ifeq ($(DEB_TARGET_ARCH),alpha)
191
debian_patches += alpha-ieee
192
ifneq ($(GFDL_INVARIANT_FREE),yes)
193
debian_patches += alpha-ieee-doc
197
ifeq ($(DEB_TARGET_ARCH_CPU),amd64)
198
debian_patches += libjava-testsuite
201
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
202
debian_patches += libjava-armel-unwind
205
ifeq ($(DEB_TARGET_ARCH),armhf)
206
debian_patches += gcj-arm-mode
207
else ifeq ($(DEB_TARGET_ARCH),armel)
208
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
209
debian_patches += gcj-arm-mode
213
ifeq ($(DEB_TARGET_ARCH),m68k)
214
debian_patches += m68k-ada
215
debian_patches += m68k-revert-pr45144
216
debian_patches += pr52714
217
debian_patches += pr58369
218
debian_patches += pr52306
221
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
222
debian_patches += powerpc_remove_many
223
debian_patches += powerpc_nofprs
226
ifeq ($(with_ibm_branch),yes)
227
debian_patches += gcc-ppc64el
228
ifneq ($(GFDL_INVARIANT_FREE),yes)
229
debian_patches += gcc-ppc64el-doc
232
# this will cause all the configure files to be updated once libtool is patched
234
./src/gnattools/configure.ac \
235
./src/libobjc/configure.ac \
236
./src/libatomic/configure.ac \
237
./src/libstdc++-v3/configure.ac \
238
./src/libgfortran/configure.ac \
239
./src/boehm-gc/configure.ac \
240
./src/libsanitizer/configure.ac \
241
./src/fixincludes/configure.ac \
242
./src/lto-plugin/configure.ac \
243
./src/libgcc/configure.ac \
244
./src/libiberty/configure.ac \
245
./src/libffi/configure.ac \
246
./src/zlib/configure.ac \
247
./src/libbacktrace/configure.ac \
248
./src/libjava/classpath/configure.ac \
249
./src/libjava/libltdl/configure.ac \
250
./src/libjava/configure.ac \
251
./src/libitm/configure.ac \
252
./src/intl/configure.ac \
253
./src/libquadmath/configure.ac \
254
./src/libada/configure.ac \
255
./src/libdecnumber/configure.ac \
256
./src/gcc/configure.ac \
257
./src/libgo/configure.ac \
258
./src/libcpp/configure.ac \
260
./src/libssp/configure.ac \
261
./src/libmudflap/configure.ac \
262
./src/libgomp/configure.ac
265
#debian_patches += link-libs
267
# all patches below this line are applied for gcc-snapshot builds as well
269
ifeq ($(single_package),yes)
273
debian_patches += gcc-sysroot
274
debian_patches += goarch-aarch64
275
debian_patches += libgo-explicit-reservation
279
ifeq ($(with_softfloat),yes)
280
debian_patches += arm-multilib-soft-float
281
else ifeq ($(multilib),yes)
282
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
283
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
285
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
288
debian_patches += arm-multilib-defaults
290
ifeq ($(DEB_CROSS),yes)
291
debian_patches += cross-fixes
292
ifeq ($(with_deps_on_target_arch_pkgs),yes)
293
debian_patches += cross-ma-install-location
295
debian_patches += cross-install-location
299
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
300
debian_patches += hurd-changes
303
debian_patches += gcc-ice-hack gcc-ice-apport
305
#debian_patches += gold-and-ld
307
debian_patches += libjava-fixed-symlinks
308
debian_patches += libstdc++-arm-wno-abi
310
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
311
# timeouts on the buildd's, Debian
312
debian_patches += libstdc++-no-testsuite
313
else ifeq ($(distribution),Ubuntu)
314
# timeouts on the buildd's, Ubuntu only
315
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
316
debian_patches += libstdc++-no-testsuite
319
debian_patches += ada-mips
320
debian_patches += libffi-ro-eh_frame_sect
322
debian_patches += gcc-multiarch$(if $(with_ibm_branch),-ibm)
323
ifeq ($(with_multiarch_lib),yes)
324
ifneq ($(single_package),yes)
325
debian_patches += libjava-multiarch
328
debian_patches += libjava-nobiarch-check
329
debian_patches += config-ml
330
ifneq ($(single_package),yes)
331
ifeq ($(with_multiarch_cxxheaders),yes)
332
debian_patches += g++-multiarch-incdir
335
ifeq ($(DEB_CROSS),yes)
336
debian_patches += cross-no-locale-include
338
ifeq ($(biarch64),yes)
339
ifeq ($(DEB_CROSS),yes)
340
debian_patches += cross-biarch
343
debian_patches += gcc-multilib-multiarch$(if $(with_ibm_branch),-ibm)
345
ifneq (,$(filter $(derivative),Ubuntu))
346
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
347
debian_patches += gcc-as-needed
350
#debian_patches += gcc-as-needed
352
debian_patches += mips-fix-loongson2f-nop
353
ifeq ($(derivative),Ubuntu)
354
ifeq ($(DEB_TARGET_ARCH),ppc64)
355
debian_patches += gcc-ppc64-O3
358
debian_patches += libgomp-kfreebsd-testsuite
360
series_stamp = $(stampdir)/02-series-stamp
361
series: $(series_stamp)
363
echo $(strip $(addsuffix .diff,$(debian_patches))) \
364
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
365
ifneq (,$(strip $(hardening_patches)))
366
ifneq ($(trunk_build),yes)
367
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
368
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
371
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
374
autotools_files += $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
375
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
376
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
377
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
379
autoconf_version = 2.64
380
ifeq ($(trunk_build),yes)
381
# The actual version depends on the build-dependencies set by
382
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
383
# correct version is installed.
387
# FIXME: the auto* stuff is done every time for every subdir, which
388
# leads to build errors. Idea: record the auto* calls in the patch
389
# files (AUTO <dir> <auto-command with options>) and run them separately,
390
# maybe only once per directory).
391
$(patch_stamp): $(unpack_stamp) $(series_stamp)
392
QUILT_PATCHES=$(patchdir) \
393
quilt --quiltrc /dev/null push -a || test $$? = 2
395
ifneq (,$(filter svn-updates, $(debian_patches)))
396
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
397
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
400
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
402
cd $(srcdir)/fixincludes && ./genfixes
404
for f in $(autotools_files) ; \
406
*/classpath/m4/acinclude.m4) \
408
*/configure.*|*/acinclude.m4) \
409
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
410
then echo "Skipping already regenerated file $$f." ; \
412
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
413
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
414
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
416
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
419
*) echo "Unknown file: $$f"; false; \
423
for i in $(debian_patches) $(hardening_patches); do \
424
echo -e "\n$$i:" >> pxxx; \
425
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
427
# -$(srcdir)/move-if-change pxxx $@
431
QUILT_PATCHES=$(patchdir) \
432
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
434
for f in $(autotools_files); do \
435
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
438
update-patches: $(series_stamp)
439
export QUILT_PATCHES=$(patchdir); \
440
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
441
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
442
while quilt push; do quilt refresh; done
444
patch: $(patch_stamp)
445
.PHONY: patch series quilt autotools