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),pr61208-revert) \
18
$(if $(with_linaro_branch),gcc-linaro) \
19
$(if $(with_linaro_branch),gcc-linaro-no-local) \
21
# FIXME: pr61208 requires Linaro 4.9-2014.04.
22
# $(if $(with_linaro_branch),pr61208-linaro) \
24
ifeq ($(with_java),yes)
29
ifneq ($(GFDL_INVARIANT_FREE),yes)
32
$(if $(with_linaro_branch),gcc-linaro-doc) \
35
# $(if $(with_linaro_branch),,svn-doc-updates) \
39
$(if $(with_linaro_branch),gcc-dfsg-linaro-doc)
44
# boehm-gc-nocheck: seems to work on the buildds \
48
gcc-driver-extra-langs
50
ifneq (,$(filter $(distrelease),etch lenny squeeze wheezy dapper hardy intrepid jaunty karmic lucid))
51
debian_patches += gcc-hash-style-both
53
debian_patches += gcc-hash-style-gnu
60
libstdc++-test-installed \
64
libjava-disable-plugin \
65
alpha-no-ev4-directive \
68
libgomp-omp_h-multilib \
75
gcc-target-include-asm \
76
libgo-revert-timeout-exp \
77
$(if $(with_linaro_branch),,arm-sanitizer) \
78
libgo-setcontext-config \
90
$(if $(with_linaro_branch),pr59744) \
91
$(if $(with_linaro_branch),aarch64-call-frame-info) \
92
$(if $(with_linaro_branch),aarch64-abi-fix) \
93
fix-ffi_call_VFP-with-no-VFP-argument \
94
$(if $(with_linaro_branch),pr60034) \
101
gcc-setmultilib-fix \
107
# FIXME: still necessary for cross building the native compiler?
110
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
111
# libstdc++-nothumb-check \
117
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
118
hardening_patches += gcc-default-ssp
119
hardening_patches += gcc-default-format-security
121
ifeq ($(distribution),Ubuntu)
122
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
123
hardening_patches += \
124
gcc-default-fortify-source \
126
testsuite-hardening-format \
127
testsuite-hardening-printf-types \
128
testsuite-hardening-updates
132
# FIXME 4.5: Drop and adjust symbols files
133
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
134
debian_patches += pr39491
137
ifeq ($(with_ada),yes)
141
ada-default-project-path \
142
ada-symbolic-tracebacks \
143
ada-library-project-files-soname \
146
ifeq ($(biarch64),yes)
151
ifeq ($(with_libgnat),yes)
157
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
163
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
165
gcc_ada_gcc-interface_Makefile.in \
166
ada-s-osinte-gnu.adb \
167
ada-s-osinte-gnu.ads \
183
ifneq ($(GFDL_INVARIANT_FREE),yes)
184
debian_patches += gdc-4.8-doc
186
debian_patches += gdc-texinfo
188
ifeq ($(with_libphobos),yes)
189
debian_patches += gdc-libphobos-build
191
debian_patches += gdc-driver-nophobos
193
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
194
debian_patches += disable-gdc-tests
197
debian_patches += gcc-d-lang
200
ifeq ($(DEB_TARGET_ARCH),alpha)
201
debian_patches += alpha-ieee
202
ifneq ($(GFDL_INVARIANT_FREE),yes)
203
debian_patches += alpha-ieee-doc
207
ifeq ($(DEB_TARGET_ARCH_CPU),amd64)
208
debian_patches += libjava-testsuite
211
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
212
debian_patches += libjava-armel-unwind
215
ifeq ($(DEB_TARGET_ARCH),armhf)
216
debian_patches += gcj-arm-mode
217
else ifeq ($(DEB_TARGET_ARCH),armel)
218
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
219
debian_patches += gcj-arm-mode
223
ifeq ($(DEB_TARGET_ARCH),m68k)
224
debian_patches += m68k-ada
225
debian_patches += m68k-revert-pr45144
226
debian_patches += pr52714
227
debian_patches += pr58369
228
debian_patches += pr52306
231
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
232
debian_patches += powerpc_remove_many
233
debian_patches += powerpc_nofprs
236
#debian_patches += link-libs
238
# all patches below this line are applied for gcc-snapshot builds as well
240
ifeq ($(single_package),yes)
244
debian_patches += gcc-sysroot
245
debian_patches += goarch-aarch64
246
debian_patches += libgo-explicit-reservation
250
ifeq ($(with_softfloat),yes)
251
debian_patches += arm-multilib-soft-float
252
else ifeq ($(multilib),yes)
253
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
254
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
256
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
259
debian_patches += arm-multilib-defaults
261
ifeq ($(DEB_CROSS),yes)
262
debian_patches += cross-fixes
263
ifeq ($(with_deps_on_target_arch_pkgs),yes)
264
debian_patches += cross-ma-install-location
266
debian_patches += cross-install-location
270
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
271
debian_patches += hurd-changes
274
debian_patches += gcc-ice-hack gcc-ice-apport
276
#debian_patches += gold-and-ld
278
debian_patches += libjava-fixed-symlinks
280
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
281
# timeouts on the buildd's, Debian
282
debian_patches += libstdc++-no-testsuite
283
else ifeq ($(distribution),Ubuntu)
284
# timeouts on the buildd's, Ubuntu only
285
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
286
debian_patches += libstdc++-no-testsuite
289
debian_patches += ada-mips
290
debian_patches += libffi-ro-eh_frame_sect
292
debian_patches += gcc-multiarch
293
ifeq ($(with_multiarch_lib),yes)
294
ifneq ($(single_package),yes)
295
debian_patches += libjava-multiarch
298
debian_patches += libjava-nobiarch-check
299
debian_patches += config-ml
300
ifneq ($(single_package),yes)
301
ifeq ($(with_multiarch_cxxheaders),yes)
302
debian_patches += g++-multiarch-incdir
305
ifeq ($(DEB_CROSS),yes)
306
debian_patches += cross-no-locale-include
308
ifeq ($(biarch64),yes)
309
ifeq ($(DEB_CROSS),yes)
310
debian_patches += cross-biarch
313
debian_patches += gcc-multilib-multiarch
315
ifneq (,$(filter $(derivative),Ubuntu))
316
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
317
debian_patches += gcc-as-needed
320
#debian_patches += gcc-as-needed
322
debian_patches += mips-fix-loongson2f-nop
323
ifeq ($(derivative),Ubuntu)
324
ifeq ($(DEB_TARGET_ARCH),ppc64)
325
debian_patches += gcc-ppc64-O3
328
debian_patches += libgomp-kfreebsd-testsuite
330
series_stamp = $(stampdir)/02-series-stamp
331
series: $(series_stamp)
333
echo $(strip $(addsuffix .diff,$(debian_patches))) \
334
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
335
ifneq (,$(strip $(hardening_patches)))
336
ifneq ($(trunk_build),yes)
337
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
338
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
341
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
344
autotools_files = $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
345
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
346
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
347
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
349
autoconf_version = 2.64
350
ifeq ($(trunk_build),yes)
351
# The actual version depends on the build-dependencies set by
352
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
353
# correct version is installed.
357
# FIXME: the auto* stuff is done every time for every subdir, which
358
# leads to build errors. Idea: record the auto* calls in the patch
359
# files (AUTO <dir> <auto-command with options>) and run them separately,
360
# maybe only once per directory).
361
$(patch_stamp): $(unpack_stamp) $(series_stamp)
362
QUILT_PATCHES=$(patchdir) \
363
quilt --quiltrc /dev/null push -a || test $$? = 2
365
ifneq (,$(filter svn-updates, $(debian_patches)))
366
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
367
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
370
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
372
cd $(srcdir)/fixincludes && ./genfixes
374
for f in $(autotools_files) ; \
376
*/classpath/m4/acinclude.m4) \
378
*/configure.*|*/acinclude.m4) \
379
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
380
then echo "Skipping already regenerated file $$f." ; \
382
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
383
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
384
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
386
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
389
*) echo "Unknown file: $$f"; false; \
393
for i in $(debian_patches) $(hardening_patches); do \
394
echo -e "\n$$i:" >> pxxx; \
395
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
397
# -$(srcdir)/move-if-change pxxx $@
401
QUILT_PATCHES=$(patchdir) \
402
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
404
for f in $(autotools_files); do \
405
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
408
update-patches: $(series_stamp)
409
export QUILT_PATCHES=$(patchdir); \
410
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
411
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
412
while quilt push; do quilt refresh; done
414
patch: $(patch_stamp)
415
.PHONY: patch series quilt autotools