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 \
84
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
85
# libstdc++-nothumb-check \
91
ifneq ($(distribution),Debian)
92
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
93
# FIXME: bootstrap failure building the target libstdc++ library
94
#hardening_patches += gcc-default-format-security
95
hardening_patches += \
96
gcc-default-fortify-source \
98
testsuite-hardening-format \
99
testsuite-hardening-printf-types
102
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
103
hardening_patches += gcc-default-ssp
106
# FIXME 4.5: Drop and adjust symbols files
107
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
108
debian_patches += pr39491
111
ifeq ($(with_ada),yes)
115
ada-default-project-path \
116
ada-symbolic-tracebacks \
117
ada-library-project-files-soname
119
ifeq ($(biarch64),yes)
124
ifeq ($(with_libgnat),yes)
130
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
136
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
137
debian_patches += ada-kfreebsd-gnu \
141
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
143
gcc_ada_gcc-interface_Makefile.in \
144
ada-s-osinte-gnu.adb \
145
ada-s-osinte-gnu.ads \
161
ifneq ($(GFDL_INVARIANT_FREE),yes)
162
debian_patches += gdc-4.8-doc
164
debian_patches += gdc-texinfo
166
ifeq ($(with_libphobos),yes)
167
debian_patches += gdc-libphobos-build
169
debian_patches += gdc-driver-nophobos
172
debian_patches += gcc-d-lang
175
ifeq ($(DEB_TARGET_ARCH),alpha)
176
debian_patches += alpha-ieee mudflap-nocheck
177
ifneq ($(GFDL_INVARIANT_FREE),yes)
178
debian_patches += alpha-ieee-doc
182
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
183
debian_patches += libjava-armel-unwind
186
ifeq ($(DEB_TARGET_ARCH),armhf)
187
debian_patches += gcj-arm-mode
188
else ifeq ($(DEB_TARGET_ARCH),armel)
189
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
190
debian_patches += gcj-arm-mode
194
ifeq ($(DEB_TARGET_ARCH),m68k)
195
debian_patches += m68k-ada
198
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
199
debian_patches += powerpc_remove_many
200
debian_patches += powerpc_nofprs
203
ifeq ($(DEB_TARGET_ARCH),ppc64)
204
ifeq ($(distribution),Ubuntu)
205
#debian_patches += ibm-branch
209
#debian_patches += link-libs
211
# all patches below this line are applied for gcc-snapshot builds as well
213
ifeq ($(single_package),yes)
217
debian_patches += gcc-sysroot
221
ifeq ($(with_softfloat),yes)
222
debian_patches += arm-multilib-soft-float
223
else ifeq ($(multilib),yes)
224
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
225
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
227
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
230
debian_patches += arm-multilib-defaults
232
ifeq ($(DEB_CROSS),yes)
233
debian_patches += cross-fixes
234
ifeq ($(with_deps_on_target_arch_pkgs),yes)
235
debian_patches += cross-ma-install-location
237
debian_patches += cross-install-location
241
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
242
debian_patches += hurd-changes
245
debian_patches += gcc-ice-hack gcc-ice-apport
247
#debian_patches += gold-and-ld
249
debian_patches += libjava-fixed-symlinks
250
debian_patches += libstdc++-arm-wno-abi
252
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
253
# timeouts on the buildd's, Debian
254
debian_patches += libstdc++-no-testsuite
255
else ifeq ($(distribution),Ubuntu)
256
# timeouts on the buildd's, Ubuntu only
257
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
258
debian_patches += libstdc++-no-testsuite
261
debian_patches += ada-mips
262
debian_patches += libffi-ro-eh_frame_sect
264
debian_patches += gcc-multiarch
265
ifeq ($(with_multiarch_lib),yes)
266
ifneq ($(single_package),yes)
267
debian_patches += libjava-multiarch
270
debian_patches += libjava-nobiarch-check
271
debian_patches += config-ml
272
ifneq ($(single_package),yes)
273
ifeq ($(with_multiarch_cxxheaders),yes)
274
debian_patches += g++-multiarch-incdir
277
ifeq ($(DEB_CROSS),yes)
278
debian_patches += cross-no-locale-include
280
ifeq ($(biarch64),yes)
281
ifeq ($(DEB_CROSS),yes)
282
debian_patches += cross-biarch
285
debian_patches += gcc-multilib-multiarch
287
ifeq (,$(filter $(distrelease),lenny squeeze wheezy sid experimental dapper hardy intrepid jaunty karmic lucid maverick))
288
debian_patches += gcc-as-needed
290
debian_patches += mips-fix-loongson2f-nop
291
ifeq ($(distribution),Ubuntu)
292
ifeq ($(DEB_TARGET_ARCH),ppc64)
293
debian_patches += gcc-ppc64-O3
296
debian_patches += libgomp-kfreebsd-testsuite
298
series_stamp = $(stampdir)/02-series-stamp
299
series: $(series_stamp)
301
echo $(strip $(addsuffix .diff,$(debian_patches))) \
302
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
303
ifneq (,$(strip $(hardening_patches)))
304
ifneq ($(trunk_build),yes)
305
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
306
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
309
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
312
autotools_files := $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
313
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
314
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
315
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
317
autoconf_version = 2.64
318
ifeq ($(trunk_build),yes)
319
# The actual version depends on the build-dependencies set by
320
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
321
# correct version is installed.
325
# FIXME: the auto* stuff is done every time for every subdir, which
326
# leads to build errors. Idea: record the auto* calls in the patch
327
# files (AUTO <dir> <auto-command with options>) and run them separately,
328
# maybe only once per directory).
329
$(patch_stamp): $(unpack_stamp) $(series_stamp)
330
QUILT_PATCHES=$(patchdir) \
331
quilt --quiltrc /dev/null push -a || test $$? = 2
333
ifneq (,$(filter svn-updates, $(debian_patches)))
334
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
335
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
338
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
340
cd $(srcdir)/fixincludes && ./genfixes
342
for f in $(autotools_files) ; \
344
*/classpath/m4/acinclude.m4) \
346
*/configure.*|*/acinclude.m4) \
347
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
348
then echo "Skipping already regenerated file $$f." ; \
350
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
351
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
352
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
354
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
357
*) echo "Unknown file: $$f"; false; \
361
for i in $(debian_patches); do \
362
echo -e "\n$$i:" >> pxxx; \
363
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
365
# -$(srcdir)/move-if-change pxxx $@
369
QUILT_PATCHES=$(patchdir) \
370
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
372
for f in $(autotools_files); do \
373
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
376
update-patches: $(series_stamp)
377
export QUILT_PATCHES=$(patchdir); \
378
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
379
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
380
while quilt push; do quilt refresh; done
382
patch: $(patch_stamp)
383
.PHONY: patch series quilt autotools