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) \
37
$(if $(with_linaro_branch),gcc-dfsg-linaro-doc)
42
# boehm-gc-nocheck: seems to work on the buildds \
46
gcc-driver-extra-langs
48
ifneq (,$(filter $(distrelease),etch lenny squeeze wheezy dapper hardy intrepid jaunty karmic lucid))
49
debian_patches += gcc-hash-style-both
51
debian_patches += gcc-hash-style-gnu
58
libstdc++-test-installed \
62
libjava-disable-plugin \
63
alpha-no-ev4-directive \
66
libgomp-omp_h-multilib \
73
gcc-target-include-asm \
74
libgo-revert-timeout-exp \
75
$(if $(with_linaro_branch),,arm-sanitizer) \
76
libgo-setcontext-config \
88
$(if $(with_linaro_branch),pr59744) \
89
$(if $(with_linaro_branch),aarch64-call-frame-info) \
90
$(if $(with_linaro_branch),aarch64-abi-fix) \
91
fix-ffi_call_VFP-with-no-VFP-argument \
92
$(if $(with_linaro_branch),pr60034) \
96
testsuite-hardening-ssp \
99
# FIXME: still necessary for cross building the native compiler?
102
gdb_depends := $(shell dpkg -s gdb | grep '^Depends:.*libpython3')
103
ifneq (,$(findstring libpython3,$(gdb_depends)))
104
debian_patches += libstdc++-python3
107
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
108
# libstdc++-nothumb-check \
114
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
115
hardening_patches += gcc-default-ssp
116
hardening_patches += gcc-default-format-security
118
ifeq ($(distribution),Ubuntu)
119
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
120
hardening_patches += \
121
gcc-default-fortify-source \
123
testsuite-hardening-format \
124
testsuite-hardening-printf-types \
125
testsuite-hardening-updates
129
# FIXME 4.5: Drop and adjust symbols files
130
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
131
debian_patches += pr39491
134
ifeq ($(with_ada),yes)
138
ada-default-project-path \
139
ada-symbolic-tracebacks \
140
ada-library-project-files-soname \
143
ifeq ($(biarch64),yes)
148
ifeq ($(with_libgnat),yes)
154
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
160
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
162
gcc_ada_gcc-interface_Makefile.in \
163
ada-s-osinte-gnu.adb \
164
ada-s-osinte-gnu.ads \
180
ifneq ($(GFDL_INVARIANT_FREE),yes)
181
debian_patches += gdc-4.8-doc
183
debian_patches += gdc-texinfo
185
ifeq ($(with_libphobos),yes)
186
debian_patches += gdc-libphobos-build
188
debian_patches += gdc-driver-nophobos
190
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
191
debian_patches += disable-gdc-tests
194
debian_patches += gcc-d-lang
197
ifeq ($(DEB_TARGET_ARCH),alpha)
198
debian_patches += alpha-ieee
199
ifneq ($(GFDL_INVARIANT_FREE),yes)
200
debian_patches += alpha-ieee-doc
204
ifeq ($(DEB_TARGET_ARCH_CPU),amd64)
205
debian_patches += libjava-testsuite
208
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
209
debian_patches += libjava-armel-unwind
212
ifeq ($(DEB_TARGET_ARCH),armhf)
213
debian_patches += gcj-arm-mode
214
else ifeq ($(DEB_TARGET_ARCH),armel)
215
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
216
debian_patches += gcj-arm-mode
220
ifeq ($(DEB_TARGET_ARCH),m68k)
221
debian_patches += m68k-ada
222
debian_patches += m68k-revert-pr45144
223
debian_patches += pr52714
224
debian_patches += pr58369
225
debian_patches += pr52306
228
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
229
debian_patches += powerpc_remove_many
230
debian_patches += powerpc_nofprs
233
#debian_patches += link-libs
235
# all patches below this line are applied for gcc-snapshot builds as well
237
ifeq ($(single_package),yes)
241
debian_patches += gcc-sysroot
242
debian_patches += goarch-aarch64
243
debian_patches += libgo-explicit-reservation
247
ifeq ($(with_softfloat),yes)
248
debian_patches += arm-multilib-soft-float
249
else ifeq ($(multilib),yes)
250
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
251
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
253
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
256
debian_patches += arm-multilib-defaults
258
ifeq ($(DEB_CROSS),yes)
259
debian_patches += cross-fixes
260
ifeq ($(with_deps_on_target_arch_pkgs),yes)
261
debian_patches += cross-ma-install-location
263
debian_patches += cross-install-location
267
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
268
debian_patches += hurd-changes
271
debian_patches += gcc-ice-hack gcc-ice-apport
273
#debian_patches += gold-and-ld
275
debian_patches += libjava-fixed-symlinks
276
debian_patches += libstdc++-arm-wno-abi
278
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
279
# timeouts on the buildd's, Debian
280
debian_patches += libstdc++-no-testsuite
281
else ifeq ($(distribution),Ubuntu)
282
# timeouts on the buildd's, Ubuntu only
283
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
284
debian_patches += libstdc++-no-testsuite
287
debian_patches += ada-mips
288
debian_patches += libffi-ro-eh_frame_sect
290
debian_patches += gcc-multiarch
291
ifeq ($(with_multiarch_lib),yes)
292
ifneq ($(single_package),yes)
293
debian_patches += libjava-multiarch
296
debian_patches += libjava-nobiarch-check
297
debian_patches += config-ml
298
ifneq ($(single_package),yes)
299
ifeq ($(with_multiarch_cxxheaders),yes)
300
debian_patches += g++-multiarch-incdir
303
ifeq ($(DEB_CROSS),yes)
304
debian_patches += cross-no-locale-include
306
ifeq ($(biarch64),yes)
307
ifeq ($(DEB_CROSS),yes)
308
debian_patches += cross-biarch
311
debian_patches += gcc-multilib-multiarch
313
ifneq (,$(filter $(derivative),Ubuntu))
314
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
315
debian_patches += gcc-as-needed
318
#debian_patches += gcc-as-needed
320
debian_patches += mips-fix-loongson2f-nop
321
ifeq ($(derivative),Ubuntu)
322
ifeq ($(DEB_TARGET_ARCH),ppc64)
323
debian_patches += gcc-ppc64-O3
326
debian_patches += libgomp-kfreebsd-testsuite
328
series_stamp = $(stampdir)/02-series-stamp
329
series: $(series_stamp)
331
echo $(strip $(addsuffix .diff,$(debian_patches))) \
332
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
333
ifneq (,$(strip $(hardening_patches)))
334
ifneq ($(trunk_build),yes)
335
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
336
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
339
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
342
autotools_files = $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
343
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
344
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
345
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
347
autoconf_version = 2.64
348
ifeq ($(trunk_build),yes)
349
# The actual version depends on the build-dependencies set by
350
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
351
# correct version is installed.
355
# FIXME: the auto* stuff is done every time for every subdir, which
356
# leads to build errors. Idea: record the auto* calls in the patch
357
# files (AUTO <dir> <auto-command with options>) and run them separately,
358
# maybe only once per directory).
359
$(patch_stamp): $(unpack_stamp) $(series_stamp)
360
QUILT_PATCHES=$(patchdir) \
361
quilt --quiltrc /dev/null push -a || test $$? = 2
363
ifneq (,$(filter svn-updates, $(debian_patches)))
364
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
365
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
368
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
370
cd $(srcdir)/fixincludes && ./genfixes
372
for f in $(autotools_files) ; \
374
*/classpath/m4/acinclude.m4) \
376
*/configure.*|*/acinclude.m4) \
377
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
378
then echo "Skipping already regenerated file $$f." ; \
380
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
381
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
382
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
384
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
387
*) echo "Unknown file: $$f"; false; \
391
for i in $(debian_patches) $(hardening_patches); do \
392
echo -e "\n$$i:" >> pxxx; \
393
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
395
# -$(srcdir)/move-if-change pxxx $@
399
QUILT_PATCHES=$(patchdir) \
400
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
402
for f in $(autotools_files); do \
403
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
406
update-patches: $(series_stamp)
407
export QUILT_PATCHES=$(patchdir); \
408
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
409
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
410
while quilt push; do quilt refresh; done
412
patch: $(patch_stamp)
413
.PHONY: patch series quilt autotools