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),pr49423-revert) \
18
$(if $(with_linaro_branch),pr61208-revert) \
19
$(if $(with_linaro_branch),gcc-linaro) \
20
$(if $(with_linaro_branch),gcc-linaro-no-local) \
22
# FIXME: pr61208 requires Linaro 4.9-2014.04.
23
# $(if $(with_linaro_branch),pr61208-linaro) \
25
ifeq ($(with_java),yes)
30
ifneq ($(GFDL_INVARIANT_FREE),yes)
33
$(if $(with_linaro_branch),gcc-linaro-doc) \
36
# $(if $(with_linaro_branch),,svn-doc-updates) \
40
$(if $(with_linaro_branch),gcc-dfsg-linaro-doc)
45
# boehm-gc-nocheck: seems to work on the buildds \
49
gcc-driver-extra-langs
51
ifneq (,$(filter $(distrelease),etch lenny squeeze wheezy dapper hardy intrepid jaunty karmic lucid))
52
debian_patches += gcc-hash-style-both
54
debian_patches += gcc-hash-style-gnu
61
libstdc++-test-installed \
65
libjava-disable-plugin \
66
alpha-no-ev4-directive \
69
libgomp-omp_h-multilib \
76
gcc-target-include-asm \
77
libgo-revert-timeout-exp \
78
$(if $(with_linaro_branch),,arm-sanitizer) \
79
libgo-setcontext-config \
92
$(if $(with_linaro_branch),pr59744) \
93
$(if $(with_linaro_branch),aarch64-call-frame-info) \
94
$(if $(with_linaro_branch),aarch64-abi-fix) \
95
fix-ffi_call_VFP-with-no-VFP-argument \
96
$(if $(with_linaro_branch),pr60034) \
103
gcc-setmultilib-fix \
108
# FIXME: still necessary for cross building the native compiler?
111
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
112
# libstdc++-nothumb-check \
118
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
119
hardening_patches += gcc-default-ssp
120
hardening_patches += gcc-default-format-security
122
ifeq ($(distribution),Ubuntu)
123
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
124
hardening_patches += \
125
gcc-default-fortify-source \
127
testsuite-hardening-format \
128
testsuite-hardening-printf-types \
129
testsuite-hardening-updates
133
# FIXME 4.5: Drop and adjust symbols files
134
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
135
debian_patches += pr39491
138
ifeq ($(with_ada),yes)
142
ada-default-project-path \
143
ada-symbolic-tracebacks \
144
ada-library-project-files-soname \
147
ifeq ($(biarch64),yes)
152
ifeq ($(with_libgnat),yes)
158
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
164
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
166
gcc_ada_gcc-interface_Makefile.in \
167
ada-s-osinte-gnu.adb \
168
ada-s-osinte-gnu.ads \
184
ifneq ($(GFDL_INVARIANT_FREE),yes)
185
debian_patches += gdc-4.8-doc
187
debian_patches += gdc-texinfo
189
ifeq ($(with_libphobos),yes)
190
debian_patches += gdc-libphobos-build
192
debian_patches += gdc-driver-nophobos
194
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
195
debian_patches += disable-gdc-tests
198
debian_patches += gcc-d-lang
201
ifeq ($(DEB_TARGET_ARCH),alpha)
202
debian_patches += alpha-ieee
203
ifneq ($(GFDL_INVARIANT_FREE),yes)
204
debian_patches += alpha-ieee-doc
208
ifeq ($(DEB_TARGET_ARCH_CPU),amd64)
209
debian_patches += libjava-testsuite
212
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
213
debian_patches += libjava-armel-unwind
216
ifeq ($(DEB_TARGET_ARCH),armhf)
217
debian_patches += gcj-arm-mode
218
else ifeq ($(DEB_TARGET_ARCH),armel)
219
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
220
debian_patches += gcj-arm-mode
224
ifeq ($(DEB_TARGET_ARCH),m68k)
225
debian_patches += m68k-ada
226
debian_patches += m68k-revert-pr45144
227
debian_patches += pr52714
228
debian_patches += pr58369
229
debian_patches += pr52306
232
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
233
debian_patches += powerpc_remove_many
234
debian_patches += powerpc_nofprs
237
#debian_patches += link-libs
239
# all patches below this line are applied for gcc-snapshot builds as well
241
ifeq ($(single_package),yes)
245
debian_patches += gcc-sysroot
246
debian_patches += goarch-aarch64
247
debian_patches += libgo-explicit-reservation
251
ifeq ($(with_softfloat),yes)
252
debian_patches += arm-multilib-soft-float
253
else ifeq ($(multilib),yes)
254
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
255
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
257
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
260
debian_patches += arm-multilib-defaults
262
ifeq ($(DEB_CROSS),yes)
263
debian_patches += cross-fixes
264
ifeq ($(with_deps_on_target_arch_pkgs),yes)
265
debian_patches += cross-ma-install-location
267
debian_patches += cross-install-location
271
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
272
debian_patches += hurd-changes
275
debian_patches += gcc-ice-hack gcc-ice-apport
277
#debian_patches += gold-and-ld
279
debian_patches += libjava-fixed-symlinks
281
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
282
# timeouts on the buildd's, Debian
283
debian_patches += libstdc++-no-testsuite
284
else ifeq ($(distribution),Ubuntu)
285
# timeouts on the buildd's, Ubuntu only
286
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
287
debian_patches += libstdc++-no-testsuite
290
debian_patches += ada-mips
291
debian_patches += libffi-ro-eh_frame_sect
293
debian_patches += gcc-multiarch
294
ifeq ($(with_multiarch_lib),yes)
295
ifneq ($(single_package),yes)
296
debian_patches += libjava-multiarch
299
debian_patches += libjava-nobiarch-check
300
debian_patches += config-ml
301
ifneq ($(single_package),yes)
302
ifeq ($(with_multiarch_cxxheaders),yes)
303
debian_patches += g++-multiarch-incdir
306
ifeq ($(DEB_CROSS),yes)
307
debian_patches += cross-no-locale-include
309
ifeq ($(biarch64),yes)
310
ifeq ($(DEB_CROSS),yes)
311
debian_patches += cross-biarch
314
debian_patches += gcc-multilib-multiarch
316
ifneq (,$(filter $(derivative),Ubuntu))
317
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
318
debian_patches += gcc-as-needed
321
#debian_patches += gcc-as-needed
323
debian_patches += mips-fix-loongson2f-nop
324
ifeq ($(derivative),Ubuntu)
325
ifeq ($(DEB_TARGET_ARCH),ppc64)
326
debian_patches += gcc-ppc64-O3
329
debian_patches += libgomp-kfreebsd-testsuite
331
series_stamp = $(stampdir)/02-series-stamp
332
series: $(series_stamp)
334
echo $(strip $(addsuffix .diff,$(debian_patches))) \
335
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
336
ifneq (,$(strip $(hardening_patches)))
337
ifneq ($(trunk_build),yes)
338
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
339
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
342
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
345
autotools_files = $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
346
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
347
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
348
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
350
autoconf_version = 2.64
351
ifeq ($(trunk_build),yes)
352
# The actual version depends on the build-dependencies set by
353
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
354
# correct version is installed.
358
# FIXME: the auto* stuff is done every time for every subdir, which
359
# leads to build errors. Idea: record the auto* calls in the patch
360
# files (AUTO <dir> <auto-command with options>) and run them separately,
361
# maybe only once per directory).
362
$(patch_stamp): $(unpack_stamp) $(series_stamp)
363
QUILT_PATCHES=$(patchdir) \
364
quilt --quiltrc /dev/null push -a || test $$? = 2
366
ifneq (,$(filter svn-updates, $(debian_patches)))
367
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
368
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
371
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
373
cd $(srcdir)/fixincludes && ./genfixes
375
for f in $(autotools_files) ; \
377
*/classpath/m4/acinclude.m4) \
379
*/configure.*|*/acinclude.m4) \
380
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
381
then echo "Skipping already regenerated file $$f." ; \
383
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
384
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
385
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
387
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
390
*) echo "Unknown file: $$f"; false; \
394
for i in $(debian_patches) $(hardening_patches); do \
395
echo -e "\n$$i:" >> pxxx; \
396
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
398
# -$(srcdir)/move-if-change pxxx $@
402
QUILT_PATCHES=$(patchdir) \
403
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
405
for f in $(autotools_files); do \
406
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
409
update-patches: $(series_stamp)
410
export QUILT_PATCHES=$(patchdir); \
411
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
412
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
413
while quilt push; do quilt refresh; done
415
patch: $(patch_stamp)
416
.PHONY: patch series quilt autotools