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) \
19
# svn-updates$(if $(with_linaro_branch),-linaro) \
21
ifeq ($(with_java),yes)
26
ifneq ($(GFDL_INVARIANT_FREE),yes)
29
$(if $(with_linaro_branch),gcc-linaro-doc) \
32
# $(if $(with_linaro_branch),,svn-doc-updates) \
39
# boehm-gc-nocheck: seems to work on the buildds \
43
gcc-driver-extra-langs
45
ifneq (,$(filter $(distrelease),etch lenny squeeze wheezy dapper hardy intrepid jaunty karmic lucid))
46
debian_patches += gcc-hash-style-both
48
debian_patches += gcc-hash-style-gnu
55
libstdc++-test-installed \
59
libjava-disable-plugin \
60
alpha-no-ev4-directive \
63
libgomp-omp_h-multilib \
73
gcc-target-include-asm \
74
libgo-revert-timeout-exp \
75
$(if $(with_linaro_branch),,arm-sanitizer) \
77
libgo-setcontext-config \
87
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
88
# libstdc++-nothumb-check \
94
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
95
hardening_patches += gcc-default-ssp
97
ifneq ($(distribution),Debian)
98
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
99
hardening_patches += \
100
gcc-default-format-security \
101
gcc-default-fortify-source \
103
testsuite-hardening-format \
104
testsuite-hardening-printf-types \
105
testsuite-hardening-updates
109
# FIXME 4.5: Drop and adjust symbols files
110
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
111
debian_patches += pr39491
114
ifeq ($(with_ada),yes)
118
ada-default-project-path \
119
ada-symbolic-tracebacks \
120
ada-library-project-files-soname
122
ifeq ($(biarch64),yes)
127
ifeq ($(with_libgnat),yes)
133
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
139
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
140
debian_patches += ada-kfreebsd-gnu \
144
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
146
gcc_ada_gcc-interface_Makefile.in \
147
ada-s-osinte-gnu.adb \
148
ada-s-osinte-gnu.ads \
164
ifneq ($(GFDL_INVARIANT_FREE),yes)
165
debian_patches += gdc-4.8-doc
167
debian_patches += gdc-texinfo
169
ifeq ($(with_libphobos),yes)
170
debian_patches += gdc-libphobos-build
172
debian_patches += gdc-driver-nophobos
175
debian_patches += gcc-d-lang
178
ifeq ($(DEB_TARGET_ARCH),alpha)
179
debian_patches += alpha-ieee mudflap-nocheck
180
ifneq ($(GFDL_INVARIANT_FREE),yes)
181
debian_patches += alpha-ieee-doc
185
ifeq ($(DEB_TARGET_ARCH_CPU),amd64)
186
debian_patches += libjava-testsuite
189
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
190
debian_patches += libjava-armel-unwind
193
ifeq ($(DEB_TARGET_ARCH),armhf)
194
debian_patches += gcj-arm-mode
195
else ifeq ($(DEB_TARGET_ARCH),armel)
196
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
197
debian_patches += gcj-arm-mode
201
ifeq ($(DEB_TARGET_ARCH),m68k)
202
debian_patches += m68k-ada
203
debian_patches += m68k-revert-pr45144
204
debian_patches += pr52714
207
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
208
debian_patches += powerpc_remove_many
209
debian_patches += powerpc_nofprs
212
ifeq ($(DEB_TARGET_ARCH),ppc64)
213
ifeq ($(distribution),Ubuntu)
214
#debian_patches += ibm-branch
218
#debian_patches += link-libs
220
# all patches below this line are applied for gcc-snapshot builds as well
222
ifeq ($(single_package),yes)
226
debian_patches += gcc-sysroot
230
ifeq ($(with_softfloat),yes)
231
debian_patches += arm-multilib-soft-float
232
else ifeq ($(multilib),yes)
233
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
234
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
236
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
239
debian_patches += arm-multilib-defaults
241
ifeq ($(DEB_CROSS),yes)
242
debian_patches += cross-fixes
243
ifeq ($(with_deps_on_target_arch_pkgs),yes)
244
debian_patches += cross-ma-install-location
246
debian_patches += cross-install-location
250
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
251
debian_patches += hurd-changes
254
debian_patches += gcc-ice-hack gcc-ice-apport
256
#debian_patches += gold-and-ld
258
debian_patches += libjava-fixed-symlinks
259
debian_patches += libstdc++-arm-wno-abi
261
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
262
# timeouts on the buildd's, Debian
263
debian_patches += libstdc++-no-testsuite
264
else ifeq ($(distribution),Ubuntu)
265
# timeouts on the buildd's, Ubuntu only
266
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
267
debian_patches += libstdc++-no-testsuite
270
debian_patches += ada-mips
271
debian_patches += libffi-ro-eh_frame_sect
273
debian_patches += gcc-multiarch
274
ifeq ($(with_multiarch_lib),yes)
275
ifneq ($(single_package),yes)
276
debian_patches += libjava-multiarch
279
debian_patches += libjava-nobiarch-check
280
debian_patches += config-ml
281
ifneq ($(single_package),yes)
282
ifeq ($(with_multiarch_cxxheaders),yes)
283
debian_patches += g++-multiarch-incdir
286
ifeq ($(DEB_CROSS),yes)
287
debian_patches += cross-no-locale-include
289
ifeq ($(biarch64),yes)
290
ifeq ($(DEB_CROSS),yes)
291
debian_patches += cross-biarch
294
debian_patches += gcc-multilib-multiarch
296
ifneq (,$(filter $(derivative),Ubuntu))
297
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
298
debian_patches += gcc-as-needed
301
#debian_patches += gcc-as-needed
303
debian_patches += mips-fix-loongson2f-nop
304
ifeq ($(distribution),Ubuntu)
305
ifeq ($(DEB_TARGET_ARCH),ppc64)
306
debian_patches += gcc-ppc64-O3
309
debian_patches += libgomp-kfreebsd-testsuite
311
series_stamp = $(stampdir)/02-series-stamp
312
series: $(series_stamp)
314
echo $(strip $(addsuffix .diff,$(debian_patches))) \
315
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
316
ifneq (,$(strip $(hardening_patches)))
317
ifneq ($(trunk_build),yes)
318
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
319
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
322
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
325
autotools_files := $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
326
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
327
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
328
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
330
autoconf_version = 2.64
331
ifeq ($(trunk_build),yes)
332
# The actual version depends on the build-dependencies set by
333
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
334
# correct version is installed.
338
# FIXME: the auto* stuff is done every time for every subdir, which
339
# leads to build errors. Idea: record the auto* calls in the patch
340
# files (AUTO <dir> <auto-command with options>) and run them separately,
341
# maybe only once per directory).
342
$(patch_stamp): $(unpack_stamp) $(series_stamp)
343
QUILT_PATCHES=$(patchdir) \
344
quilt --quiltrc /dev/null push -a || test $$? = 2
346
ifneq (,$(filter svn-updates, $(debian_patches)))
347
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
348
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
351
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
353
cd $(srcdir)/fixincludes && ./genfixes
355
for f in $(autotools_files) ; \
357
*/classpath/m4/acinclude.m4) \
359
*/configure.*|*/acinclude.m4) \
360
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
361
then echo "Skipping already regenerated file $$f." ; \
363
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
364
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
365
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
367
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
370
*) echo "Unknown file: $$f"; false; \
374
for i in $(debian_patches); do \
375
echo -e "\n$$i:" >> pxxx; \
376
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
378
# -$(srcdir)/move-if-change pxxx $@
382
QUILT_PATCHES=$(patchdir) \
383
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
385
for f in $(autotools_files); do \
386
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
389
update-patches: $(series_stamp)
390
export QUILT_PATCHES=$(patchdir); \
391
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
392
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
393
while quilt push; do quilt refresh; done
395
patch: $(patch_stamp)
396
.PHONY: patch series quilt autotools