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 \
82
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
83
# libstdc++-nothumb-check \
89
ifneq ($(distribution),Debian)
90
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
91
# FIXME: bootstrap failure building the target libstdc++ library
92
#hardening_patches += gcc-default-format-security
93
hardening_patches += \
94
gcc-default-fortify-source \
96
testsuite-hardening-format \
97
testsuite-hardening-printf-types
100
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
101
hardening_patches += gcc-default-ssp
104
# FIXME 4.5: Drop and adjust symbols files
105
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
106
debian_patches += pr39491
109
ifeq ($(with_ada),yes)
113
ada-default-project-path \
114
ada-symbolic-tracebacks \
115
ada-library-project-files-soname
117
ifeq ($(biarch64),yes)
122
ifeq ($(with_libgnat),yes)
128
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
134
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
135
debian_patches += ada-kfreebsd-gnu \
139
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
141
gcc_ada_gcc-interface_Makefile.in \
142
ada-s-osinte-gnu.adb \
143
ada-s-osinte-gnu.ads \
159
ifneq ($(GFDL_INVARIANT_FREE),yes)
160
debian_patches += gdc-4.8-doc
162
debian_patches += gdc-texinfo
164
ifeq ($(with_libphobos),yes)
165
debian_patches += gdc-libphobos-build
167
debian_patches += gdc-driver-nophobos
170
debian_patches += gcc-d-lang
173
ifeq ($(DEB_TARGET_ARCH),alpha)
174
debian_patches += alpha-ieee mudflap-nocheck
175
ifneq ($(GFDL_INVARIANT_FREE),yes)
176
debian_patches += alpha-ieee-doc
180
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
181
debian_patches += libjava-armel-unwind
184
ifeq ($(DEB_TARGET_ARCH),armhf)
185
debian_patches += gcj-arm-mode
186
else ifeq ($(DEB_TARGET_ARCH),armel)
187
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
188
debian_patches += gcj-arm-mode
192
ifeq ($(DEB_TARGET_ARCH),m68k)
193
debian_patches += m68k-ada
196
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
197
debian_patches += powerpc_remove_many
198
debian_patches += powerpc_nofprs
201
ifeq ($(DEB_TARGET_ARCH),ppc64)
202
ifeq ($(distribution),Ubuntu)
203
#debian_patches += ibm-branch
207
#debian_patches += link-libs
209
# all patches below this line are applied for gcc-snapshot builds as well
211
ifeq ($(single_package),yes)
215
debian_patches += gcc-sysroot
219
ifeq ($(with_softfloat),yes)
220
debian_patches += arm-multilib-soft-float
221
else ifeq ($(multilib),yes)
222
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
223
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
225
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
228
debian_patches += arm-multilib-defaults
230
ifeq ($(DEB_CROSS),yes)
231
debian_patches += cross-fixes
232
ifeq ($(with_deps_on_target_arch_pkgs),yes)
233
debian_patches += cross-ma-install-location
235
debian_patches += cross-install-location
239
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
240
debian_patches += hurd-changes
243
debian_patches += gcc-ice-hack gcc-ice-apport
245
#debian_patches += gold-and-ld
247
debian_patches += libjava-fixed-symlinks
248
debian_patches += libstdc++-arm-wno-abi
250
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
251
# timeouts on the buildd's, Debian
252
debian_patches += libstdc++-no-testsuite
253
else ifeq ($(distribution),Ubuntu)
254
# timeouts on the buildd's, Ubuntu only
255
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
256
debian_patches += libstdc++-no-testsuite
259
debian_patches += ada-mips
260
debian_patches += libffi-ro-eh_frame_sect
262
debian_patches += gcc-multiarch
263
ifeq ($(with_multiarch_lib),yes)
264
ifneq ($(single_package),yes)
265
debian_patches += libjava-multiarch
268
debian_patches += libjava-nobiarch-check
269
debian_patches += config-ml
270
ifneq ($(single_package),yes)
271
ifeq ($(with_multiarch_cxxheaders),yes)
272
debian_patches += g++-multiarch-incdir
275
ifeq ($(DEB_CROSS),yes)
276
debian_patches += cross-no-locale-include
278
ifeq ($(biarch64),yes)
279
ifeq ($(DEB_CROSS),yes)
280
debian_patches += cross-biarch
283
debian_patches += gcc-multilib-multiarch
285
ifeq (,$(filter $(distrelease),lenny squeeze wheezy sid experimental dapper hardy intrepid jaunty karmic lucid maverick))
286
debian_patches += gcc-as-needed
288
debian_patches += mips-fix-loongson2f-nop
289
ifeq ($(distribution),Ubuntu)
290
ifeq ($(DEB_TARGET_ARCH),ppc64)
291
debian_patches += gcc-ppc64-O3
294
debian_patches += libgomp-kfreebsd-testsuite
296
series_stamp = $(stampdir)/02-series-stamp
297
series: $(series_stamp)
299
echo $(strip $(addsuffix .diff,$(debian_patches))) \
300
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
301
ifneq (,$(strip $(hardening_patches)))
302
ifneq ($(trunk_build),yes)
303
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
304
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
307
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
310
autotools_files := $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
311
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
312
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
313
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
315
autoconf_version = 2.64
316
ifeq ($(trunk_build),yes)
317
# The actual version depends on the build-dependencies set by
318
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
319
# correct version is installed.
323
# FIXME: the auto* stuff is done every time for every subdir, which
324
# leads to build errors. Idea: record the auto* calls in the patch
325
# files (AUTO <dir> <auto-command with options>) and run them separately,
326
# maybe only once per directory).
327
$(patch_stamp): $(unpack_stamp) $(series_stamp)
328
QUILT_PATCHES=$(patchdir) \
329
quilt --quiltrc /dev/null push -a || test $$? = 2
331
ifneq (,$(filter svn-updates, $(debian_patches)))
332
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
333
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
336
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
338
cd $(srcdir)/fixincludes && ./genfixes
340
for f in $(autotools_files) ; \
342
*/classpath/m4/acinclude.m4) \
344
*/configure.*|*/acinclude.m4) \
345
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
346
then echo "Skipping already regenerated file $$f." ; \
348
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
349
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
350
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
352
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
355
*) echo "Unknown file: $$f"; false; \
359
for i in $(debian_patches); do \
360
echo -e "\n$$i:" >> pxxx; \
361
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
363
# -$(srcdir)/move-if-change pxxx $@
367
QUILT_PATCHES=$(patchdir) \
368
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
370
for f in $(autotools_files); do \
371
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
374
update-patches: $(series_stamp)
375
export QUILT_PATCHES=$(patchdir); \
376
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
377
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
378
while quilt push; do quilt refresh; done
380
patch: $(patch_stamp)
381
.PHONY: patch series quilt autotools