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
# svn-updates$(if $(with_linaro_branch),-linaro) \
20
ifeq ($(with_java),yes)
25
ifneq ($(GFDL_INVARIANT_FREE),yes)
29
# $(if $(with_linaro_branch),gcc-linaro-doc) \
30
# $(if $(with_linaro_branch),,svn-doc-updates) \
37
# boehm-gc-nocheck: seems to work on the buildds \
41
gcc-driver-extra-langs
43
ifeq ($(distribution),Ubuntu)
44
ifneq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid))
45
debian_patches += gcc-hash-style-both
47
debian_patches += gcc-hash-style-gnu
50
debian_patches += gcc-hash-style-both
57
libstdc++-test-installed \
61
libjava-disable-plugin \
62
alpha-no-ev4-directive \
65
libgomp-omp_h-multilib \
77
gcc-target-include-asm \
79
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
80
# libstdc++-nothumb-check \
86
ifneq ($(distribution),Debian)
87
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
88
# FIXME: bootstrap failure building the target libstdc++ library
89
#hardening_patches += gcc-default-format-security
90
hardening_patches += \
91
gcc-default-fortify-source \
93
testsuite-hardening-format \
94
testsuite-hardening-printf-types
97
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
98
hardening_patches += gcc-default-ssp
101
# FIXME 4.5: Drop and adjust symbols files
102
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
103
debian_patches += pr39491
106
ifeq ($(with_ada),yes)
110
ada-default-project-path \
111
ada-symbolic-tracebacks \
112
ada-library-project-files-soname
114
ifeq ($(biarch64),yes)
119
ifeq ($(with_libgnat),yes)
125
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
131
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
132
debian_patches += ada-kfreebsd-gnu \
136
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
138
gcc_ada_gcc-interface_Makefile.in \
139
ada-s-osinte-gnu.adb \
140
ada-s-osinte-gnu.ads \
153
ifeq ($(with_libphobos),yes)
154
debian_patches += gdc-libphobos-build
156
debian_patches += gdc-driver-nophobos
160
debian_patches += gcc-d-lang
164
ifeq ($(DEB_TARGET_ARCH),alpha)
165
debian_patches += alpha-ieee mudflap-nocheck
166
ifneq ($(GFDL_INVARIANT_FREE),yes)
167
debian_patches += alpha-ieee-doc
171
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
172
debian_patches += libjava-armel-unwind
175
ifeq ($(DEB_TARGET_ARCH),m68k)
179
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
180
debian_patches += powerpc_remove_many
181
debian_patches += powerpc_nofprs
184
ifeq ($(DEB_TARGET_ARCH),ppc64)
185
ifeq ($(distribution),Ubuntu)
186
#debian_patches += ibm-branch
190
spu_patches = cross-install-location
192
#debian_patches += link-libs
194
# all patches below this line are applied for gcc-snapshot builds as well
196
ifeq ($(single_package),yes)
201
debian_patches += gcc-sysroot
205
ifeq ($(with_softfloat),yes)
206
debian_patches += arm-multilib-soft-float
207
else ifeq ($(multilib),yes)
208
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
209
debian_patches += arm-multilib-softfp
211
debian_patches += arm-multilib-soft
214
debian_patches += arm-multilib-defaults
216
ifeq ($(DEB_CROSS),yes)
217
debian_patches += cross-fixes
218
ifeq ($(with_deps_on_target_arch_pkgs),yes)
219
debian_patches += cross-ma-install-location
221
debian_patches += cross-install-location
222
spu_patches := $(filter-out cross-install-location,$(spu_patches))
226
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
227
debian_patches += hurd-changes
230
debian_patches += gcc-ice-hack gcc-ice-apport
232
#debian_patches += gold-and-ld
234
debian_patches += libjava-fixed-symlinks
235
debian_patches += libstdc++-arm-wno-abi
237
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
238
# timeouts on the buildd's, Debian
239
debian_patches += libstdc++-no-testsuite
240
else ifeq ($(distribution)-$(DEB_TARGET_ARCH),Ubuntu-armel)
241
# timeouts on the buildd's, Ubuntu only
242
debian_patches += libstdc++-no-testsuite
244
debian_patches += ada-mips
245
debian_patches += libffi-ro-eh_frame_sect
247
debian_patches += gcc-multiarch
248
ifeq ($(with_multiarch_lib),yes)
249
ifneq ($(single_package),yes)
250
debian_patches += libjava-multiarch
253
debian_patches += libjava-nobiarch-check
254
debian_patches += config-ml
255
ifneq ($(single_package),yes)
256
ifeq ($(with_multiarch_cxxheaders),yes)
257
debian_patches += g++-multiarch-incdir
260
ifeq ($(DEB_CROSS),yes)
261
debian_patches += cross-no-locale-include
263
ifeq ($(biarch64),yes)
264
ifeq ($(DEB_CROSS),yes)
265
debian_patches += cross-biarch
268
debian_patches += gcc-multilib-multiarch
270
ifeq (,$(filter $(distrelease),lenny squeeze wheezy sid experimental dapper hardy intrepid jaunty karmic lucid maverick))
271
debian_patches += gcc-as-needed
273
debian_patches += mips-fix-loongson2f-nop
274
ifeq ($(distribution),Ubuntu)
275
ifeq ($(DEB_TARGET_ARCH),ppc64)
276
debian_patches += gcc-ppc64-O3
279
debian_patches += libgomp-kfreebsd-testsuite
282
series_stamp = $(stampdir)/02-series-stamp
283
series: $(series_stamp)
285
echo $(strip $(addsuffix .diff,$(debian_patches))) \
286
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
287
ifneq (,$(strip $(hardening_patches)))
288
ifneq ($(trunk_build),yes)
289
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
290
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
293
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
296
autotools_files := $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
297
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
298
| sed -r 's/[ab]\/src\//src\//' | sort | uniq),$(shell echo $(file) \
299
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
301
autoconf_version = 2.64
302
ifeq ($(trunk_build),yes)
303
# The actual version depends on the build-dependencies set by
304
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
305
# correct version is installed.
309
# FIXME: the auto* stuff is done every time for every subdir, which
310
# leads to build errors. Idea: record the auto* calls in the patch
311
# files (AUTO <dir> <auto-command with options>) and run them separately,
312
# maybe only once per directory).
313
$(patch_stamp): $(unpack_stamp) $(series_stamp)
314
QUILT_PATCHES=$(patchdir) \
315
quilt --quiltrc /dev/null push -a || test $$? = 2
317
ifneq (,$(filter svn-updates, $(debian_patches)))
318
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
319
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
322
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
324
cd $(srcdir)/fixincludes && ./genfixes
326
for f in $(autotools_files) ; \
328
*/classpath/m4/acinclude.m4) \
330
*/configure.*|*/acinclude.m4) \
331
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
332
then echo "Skipping already regenerated file $$f." ; \
334
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
335
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
336
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
338
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
341
*) echo "Unknown file: $$f"; false; \
345
for i in $(debian_patches); do \
346
echo -e "\n$$i:" >> pxxx; \
347
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
349
# -$(srcdir)/move-if-change pxxx $@
353
QUILT_PATCHES=$(patchdir) \
354
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
356
for f in $(autotools_files); do \
357
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
360
$(src_spu_stamp): $(patch_stamp)
362
ifeq (,$(strip $(hardening_patches)$(spu_patches)))
368
for p in $(hardening_patches); do \
371
for p in $$list; do \
372
echo "Revert for spu build: $$p"; \
373
patch -d src-spu -p2 -R < debian/patches/$$p.diff; \
376
for p in $(spu_patches); do \
377
echo "Apply for spu build: $$p"; \
378
patch -d src-spu -p2 < debian/patches/$$p.diff; \
382
update-patches: $(series_stamp)
383
export QUILT_PATCHES=$(patchdir); \
384
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
385
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
386
while quilt push; do quilt refresh; done
388
patch: $(patch_stamp)
389
.PHONY: patch series quilt autotools