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),pr59593-revert) \
20
$(if $(with_linaro_branch),gcc-linaro) \
21
$(if $(with_linaro_branch),gcc-linaro-no-local) \
23
# FIXME: pr61208 requires Linaro 4.9-2014.04.
24
# $(if $(with_linaro_branch),pr61208-linaro) \
26
ifeq ($(with_java),yes)
31
ifneq ($(GFDL_INVARIANT_FREE),yes)
34
$(if $(with_linaro_branch),gcc-linaro-doc) \
37
# $(if $(with_linaro_branch),,svn-doc-updates) \
41
$(if $(with_linaro_branch),gcc-dfsg-linaro-doc)
46
# boehm-gc-nocheck: seems to work on the buildds \
50
gcc-driver-extra-langs
52
ifneq (,$(filter $(distrelease),etch lenny squeeze wheezy dapper hardy intrepid jaunty karmic lucid))
53
debian_patches += gcc-hash-style-both
55
debian_patches += gcc-hash-style-gnu
62
libstdc++-test-installed \
66
libjava-disable-plugin \
67
alpha-no-ev4-directive \
70
libgomp-omp_h-multilib \
77
gcc-target-include-asm \
78
libgo-revert-timeout-exp \
79
$(if $(with_linaro_branch),,arm-sanitizer) \
80
libgo-setcontext-config \
93
$(if $(with_linaro_branch),pr59744) \
94
$(if $(with_linaro_branch),aarch64-call-frame-info) \
95
$(if $(with_linaro_branch),aarch64-abi-fix) \
96
fix-ffi_call_VFP-with-no-VFP-argument \
97
$(if $(with_linaro_branch),pr60034) \
104
gcc-setmultilib-fix \
109
# FIXME: still necessary for cross building the native compiler?
112
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
113
# libstdc++-nothumb-check \
119
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
120
hardening_patches += gcc-default-ssp
121
hardening_patches += gcc-default-format-security
123
ifeq ($(distribution),Ubuntu)
124
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
125
hardening_patches += \
126
gcc-default-fortify-source \
128
testsuite-hardening-format \
129
testsuite-hardening-printf-types \
130
testsuite-hardening-updates
134
# FIXME 4.5: Drop and adjust symbols files
135
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
136
debian_patches += pr39491
139
ifeq ($(with_ada),yes)
143
ada-default-project-path \
144
ada-symbolic-tracebacks \
145
ada-library-project-files-soname \
148
ifeq ($(biarch64),yes)
153
ifeq ($(with_libgnat),yes)
159
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
165
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
167
gcc_ada_gcc-interface_Makefile.in \
168
ada-s-osinte-gnu.adb \
169
ada-s-osinte-gnu.ads \
185
ifneq ($(GFDL_INVARIANT_FREE),yes)
186
debian_patches += gdc-4.8-doc
188
debian_patches += gdc-texinfo
190
ifeq ($(with_libphobos),yes)
191
debian_patches += gdc-libphobos-build
193
debian_patches += gdc-driver-nophobos
195
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
196
debian_patches += disable-gdc-tests
199
debian_patches += gcc-d-lang
202
ifeq ($(DEB_TARGET_ARCH),alpha)
203
debian_patches += alpha-ieee
204
ifneq ($(GFDL_INVARIANT_FREE),yes)
205
debian_patches += alpha-ieee-doc
209
ifeq ($(DEB_TARGET_ARCH_CPU),amd64)
210
debian_patches += libjava-testsuite
213
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
214
debian_patches += libjava-armel-unwind
217
ifeq ($(DEB_TARGET_ARCH),armhf)
218
debian_patches += gcj-arm-mode
219
else ifeq ($(DEB_TARGET_ARCH),armel)
220
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
221
debian_patches += gcj-arm-mode
225
ifeq ($(DEB_TARGET_ARCH),m68k)
226
debian_patches += m68k-ada
227
debian_patches += m68k-revert-pr45144
228
debian_patches += pr52714
229
debian_patches += pr58369
230
debian_patches += pr52306
233
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
234
debian_patches += powerpc_remove_many
235
debian_patches += powerpc_nofprs
238
#debian_patches += link-libs
240
# all patches below this line are applied for gcc-snapshot builds as well
242
ifeq ($(single_package),yes)
246
debian_patches += gcc-sysroot
247
debian_patches += goarch-aarch64
248
debian_patches += libgo-explicit-reservation
252
ifeq ($(with_softfloat),yes)
253
debian_patches += arm-multilib-soft-float
254
else ifeq ($(multilib),yes)
255
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
256
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
258
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
261
debian_patches += arm-multilib-defaults
263
ifeq ($(DEB_CROSS),yes)
264
debian_patches += cross-fixes
265
ifeq ($(with_deps_on_target_arch_pkgs),yes)
266
debian_patches += cross-ma-install-location
268
debian_patches += cross-install-location
270
debian_patches += gdc-cross-install-location
275
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
276
debian_patches += hurd-changes
279
debian_patches += gcc-ice-hack gcc-ice-apport
281
#debian_patches += gold-and-ld
283
debian_patches += libjava-fixed-symlinks
285
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
286
# timeouts on the buildd's, Debian
287
debian_patches += libstdc++-no-testsuite
288
else ifeq ($(distribution),Ubuntu)
289
# timeouts on the buildd's, Ubuntu only
290
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
291
debian_patches += libstdc++-no-testsuite
294
debian_patches += ada-mips
295
debian_patches += libffi-ro-eh_frame_sect
297
debian_patches += gcc-multiarch
298
ifeq ($(with_multiarch_lib),yes)
299
ifneq ($(single_package),yes)
300
debian_patches += libjava-multiarch
303
debian_patches += libjava-nobiarch-check
304
debian_patches += config-ml
305
ifneq ($(single_package),yes)
306
ifeq ($(with_multiarch_cxxheaders),yes)
307
debian_patches += g++-multiarch-incdir
310
ifeq ($(DEB_CROSS),yes)
311
debian_patches += cross-no-locale-include
313
ifeq ($(biarch64),yes)
314
ifeq ($(DEB_CROSS),yes)
315
debian_patches += cross-biarch
318
debian_patches += gcc-multilib-multiarch
320
ifneq (,$(filter $(derivative),Ubuntu))
321
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
322
debian_patches += gcc-as-needed
325
#debian_patches += gcc-as-needed
327
debian_patches += mips-fix-loongson2f-nop
328
ifeq ($(derivative),Ubuntu)
329
ifeq ($(DEB_TARGET_ARCH),ppc64)
330
debian_patches += gcc-ppc64-O3
333
debian_patches += libgomp-kfreebsd-testsuite
335
series_stamp = $(stampdir)/02-series-stamp
336
series: $(series_stamp)
338
echo $(strip $(addsuffix .diff,$(debian_patches))) \
339
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
340
ifneq (,$(strip $(hardening_patches)))
341
ifneq ($(trunk_build),yes)
342
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
343
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
346
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
349
autotools_files = $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
350
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
351
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
352
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
354
autoconf_version = 2.64
355
ifeq ($(trunk_build),yes)
356
# The actual version depends on the build-dependencies set by
357
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
358
# correct version is installed.
362
# FIXME: the auto* stuff is done every time for every subdir, which
363
# leads to build errors. Idea: record the auto* calls in the patch
364
# files (AUTO <dir> <auto-command with options>) and run them separately,
365
# maybe only once per directory).
366
$(patch_stamp): $(unpack_stamp) $(series_stamp)
367
QUILT_PATCHES=$(patchdir) \
368
quilt --quiltrc /dev/null push -a || test $$? = 2
370
ifneq (,$(filter svn-updates, $(debian_patches)))
371
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
372
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
375
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
377
cd $(srcdir)/fixincludes && ./genfixes
379
for f in $(autotools_files) ; \
381
*/classpath/m4/acinclude.m4) \
383
*/configure.*|*/acinclude.m4) \
384
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
385
then echo "Skipping already regenerated file $$f." ; \
387
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
388
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
389
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
391
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
394
*) echo "Unknown file: $$f"; false; \
398
for i in $(debian_patches) $(hardening_patches); do \
399
echo -e "\n$$i:" >> pxxx; \
400
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
402
# -$(srcdir)/move-if-change pxxx $@
406
QUILT_PATCHES=$(patchdir) \
407
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
409
for f in $(autotools_files); do \
410
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
413
update-patches: $(series_stamp)
414
export QUILT_PATCHES=$(patchdir); \
415
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
416
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
417
while quilt push; do quilt refresh; done
419
patch: $(patch_stamp)
420
.PHONY: patch series quilt autotools