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?
16
$(if $(with_linaro_branch),gcc-linaro) \
17
$(if $(with_linaro_branch),pr58578) \
18
$(if $(with_linaro_branch),arm-fix-add-pattern) \
19
$(if $(with_linaro_branch),aarch64-libatomic) \
22
# svn-updates$(if $(with_linaro_branch),-linaro) \
24
ifeq ($(with_java),yes)
29
ifneq ($(GFDL_INVARIANT_FREE),yes)
32
$(if $(with_linaro_branch),gcc-linaro-doc) \
35
# $(if $(with_linaro_branch),,svn-doc-updates) \
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 \
76
gcc-target-include-asm \
77
libgo-revert-timeout-exp \
78
$(if $(with_linaro_branch),,arm-sanitizer) \
80
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
105
ifneq ($(distribution),Debian)
106
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
107
hardening_patches += \
108
gcc-default-format-security \
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
183
debian_patches += gcc-d-lang
186
ifeq ($(DEB_TARGET_ARCH),alpha)
187
debian_patches += alpha-ieee mudflap-nocheck
188
ifneq ($(GFDL_INVARIANT_FREE),yes)
189
debian_patches += alpha-ieee-doc
193
ifeq ($(DEB_TARGET_ARCH_CPU),amd64)
194
debian_patches += libjava-testsuite
197
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
198
debian_patches += libjava-armel-unwind
201
ifeq ($(DEB_TARGET_ARCH),armhf)
202
debian_patches += gcj-arm-mode
203
else ifeq ($(DEB_TARGET_ARCH),armel)
204
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
205
debian_patches += gcj-arm-mode
209
ifeq ($(DEB_TARGET_ARCH),m68k)
210
debian_patches += m68k-ada
211
debian_patches += m68k-revert-pr45144
212
debian_patches += pr52714
215
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
216
debian_patches += powerpc_remove_many
217
debian_patches += powerpc_nofprs
220
ifeq ($(DEB_TARGET_ARCH),ppc64)
221
ifeq ($(distribution),Ubuntu)
222
#debian_patches += ibm-branch
226
#debian_patches += link-libs
228
# all patches below this line are applied for gcc-snapshot builds as well
230
ifeq ($(single_package),yes)
234
debian_patches += gcc-sysroot
238
ifeq ($(with_softfloat),yes)
239
debian_patches += arm-multilib-soft-float
240
else ifeq ($(multilib),yes)
241
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
242
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
244
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
247
debian_patches += arm-multilib-defaults
249
ifeq ($(DEB_CROSS),yes)
250
debian_patches += cross-fixes
251
ifeq ($(with_deps_on_target_arch_pkgs),yes)
252
debian_patches += cross-ma-install-location
254
debian_patches += cross-install-location
258
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
259
debian_patches += hurd-changes
262
debian_patches += gcc-ice-hack gcc-ice-apport
264
#debian_patches += gold-and-ld
266
debian_patches += libjava-fixed-symlinks
267
debian_patches += libstdc++-arm-wno-abi
269
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
270
# timeouts on the buildd's, Debian
271
debian_patches += libstdc++-no-testsuite
272
else ifeq ($(distribution),Ubuntu)
273
# timeouts on the buildd's, Ubuntu only
274
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
275
debian_patches += libstdc++-no-testsuite
278
debian_patches += ada-mips
279
debian_patches += libffi-ro-eh_frame_sect
281
debian_patches += gcc-multiarch
282
ifeq ($(with_multiarch_lib),yes)
283
ifneq ($(single_package),yes)
284
debian_patches += libjava-multiarch
287
debian_patches += libjava-nobiarch-check
288
debian_patches += config-ml
289
ifneq ($(single_package),yes)
290
ifeq ($(with_multiarch_cxxheaders),yes)
291
debian_patches += g++-multiarch-incdir
294
ifeq ($(DEB_CROSS),yes)
295
debian_patches += cross-no-locale-include
297
ifeq ($(biarch64),yes)
298
ifeq ($(DEB_CROSS),yes)
299
debian_patches += cross-biarch
302
debian_patches += gcc-multilib-multiarch
304
ifneq (,$(filter $(derivative),Ubuntu))
305
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
306
debian_patches += gcc-as-needed
309
#debian_patches += gcc-as-needed
311
debian_patches += mips-fix-loongson2f-nop
312
ifeq ($(distribution),Ubuntu)
313
ifeq ($(DEB_TARGET_ARCH),ppc64)
314
debian_patches += gcc-ppc64-O3
317
debian_patches += libgomp-kfreebsd-testsuite
319
series_stamp = $(stampdir)/02-series-stamp
320
series: $(series_stamp)
322
echo $(strip $(addsuffix .diff,$(debian_patches))) \
323
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
324
ifneq (,$(strip $(hardening_patches)))
325
ifneq ($(trunk_build),yes)
326
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
327
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
330
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
333
autotools_files := $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
334
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
335
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
336
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
338
autoconf_version = 2.64
339
ifeq ($(trunk_build),yes)
340
# The actual version depends on the build-dependencies set by
341
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
342
# correct version is installed.
346
# FIXME: the auto* stuff is done every time for every subdir, which
347
# leads to build errors. Idea: record the auto* calls in the patch
348
# files (AUTO <dir> <auto-command with options>) and run them separately,
349
# maybe only once per directory).
350
$(patch_stamp): $(unpack_stamp) $(series_stamp)
351
QUILT_PATCHES=$(patchdir) \
352
quilt --quiltrc /dev/null push -a || test $$? = 2
354
ifneq (,$(filter svn-updates, $(debian_patches)))
355
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
356
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
359
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
361
cd $(srcdir)/fixincludes && ./genfixes
363
for f in $(autotools_files) ; \
365
*/classpath/m4/acinclude.m4) \
367
*/configure.*|*/acinclude.m4) \
368
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
369
then echo "Skipping already regenerated file $$f." ; \
371
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
372
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
373
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
375
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
378
*) echo "Unknown file: $$f"; false; \
382
for i in $(debian_patches); do \
383
echo -e "\n$$i:" >> pxxx; \
384
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
386
# -$(srcdir)/move-if-change pxxx $@
390
QUILT_PATCHES=$(patchdir) \
391
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
393
for f in $(autotools_files); do \
394
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
397
update-patches: $(series_stamp)
398
export QUILT_PATCHES=$(patchdir); \
399
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
400
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
401
while quilt push; do quilt refresh; done
403
patch: $(patch_stamp)
404
.PHONY: patch series quilt autotools