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 \
87
$(if $(with_linaro_branch),pr59744) \
88
$(if $(with_linaro_branch),aarch64-call-frame-info) \
90
gdb_depends := $(shell dpkg -s gdb | grep '^Depends:.*libpython3')
91
ifneq (,$(findstring libpython3,$(gdb_depends)))
92
debian_patches += libstdc++-python3
95
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
96
# libstdc++-nothumb-check \
102
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
103
hardening_patches += gcc-default-ssp
104
hardening_patches += gcc-default-format-security
106
ifeq ($(distribution),Ubuntu)
107
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
108
hardening_patches += \
109
gcc-default-fortify-source \
111
testsuite-hardening-format \
112
testsuite-hardening-printf-types \
113
testsuite-hardening-updates
117
# FIXME 4.5: Drop and adjust symbols files
118
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
119
debian_patches += pr39491
122
ifeq ($(with_ada),yes)
126
ada-default-project-path \
127
ada-symbolic-tracebacks \
128
ada-library-project-files-soname \
131
ifeq ($(biarch64),yes)
136
ifeq ($(with_libgnat),yes)
142
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
148
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
150
gcc_ada_gcc-interface_Makefile.in \
151
ada-s-osinte-gnu.adb \
152
ada-s-osinte-gnu.ads \
168
ifneq ($(GFDL_INVARIANT_FREE),yes)
169
debian_patches += gdc-4.8-doc
171
debian_patches += gdc-texinfo
173
ifeq ($(with_libphobos),yes)
174
debian_patches += gdc-libphobos-build
176
debian_patches += gdc-driver-nophobos
178
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
179
debian_patches += disable-gdc-tests
182
debian_patches += gcc-d-lang
185
ifeq ($(DEB_TARGET_ARCH),alpha)
186
debian_patches += alpha-ieee
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
221
ifeq ($(DEB_TARGET_ARCH),ppc64)
222
ifeq ($(distribution),Ubuntu)
223
#debian_patches += ibm-branch
227
ifeq ($(with_ibm_branch),yes)
228
debian_patches += gcc-ppc64el
229
ifneq ($(GFDL_INVARIANT_FREE),yes)
230
debian_patches += gcc-ppc64el-doc
233
# this will cause all the configure files to be updated once libtool is patched
235
./src/gnattools/configure.ac \
236
./src/libobjc/configure.ac \
237
./src/libatomic/configure.ac \
238
./src/libstdc++-v3/configure.ac \
239
./src/libgfortran/configure.ac \
240
./src/boehm-gc/configure.ac \
241
./src/libsanitizer/configure.ac \
242
./src/fixincludes/configure.ac \
243
./src/lto-plugin/configure.ac \
244
./src/libgcc/configure.ac \
245
./src/libiberty/configure.ac \
246
./src/libffi/configure.ac \
247
./src/zlib/configure.ac \
248
./src/libbacktrace/configure.ac \
249
./src/libjava/classpath/configure.ac \
250
./src/libjava/libltdl/configure.ac \
251
./src/libjava/configure.ac \
252
./src/libitm/configure.ac \
253
./src/intl/configure.ac \
254
./src/libquadmath/configure.ac \
255
./src/libada/configure.ac \
256
./src/libdecnumber/configure.ac \
257
./src/gcc/configure.ac \
258
./src/libgo/configure.ac \
259
./src/libcpp/configure.ac \
261
./src/libssp/configure.ac \
262
./src/libmudflap/configure.ac \
263
./src/libgomp/configure.ac
266
#debian_patches += link-libs
268
# all patches below this line are applied for gcc-snapshot builds as well
270
ifeq ($(single_package),yes)
274
debian_patches += gcc-sysroot
275
debian_patches += goarch-aarch64
276
debian_patches += libgo-explicit-reservation
280
ifeq ($(with_softfloat),yes)
281
debian_patches += arm-multilib-soft-float
282
else ifeq ($(multilib),yes)
283
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
284
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
286
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
289
debian_patches += arm-multilib-defaults
291
ifeq ($(DEB_CROSS),yes)
292
debian_patches += cross-fixes
293
ifeq ($(with_deps_on_target_arch_pkgs),yes)
294
debian_patches += cross-ma-install-location
296
debian_patches += cross-install-location
300
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
301
debian_patches += hurd-changes
304
debian_patches += gcc-ice-hack gcc-ice-apport
306
#debian_patches += gold-and-ld
308
debian_patches += libjava-fixed-symlinks
309
debian_patches += libstdc++-arm-wno-abi
311
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
312
# timeouts on the buildd's, Debian
313
debian_patches += libstdc++-no-testsuite
314
else ifeq ($(distribution),Ubuntu)
315
# timeouts on the buildd's, Ubuntu only
316
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
317
debian_patches += libstdc++-no-testsuite
320
debian_patches += ada-mips
321
debian_patches += libffi-ro-eh_frame_sect
323
debian_patches += gcc-multiarch
324
ifeq ($(with_multiarch_lib),yes)
325
ifneq ($(single_package),yes)
326
debian_patches += libjava-multiarch
329
debian_patches += libjava-nobiarch-check
330
debian_patches += config-ml
331
ifneq ($(single_package),yes)
332
ifeq ($(with_multiarch_cxxheaders),yes)
333
debian_patches += g++-multiarch-incdir
336
ifeq ($(DEB_CROSS),yes)
337
debian_patches += cross-no-locale-include
339
ifeq ($(biarch64),yes)
340
ifeq ($(DEB_CROSS),yes)
341
debian_patches += cross-biarch
344
debian_patches += gcc-multilib-multiarch
345
ifneq ($(trunk_build),yes)
346
ifeq ($(with_ibm_branch),yes)
347
debian_patches += powerpc64le-multilib-definitions
351
ifneq (,$(filter $(derivative),Ubuntu))
352
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
353
debian_patches += gcc-as-needed
356
#debian_patches += gcc-as-needed
358
debian_patches += mips-fix-loongson2f-nop
359
ifeq ($(derivative),Ubuntu)
360
ifeq ($(DEB_TARGET_ARCH),ppc64)
361
debian_patches += gcc-ppc64-O3
364
debian_patches += libgomp-kfreebsd-testsuite
366
series_stamp = $(stampdir)/02-series-stamp
367
series: $(series_stamp)
369
echo $(strip $(addsuffix .diff,$(debian_patches))) \
370
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
371
ifneq (,$(strip $(hardening_patches)))
372
ifneq ($(trunk_build),yes)
373
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
374
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
377
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
380
autotools_files += $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
381
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
382
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
383
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
385
autoconf_version = 2.64
386
ifeq ($(trunk_build),yes)
387
# The actual version depends on the build-dependencies set by
388
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
389
# correct version is installed.
393
# FIXME: the auto* stuff is done every time for every subdir, which
394
# leads to build errors. Idea: record the auto* calls in the patch
395
# files (AUTO <dir> <auto-command with options>) and run them separately,
396
# maybe only once per directory).
397
$(patch_stamp): $(unpack_stamp) $(series_stamp)
398
QUILT_PATCHES=$(patchdir) \
399
quilt --quiltrc /dev/null push -a || test $$? = 2
401
ifneq (,$(filter svn-updates, $(debian_patches)))
402
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
403
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
406
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
408
cd $(srcdir)/fixincludes && ./genfixes
410
for f in $(autotools_files) ; \
412
*/classpath/m4/acinclude.m4) \
414
*/configure.*|*/acinclude.m4) \
415
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
416
then echo "Skipping already regenerated file $$f." ; \
418
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
419
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
420
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
422
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
425
*) echo "Unknown file: $$f"; false; \
429
for i in $(debian_patches) $(hardening_patches); do \
430
echo -e "\n$$i:" >> pxxx; \
431
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
433
# -$(srcdir)/move-if-change pxxx $@
437
QUILT_PATCHES=$(patchdir) \
438
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
440
for f in $(autotools_files); do \
441
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
444
update-patches: $(series_stamp)
445
export QUILT_PATCHES=$(patchdir); \
446
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
447
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
448
while quilt push; do quilt refresh; done
450
patch: $(patch_stamp)
451
.PHONY: patch series quilt autotools