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
47
libstdc++-test-installed \
51
libjava-disable-plugin \
52
alpha-no-ev4-directive \
55
libgomp-omp_h-multilib \
67
gcc-target-include-asm \
70
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
71
# libstdc++-nothumb-check \
77
ifneq ($(distribution),Debian)
78
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
79
# FIXME: bootstrap failure building the target libstdc++ library
80
#hardening_patches += gcc-default-format-security
81
hardening_patches += \
82
gcc-default-fortify-source \
84
testsuite-hardening-format \
85
testsuite-hardening-printf-types
88
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
89
hardening_patches += gcc-default-ssp
92
# FIXME 4.5: Drop and adjust symbols files
93
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
94
debian_patches += pr39491
97
ifeq ($(with_ada),yes)
101
ada-default-project-path \
102
ada-symbolic-tracebacks \
103
ada-library-project-files-soname
105
ifeq ($(biarch64),yes)
110
ifeq ($(with_libgnat),yes)
116
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
122
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
123
debian_patches += ada-kfreebsd-gnu \
127
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
129
gcc_ada_gcc-interface_Makefile.in \
130
ada-s-osinte-gnu.adb \
131
ada-s-osinte-gnu.ads \
144
ifeq ($(with_libphobos),yes)
145
debian_patches += gdc-libphobos-build
147
debian_patches += gdc-driver-nophobos
151
debian_patches += gcc-d-lang
155
ifeq ($(DEB_TARGET_ARCH),alpha)
156
debian_patches += alpha-ieee mudflap-nocheck
157
ifneq ($(GFDL_INVARIANT_FREE),yes)
158
debian_patches += alpha-ieee-doc
162
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
163
debian_patches += libjava-armel-unwind
166
ifeq ($(DEB_TARGET_ARCH),m68k)
170
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
171
debian_patches += powerpc_remove_many
172
debian_patches += powerpc_nofprs
175
ifeq ($(DEB_TARGET_ARCH),ppc64)
176
ifeq ($(distribution),Ubuntu)
177
#debian_patches += ibm-branch
181
spu_patches = cross-install-location
183
#debian_patches += link-libs
185
# all patches below this line are applied for gcc-snapshot builds as well
187
ifeq ($(single_package),yes)
192
debian_patches += gcc-sysroot
196
ifeq ($(with_softfloat),yes)
197
debian_patches += arm-multilib-soft-float
198
else ifeq ($(multilib),yes)
199
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
200
debian_patches += arm-multilib-softfp
202
debian_patches += arm-multilib-soft
205
debian_patches += arm-multilib-defaults
207
ifeq ($(DEB_CROSS),yes)
208
debian_patches += cross-fixes
209
ifeq ($(with_deps_on_target_arch_pkgs),yes)
210
debian_patches += cross-ma-install-location
212
debian_patches += cross-install-location
213
spu_patches := $(filter-out cross-install-location,$(spu_patches))
217
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
218
debian_patches += hurd-changes
221
debian_patches += gcc-ice-hack gcc-ice-apport
223
#debian_patches += gold-and-ld
225
debian_patches += libjava-fixed-symlinks
226
debian_patches += libstdc++-arm-wno-abi
228
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
229
# timeouts on the buildd's, Debian
230
debian_patches += libstdc++-no-testsuite
231
else ifeq ($(distribution)-$(DEB_TARGET_ARCH),Ubuntu-armel)
232
# timeouts on the buildd's, Ubuntu only
233
debian_patches += libstdc++-no-testsuite
235
debian_patches += ada-mips
236
debian_patches += libffi-ro-eh_frame_sect
238
debian_patches += gcc-multiarch
239
ifeq ($(with_multiarch_lib),yes)
240
ifneq ($(single_package),yes)
241
debian_patches += libjava-multiarch
244
debian_patches += libjava-nobiarch-check
245
debian_patches += config-ml
246
ifneq ($(single_package),yes)
247
ifeq ($(with_multiarch_cxxheaders),yes)
248
debian_patches += g++-multiarch-incdir
251
ifeq ($(DEB_CROSS),yes)
252
debian_patches += cross-no-locale-include
254
ifeq ($(biarch64),yes)
255
ifeq ($(DEB_CROSS),yes)
256
debian_patches += cross-biarch
259
debian_patches += gcc-multilib-multiarch
261
ifeq ($(distribution),Ubuntu)
262
ifneq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid))
263
debian_patches += gcc-hash-style-both
265
debian_patches += gcc-hash-style-gnu
268
debian_patches += gcc-hash-style-both
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