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 \
85
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
86
# libstdc++-nothumb-check \
92
ifneq ($(distribution),Debian)
93
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
94
# FIXME: bootstrap failure building the target libstdc++ library
95
#hardening_patches += gcc-default-format-security
96
hardening_patches += \
97
gcc-default-fortify-source \
99
testsuite-hardening-format \
100
testsuite-hardening-printf-types
103
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
104
hardening_patches += gcc-default-ssp
107
# FIXME 4.5: Drop and adjust symbols files
108
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
109
debian_patches += pr39491
112
ifeq ($(with_ada),yes)
116
ada-default-project-path \
117
ada-symbolic-tracebacks \
118
ada-library-project-files-soname
120
ifeq ($(biarch64),yes)
125
ifeq ($(with_libgnat),yes)
131
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
137
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
138
debian_patches += ada-kfreebsd-gnu \
142
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
144
gcc_ada_gcc-interface_Makefile.in \
145
ada-s-osinte-gnu.adb \
146
ada-s-osinte-gnu.ads \
162
ifneq ($(GFDL_INVARIANT_FREE),yes)
163
debian_patches += gdc-4.8-doc
165
debian_patches += gdc-texinfo
167
ifeq ($(with_libphobos),yes)
168
debian_patches += gdc-libphobos-build
170
debian_patches += gdc-driver-nophobos
173
debian_patches += gcc-d-lang
176
ifeq ($(DEB_TARGET_ARCH),alpha)
177
debian_patches += alpha-ieee mudflap-nocheck
178
ifneq ($(GFDL_INVARIANT_FREE),yes)
179
debian_patches += alpha-ieee-doc
183
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
184
debian_patches += libjava-armel-unwind
187
ifeq ($(DEB_TARGET_ARCH),armhf)
188
debian_patches += gcj-arm-mode
189
else ifeq ($(DEB_TARGET_ARCH),armel)
190
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
191
debian_patches += gcj-arm-mode
195
ifeq ($(DEB_TARGET_ARCH),m68k)
196
debian_patches += m68k-ada
199
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
200
debian_patches += powerpc_remove_many
201
debian_patches += powerpc_nofprs
204
ifeq ($(DEB_TARGET_ARCH),ppc64)
205
ifeq ($(distribution),Ubuntu)
206
#debian_patches += ibm-branch
210
#debian_patches += link-libs
212
# all patches below this line are applied for gcc-snapshot builds as well
214
ifeq ($(single_package),yes)
218
debian_patches += gcc-sysroot
222
ifeq ($(with_softfloat),yes)
223
debian_patches += arm-multilib-soft-float
224
else ifeq ($(multilib),yes)
225
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
226
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
228
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
231
debian_patches += arm-multilib-defaults
233
ifeq ($(DEB_CROSS),yes)
234
debian_patches += cross-fixes
235
ifeq ($(with_deps_on_target_arch_pkgs),yes)
236
debian_patches += cross-ma-install-location
238
debian_patches += cross-install-location
242
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
243
debian_patches += hurd-changes
246
debian_patches += gcc-ice-hack gcc-ice-apport
248
#debian_patches += gold-and-ld
250
debian_patches += libjava-fixed-symlinks
251
debian_patches += libstdc++-arm-wno-abi
253
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
254
# timeouts on the buildd's, Debian
255
debian_patches += libstdc++-no-testsuite
256
else ifeq ($(distribution),Ubuntu)
257
# timeouts on the buildd's, Ubuntu only
258
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
259
debian_patches += libstdc++-no-testsuite
262
debian_patches += ada-mips
263
debian_patches += libffi-ro-eh_frame_sect
265
debian_patches += gcc-multiarch
266
ifeq ($(with_multiarch_lib),yes)
267
ifneq ($(single_package),yes)
268
debian_patches += libjava-multiarch
271
debian_patches += libjava-nobiarch-check
272
debian_patches += config-ml
273
ifneq ($(single_package),yes)
274
ifeq ($(with_multiarch_cxxheaders),yes)
275
debian_patches += g++-multiarch-incdir
278
ifeq ($(DEB_CROSS),yes)
279
debian_patches += cross-no-locale-include
281
ifeq ($(biarch64),yes)
282
ifeq ($(DEB_CROSS),yes)
283
debian_patches += cross-biarch
286
debian_patches += gcc-multilib-multiarch
288
ifeq (,$(filter $(distrelease),lenny squeeze wheezy sid experimental dapper hardy intrepid jaunty karmic lucid maverick))
289
debian_patches += gcc-as-needed
291
debian_patches += mips-fix-loongson2f-nop
292
ifeq ($(distribution),Ubuntu)
293
ifeq ($(DEB_TARGET_ARCH),ppc64)
294
debian_patches += gcc-ppc64-O3
297
debian_patches += libgomp-kfreebsd-testsuite
299
series_stamp = $(stampdir)/02-series-stamp
300
series: $(series_stamp)
302
echo $(strip $(addsuffix .diff,$(debian_patches))) \
303
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
304
ifneq (,$(strip $(hardening_patches)))
305
ifneq ($(trunk_build),yes)
306
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
307
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
310
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
313
autotools_files := $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
314
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
315
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
316
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
318
autoconf_version = 2.64
319
ifeq ($(trunk_build),yes)
320
# The actual version depends on the build-dependencies set by
321
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
322
# correct version is installed.
326
# FIXME: the auto* stuff is done every time for every subdir, which
327
# leads to build errors. Idea: record the auto* calls in the patch
328
# files (AUTO <dir> <auto-command with options>) and run them separately,
329
# maybe only once per directory).
330
$(patch_stamp): $(unpack_stamp) $(series_stamp)
331
QUILT_PATCHES=$(patchdir) \
332
quilt --quiltrc /dev/null push -a || test $$? = 2
334
ifneq (,$(filter svn-updates, $(debian_patches)))
335
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
336
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
339
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
341
cd $(srcdir)/fixincludes && ./genfixes
343
for f in $(autotools_files) ; \
345
*/classpath/m4/acinclude.m4) \
347
*/configure.*|*/acinclude.m4) \
348
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
349
then echo "Skipping already regenerated file $$f." ; \
351
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
352
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
353
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
355
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
358
*) echo "Unknown file: $$f"; false; \
362
for i in $(debian_patches); do \
363
echo -e "\n$$i:" >> pxxx; \
364
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
366
# -$(srcdir)/move-if-change pxxx $@
370
QUILT_PATCHES=$(patchdir) \
371
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
373
for f in $(autotools_files); do \
374
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
377
update-patches: $(series_stamp)
378
export QUILT_PATCHES=$(patchdir); \
379
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
380
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
381
while quilt push; do quilt refresh; done
383
patch: $(patch_stamp)
384
.PHONY: patch series quilt autotools