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
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 \
82
libgo-setcontext-config \
87
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
88
# libstdc++-nothumb-check \
94
ifneq ($(distribution),Debian)
95
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
96
# FIXME: bootstrap failure building the target libstdc++ library
97
#hardening_patches += gcc-default-format-security
98
hardening_patches += \
99
gcc-default-fortify-source \
101
testsuite-hardening-format \
102
testsuite-hardening-printf-types
105
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
106
hardening_patches += gcc-default-ssp
109
# FIXME 4.5: Drop and adjust symbols files
110
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
111
debian_patches += pr39491
114
ifeq ($(with_ada),yes)
118
ada-default-project-path \
119
ada-symbolic-tracebacks \
120
ada-library-project-files-soname
122
ifeq ($(biarch64),yes)
127
ifeq ($(with_libgnat),yes)
133
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
139
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
140
debian_patches += ada-kfreebsd-gnu \
144
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
146
gcc_ada_gcc-interface_Makefile.in \
147
ada-s-osinte-gnu.adb \
148
ada-s-osinte-gnu.ads \
164
ifneq ($(GFDL_INVARIANT_FREE),yes)
165
debian_patches += gdc-4.8-doc
167
debian_patches += gdc-texinfo
169
ifeq ($(with_libphobos),yes)
170
debian_patches += gdc-libphobos-build
172
debian_patches += gdc-driver-nophobos
175
debian_patches += gcc-d-lang
178
ifeq ($(DEB_TARGET_ARCH),alpha)
179
debian_patches += alpha-ieee mudflap-nocheck
180
ifneq ($(GFDL_INVARIANT_FREE),yes)
181
debian_patches += alpha-ieee-doc
185
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
186
debian_patches += libjava-armel-unwind
189
ifeq ($(DEB_TARGET_ARCH),armhf)
190
debian_patches += gcj-arm-mode
191
else ifeq ($(DEB_TARGET_ARCH),armel)
192
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
193
debian_patches += gcj-arm-mode
197
ifeq ($(DEB_TARGET_ARCH),m68k)
198
debian_patches += m68k-ada
201
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
202
debian_patches += powerpc_remove_many
203
debian_patches += powerpc_nofprs
206
ifeq ($(DEB_TARGET_ARCH),ppc64)
207
ifeq ($(distribution),Ubuntu)
208
#debian_patches += ibm-branch
212
#debian_patches += link-libs
214
# all patches below this line are applied for gcc-snapshot builds as well
216
ifeq ($(single_package),yes)
220
debian_patches += gcc-sysroot
224
ifeq ($(with_softfloat),yes)
225
debian_patches += arm-multilib-soft-float
226
else ifeq ($(multilib),yes)
227
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
228
debian_patches += arm-multilib-softfp
230
debian_patches += arm-multilib-soft
233
debian_patches += arm-multilib-defaults
235
ifeq ($(DEB_CROSS),yes)
236
debian_patches += cross-fixes
237
ifeq ($(with_deps_on_target_arch_pkgs),yes)
238
debian_patches += cross-ma-install-location
240
debian_patches += cross-install-location
244
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
245
debian_patches += hurd-changes
248
debian_patches += gcc-ice-hack gcc-ice-apport
250
#debian_patches += gold-and-ld
252
debian_patches += libjava-fixed-symlinks
253
debian_patches += libstdc++-arm-wno-abi
255
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
256
# timeouts on the buildd's, Debian
257
debian_patches += libstdc++-no-testsuite
258
else ifeq ($(distribution),Ubuntu)
259
# timeouts on the buildd's, Ubuntu only
260
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
261
debian_patches += libstdc++-no-testsuite
264
debian_patches += ada-mips
265
debian_patches += libffi-ro-eh_frame_sect
267
debian_patches += gcc-multiarch
268
ifeq ($(with_multiarch_lib),yes)
269
ifneq ($(single_package),yes)
270
debian_patches += libjava-multiarch
273
debian_patches += libjava-nobiarch-check
274
debian_patches += config-ml
275
ifneq ($(single_package),yes)
276
ifeq ($(with_multiarch_cxxheaders),yes)
277
debian_patches += g++-multiarch-incdir
280
ifeq ($(DEB_CROSS),yes)
281
debian_patches += cross-no-locale-include
283
ifeq ($(biarch64),yes)
284
ifeq ($(DEB_CROSS),yes)
285
debian_patches += cross-biarch
288
debian_patches += gcc-multilib-multiarch
290
ifeq (,$(filter $(distrelease),lenny squeeze wheezy sid experimental dapper hardy intrepid jaunty karmic lucid maverick))
291
debian_patches += gcc-as-needed
293
debian_patches += mips-fix-loongson2f-nop
294
ifeq ($(distribution),Ubuntu)
295
ifeq ($(DEB_TARGET_ARCH),ppc64)
296
debian_patches += gcc-ppc64-O3
299
debian_patches += libgomp-kfreebsd-testsuite
301
series_stamp = $(stampdir)/02-series-stamp
302
series: $(series_stamp)
304
echo $(strip $(addsuffix .diff,$(debian_patches))) \
305
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
306
ifneq (,$(strip $(hardening_patches)))
307
ifneq ($(trunk_build),yes)
308
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
309
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
312
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
315
autotools_files := $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
316
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
317
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
318
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
320
autoconf_version = 2.64
321
ifeq ($(trunk_build),yes)
322
# The actual version depends on the build-dependencies set by
323
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
324
# correct version is installed.
328
# FIXME: the auto* stuff is done every time for every subdir, which
329
# leads to build errors. Idea: record the auto* calls in the patch
330
# files (AUTO <dir> <auto-command with options>) and run them separately,
331
# maybe only once per directory).
332
$(patch_stamp): $(unpack_stamp) $(series_stamp)
333
QUILT_PATCHES=$(patchdir) \
334
quilt --quiltrc /dev/null push -a || test $$? = 2
336
ifneq (,$(filter svn-updates, $(debian_patches)))
337
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
338
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
341
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
343
cd $(srcdir)/fixincludes && ./genfixes
345
for f in $(autotools_files) ; \
347
*/classpath/m4/acinclude.m4) \
349
*/configure.*|*/acinclude.m4) \
350
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
351
then echo "Skipping already regenerated file $$f." ; \
353
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
354
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
355
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
357
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
360
*) echo "Unknown file: $$f"; false; \
364
for i in $(debian_patches); do \
365
echo -e "\n$$i:" >> pxxx; \
366
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
368
# -$(srcdir)/move-if-change pxxx $@
372
QUILT_PATCHES=$(patchdir) \
373
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
375
for f in $(autotools_files); do \
376
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
379
update-patches: $(series_stamp)
380
export QUILT_PATCHES=$(patchdir); \
381
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
382
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
383
while quilt push; do quilt refresh; done
385
patch: $(patch_stamp)
386
.PHONY: patch series quilt autotools