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-linaro-no-local) \
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 \
71
gcc-target-include-asm \
72
libgo-revert-timeout-exp \
73
$(if $(with_linaro_branch),,arm-sanitizer) \
74
libgo-setcontext-config \
87
$(if $(with_linaro_branch),pr59744) \
88
$(if $(with_linaro_branch),aarch64-call-frame-info) \
89
$(if $(with_linaro_branch),aarch64-abi-fix) \
90
fix-ffi_call_VFP-with-no-VFP-argument \
92
gdb_depends := $(shell dpkg -s gdb | grep '^Depends:.*libpython3')
93
ifneq (,$(findstring libpython3,$(gdb_depends)))
94
debian_patches += libstdc++-python3
97
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
98
# libstdc++-nothumb-check \
104
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
105
hardening_patches += gcc-default-ssp
106
hardening_patches += gcc-default-format-security
108
ifeq ($(distribution),Ubuntu)
109
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
110
hardening_patches += \
111
gcc-default-fortify-source \
113
testsuite-hardening-format \
114
testsuite-hardening-printf-types \
115
testsuite-hardening-updates
119
# FIXME 4.5: Drop and adjust symbols files
120
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
121
debian_patches += pr39491
124
ifeq ($(with_ada),yes)
128
ada-default-project-path \
129
ada-symbolic-tracebacks \
130
ada-library-project-files-soname \
133
ifeq ($(biarch64),yes)
138
ifeq ($(with_libgnat),yes)
144
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
150
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
152
gcc_ada_gcc-interface_Makefile.in \
153
ada-s-osinte-gnu.adb \
154
ada-s-osinte-gnu.ads \
170
ifneq ($(GFDL_INVARIANT_FREE),yes)
171
debian_patches += gdc-4.8-doc
173
debian_patches += gdc-texinfo
175
ifeq ($(with_libphobos),yes)
176
debian_patches += gdc-libphobos-build
178
debian_patches += gdc-driver-nophobos
180
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
181
debian_patches += disable-gdc-tests
184
debian_patches += gcc-d-lang
187
ifeq ($(DEB_TARGET_ARCH),alpha)
188
debian_patches += alpha-ieee
189
ifneq ($(GFDL_INVARIANT_FREE),yes)
190
debian_patches += alpha-ieee-doc
194
ifeq ($(DEB_TARGET_ARCH_CPU),amd64)
195
debian_patches += libjava-testsuite
198
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
199
debian_patches += libjava-armel-unwind
202
ifeq ($(DEB_TARGET_ARCH),armhf)
203
debian_patches += gcj-arm-mode
204
else ifeq ($(DEB_TARGET_ARCH),armel)
205
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
206
debian_patches += gcj-arm-mode
210
ifeq ($(DEB_TARGET_ARCH),m68k)
211
debian_patches += m68k-ada
212
debian_patches += m68k-revert-pr45144
213
debian_patches += pr52714
214
debian_patches += pr58369
215
debian_patches += pr52306
218
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
219
debian_patches += powerpc_remove_many
220
debian_patches += powerpc_nofprs
223
ifeq ($(with_ibm_branch),yes)
224
debian_patches += gcc-ppc64el
225
ifneq ($(GFDL_INVARIANT_FREE),yes)
226
debian_patches += gcc-ppc64el-doc
229
# this will cause all the configure files to be updated once libtool is patched
231
./src/gnattools/configure.ac \
232
./src/libobjc/configure.ac \
233
./src/libatomic/configure.ac \
234
./src/libstdc++-v3/configure.ac \
235
./src/libgfortran/configure.ac \
236
./src/boehm-gc/configure.ac \
237
./src/libsanitizer/configure.ac \
238
./src/fixincludes/configure.ac \
239
./src/lto-plugin/configure.ac \
240
./src/libgcc/configure.ac \
241
./src/libiberty/configure.ac \
242
./src/libffi/configure.ac \
243
./src/zlib/configure.ac \
244
./src/libbacktrace/configure.ac \
245
./src/libjava/classpath/configure.ac \
246
./src/libjava/libltdl/configure.ac \
247
./src/libjava/configure.ac \
248
./src/libitm/configure.ac \
249
./src/intl/configure.ac \
250
./src/libquadmath/configure.ac \
251
./src/libada/configure.ac \
252
./src/libdecnumber/configure.ac \
253
./src/gcc/configure.ac \
254
./src/libgo/configure.ac \
255
./src/libcpp/configure.ac \
257
./src/libssp/configure.ac \
258
./src/libmudflap/configure.ac \
259
./src/libgomp/configure.ac
262
#debian_patches += link-libs
264
# all patches below this line are applied for gcc-snapshot builds as well
266
ifeq ($(single_package),yes)
270
debian_patches += gcc-sysroot
271
debian_patches += goarch-aarch64
272
debian_patches += libgo-explicit-reservation
276
ifeq ($(with_softfloat),yes)
277
debian_patches += arm-multilib-soft-float
278
else ifeq ($(multilib),yes)
279
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
280
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
282
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
285
debian_patches += arm-multilib-defaults
287
ifeq ($(DEB_CROSS),yes)
288
debian_patches += cross-fixes
289
ifeq ($(with_deps_on_target_arch_pkgs),yes)
290
debian_patches += cross-ma-install-location
292
debian_patches += cross-install-location
296
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
297
debian_patches += hurd-changes
300
debian_patches += gcc-ice-hack gcc-ice-apport
302
#debian_patches += gold-and-ld
304
debian_patches += libjava-fixed-symlinks
305
debian_patches += libstdc++-arm-wno-abi
307
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
308
# timeouts on the buildd's, Debian
309
debian_patches += libstdc++-no-testsuite
310
else ifeq ($(distribution),Ubuntu)
311
# timeouts on the buildd's, Ubuntu only
312
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
313
debian_patches += libstdc++-no-testsuite
316
debian_patches += ada-mips
317
debian_patches += libffi-ro-eh_frame_sect
319
debian_patches += gcc-multiarch$(if $(with_ibm_branch),-ibm)
320
ifeq ($(with_multiarch_lib),yes)
321
ifneq ($(single_package),yes)
322
debian_patches += libjava-multiarch
325
debian_patches += libjava-nobiarch-check
326
debian_patches += config-ml
327
ifneq ($(single_package),yes)
328
ifeq ($(with_multiarch_cxxheaders),yes)
329
debian_patches += g++-multiarch-incdir
332
ifeq ($(DEB_CROSS),yes)
333
debian_patches += cross-no-locale-include
335
ifeq ($(biarch64),yes)
336
ifeq ($(DEB_CROSS),yes)
337
debian_patches += cross-biarch
340
debian_patches += gcc-multilib-multiarch$(if $(with_ibm_branch),-ibm)
342
ifneq (,$(filter $(derivative),Ubuntu))
343
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
344
debian_patches += gcc-as-needed
347
#debian_patches += gcc-as-needed
349
debian_patches += mips-fix-loongson2f-nop
350
ifeq ($(derivative),Ubuntu)
351
ifeq ($(DEB_TARGET_ARCH),ppc64)
352
debian_patches += gcc-ppc64-O3
355
debian_patches += libgomp-kfreebsd-testsuite
357
series_stamp = $(stampdir)/02-series-stamp
358
series: $(series_stamp)
360
echo $(strip $(addsuffix .diff,$(debian_patches))) \
361
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
362
ifneq (,$(strip $(hardening_patches)))
363
ifneq ($(trunk_build),yes)
364
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
365
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
368
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
371
autotools_files += $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
372
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
373
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
374
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
376
autoconf_version = 2.64
377
ifeq ($(trunk_build),yes)
378
# The actual version depends on the build-dependencies set by
379
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
380
# correct version is installed.
384
# FIXME: the auto* stuff is done every time for every subdir, which
385
# leads to build errors. Idea: record the auto* calls in the patch
386
# files (AUTO <dir> <auto-command with options>) and run them separately,
387
# maybe only once per directory).
388
$(patch_stamp): $(unpack_stamp) $(series_stamp)
389
QUILT_PATCHES=$(patchdir) \
390
quilt --quiltrc /dev/null push -a || test $$? = 2
392
ifneq (,$(filter svn-updates, $(debian_patches)))
393
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
394
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
397
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
399
cd $(srcdir)/fixincludes && ./genfixes
401
for f in $(autotools_files) ; \
403
*/classpath/m4/acinclude.m4) \
405
*/configure.*|*/acinclude.m4) \
406
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
407
then echo "Skipping already regenerated file $$f." ; \
409
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
410
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
411
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
413
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
416
*) echo "Unknown file: $$f"; false; \
420
for i in $(debian_patches) $(hardening_patches); do \
421
echo -e "\n$$i:" >> pxxx; \
422
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
424
# -$(srcdir)/move-if-change pxxx $@
428
QUILT_PATCHES=$(patchdir) \
429
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
431
for f in $(autotools_files); do \
432
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
435
update-patches: $(series_stamp)
436
export QUILT_PATCHES=$(patchdir); \
437
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
438
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
439
while quilt push; do quilt refresh; done
441
patch: $(patch_stamp)
442
.PHONY: patch series quilt autotools