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 \
92
gdb_depends := $(shell dpkg -s gdb | grep '^Depends:.*libpython3')
93
ifneq (,$(findstring libpython3,$(gdb_depends)))
94
debian_patches += libstdc++-python3
97
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
98
# libstdc++-nothumb-check \
104
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
105
hardening_patches += gcc-default-ssp
106
hardening_patches += gcc-default-format-security
108
ifeq ($(distribution),Ubuntu)
109
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
110
hardening_patches += \
111
gcc-default-fortify-source \
113
testsuite-hardening-format \
114
testsuite-hardening-printf-types \
115
testsuite-hardening-updates
119
# FIXME 4.5: Drop and adjust symbols files
120
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
121
debian_patches += pr39491
124
ifeq ($(with_ada),yes)
128
ada-default-project-path \
129
ada-symbolic-tracebacks \
130
ada-library-project-files-soname
132
ifeq ($(biarch64),yes)
137
ifeq ($(with_libgnat),yes)
143
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
149
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
150
debian_patches += ada-kfreebsd-gnu \
154
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
156
gcc_ada_gcc-interface_Makefile.in \
157
ada-s-osinte-gnu.adb \
158
ada-s-osinte-gnu.ads \
174
ifneq ($(GFDL_INVARIANT_FREE),yes)
175
debian_patches += gdc-4.8-doc
177
debian_patches += gdc-texinfo
179
ifeq ($(with_libphobos),yes)
180
debian_patches += gdc-libphobos-build
182
debian_patches += gdc-driver-nophobos
184
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
185
debian_patches += disable-gdc-tests
188
debian_patches += gcc-d-lang
191
ifeq ($(DEB_TARGET_ARCH),alpha)
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 ($(DEB_TARGET_ARCH),ppc64)
227
ifeq ($(distribution),Ubuntu)
228
#debian_patches += ibm-branch
232
ifeq ($(with_ibm_branch),yes)
233
debian_patches += gcc-ppc64el libffi-ppc64el
234
ifneq ($(GFDL_INVARIANT_FREE),yes)
235
debian_patches += gcc-ppc64el-doc
238
# this will cause all the configure files to be updated once libtool is patched
240
./src/gnattools/configure.ac \
241
./src/libobjc/configure.ac \
242
./src/libatomic/configure.ac \
243
./src/libstdc++-v3/configure.ac \
244
./src/libgfortran/configure.ac \
245
./src/boehm-gc/configure.ac \
246
./src/libsanitizer/configure.ac \
247
./src/fixincludes/configure.ac \
248
./src/lto-plugin/configure.ac \
249
./src/libgcc/configure.ac \
250
./src/libiberty/configure.ac \
251
./src/libffi/configure.ac \
252
./src/zlib/configure.ac \
253
./src/libbacktrace/configure.ac \
254
./src/libjava/classpath/configure.ac \
255
./src/libjava/libltdl/configure.ac \
256
./src/libjava/configure.ac \
257
./src/libitm/configure.ac \
258
./src/intl/configure.ac \
259
./src/libquadmath/configure.ac \
260
./src/libada/configure.ac \
261
./src/libdecnumber/configure.ac \
262
./src/gcc/configure.ac \
263
./src/libgo/configure.ac \
264
./src/libcpp/configure.ac \
266
./src/libssp/configure.ac \
267
./src/libmudflap/configure.ac \
268
./src/libgomp/configure.ac
271
#debian_patches += link-libs
273
# all patches below this line are applied for gcc-snapshot builds as well
275
ifeq ($(single_package),yes)
279
debian_patches += gcc-sysroot
280
debian_patches += goarch-aarch64
284
ifeq ($(with_softfloat),yes)
285
debian_patches += arm-multilib-soft-float
286
else ifeq ($(multilib),yes)
287
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
288
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
290
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
293
debian_patches += arm-multilib-defaults
295
ifeq ($(DEB_CROSS),yes)
296
debian_patches += cross-fixes
297
ifeq ($(with_deps_on_target_arch_pkgs),yes)
298
debian_patches += cross-ma-install-location
300
debian_patches += cross-install-location
304
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
305
debian_patches += hurd-changes
308
debian_patches += gcc-ice-hack gcc-ice-apport
310
#debian_patches += gold-and-ld
312
debian_patches += libjava-fixed-symlinks
313
debian_patches += libstdc++-arm-wno-abi
315
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
316
# timeouts on the buildd's, Debian
317
debian_patches += libstdc++-no-testsuite
318
else ifeq ($(distribution),Ubuntu)
319
# timeouts on the buildd's, Ubuntu only
320
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
321
debian_patches += libstdc++-no-testsuite
324
debian_patches += ada-mips
325
debian_patches += libffi-ro-eh_frame_sect
327
debian_patches += gcc-multiarch
328
ifeq ($(with_multiarch_lib),yes)
329
ifneq ($(single_package),yes)
330
debian_patches += libjava-multiarch
333
debian_patches += libjava-nobiarch-check
334
debian_patches += config-ml
335
ifneq ($(single_package),yes)
336
ifeq ($(with_multiarch_cxxheaders),yes)
337
debian_patches += g++-multiarch-incdir
340
ifeq ($(DEB_CROSS),yes)
341
debian_patches += cross-no-locale-include
343
ifeq ($(biarch64),yes)
344
ifeq ($(DEB_CROSS),yes)
345
debian_patches += cross-biarch
348
debian_patches += gcc-multilib-multiarch
349
ifeq ($(with_ibm_branch),yes)
350
debian_patches += powerpc64le-multilib-definitions
353
ifneq (,$(filter $(derivative),Ubuntu))
354
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
355
debian_patches += gcc-as-needed
358
#debian_patches += gcc-as-needed
360
debian_patches += mips-fix-loongson2f-nop
361
ifeq ($(derivative),Ubuntu)
362
ifeq ($(DEB_TARGET_ARCH),ppc64)
363
debian_patches += gcc-ppc64-O3
366
debian_patches += libgomp-kfreebsd-testsuite
368
series_stamp = $(stampdir)/02-series-stamp
369
series: $(series_stamp)
371
echo $(strip $(addsuffix .diff,$(debian_patches))) \
372
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
373
ifneq (,$(strip $(hardening_patches)))
374
ifneq ($(trunk_build),yes)
375
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
376
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
379
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
382
autotools_files += $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
383
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
384
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
385
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
387
autoconf_version = 2.64
388
ifeq ($(trunk_build),yes)
389
# The actual version depends on the build-dependencies set by
390
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
391
# correct version is installed.
395
# FIXME: the auto* stuff is done every time for every subdir, which
396
# leads to build errors. Idea: record the auto* calls in the patch
397
# files (AUTO <dir> <auto-command with options>) and run them separately,
398
# maybe only once per directory).
399
$(patch_stamp): $(unpack_stamp) $(series_stamp)
400
QUILT_PATCHES=$(patchdir) \
401
quilt --quiltrc /dev/null push -a || test $$? = 2
403
ifneq (,$(filter svn-updates, $(debian_patches)))
404
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
405
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
408
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
410
cd $(srcdir)/fixincludes && ./genfixes
412
for f in $(autotools_files) ; \
414
*/classpath/m4/acinclude.m4) \
416
*/configure.*|*/acinclude.m4) \
417
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
418
then echo "Skipping already regenerated file $$f." ; \
420
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
421
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
422
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
424
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
427
*) echo "Unknown file: $$f"; false; \
431
for i in $(debian_patches); do \
432
echo -e "\n$$i:" >> pxxx; \
433
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
435
# -$(srcdir)/move-if-change pxxx $@
439
QUILT_PATCHES=$(patchdir) \
440
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
442
for f in $(autotools_files); do \
443
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
446
update-patches: $(series_stamp)
447
export QUILT_PATCHES=$(patchdir); \
448
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
449
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
450
while quilt push; do quilt refresh; done
452
patch: $(patch_stamp)
453
.PHONY: patch series quilt autotools