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
ifeq ($(with_java),yes)
25
ifneq ($(GFDL_INVARIANT_FREE),yes)
28
$(if $(with_linaro_branch),gcc-linaro-doc) \
31
# $(if $(with_linaro_branch),,svn-doc-updates) \
35
$(if $(with_linaro_branch),gcc-dfsg-linaro-doc)
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 \
86
$(if $(with_linaro_branch),pr59744) \
87
$(if $(with_linaro_branch),aarch64-call-frame-info) \
88
$(if $(with_linaro_branch),aarch64-abi-fix) \
89
fix-ffi_call_VFP-with-no-VFP-argument \
90
$(if $(with_linaro_branch),pr60034) \
96
# FIXME: still necessary for cross building the native compiler?
99
gdb_depends := $(shell dpkg -s gdb | grep '^Depends:.*libpython3')
100
ifneq (,$(findstring libpython3,$(gdb_depends)))
101
debian_patches += libstdc++-python3
104
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
105
# libstdc++-nothumb-check \
111
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
112
hardening_patches += gcc-default-ssp
113
hardening_patches += gcc-default-format-security
115
ifeq ($(distribution),Ubuntu)
116
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
117
hardening_patches += \
118
gcc-default-fortify-source \
120
testsuite-hardening-format \
121
testsuite-hardening-printf-types \
122
testsuite-hardening-updates
126
# FIXME 4.5: Drop and adjust symbols files
127
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
128
debian_patches += pr39491
131
ifeq ($(with_ada),yes)
135
ada-default-project-path \
136
ada-symbolic-tracebacks \
137
ada-library-project-files-soname \
140
ifeq ($(biarch64),yes)
145
ifeq ($(with_libgnat),yes)
151
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
157
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
159
gcc_ada_gcc-interface_Makefile.in \
160
ada-s-osinte-gnu.adb \
161
ada-s-osinte-gnu.ads \
177
ifneq ($(GFDL_INVARIANT_FREE),yes)
178
debian_patches += gdc-4.8-doc
180
debian_patches += gdc-texinfo
182
ifeq ($(with_libphobos),yes)
183
debian_patches += gdc-libphobos-build
185
debian_patches += gdc-driver-nophobos
187
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
188
debian_patches += disable-gdc-tests
191
debian_patches += gcc-d-lang
194
ifeq ($(DEB_TARGET_ARCH),alpha)
195
debian_patches += alpha-ieee
196
ifneq ($(GFDL_INVARIANT_FREE),yes)
197
debian_patches += alpha-ieee-doc
201
ifeq ($(DEB_TARGET_ARCH_CPU),amd64)
202
debian_patches += libjava-testsuite
205
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
206
debian_patches += libjava-armel-unwind
209
ifeq ($(DEB_TARGET_ARCH),armhf)
210
debian_patches += gcj-arm-mode
211
else ifeq ($(DEB_TARGET_ARCH),armel)
212
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
213
debian_patches += gcj-arm-mode
217
ifeq ($(DEB_TARGET_ARCH),m68k)
218
debian_patches += m68k-ada
219
debian_patches += m68k-revert-pr45144
220
debian_patches += pr52714
221
debian_patches += pr58369
222
debian_patches += pr52306
225
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
226
debian_patches += powerpc_remove_many
227
debian_patches += powerpc_nofprs
230
#debian_patches += link-libs
232
# all patches below this line are applied for gcc-snapshot builds as well
234
ifeq ($(single_package),yes)
238
debian_patches += gcc-sysroot
239
debian_patches += goarch-aarch64
240
debian_patches += libgo-explicit-reservation
244
ifeq ($(with_softfloat),yes)
245
debian_patches += arm-multilib-soft-float
246
else ifeq ($(multilib),yes)
247
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
248
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
250
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
253
debian_patches += arm-multilib-defaults
255
ifeq ($(DEB_CROSS),yes)
256
debian_patches += cross-fixes
257
ifeq ($(with_deps_on_target_arch_pkgs),yes)
258
debian_patches += cross-ma-install-location
260
debian_patches += cross-install-location
264
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
265
debian_patches += hurd-changes
268
debian_patches += gcc-ice-hack gcc-ice-apport
270
#debian_patches += gold-and-ld
272
debian_patches += libjava-fixed-symlinks
274
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
275
# timeouts on the buildd's, Debian
276
debian_patches += libstdc++-no-testsuite
277
else ifeq ($(distribution),Ubuntu)
278
# timeouts on the buildd's, Ubuntu only
279
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
280
debian_patches += libstdc++-no-testsuite
283
debian_patches += ada-mips
284
debian_patches += libffi-ro-eh_frame_sect
286
debian_patches += gcc-multiarch
287
ifeq ($(with_multiarch_lib),yes)
288
ifneq ($(single_package),yes)
289
debian_patches += libjava-multiarch
292
debian_patches += libjava-nobiarch-check
293
debian_patches += config-ml
294
ifneq ($(single_package),yes)
295
ifeq ($(with_multiarch_cxxheaders),yes)
296
debian_patches += g++-multiarch-incdir
299
ifeq ($(DEB_CROSS),yes)
300
debian_patches += cross-no-locale-include
302
ifeq ($(biarch64),yes)
303
ifeq ($(DEB_CROSS),yes)
304
debian_patches += cross-biarch
307
debian_patches += gcc-multilib-multiarch
309
ifneq (,$(filter $(derivative),Ubuntu))
310
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
311
debian_patches += gcc-as-needed
314
#debian_patches += gcc-as-needed
316
debian_patches += mips-fix-loongson2f-nop
317
ifeq ($(derivative),Ubuntu)
318
ifeq ($(DEB_TARGET_ARCH),ppc64)
319
debian_patches += gcc-ppc64-O3
322
debian_patches += libgomp-kfreebsd-testsuite
324
series_stamp = $(stampdir)/02-series-stamp
325
series: $(series_stamp)
327
echo $(strip $(addsuffix .diff,$(debian_patches))) \
328
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
329
ifneq (,$(strip $(hardening_patches)))
330
ifneq ($(trunk_build),yes)
331
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
332
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
335
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
338
autotools_files = $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
339
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
340
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
341
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
343
autoconf_version = 2.64
344
ifeq ($(trunk_build),yes)
345
# The actual version depends on the build-dependencies set by
346
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
347
# correct version is installed.
351
# FIXME: the auto* stuff is done every time for every subdir, which
352
# leads to build errors. Idea: record the auto* calls in the patch
353
# files (AUTO <dir> <auto-command with options>) and run them separately,
354
# maybe only once per directory).
355
$(patch_stamp): $(unpack_stamp) $(series_stamp)
356
QUILT_PATCHES=$(patchdir) \
357
quilt --quiltrc /dev/null push -a || test $$? = 2
359
ifneq (,$(filter svn-updates, $(debian_patches)))
360
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
361
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
364
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
366
cd $(srcdir)/fixincludes && ./genfixes
368
for f in $(autotools_files) ; \
370
*/classpath/m4/acinclude.m4) \
372
*/configure.*|*/acinclude.m4) \
373
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
374
then echo "Skipping already regenerated file $$f." ; \
376
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
377
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
378
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
380
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
383
*) echo "Unknown file: $$f"; false; \
387
for i in $(debian_patches) $(hardening_patches); do \
388
echo -e "\n$$i:" >> pxxx; \
389
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
391
# -$(srcdir)/move-if-change pxxx $@
395
QUILT_PATCHES=$(patchdir) \
396
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
398
for f in $(autotools_files); do \
399
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
402
update-patches: $(series_stamp)
403
export QUILT_PATCHES=$(patchdir); \
404
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
405
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
406
while quilt push; do quilt refresh; done
408
patch: $(patch_stamp)
409
.PHONY: patch series quilt autotools