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 \
80
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
81
# libstdc++-nothumb-check \
87
ifneq ($(distribution),Debian)
88
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
89
# FIXME: bootstrap failure building the target libstdc++ library
90
#hardening_patches += gcc-default-format-security
91
hardening_patches += \
92
gcc-default-fortify-source \
94
testsuite-hardening-format \
95
testsuite-hardening-printf-types
98
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
99
hardening_patches += gcc-default-ssp
102
# FIXME 4.5: Drop and adjust symbols files
103
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
104
debian_patches += pr39491
107
ifeq ($(with_ada),yes)
111
ada-default-project-path \
112
ada-symbolic-tracebacks \
113
ada-library-project-files-soname
115
ifeq ($(biarch64),yes)
120
ifeq ($(with_libgnat),yes)
126
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
132
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
133
debian_patches += ada-kfreebsd-gnu \
137
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
139
gcc_ada_gcc-interface_Makefile.in \
140
ada-s-osinte-gnu.adb \
141
ada-s-osinte-gnu.ads \
154
ifeq ($(with_libphobos),yes)
155
debian_patches += gdc-libphobos-build
157
debian_patches += gdc-driver-nophobos
161
debian_patches += gcc-d-lang
165
ifeq ($(DEB_TARGET_ARCH),alpha)
166
debian_patches += alpha-ieee mudflap-nocheck
167
ifneq ($(GFDL_INVARIANT_FREE),yes)
168
debian_patches += alpha-ieee-doc
172
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
173
debian_patches += libjava-armel-unwind
176
ifeq ($(DEB_TARGET_ARCH),m68k)
180
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
181
debian_patches += powerpc_remove_many
182
debian_patches += powerpc_nofprs
185
ifeq ($(DEB_TARGET_ARCH),ppc64)
186
ifeq ($(distribution),Ubuntu)
187
#debian_patches += ibm-branch
191
spu_patches = cross-install-location
193
#debian_patches += link-libs
195
# all patches below this line are applied for gcc-snapshot builds as well
197
ifeq ($(single_package),yes)
202
debian_patches += gcc-sysroot
206
ifeq ($(with_softfloat),yes)
207
debian_patches += arm-multilib-soft-float
208
else ifeq ($(multilib),yes)
209
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
210
debian_patches += arm-multilib-softfp
212
debian_patches += arm-multilib-soft
215
debian_patches += arm-multilib-defaults
217
ifeq ($(DEB_CROSS),yes)
218
debian_patches += cross-fixes
219
ifeq ($(with_deps_on_target_arch_pkgs),yes)
220
debian_patches += cross-ma-install-location
222
debian_patches += cross-install-location
223
spu_patches := $(filter-out cross-install-location,$(spu_patches))
227
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
228
debian_patches += hurd-changes
231
debian_patches += gcc-ice-hack gcc-ice-apport
233
#debian_patches += gold-and-ld
235
debian_patches += libjava-fixed-symlinks
236
debian_patches += libstdc++-arm-wno-abi
238
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
239
# timeouts on the buildd's, Debian
240
debian_patches += libstdc++-no-testsuite
241
else ifeq ($(distribution)-$(DEB_TARGET_ARCH),Ubuntu-armel)
242
# timeouts on the buildd's, Ubuntu only
243
debian_patches += libstdc++-no-testsuite
245
debian_patches += ada-mips
246
debian_patches += libffi-ro-eh_frame_sect
248
debian_patches += gcc-multiarch
249
ifeq ($(with_multiarch_lib),yes)
250
ifneq ($(single_package),yes)
251
debian_patches += libjava-multiarch
254
debian_patches += libjava-nobiarch-check
255
debian_patches += config-ml
256
ifneq ($(single_package),yes)
257
ifeq ($(with_multiarch_cxxheaders),yes)
258
debian_patches += g++-multiarch-incdir
261
ifeq ($(DEB_CROSS),yes)
262
debian_patches += cross-no-locale-include
264
ifeq ($(biarch64),yes)
265
ifeq ($(DEB_CROSS),yes)
266
debian_patches += cross-biarch
269
debian_patches += gcc-multilib-multiarch
271
ifeq (,$(filter $(distrelease),lenny squeeze wheezy sid experimental dapper hardy intrepid jaunty karmic lucid maverick))
272
debian_patches += gcc-as-needed
274
debian_patches += mips-fix-loongson2f-nop
275
ifeq ($(distribution),Ubuntu)
276
ifeq ($(DEB_TARGET_ARCH),ppc64)
277
debian_patches += gcc-ppc64-O3
280
debian_patches += libgomp-kfreebsd-testsuite
283
series_stamp = $(stampdir)/02-series-stamp
284
series: $(series_stamp)
286
echo $(strip $(addsuffix .diff,$(debian_patches))) \
287
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
288
ifneq (,$(strip $(hardening_patches)))
289
ifneq ($(trunk_build),yes)
290
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
291
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
294
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
297
autotools_files := $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
298
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
299
| sed -r 's/[ab]\/src\//src\//' | sort | uniq),$(shell echo $(file) \
300
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
302
autoconf_version = 2.64
303
ifeq ($(trunk_build),yes)
304
# The actual version depends on the build-dependencies set by
305
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
306
# correct version is installed.
310
# FIXME: the auto* stuff is done every time for every subdir, which
311
# leads to build errors. Idea: record the auto* calls in the patch
312
# files (AUTO <dir> <auto-command with options>) and run them separately,
313
# maybe only once per directory).
314
$(patch_stamp): $(unpack_stamp) $(series_stamp)
315
QUILT_PATCHES=$(patchdir) \
316
quilt --quiltrc /dev/null push -a || test $$? = 2
318
ifneq (,$(filter svn-updates, $(debian_patches)))
319
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
320
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
323
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
325
cd $(srcdir)/fixincludes && ./genfixes
327
for f in $(autotools_files) ; \
329
*/classpath/m4/acinclude.m4) \
331
*/configure.*|*/acinclude.m4) \
332
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
333
then echo "Skipping already regenerated file $$f." ; \
335
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
336
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
337
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
339
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
342
*) echo "Unknown file: $$f"; false; \
346
for i in $(debian_patches); do \
347
echo -e "\n$$i:" >> pxxx; \
348
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
350
# -$(srcdir)/move-if-change pxxx $@
354
QUILT_PATCHES=$(patchdir) \
355
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
357
for f in $(autotools_files); do \
358
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
361
$(src_spu_stamp): $(patch_stamp)
363
ifeq (,$(strip $(hardening_patches)$(spu_patches)))
369
for p in $(hardening_patches); do \
372
for p in $$list; do \
373
echo "Revert for spu build: $$p"; \
374
patch -d src-spu -p2 -R < debian/patches/$$p.diff; \
377
for p in $(spu_patches); do \
378
echo "Apply for spu build: $$p"; \
379
patch -d src-spu -p2 < debian/patches/$$p.diff; \
383
update-patches: $(series_stamp)
384
export QUILT_PATCHES=$(patchdir); \
385
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
386
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
387
while quilt push; do quilt refresh; done
389
patch: $(patch_stamp)
390
.PHONY: patch series quilt autotools