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
$(if $(with_linaro_branch),gcc-aarch64-reentrant) \
21
# svn-updates$(if $(with_linaro_branch),-linaro) \
23
ifeq ($(with_java),yes)
28
ifneq ($(GFDL_INVARIANT_FREE),yes)
31
$(if $(with_linaro_branch),gcc-linaro-doc) \
34
# $(if $(with_linaro_branch),,svn-doc-updates) \
41
# boehm-gc-nocheck: seems to work on the buildds \
45
gcc-driver-extra-langs
47
ifneq (,$(filter $(distrelease),etch lenny squeeze wheezy dapper hardy intrepid jaunty karmic lucid))
48
debian_patches += gcc-hash-style-both
50
debian_patches += gcc-hash-style-gnu
57
libstdc++-test-installed \
61
libjava-disable-plugin \
62
alpha-no-ev4-directive \
65
libgomp-omp_h-multilib \
75
gcc-target-include-asm \
76
libgo-revert-timeout-exp \
77
$(if $(with_linaro_branch),,arm-sanitizer) \
79
libgo-setcontext-config \
86
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
87
# libstdc++-nothumb-check \
93
ifneq ($(distribution),Debian)
94
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
95
# FIXME: bootstrap failure building the target libstdc++ library
96
#hardening_patches += gcc-default-format-security
97
hardening_patches += \
98
gcc-default-fortify-source \
100
testsuite-hardening-format \
101
testsuite-hardening-printf-types
104
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
105
hardening_patches += gcc-default-ssp
108
# FIXME 4.5: Drop and adjust symbols files
109
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
110
debian_patches += pr39491
113
ifeq ($(with_ada),yes)
117
ada-default-project-path \
118
ada-symbolic-tracebacks \
119
ada-library-project-files-soname
121
ifeq ($(biarch64),yes)
126
ifeq ($(with_libgnat),yes)
132
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
138
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
139
debian_patches += ada-kfreebsd-gnu \
143
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
145
gcc_ada_gcc-interface_Makefile.in \
146
ada-s-osinte-gnu.adb \
147
ada-s-osinte-gnu.ads \
163
ifneq ($(GFDL_INVARIANT_FREE),yes)
164
debian_patches += gdc-4.8-doc
166
debian_patches += gdc-texinfo
168
ifeq ($(with_libphobos),yes)
169
debian_patches += gdc-libphobos-build
171
debian_patches += gdc-driver-nophobos
174
debian_patches += gcc-d-lang
177
ifeq ($(DEB_TARGET_ARCH),alpha)
178
debian_patches += alpha-ieee mudflap-nocheck
179
ifneq ($(GFDL_INVARIANT_FREE),yes)
180
debian_patches += alpha-ieee-doc
184
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
185
debian_patches += libjava-armel-unwind
188
ifeq ($(DEB_TARGET_ARCH),armhf)
189
debian_patches += gcj-arm-mode
190
else ifeq ($(DEB_TARGET_ARCH),armel)
191
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
192
debian_patches += gcj-arm-mode
196
ifeq ($(DEB_TARGET_ARCH),m68k)
197
debian_patches += m68k-ada
200
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
201
debian_patches += powerpc_remove_many
202
debian_patches += powerpc_nofprs
205
ifeq ($(DEB_TARGET_ARCH),ppc64)
206
ifeq ($(distribution),Ubuntu)
207
#debian_patches += ibm-branch
211
#debian_patches += link-libs
213
# all patches below this line are applied for gcc-snapshot builds as well
215
ifeq ($(single_package),yes)
219
debian_patches += gcc-sysroot
223
ifeq ($(with_softfloat),yes)
224
debian_patches += arm-multilib-soft-float
225
else ifeq ($(multilib),yes)
226
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
227
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
229
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
232
debian_patches += arm-multilib-defaults
234
ifeq ($(DEB_CROSS),yes)
235
debian_patches += cross-fixes
236
ifeq ($(with_deps_on_target_arch_pkgs),yes)
237
debian_patches += cross-ma-install-location
239
debian_patches += cross-install-location
243
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
244
debian_patches += hurd-changes
247
debian_patches += gcc-ice-hack gcc-ice-apport
249
#debian_patches += gold-and-ld
251
debian_patches += libjava-fixed-symlinks
252
debian_patches += libstdc++-arm-wno-abi
254
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
255
# timeouts on the buildd's, Debian
256
debian_patches += libstdc++-no-testsuite
257
else ifeq ($(distribution),Ubuntu)
258
# timeouts on the buildd's, Ubuntu only
259
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
260
debian_patches += libstdc++-no-testsuite
263
debian_patches += ada-mips
264
debian_patches += libffi-ro-eh_frame_sect
266
debian_patches += gcc-multiarch
267
ifeq ($(with_multiarch_lib),yes)
268
ifneq ($(single_package),yes)
269
debian_patches += libjava-multiarch
272
debian_patches += libjava-nobiarch-check
273
debian_patches += config-ml
274
ifneq ($(single_package),yes)
275
ifeq ($(with_multiarch_cxxheaders),yes)
276
debian_patches += g++-multiarch-incdir
279
ifeq ($(DEB_CROSS),yes)
280
debian_patches += cross-no-locale-include
282
ifeq ($(biarch64),yes)
283
ifeq ($(DEB_CROSS),yes)
284
debian_patches += cross-biarch
287
debian_patches += gcc-multilib-multiarch
289
ifeq (,$(filter $(distrelease),lenny squeeze wheezy sid experimental dapper hardy intrepid jaunty karmic lucid maverick))
290
debian_patches += gcc-as-needed
292
debian_patches += mips-fix-loongson2f-nop
293
ifeq ($(distribution),Ubuntu)
294
ifeq ($(DEB_TARGET_ARCH),ppc64)
295
debian_patches += gcc-ppc64-O3
298
debian_patches += libgomp-kfreebsd-testsuite
300
series_stamp = $(stampdir)/02-series-stamp
301
series: $(series_stamp)
303
echo $(strip $(addsuffix .diff,$(debian_patches))) \
304
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
305
ifneq (,$(strip $(hardening_patches)))
306
ifneq ($(trunk_build),yes)
307
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
308
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
311
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
314
autotools_files := $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
315
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
316
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
317
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
319
autoconf_version = 2.64
320
ifeq ($(trunk_build),yes)
321
# The actual version depends on the build-dependencies set by
322
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
323
# correct version is installed.
327
# FIXME: the auto* stuff is done every time for every subdir, which
328
# leads to build errors. Idea: record the auto* calls in the patch
329
# files (AUTO <dir> <auto-command with options>) and run them separately,
330
# maybe only once per directory).
331
$(patch_stamp): $(unpack_stamp) $(series_stamp)
332
QUILT_PATCHES=$(patchdir) \
333
quilt --quiltrc /dev/null push -a || test $$? = 2
335
ifneq (,$(filter svn-updates, $(debian_patches)))
336
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
337
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
340
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
342
cd $(srcdir)/fixincludes && ./genfixes
344
for f in $(autotools_files) ; \
346
*/classpath/m4/acinclude.m4) \
348
*/configure.*|*/acinclude.m4) \
349
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
350
then echo "Skipping already regenerated file $$f." ; \
352
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
353
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
354
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
356
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
359
*) echo "Unknown file: $$f"; false; \
363
for i in $(debian_patches); do \
364
echo -e "\n$$i:" >> pxxx; \
365
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
367
# -$(srcdir)/move-if-change pxxx $@
371
QUILT_PATCHES=$(patchdir) \
372
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
374
for f in $(autotools_files); do \
375
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
378
update-patches: $(series_stamp)
379
export QUILT_PATCHES=$(patchdir); \
380
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
381
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
382
while quilt push; do quilt refresh; done
384
patch: $(patch_stamp)
385
.PHONY: patch series quilt autotools