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),pr58578) \
19
$(if $(with_linaro_branch),arm-fix-add-pattern) \
21
# svn-updates$(if $(with_linaro_branch),-linaro) \
23
ifeq ($(with_java),yes)
28
ifneq ($(GFDL_INVARIANT_FREE),yes)
31
$(if $(with_linaro_branch),gcc-linaro-doc) \
34
# $(if $(with_linaro_branch),,svn-doc-updates) \
41
# boehm-gc-nocheck: seems to work on the buildds \
45
gcc-driver-extra-langs
47
ifneq (,$(filter $(distrelease),etch lenny squeeze wheezy dapper hardy intrepid jaunty karmic lucid))
48
debian_patches += gcc-hash-style-both
50
debian_patches += gcc-hash-style-gnu
57
libstdc++-test-installed \
61
libjava-disable-plugin \
62
alpha-no-ev4-directive \
65
libgomp-omp_h-multilib \
75
gcc-target-include-asm \
76
libgo-revert-timeout-exp \
77
$(if $(with_linaro_branch),,arm-sanitizer) \
79
libgo-setcontext-config \
89
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
90
# libstdc++-nothumb-check \
96
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
97
hardening_patches += gcc-default-ssp
99
ifneq ($(distribution),Debian)
100
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
101
hardening_patches += \
102
gcc-default-format-security \
103
gcc-default-fortify-source \
105
testsuite-hardening-format \
106
testsuite-hardening-printf-types \
107
testsuite-hardening-updates
111
# FIXME 4.5: Drop and adjust symbols files
112
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
113
debian_patches += pr39491
116
ifeq ($(with_ada),yes)
120
ada-default-project-path \
121
ada-symbolic-tracebacks \
122
ada-library-project-files-soname
124
ifeq ($(biarch64),yes)
129
ifeq ($(with_libgnat),yes)
135
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
141
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
142
debian_patches += ada-kfreebsd-gnu \
146
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
148
gcc_ada_gcc-interface_Makefile.in \
149
ada-s-osinte-gnu.adb \
150
ada-s-osinte-gnu.ads \
166
ifneq ($(GFDL_INVARIANT_FREE),yes)
167
debian_patches += gdc-4.8-doc
169
debian_patches += gdc-texinfo
171
ifeq ($(with_libphobos),yes)
172
debian_patches += gdc-libphobos-build
174
debian_patches += gdc-driver-nophobos
177
debian_patches += gcc-d-lang
180
ifeq ($(DEB_TARGET_ARCH),alpha)
181
debian_patches += alpha-ieee mudflap-nocheck
182
ifneq ($(GFDL_INVARIANT_FREE),yes)
183
debian_patches += alpha-ieee-doc
187
ifeq ($(DEB_TARGET_ARCH_CPU),amd64)
188
debian_patches += libjava-testsuite
191
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
192
debian_patches += libjava-armel-unwind
195
ifeq ($(DEB_TARGET_ARCH),armhf)
196
debian_patches += gcj-arm-mode
197
else ifeq ($(DEB_TARGET_ARCH),armel)
198
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
199
debian_patches += gcj-arm-mode
203
ifeq ($(DEB_TARGET_ARCH),m68k)
204
debian_patches += m68k-ada
205
debian_patches += m68k-revert-pr45144
206
debian_patches += pr52714
209
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
210
debian_patches += powerpc_remove_many
211
debian_patches += powerpc_nofprs
214
ifeq ($(DEB_TARGET_ARCH),ppc64)
215
ifeq ($(distribution),Ubuntu)
216
#debian_patches += ibm-branch
220
#debian_patches += link-libs
222
# all patches below this line are applied for gcc-snapshot builds as well
224
ifeq ($(single_package),yes)
228
debian_patches += gcc-sysroot
232
ifeq ($(with_softfloat),yes)
233
debian_patches += arm-multilib-soft-float
234
else ifeq ($(multilib),yes)
235
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
236
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
238
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
241
debian_patches += arm-multilib-defaults
243
ifeq ($(DEB_CROSS),yes)
244
debian_patches += cross-fixes
245
ifeq ($(with_deps_on_target_arch_pkgs),yes)
246
debian_patches += cross-ma-install-location
248
debian_patches += cross-install-location
252
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
253
debian_patches += hurd-changes
256
debian_patches += gcc-ice-hack gcc-ice-apport
258
#debian_patches += gold-and-ld
260
debian_patches += libjava-fixed-symlinks
261
debian_patches += libstdc++-arm-wno-abi
263
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
264
# timeouts on the buildd's, Debian
265
debian_patches += libstdc++-no-testsuite
266
else ifeq ($(distribution),Ubuntu)
267
# timeouts on the buildd's, Ubuntu only
268
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
269
debian_patches += libstdc++-no-testsuite
272
debian_patches += ada-mips
273
debian_patches += libffi-ro-eh_frame_sect
275
debian_patches += gcc-multiarch
276
ifeq ($(with_multiarch_lib),yes)
277
ifneq ($(single_package),yes)
278
debian_patches += libjava-multiarch
281
debian_patches += libjava-nobiarch-check
282
debian_patches += config-ml
283
ifneq ($(single_package),yes)
284
ifeq ($(with_multiarch_cxxheaders),yes)
285
debian_patches += g++-multiarch-incdir
288
ifeq ($(DEB_CROSS),yes)
289
debian_patches += cross-no-locale-include
291
ifeq ($(biarch64),yes)
292
ifeq ($(DEB_CROSS),yes)
293
debian_patches += cross-biarch
296
debian_patches += gcc-multilib-multiarch
298
ifneq (,$(filter $(derivative),Ubuntu))
299
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
300
debian_patches += gcc-as-needed
303
#debian_patches += gcc-as-needed
305
debian_patches += mips-fix-loongson2f-nop
306
ifeq ($(distribution),Ubuntu)
307
ifeq ($(DEB_TARGET_ARCH),ppc64)
308
debian_patches += gcc-ppc64-O3
311
debian_patches += libgomp-kfreebsd-testsuite
313
series_stamp = $(stampdir)/02-series-stamp
314
series: $(series_stamp)
316
echo $(strip $(addsuffix .diff,$(debian_patches))) \
317
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
318
ifneq (,$(strip $(hardening_patches)))
319
ifneq ($(trunk_build),yes)
320
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
321
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
324
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
327
autotools_files := $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
328
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
329
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
330
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
332
autoconf_version = 2.64
333
ifeq ($(trunk_build),yes)
334
# The actual version depends on the build-dependencies set by
335
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
336
# correct version is installed.
340
# FIXME: the auto* stuff is done every time for every subdir, which
341
# leads to build errors. Idea: record the auto* calls in the patch
342
# files (AUTO <dir> <auto-command with options>) and run them separately,
343
# maybe only once per directory).
344
$(patch_stamp): $(unpack_stamp) $(series_stamp)
345
QUILT_PATCHES=$(patchdir) \
346
quilt --quiltrc /dev/null push -a || test $$? = 2
348
ifneq (,$(filter svn-updates, $(debian_patches)))
349
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
350
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
353
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
355
cd $(srcdir)/fixincludes && ./genfixes
357
for f in $(autotools_files) ; \
359
*/classpath/m4/acinclude.m4) \
361
*/configure.*|*/acinclude.m4) \
362
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
363
then echo "Skipping already regenerated file $$f." ; \
365
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
366
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
367
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
369
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
372
*) echo "Unknown file: $$f"; false; \
376
for i in $(debian_patches); do \
377
echo -e "\n$$i:" >> pxxx; \
378
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
380
# -$(srcdir)/move-if-change pxxx $@
384
QUILT_PATCHES=$(patchdir) \
385
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
387
for f in $(autotools_files); do \
388
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
391
update-patches: $(series_stamp)
392
export QUILT_PATCHES=$(patchdir); \
393
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
394
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
395
while quilt push; do quilt refresh; done
397
patch: $(patch_stamp)
398
.PHONY: patch series quilt autotools