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)
30
$(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
ifeq ($(distribution),Ubuntu)
46
ifneq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid))
47
debian_patches += gcc-hash-style-both
49
debian_patches += gcc-hash-style-gnu
52
debian_patches += gcc-hash-style-both
59
libstdc++-test-installed \
60
libstdc++-host-headers \
64
libjava-disable-plugin \
65
alpha-no-ev4-directive \
68
libgomp-omp_h-multilib \
78
gcc-target-include-asm \
79
libgo-revert-timeout-exp \
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 \
158
ifeq ($(with_libphobos),yes)
159
debian_patches += gdc-libphobos-build
161
debian_patches += gdc-driver-nophobos
165
debian_patches += gcc-d-lang
168
ifeq ($(DEB_TARGET_ARCH),alpha)
169
debian_patches += alpha-ieee mudflap-nocheck
170
ifneq ($(GFDL_INVARIANT_FREE),yes)
171
debian_patches += alpha-ieee-doc
175
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
176
debian_patches += libjava-armel-unwind
179
ifeq ($(DEB_TARGET_ARCH),armhf)
180
debian_patches += gcj-arm-mode
181
else ifeq ($(DEB_TARGET_ARCH),armel)
182
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
183
debian_patches += gcj-arm-mode
187
ifeq ($(DEB_TARGET_ARCH),m68k)
188
debian_patches += m68k-ada
191
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
192
debian_patches += powerpc_remove_many
193
debian_patches += powerpc_nofprs
196
ifeq ($(DEB_TARGET_ARCH),ppc64)
197
ifeq ($(distribution),Ubuntu)
198
#debian_patches += ibm-branch
202
#debian_patches += link-libs
204
# all patches below this line are applied for gcc-snapshot builds as well
206
ifeq ($(single_package),yes)
210
debian_patches += gcc-sysroot
214
ifeq ($(with_softfloat),yes)
215
debian_patches += arm-multilib-soft-float
216
else ifeq ($(multilib),yes)
217
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
218
debian_patches += arm-multilib-softfp
220
debian_patches += arm-multilib-soft
223
debian_patches += arm-multilib-defaults
225
ifeq ($(DEB_CROSS),yes)
226
debian_patches += cross-fixes
227
ifeq ($(with_deps_on_target_arch_pkgs),yes)
228
debian_patches += cross-ma-install-location
230
debian_patches += cross-install-location
234
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
235
debian_patches += hurd-changes
238
debian_patches += gcc-ice-hack gcc-ice-apport
240
#debian_patches += gold-and-ld
242
debian_patches += libjava-fixed-symlinks
243
debian_patches += libstdc++-arm-wno-abi
245
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
246
# timeouts on the buildd's, Debian
247
debian_patches += libstdc++-no-testsuite
248
else ifeq ($(distribution),Ubuntu)
249
# timeouts on the buildd's, Ubuntu only
250
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
251
debian_patches += libstdc++-no-testsuite
254
debian_patches += ada-mips
255
debian_patches += libffi-ro-eh_frame_sect
257
debian_patches += gcc-multiarch
258
ifeq ($(with_multiarch_lib),yes)
259
ifneq ($(single_package),yes)
260
debian_patches += libjava-multiarch
263
debian_patches += libjava-nobiarch-check
264
debian_patches += config-ml
265
ifneq ($(single_package),yes)
266
ifeq ($(with_multiarch_cxxheaders),yes)
267
debian_patches += g++-multiarch-incdir
270
ifeq ($(DEB_CROSS),yes)
271
debian_patches += cross-no-locale-include
273
ifeq ($(biarch64),yes)
274
ifeq ($(DEB_CROSS),yes)
275
debian_patches += cross-biarch
278
debian_patches += gcc-multilib-multiarch
280
ifeq (,$(filter $(distrelease),lenny squeeze wheezy sid experimental dapper hardy intrepid jaunty karmic lucid maverick))
281
debian_patches += gcc-as-needed
283
debian_patches += mips-fix-loongson2f-nop
284
ifeq ($(distribution),Ubuntu)
285
ifeq ($(DEB_TARGET_ARCH),ppc64)
286
debian_patches += gcc-ppc64-O3
289
debian_patches += libgomp-kfreebsd-testsuite
291
series_stamp = $(stampdir)/02-series-stamp
292
series: $(series_stamp)
294
echo $(strip $(addsuffix .diff,$(debian_patches))) \
295
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
296
ifneq (,$(strip $(hardening_patches)))
297
ifneq ($(trunk_build),yes)
298
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
299
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
302
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
305
autotools_files := $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
306
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
307
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
308
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
310
autoconf_version = 2.64
311
ifeq ($(trunk_build),yes)
312
# The actual version depends on the build-dependencies set by
313
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
314
# correct version is installed.
318
# FIXME: the auto* stuff is done every time for every subdir, which
319
# leads to build errors. Idea: record the auto* calls in the patch
320
# files (AUTO <dir> <auto-command with options>) and run them separately,
321
# maybe only once per directory).
322
$(patch_stamp): $(unpack_stamp) $(series_stamp)
323
QUILT_PATCHES=$(patchdir) \
324
quilt --quiltrc /dev/null push -a || test $$? = 2
326
ifneq (,$(filter svn-updates, $(debian_patches)))
327
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
328
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
331
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
333
cd $(srcdir)/fixincludes && ./genfixes
335
for f in $(autotools_files) ; \
337
*/classpath/m4/acinclude.m4) \
339
*/configure.*|*/acinclude.m4) \
340
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
341
then echo "Skipping already regenerated file $$f." ; \
343
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
344
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
345
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
347
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
350
*) echo "Unknown file: $$f"; false; \
354
for i in $(debian_patches); do \
355
echo -e "\n$$i:" >> pxxx; \
356
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
358
# -$(srcdir)/move-if-change pxxx $@
362
QUILT_PATCHES=$(patchdir) \
363
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
365
for f in $(autotools_files); do \
366
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
369
update-patches: $(series_stamp)
370
export QUILT_PATCHES=$(patchdir); \
371
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
372
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
373
while quilt push; do quilt refresh; done
375
patch: $(patch_stamp)
376
.PHONY: patch series quilt autotools