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) \
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) \
89
$(if $(with_linaro_branch),aarch64-abi-fix) \
90
fix-ffi_call_VFP-with-no-VFP-argument \
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 \
134
ifeq ($(biarch64),yes)
139
ifeq ($(with_libgnat),yes)
145
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
151
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
153
gcc_ada_gcc-interface_Makefile.in \
154
ada-s-osinte-gnu.adb \
155
ada-s-osinte-gnu.ads \
171
ifneq ($(GFDL_INVARIANT_FREE),yes)
172
debian_patches += gdc-4.8-doc
174
debian_patches += gdc-texinfo
176
ifeq ($(with_libphobos),yes)
177
debian_patches += gdc-libphobos-build
179
debian_patches += gdc-driver-nophobos
181
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
182
debian_patches += disable-gdc-tests
185
debian_patches += gcc-d-lang
188
ifeq ($(DEB_TARGET_ARCH),alpha)
189
debian_patches += alpha-ieee
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 ($(with_ibm_branch),yes)
225
debian_patches += gcc-ppc64el
226
ifneq ($(GFDL_INVARIANT_FREE),yes)
227
debian_patches += gcc-ppc64el-doc
230
# this will cause all the configure files to be updated once libtool is patched
232
./src/gnattools/configure.ac \
233
./src/libobjc/configure.ac \
234
./src/libatomic/configure.ac \
235
./src/libstdc++-v3/configure.ac \
236
./src/libgfortran/configure.ac \
237
./src/boehm-gc/configure.ac \
238
./src/libsanitizer/configure.ac \
239
./src/fixincludes/configure.ac \
240
./src/lto-plugin/configure.ac \
241
./src/libgcc/configure.ac \
242
./src/libiberty/configure.ac \
243
./src/libffi/configure.ac \
244
./src/zlib/configure.ac \
245
./src/libbacktrace/configure.ac \
246
./src/libjava/classpath/configure.ac \
247
./src/libjava/libltdl/configure.ac \
248
./src/libjava/configure.ac \
249
./src/libitm/configure.ac \
250
./src/intl/configure.ac \
251
./src/libquadmath/configure.ac \
252
./src/libada/configure.ac \
253
./src/libdecnumber/configure.ac \
254
./src/gcc/configure.ac \
255
./src/libgo/configure.ac \
256
./src/libcpp/configure.ac \
258
./src/libssp/configure.ac \
259
./src/libmudflap/configure.ac \
260
./src/libgomp/configure.ac
263
#debian_patches += link-libs
265
# all patches below this line are applied for gcc-snapshot builds as well
267
ifeq ($(single_package),yes)
271
debian_patches += gcc-sysroot
272
debian_patches += goarch-aarch64
273
debian_patches += libgo-explicit-reservation
277
ifeq ($(with_softfloat),yes)
278
debian_patches += arm-multilib-soft-float
279
else ifeq ($(multilib),yes)
280
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
281
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
283
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
286
debian_patches += arm-multilib-defaults
288
ifeq ($(DEB_CROSS),yes)
289
debian_patches += cross-fixes
290
ifeq ($(with_deps_on_target_arch_pkgs),yes)
291
debian_patches += cross-ma-install-location
293
debian_patches += cross-install-location
297
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
298
debian_patches += hurd-changes
301
debian_patches += gcc-ice-hack gcc-ice-apport
303
#debian_patches += gold-and-ld
305
debian_patches += libjava-fixed-symlinks
306
debian_patches += libstdc++-arm-wno-abi
308
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
309
# timeouts on the buildd's, Debian
310
debian_patches += libstdc++-no-testsuite
311
else ifeq ($(distribution),Ubuntu)
312
# timeouts on the buildd's, Ubuntu only
313
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
314
debian_patches += libstdc++-no-testsuite
317
debian_patches += ada-mips
318
debian_patches += libffi-ro-eh_frame_sect
320
debian_patches += gcc-multiarch$(if $(with_ibm_branch),-ibm)
321
ifeq ($(with_multiarch_lib),yes)
322
ifneq ($(single_package),yes)
323
debian_patches += libjava-multiarch
326
debian_patches += libjava-nobiarch-check
327
debian_patches += config-ml
328
ifneq ($(single_package),yes)
329
ifeq ($(with_multiarch_cxxheaders),yes)
330
debian_patches += g++-multiarch-incdir
333
ifeq ($(DEB_CROSS),yes)
334
debian_patches += cross-no-locale-include
336
ifeq ($(biarch64),yes)
337
ifeq ($(DEB_CROSS),yes)
338
debian_patches += cross-biarch
341
debian_patches += gcc-multilib-multiarch$(if $(with_ibm_branch),-ibm)
343
ifneq (,$(filter $(derivative),Ubuntu))
344
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
345
debian_patches += gcc-as-needed
348
#debian_patches += gcc-as-needed
350
debian_patches += mips-fix-loongson2f-nop
351
ifeq ($(derivative),Ubuntu)
352
ifeq ($(DEB_TARGET_ARCH),ppc64)
353
debian_patches += gcc-ppc64-O3
356
debian_patches += libgomp-kfreebsd-testsuite
358
series_stamp = $(stampdir)/02-series-stamp
359
series: $(series_stamp)
361
echo $(strip $(addsuffix .diff,$(debian_patches))) \
362
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
363
ifneq (,$(strip $(hardening_patches)))
364
ifneq ($(trunk_build),yes)
365
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
366
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
369
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
372
autotools_files += $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
373
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
374
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
375
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
377
autoconf_version = 2.64
378
ifeq ($(trunk_build),yes)
379
# The actual version depends on the build-dependencies set by
380
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
381
# correct version is installed.
385
# FIXME: the auto* stuff is done every time for every subdir, which
386
# leads to build errors. Idea: record the auto* calls in the patch
387
# files (AUTO <dir> <auto-command with options>) and run them separately,
388
# maybe only once per directory).
389
$(patch_stamp): $(unpack_stamp) $(series_stamp)
390
QUILT_PATCHES=$(patchdir) \
391
quilt --quiltrc /dev/null push -a || test $$? = 2
393
ifneq (,$(filter svn-updates, $(debian_patches)))
394
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
395
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
398
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
400
cd $(srcdir)/fixincludes && ./genfixes
402
for f in $(autotools_files) ; \
404
*/classpath/m4/acinclude.m4) \
406
*/configure.*|*/acinclude.m4) \
407
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
408
then echo "Skipping already regenerated file $$f." ; \
410
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
411
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
412
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
414
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
417
*) echo "Unknown file: $$f"; false; \
421
for i in $(debian_patches) $(hardening_patches); do \
422
echo -e "\n$$i:" >> pxxx; \
423
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
425
# -$(srcdir)/move-if-change pxxx $@
429
QUILT_PATCHES=$(patchdir) \
430
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
432
for f in $(autotools_files); do \
433
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
436
update-patches: $(series_stamp)
437
export QUILT_PATCHES=$(patchdir); \
438
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
439
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
440
while quilt push; do quilt refresh; done
442
patch: $(patch_stamp)
443
.PHONY: patch series quilt autotools