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 \
73
gcc-target-include-asm \
74
libgo-revert-timeout-exp \
75
$(if $(with_linaro_branch),,arm-sanitizer) \
77
libgo-setcontext-config \
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
130
ifeq ($(biarch64),yes)
135
ifeq ($(with_libgnat),yes)
141
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
147
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
148
debian_patches += ada-kfreebsd-gnu \
152
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
154
gcc_ada_gcc-interface_Makefile.in \
155
ada-s-osinte-gnu.adb \
156
ada-s-osinte-gnu.ads \
172
ifneq ($(GFDL_INVARIANT_FREE),yes)
173
debian_patches += gdc-4.8-doc
175
debian_patches += gdc-texinfo
177
ifeq ($(with_libphobos),yes)
178
debian_patches += gdc-libphobos-build
180
debian_patches += gdc-driver-nophobos
182
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
183
debian_patches += disable-gdc-tests
186
debian_patches += gcc-d-lang
189
ifeq ($(DEB_TARGET_ARCH),alpha)
190
ifneq ($(GFDL_INVARIANT_FREE),yes)
191
debian_patches += alpha-ieee-doc
195
ifeq ($(DEB_TARGET_ARCH_CPU),amd64)
196
debian_patches += libjava-testsuite
199
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
200
debian_patches += libjava-armel-unwind
203
ifeq ($(DEB_TARGET_ARCH),armhf)
204
debian_patches += gcj-arm-mode
205
else ifeq ($(DEB_TARGET_ARCH),armel)
206
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
207
debian_patches += gcj-arm-mode
211
#ifeq ($(DEB_TARGET_ARCH),m68k)
212
debian_patches += m68k-ada
213
debian_patches += m68k-revert-pr45144
214
debian_patches += pr52714
215
debian_patches += pr58369
216
debian_patches += pr52306
219
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
220
debian_patches += powerpc_remove_many
221
debian_patches += powerpc_nofprs
224
ifeq ($(DEB_TARGET_ARCH),ppc64)
225
ifeq ($(distribution),Ubuntu)
226
#debian_patches += ibm-branch
230
ifeq ($(with_ibm_branch),yes)
231
debian_patches += gcc-ppc64el libffi-ppc64el
232
ifneq ($(GFDL_INVARIANT_FREE),yes)
233
debian_patches += gcc-ppc64el-doc
236
# this will cause all the configure files to be updated once libtool is patched
238
./src/gnattools/configure.ac \
239
./src/libobjc/configure.ac \
240
./src/libatomic/configure.ac \
241
./src/libstdc++-v3/configure.ac \
242
./src/libgfortran/configure.ac \
243
./src/boehm-gc/configure.ac \
244
./src/libsanitizer/configure.ac \
245
./src/fixincludes/configure.ac \
246
./src/lto-plugin/configure.ac \
247
./src/libgcc/configure.ac \
248
./src/libiberty/configure.ac \
249
./src/libffi/configure.ac \
250
./src/zlib/configure.ac \
251
./src/libbacktrace/configure.ac \
252
./src/libjava/classpath/configure.ac \
253
./src/libjava/libltdl/configure.ac \
254
./src/libjava/configure.ac \
255
./src/libitm/configure.ac \
256
./src/intl/configure.ac \
257
./src/libquadmath/configure.ac \
258
./src/libada/configure.ac \
259
./src/libdecnumber/configure.ac \
260
./src/gcc/configure.ac \
261
./src/libgo/configure.ac \
262
./src/libcpp/configure.ac \
264
./src/libssp/configure.ac \
265
./src/libmudflap/configure.ac \
266
./src/libgomp/configure.ac
269
#debian_patches += link-libs
271
# all patches below this line are applied for gcc-snapshot builds as well
273
ifeq ($(single_package),yes)
277
debian_patches += gcc-sysroot
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
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
346
ifeq ($(with_ibm_branch),yes)
347
debian_patches += powerpc64le-multilib-definitions
350
ifneq (,$(filter $(derivative),Ubuntu))
351
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
352
debian_patches += gcc-as-needed
355
#debian_patches += gcc-as-needed
357
debian_patches += mips-fix-loongson2f-nop
358
ifeq ($(derivative),Ubuntu)
359
ifeq ($(DEB_TARGET_ARCH),ppc64)
360
debian_patches += gcc-ppc64-O3
363
debian_patches += libgomp-kfreebsd-testsuite
365
series_stamp = $(stampdir)/02-series-stamp
366
series: $(series_stamp)
368
echo $(strip $(addsuffix .diff,$(debian_patches))) \
369
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
370
ifneq (,$(strip $(hardening_patches)))
371
ifneq ($(trunk_build),yes)
372
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
373
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
376
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
379
autotools_files += $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
380
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
381
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
382
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
384
autoconf_version = 2.64
385
ifeq ($(trunk_build),yes)
386
# The actual version depends on the build-dependencies set by
387
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
388
# correct version is installed.
392
# FIXME: the auto* stuff is done every time for every subdir, which
393
# leads to build errors. Idea: record the auto* calls in the patch
394
# files (AUTO <dir> <auto-command with options>) and run them separately,
395
# maybe only once per directory).
396
$(patch_stamp): $(unpack_stamp) $(series_stamp)
397
QUILT_PATCHES=$(patchdir) \
398
quilt --quiltrc /dev/null push -a || test $$? = 2
400
ifneq (,$(filter svn-updates, $(debian_patches)))
401
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
402
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
405
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
407
cd $(srcdir)/fixincludes && ./genfixes
409
for f in $(autotools_files) ; \
411
*/classpath/m4/acinclude.m4) \
413
*/configure.*|*/acinclude.m4) \
414
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
415
then echo "Skipping already regenerated file $$f." ; \
417
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
418
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
419
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
421
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
424
*) echo "Unknown file: $$f"; false; \
428
for i in $(debian_patches); do \
429
echo -e "\n$$i:" >> pxxx; \
430
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
432
# -$(srcdir)/move-if-change pxxx $@
436
QUILT_PATCHES=$(patchdir) \
437
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
439
for f in $(autotools_files); do \
440
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
443
update-patches: $(series_stamp)
444
export QUILT_PATCHES=$(patchdir); \
445
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
446
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
447
while quilt push; do quilt refresh; done
449
patch: $(patch_stamp)
450
.PHONY: patch series quilt autotools