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),aarch64-libatomic) \
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 \
72
gcc-target-include-asm \
73
libgo-revert-timeout-exp \
74
$(if $(with_linaro_branch),,arm-sanitizer) \
76
libgo-setcontext-config \
86
gdb_depends := $(shell dpkg -s gdb | grep '^Depends:.*libpython3')
87
ifneq (,$(findstring libpython3,$(gdb_depends)))
88
debian_patches += libstdc++-python3
91
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
92
# libstdc++-nothumb-check \
98
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes)
99
hardening_patches += gcc-default-ssp
101
ifeq ($(distribution),Ubuntu)
102
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
103
hardening_patches += \
104
gcc-default-format-security \
105
gcc-default-fortify-source \
107
testsuite-hardening-format \
108
testsuite-hardening-printf-types \
109
testsuite-hardening-updates
113
# FIXME 4.5: Drop and adjust symbols files
114
ifneq (,$(findstring 4.4, $(PKGSOURCE)))
115
debian_patches += pr39491
118
ifeq ($(with_ada),yes)
122
ada-default-project-path \
123
ada-symbolic-tracebacks \
124
ada-library-project-files-soname
126
ifeq ($(biarch64),yes)
131
ifeq ($(with_libgnat),yes)
137
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes)
143
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd))
144
debian_patches += ada-kfreebsd-gnu \
148
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
150
gcc_ada_gcc-interface_Makefile.in \
151
ada-s-osinte-gnu.adb \
152
ada-s-osinte-gnu.ads \
168
ifneq ($(GFDL_INVARIANT_FREE),yes)
169
debian_patches += gdc-4.8-doc
171
debian_patches += gdc-texinfo
173
ifeq ($(with_libphobos),yes)
174
debian_patches += gdc-libphobos-build
176
debian_patches += gdc-driver-nophobos
178
ifeq (,$(filter $(DEB_TARGET_ARCH),amd64 i386))
179
debian_patches += disable-gdc-tests
182
debian_patches += gcc-d-lang
185
ifeq ($(DEB_TARGET_ARCH),alpha)
186
ifneq ($(GFDL_INVARIANT_FREE),yes)
187
debian_patches += alpha-ieee-doc
191
ifeq ($(DEB_TARGET_ARCH_CPU),amd64)
192
debian_patches += libjava-testsuite
195
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf))
196
debian_patches += libjava-armel-unwind
199
ifeq ($(DEB_TARGET_ARCH),armhf)
200
debian_patches += gcj-arm-mode
201
else ifeq ($(DEB_TARGET_ARCH),armel)
202
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
203
debian_patches += gcj-arm-mode
207
ifeq ($(DEB_TARGET_ARCH),m68k)
208
debian_patches += m68k-ada
209
debian_patches += m68k-revert-pr45144
210
debian_patches += pr52714
213
ifeq ($(DEB_TARGET_ARCH),powerpcspe)
214
debian_patches += powerpc_remove_many
215
debian_patches += powerpc_nofprs
218
ifeq ($(DEB_TARGET_ARCH),ppc64)
219
ifeq ($(distribution),Ubuntu)
220
#debian_patches += ibm-branch
224
ifeq ($(with_ibm_branch),yes)
225
debian_patches += gcc-ppc64el libffi-ppc64el
226
ifneq ($(GFDL_INVARIANT_FREE),yes)
227
debian_patches += gcc-ppc64el-doc
230
# this will cause all the configure files to be updated once libtool is patched
232
./src/gnattools/configure.ac \
233
./src/libobjc/configure.ac \
234
./src/libatomic/configure.ac \
235
./src/libstdc++-v3/configure.ac \
236
./src/libgfortran/configure.ac \
237
./src/boehm-gc/configure.ac \
238
./src/libsanitizer/configure.ac \
239
./src/fixincludes/configure.ac \
240
./src/lto-plugin/configure.ac \
241
./src/libgcc/configure.ac \
242
./src/libiberty/configure.ac \
243
./src/libffi/configure.ac \
244
./src/zlib/configure.ac \
245
./src/libbacktrace/configure.ac \
246
./src/libjava/classpath/configure.ac \
247
./src/libjava/libltdl/configure.ac \
248
./src/libjava/configure.ac \
249
./src/libitm/configure.ac \
250
./src/intl/configure.ac \
251
./src/libquadmath/configure.ac \
252
./src/libada/configure.ac \
253
./src/libdecnumber/configure.ac \
254
./src/gcc/configure.ac \
255
./src/libgo/configure.ac \
256
./src/libcpp/configure.ac \
258
./src/libssp/configure.ac \
259
./src/libmudflap/configure.ac \
260
./src/libgomp/configure.ac
263
#debian_patches += link-libs
265
# all patches below this line are applied for gcc-snapshot builds as well
267
ifeq ($(single_package),yes)
271
debian_patches += gcc-sysroot
275
ifeq ($(with_softfloat),yes)
276
debian_patches += arm-multilib-soft-float
277
else ifeq ($(multilib),yes)
278
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
279
debian_patches += arm-multilib-softfp$(if $(filter yes,$(DEB_CROSS)),-cross)
281
debian_patches += arm-multilib-soft$(if $(filter yes,$(DEB_CROSS)),-cross)
284
debian_patches += arm-multilib-defaults
286
ifeq ($(DEB_CROSS),yes)
287
debian_patches += cross-fixes
288
ifeq ($(with_deps_on_target_arch_pkgs),yes)
289
debian_patches += cross-ma-install-location
291
debian_patches += cross-install-location
295
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
296
debian_patches += hurd-changes
299
debian_patches += gcc-ice-hack gcc-ice-apport
301
#debian_patches += gold-and-ld
303
debian_patches += libjava-fixed-symlinks
304
debian_patches += libstdc++-arm-wno-abi
306
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
307
# timeouts on the buildd's, Debian
308
debian_patches += libstdc++-no-testsuite
309
else ifeq ($(distribution),Ubuntu)
310
# timeouts on the buildd's, Ubuntu only
311
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64))
312
debian_patches += libstdc++-no-testsuite
315
debian_patches += ada-mips
316
debian_patches += libffi-ro-eh_frame_sect
318
debian_patches += gcc-multiarch
319
ifeq ($(with_multiarch_lib),yes)
320
ifneq ($(single_package),yes)
321
debian_patches += libjava-multiarch
324
debian_patches += libjava-nobiarch-check
325
debian_patches += config-ml
326
ifneq ($(single_package),yes)
327
ifeq ($(with_multiarch_cxxheaders),yes)
328
debian_patches += g++-multiarch-incdir
331
ifeq ($(DEB_CROSS),yes)
332
debian_patches += cross-no-locale-include
334
ifeq ($(biarch64),yes)
335
ifeq ($(DEB_CROSS),yes)
336
debian_patches += cross-biarch
339
debian_patches += gcc-multilib-multiarch
340
ifeq ($(with_ibm_branch),yes)
341
debian_patches += powerpc64le-multilib-definitions
344
ifneq (,$(filter $(derivative),Ubuntu))
345
ifeq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid maverick))
346
debian_patches += gcc-as-needed
349
#debian_patches += gcc-as-needed
351
debian_patches += mips-fix-loongson2f-nop
352
ifeq ($(derivative),Ubuntu)
353
ifeq ($(DEB_TARGET_ARCH),ppc64)
354
debian_patches += gcc-ppc64-O3
357
debian_patches += libgomp-kfreebsd-testsuite
359
series_stamp = $(stampdir)/02-series-stamp
360
series: $(series_stamp)
362
echo $(strip $(addsuffix .diff,$(debian_patches))) \
363
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file)
364
ifneq (,$(strip $(hardening_patches)))
365
ifneq ($(trunk_build),yes)
366
echo $(strip $(addsuffix .diff,$(hardening_patches))) \
367
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file)
370
sed -r 's/(.)$$/\1 -p1/' -i $(series_file)
373
autotools_files += $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \
374
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \
375
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \
376
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4')))
378
autoconf_version = 2.64
379
ifeq ($(trunk_build),yes)
380
# The actual version depends on the build-dependencies set by
381
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
382
# correct version is installed.
386
# FIXME: the auto* stuff is done every time for every subdir, which
387
# leads to build errors. Idea: record the auto* calls in the patch
388
# files (AUTO <dir> <auto-command with options>) and run them separately,
389
# maybe only once per directory).
390
$(patch_stamp): $(unpack_stamp) $(series_stamp)
391
QUILT_PATCHES=$(patchdir) \
392
quilt --quiltrc /dev/null push -a || test $$? = 2
394
ifneq (,$(filter svn-updates, $(debian_patches)))
395
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \
396
$(patchdir)/svn-updates.diff > src/LAST_UPDATED
399
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi
401
cd $(srcdir)/fixincludes && ./genfixes
403
for f in $(autotools_files) ; \
405
*/classpath/m4/acinclude.m4) \
407
*/configure.*|*/acinclude.m4) \
408
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \
409
then echo "Skipping already regenerated file $$f." ; \
411
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \
412
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \
413
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \
415
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \
418
*) echo "Unknown file: $$f"; false; \
422
for i in $(debian_patches); do \
423
echo -e "\n$$i:" >> pxxx; \
424
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \
426
# -$(srcdir)/move-if-change pxxx $@
430
QUILT_PATCHES=$(patchdir) \
431
quilt --quiltrc /dev/null pop -a -R || test $$? = 2
433
for f in $(autotools_files); do \
434
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \
437
update-patches: $(series_stamp)
438
export QUILT_PATCHES=$(patchdir); \
439
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
440
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
441
while quilt push; do quilt refresh; done
443
patch: $(patch_stamp)
444
.PHONY: patch series quilt autotools