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
$(if $(with_linaro_branch),gcc-aarch64-reentrant) \
20
# svn-updates$(if $(with_linaro_branch),-linaro) \
22
ifeq ($(with_java),yes)
27
ifneq ($(GFDL_INVARIANT_FREE),yes)
30
$(if $(with_linaro_branch),gcc-linaro-doc) \
33
# $(if $(with_linaro_branch),,svn-doc-updates) \
40
# boehm-gc-nocheck: seems to work on the buildds \
44
gcc-driver-extra-langs
46
ifneq (,$(filter $(distrelease),etch lenny squeeze wheezy dapper hardy intrepid jaunty karmic lucid))
47
debian_patches += gcc-hash-style-both
49
debian_patches += gcc-hash-style-gnu
56
libstdc++-test-installed \
60
libjava-disable-plugin \
61
alpha-no-ev4-directive \
64
libgomp-omp_h-multilib \
74
gcc-target-include-asm \
75
libgo-revert-timeout-exp \
76
$(if $(with_linaro_branch),,arm-sanitizer) \
78
libgo-setcontext-config \
83
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
84
# libstdc++-nothumb-check \
90
ifneq ($(distribution),Debian)
91
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
92
# FIXME: bootstrap failure building the target libstdc++ library
93
#hardening_patches += gcc-default-format-security
94
hardening_patches += \
95
gcc-default-fortify-source \
97
testsuite-hardening-format \
98
testsuite-hardening-printf-types
101
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
102
hardening_patches += gcc-default-ssp
105
# FIXME 4.5: Drop and adjust symbols files
106
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
107
debian_patches += pr39491
110
ifeq ($(with_ada),yes)
114
ada-default-project-path \
115
ada-symbolic-tracebacks \
116
ada-library-project-files-soname
118
ifeq ($(biarch64),yes)
123
ifeq ($(with_libgnat),yes)
129
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
135
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
136
debian_patches += ada-kfreebsd-gnu \
140
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
142
gcc_ada_gcc-interface_Makefile.in \
143
ada-s-osinte-gnu.adb \
144
ada-s-osinte-gnu.ads \
160
ifneq ($(GFDL_INVARIANT_FREE),yes)
161
debian_patches += gdc-4.8-doc
163
debian_patches += gdc-texinfo
165
ifeq ($(with_libphobos),yes)
166
debian_patches += gdc-libphobos-build
168
debian_patches += gdc-driver-nophobos
171
debian_patches += gcc-d-lang
174
ifeq ($(DEB_TARGET_ARCH),alpha)
175
debian_patches += alpha-ieee mudflap-nocheck
176
ifneq ($(GFDL_INVARIANT_FREE),yes)
177
debian_patches += alpha-ieee-doc
181
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
182
debian_patches += libjava-armel-unwind
185
ifeq ($(DEB_TARGET_ARCH),armhf)
186
debian_patches += gcj-arm-mode
187
else ifeq ($(DEB_TARGET_ARCH),armel)
188
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
189
debian_patches += gcj-arm-mode
193
ifeq ($(DEB_TARGET_ARCH),m68k)
194
debian_patches += m68k-ada
197
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
198
debian_patches += powerpc_remove_many
199
debian_patches += powerpc_nofprs
202
ifeq ($(DEB_TARGET_ARCH),ppc64)
203
ifeq ($(distribution),Ubuntu)
204
#debian_patches += ibm-branch
208
#debian_patches += link-libs
210
# all patches below this line are applied for gcc-snapshot builds as well
212
ifeq ($(single_package),yes)
216
debian_patches += gcc-sysroot
220
ifeq ($(with_softfloat),yes)
221
debian_patches += arm-multilib-soft-float
222
else ifeq ($(multilib),yes)
223
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
224
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
226
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
229
debian_patches += arm-multilib-defaults
231
ifeq ($(DEB_CROSS),yes)
232
debian_patches += cross-fixes
233
ifeq ($(with_deps_on_target_arch_pkgs),yes)
234
debian_patches += cross-ma-install-location
236
debian_patches += cross-install-location
240
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
241
debian_patches += hurd-changes
244
debian_patches += gcc-ice-hack gcc-ice-apport
246
#debian_patches += gold-and-ld
248
debian_patches += libjava-fixed-symlinks
249
debian_patches += libstdc++-arm-wno-abi
251
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
252
# timeouts on the buildd's, Debian
253
debian_patches += libstdc++-no-testsuite
254
else ifeq ($(distribution),Ubuntu)
255
# timeouts on the buildd's, Ubuntu only
256
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
257
debian_patches += libstdc++-no-testsuite
260
debian_patches += ada-mips
261
debian_patches += libffi-ro-eh_frame_sect
263
debian_patches += gcc-multiarch
264
ifeq ($(with_multiarch_lib),yes)
265
ifneq ($(single_package),yes)
266
debian_patches += libjava-multiarch
269
debian_patches += libjava-nobiarch-check
270
debian_patches += config-ml
271
ifneq ($(single_package),yes)
272
ifeq ($(with_multiarch_cxxheaders),yes)
273
debian_patches += g++-multiarch-incdir
276
ifeq ($(DEB_CROSS),yes)
277
debian_patches += cross-no-locale-include
279
ifeq ($(biarch64),yes)
280
ifeq ($(DEB_CROSS),yes)
281
debian_patches += cross-biarch
284
debian_patches += gcc-multilib-multiarch
286
ifeq (,$(filter $(distrelease),lenny squeeze wheezy sid experimental dapper hardy intrepid jaunty karmic lucid maverick))
287
debian_patches += gcc-as-needed
289
debian_patches += mips-fix-loongson2f-nop
290
ifeq ($(distribution),Ubuntu)
291
ifeq ($(DEB_TARGET_ARCH),ppc64)
292
debian_patches += gcc-ppc64-O3
295
debian_patches += libgomp-kfreebsd-testsuite
297
series_stamp = $(stampdir)/02-series-stamp
298
series: $(series_stamp)
300
echo $(strip $(addsuffix .diff,$(debian_patches))) \
301
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
302
ifneq (,$(strip $(hardening_patches)))
303
ifneq ($(trunk_build),yes)
304
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
305
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
308
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
311
autotools_files := $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
312
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
313
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
314
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
316
autoconf_version = 2.64
317
ifeq ($(trunk_build),yes)
318
# The actual version depends on the build-dependencies set by
319
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
320
# correct version is installed.
324
# FIXME: the auto* stuff is done every time for every subdir, which
325
# leads to build errors. Idea: record the auto* calls in the patch
326
# files (AUTO <dir> <auto-command with options>) and run them separately,
327
# maybe only once per directory).
328
$(patch_stamp): $(unpack_stamp) $(series_stamp)
329
QUILT_PATCHES=$(patchdir) \
330
quilt --quiltrc /dev/null push -a || test $$? = 2
332
ifneq (,$(filter svn-updates, $(debian_patches)))
333
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
334
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
337
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
339
cd $(srcdir)/fixincludes && ./genfixes
341
for f in $(autotools_files) ; \
343
*/classpath/m4/acinclude.m4) \
345
*/configure.*|*/acinclude.m4) \
346
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
347
then echo "Skipping already regenerated file $$f." ; \
349
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
350
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
351
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
353
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
356
*) echo "Unknown file: $$f"; false; \
360
for i in $(debian_patches); do \
361
echo -e "\n$$i:" >> pxxx; \
362
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
364
# -$(srcdir)/move-if-change pxxx $@
368
QUILT_PATCHES=$(patchdir) \
369
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
371
for f in $(autotools_files); do \
372
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
375
update-patches: $(series_stamp)
376
export QUILT_PATCHES=$(patchdir); \
377
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
378
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
379
while quilt push; do quilt refresh; done
381
patch: $(patch_stamp)
382
.PHONY: patch series quilt autotools