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?
18
# $(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)
30
# $(if $(with_linaro_branch),gcc-linaro-doc) \
31
# $(if $(with_linaro_branch),,svn-doc-updates) \
38
# boehm-gc-nocheck: seems to work on the buildds \
42
gcc-driver-extra-langs
44
ifeq ($(distribution),Ubuntu)
45
ifneq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid))
46
debian_patches += gcc-hash-style-both
48
debian_patches += gcc-hash-style-gnu
51
debian_patches += gcc-hash-style-both
58
libstdc++-test-installed \
62
libjava-disable-plugin \
63
alpha-no-ev4-directive \
66
libgomp-omp_h-multilib \
77
gcc-target-include-asm \
78
libgo-revert-timeout-exp \
81
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
82
# libstdc++-nothumb-check \
88
ifneq ($(distribution),Debian)
89
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
90
# FIXME: bootstrap failure building the target libstdc++ library
91
#hardening_patches += gcc-default-format-security
92
hardening_patches += \
93
gcc-default-fortify-source \
95
testsuite-hardening-format \
96
testsuite-hardening-printf-types
99
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
100
hardening_patches += gcc-default-ssp
103
# FIXME 4.5: Drop and adjust symbols files
104
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
105
debian_patches += pr39491
108
ifeq ($(with_ada),yes)
112
ada-default-project-path \
113
ada-symbolic-tracebacks \
114
ada-library-project-files-soname
116
ifeq ($(biarch64),yes)
121
ifeq ($(with_libgnat),yes)
127
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
133
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
134
debian_patches += ada-kfreebsd-gnu \
138
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
140
gcc_ada_gcc-interface_Makefile.in \
141
ada-s-osinte-gnu.adb \
142
ada-s-osinte-gnu.ads \
155
ifeq ($(with_libphobos),yes)
156
debian_patches += gdc-libphobos-build
158
debian_patches += gdc-driver-nophobos
162
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),armhf)
177
debian_patches += gcj-arm-mode
178
else ifeq ($(DEB_TARGET_ARCH),armel)
179
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
180
debian_patches += gcj-arm-mode
184
ifeq ($(DEB_TARGET_ARCH),m68k)
188
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
189
debian_patches += powerpc_remove_many
190
debian_patches += powerpc_nofprs
193
ifeq ($(DEB_TARGET_ARCH),ppc64)
194
ifeq ($(distribution),Ubuntu)
195
#debian_patches += ibm-branch
199
spu_patches = cross-install-location
201
#debian_patches += link-libs
203
# all patches below this line are applied for gcc-snapshot builds as well
205
ifeq ($(single_package),yes)
210
debian_patches += gcc-sysroot
214
ifeq ($(with_softfloat),yes)
215
debian_patches += arm-multilib-soft-float
216
else ifeq ($(multilib),yes)
217
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
218
debian_patches += arm-multilib-softfp
220
debian_patches += arm-multilib-soft
223
debian_patches += arm-multilib-defaults
225
ifeq ($(DEB_CROSS),yes)
226
debian_patches += cross-fixes
227
ifeq ($(with_deps_on_target_arch_pkgs),yes)
228
debian_patches += cross-ma-install-location
230
debian_patches += cross-install-location
231
spu_patches := $(filter-out cross-install-location,$(spu_patches))
235
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
236
debian_patches += hurd-changes
239
debian_patches += gcc-ice-hack gcc-ice-apport
241
#debian_patches += gold-and-ld
243
debian_patches += libjava-fixed-symlinks
244
debian_patches += libstdc++-arm-wno-abi
246
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
247
# timeouts on the buildd's, Debian
248
debian_patches += libstdc++-no-testsuite
249
else ifeq ($(distribution),Ubuntu)
250
# timeouts on the buildd's, Ubuntu only
251
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
252
debian_patches += libstdc++-no-testsuite
255
debian_patches += ada-mips
256
debian_patches += libffi-ro-eh_frame_sect
258
debian_patches += gcc-multiarch
259
ifeq ($(with_multiarch_lib),yes)
260
ifneq ($(single_package),yes)
261
debian_patches += libjava-multiarch
264
debian_patches += libjava-nobiarch-check
265
debian_patches += config-ml
266
ifneq ($(single_package),yes)
267
ifeq ($(with_multiarch_cxxheaders),yes)
268
debian_patches += g++-multiarch-incdir
271
ifeq ($(DEB_CROSS),yes)
272
debian_patches += cross-no-locale-include
274
ifeq ($(biarch64),yes)
275
ifeq ($(DEB_CROSS),yes)
276
debian_patches += cross-biarch
279
debian_patches += gcc-multilib-multiarch
281
ifeq (,$(filter $(distrelease),lenny squeeze wheezy sid experimental dapper hardy intrepid jaunty karmic lucid maverick))
282
debian_patches += gcc-as-needed
284
debian_patches += mips-fix-loongson2f-nop
285
ifeq ($(distribution),Ubuntu)
286
ifeq ($(DEB_TARGET_ARCH),ppc64)
287
debian_patches += gcc-ppc64-O3
290
debian_patches += libgomp-kfreebsd-testsuite
293
series_stamp = $(stampdir)/02-series-stamp
294
series: $(series_stamp)
296
echo $(strip $(addsuffix .diff,$(debian_patches))) \
297
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
298
ifneq (,$(strip $(hardening_patches)))
299
ifneq ($(trunk_build),yes)
300
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
301
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
304
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
307
autotools_files := $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
308
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
309
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
310
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
312
autoconf_version = 2.64
313
ifeq ($(trunk_build),yes)
314
# The actual version depends on the build-dependencies set by
315
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
316
# correct version is installed.
320
# FIXME: the auto* stuff is done every time for every subdir, which
321
# leads to build errors. Idea: record the auto* calls in the patch
322
# files (AUTO <dir> <auto-command with options>) and run them separately,
323
# maybe only once per directory).
324
$(patch_stamp): $(unpack_stamp) $(series_stamp)
325
QUILT_PATCHES=$(patchdir) \
326
quilt --quiltrc /dev/null push -a || test $$? = 2
328
ifneq (,$(filter svn-updates, $(debian_patches)))
329
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
330
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
333
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
335
cd $(srcdir)/fixincludes && ./genfixes
337
for f in $(autotools_files) ; \
339
*/classpath/m4/acinclude.m4) \
341
*/configure.*|*/acinclude.m4) \
342
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
343
then echo "Skipping already regenerated file $$f." ; \
345
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
346
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
347
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
349
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
352
*) echo "Unknown file: $$f"; false; \
356
for i in $(debian_patches); do \
357
echo -e "\n$$i:" >> pxxx; \
358
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
360
# -$(srcdir)/move-if-change pxxx $@
364
QUILT_PATCHES=$(patchdir) \
365
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
367
for f in $(autotools_files); do \
368
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
371
$(src_spu_stamp): $(patch_stamp)
373
ifeq (,$(strip $(hardening_patches)$(spu_patches)))
379
for p in $(hardening_patches); do \
382
for p in $$list; do \
383
echo "Revert for spu build: $$p"; \
384
patch -d src-spu -p2 -R < debian/patches/$$p.diff; \
387
for p in $(spu_patches); do \
388
echo "Apply for spu build: $$p"; \
389
patch -d src-spu -p2 < debian/patches/$$p.diff; \
393
update-patches: $(series_stamp)
394
export QUILT_PATCHES=$(patchdir); \
395
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
396
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
397
while quilt push; do quilt refresh; done
399
patch: $(patch_stamp)
400
.PHONY: patch series quilt autotools