78
by Matthias Klose
* GCC 4.8.4 release. |
1 |
# -*- makefile -*-
|
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
|
|
7 |
||
8 |
.NOTPARALLEL: |
|
9 |
||
10 |
patchdir ?= debian/patches |
|
11 |
series_file ?= $(patchdir)/series |
|
12 |
||
13 |
# which patches should be applied?
|
|
14 |
||
15 |
debian_patches = \ |
|
16 |
svn-updates \ |
|
17 |
$(if $(with_linaro_branch),gcc-linaro) \ |
|
18 |
||
19 |
# svn-updates$(if $(with_linaro_branch),-linaro) \
|
|
20 |
||
21 |
ifeq ($(with_java),yes) |
|
22 |
# debian_patches += \
|
|
23 |
# svn-class-updates
|
|
24 |
endif
|
|
25 |
||
26 |
ifneq ($(GFDL_INVARIANT_FREE),yes) |
|
27 |
debian_patches += \ |
|
28 |
svn-doc-updates \ |
|
29 |
rename-info-files \ |
|
30 |
$(if $(with_linaro_branch),gcc-linaro-doc) \ |
|
31 |
||
32 |
# $(if $(with_linaro_branch),,svn-doc-updates) \
|
|
33 |
||
34 |
else
|
|
35 |
endif
|
|
36 |
debian_patches += \ |
|
37 |
gcc-gfdl-build |
|
38 |
||
39 |
# boehm-gc-nocheck: seems to work on the buildds \
|
|
40 |
||
41 |
debian_patches += \ |
|
42 |
gcc-textdomain \ |
|
43 |
gcc-driver-extra-langs |
|
44 |
||
45 |
ifeq ($(distribution),Ubuntu) |
|
46 |
ifneq (,$(filter $(distrelease),dapper hardy intrepid jaunty karmic lucid)) |
|
47 |
debian_patches += gcc-hash-style-both |
|
48 |
else
|
|
49 |
debian_patches += gcc-hash-style-gnu |
|
50 |
endif
|
|
51 |
else
|
|
52 |
debian_patches += gcc-hash-style-both |
|
53 |
endif
|
|
54 |
||
55 |
debian_patches += \ |
|
56 |
libstdc++-pic \ |
|
57 |
libstdc++-doclink \ |
|
58 |
libstdc++-man-3cxx \ |
|
59 |
libstdc++-test-installed \ |
|
60 |
libstdc++-host-headers \ |
|
61 |
libjava-stacktrace \ |
|
62 |
libjava-jnipath \ |
|
63 |
libjava-sjlj \ |
|
64 |
libjava-disable-plugin \ |
|
65 |
alpha-no-ev4-directive \ |
|
66 |
boehm-gc-getnprocs \ |
|
67 |
note-gnu-stack \ |
|
68 |
libgomp-omp_h-multilib \ |
|
69 |
sparc-force-cpu \ |
|
70 |
pr24619 \
|
|
71 |
gccgo-version \ |
|
72 |
pr47818 \
|
|
73 |
pr49944 \
|
|
74 |
gcc-base-version \ |
|
75 |
mudflapth-link \ |
|
76 |
libmudflap-x32 \ |
|
77 |
libgo-testsuite \ |
|
78 |
gcc-target-include-asm \ |
|
79 |
libgo-revert-timeout-exp \ |
|
80 |
arm-sanitizer \ |
|
81 |
aarch64-libjava \ |
|
82 |
||
83 |
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
|
|
84 |
# libstdc++-nothumb-check \
|
|
85 |
# TODO: update ...
|
|
86 |
# gcc-cloog-dl \
|
|
87 |
# libjava-rpath \
|
|
88 |
||
89 |
hardening_patches = |
|
90 |
ifneq ($(distribution),Debian) |
|
91 |
ifneq (,$(findstring gcc-4, $(PKGSOURCE))) |
|
92 |
# FIXME: bootstrap failure building the target libstdc++ library
|
|
93 |
#hardening_patches += gcc-default-format-security
|
|
94 |
hardening_patches += \ |
|
95 |
gcc-default-fortify-source \ |
|
96 |
gcc-default-relro \ |
|
97 |
testsuite-hardening-format \ |
|
98 |
testsuite-hardening-printf-types |
|
99 |
endif
|
|
100 |
endif
|
|
101 |
ifeq ($(with_ssp)-$(with_ssp_default),yes-yes) |
|
102 |
hardening_patches += gcc-default-ssp |
|
103 |
endif
|
|
104 |
||
105 |
# FIXME 4.5: Drop and adjust symbols files
|
|
106 |
ifneq (,$(findstring 4.4, $(PKGSOURCE))) |
|
107 |
debian_patches += pr39491 |
|
108 |
endif
|
|
109 |
||
110 |
ifeq ($(with_ada),yes) |
|
111 |
debian_patches += \ |
|
112 |
ada-driver-check \ |
|
113 |
ada-gcc-name \ |
|
114 |
ada-default-project-path \ |
|
115 |
ada-symbolic-tracebacks \ |
|
116 |
ada-library-project-files-soname |
|
117 |
||
118 |
ifeq ($(biarch64),yes) |
|
119 |
debian_patches += \ |
|
120 |
ada-nobiarch-check |
|
121 |
endif
|
|
122 |
||
123 |
ifeq ($(with_libgnat),yes) |
|
124 |
debian_patches += \ |
|
125 |
ada-link-lib \ |
|
126 |
ada-libgnatvsn \ |
|
127 |
ada-libgnatprj \ |
|
128 |
ada-acats |
|
129 |
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),yes-yes) |
|
130 |
debian_patches += \ |
|
131 |
ada-sjlj |
|
132 |
endif
|
|
133 |
endif
|
|
134 |
||
135 |
ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),kfreebsd hurd)) |
|
136 |
debian_patches += ada-kfreebsd-gnu \ |
|
137 |
ada-bug564232 |
|
138 |
endif
|
|
139 |
||
140 |
ifeq ($(DEB_TARGET_ARCH_OS),hurd) |
|
141 |
debian_patches += \ |
|
142 |
gcc_ada_gcc-interface_Makefile.in \ |
|
143 |
ada-s-osinte-gnu.adb \ |
|
144 |
ada-s-osinte-gnu.ads \ |
|
145 |
ada-s-taprop-gnu.adb |
|
146 |
endif
|
|
147 |
||
148 |
debian_patches += \ |
|
149 |
ada-link-shlib |
|
150 |
endif
|
|
151 |
||
152 |
ifeq ($(with_d),yes) |
|
153 |
debian_patches += \ |
|
154 |
gdc-4.8 \ |
|
155 |
gdc-versym-cpu \ |
|
156 |
gdc-versym-os |
|
157 |
||
158 |
ifeq ($(with_libphobos),yes) |
|
159 |
debian_patches += gdc-libphobos-build |
|
160 |
else
|
|
161 |
debian_patches += gdc-driver-nophobos |
|
162 |
endif
|
|
163 |
||
164 |
else
|
|
165 |
debian_patches += gcc-d-lang |
|
166 |
endif
|
|
167 |
||
168 |
ifeq ($(DEB_TARGET_ARCH),alpha) |
|
169 |
debian_patches += alpha-ieee mudflap-nocheck |
|
170 |
ifneq ($(GFDL_INVARIANT_FREE),yes) |
|
171 |
debian_patches += alpha-ieee-doc |
|
172 |
endif
|
|
173 |
endif
|
|
174 |
||
175 |
ifneq (,$(findstring $(DEB_TARGET_ARCH),arm armel armhf)) |
|
176 |
debian_patches += libjava-armel-unwind |
|
177 |
endif
|
|
178 |
||
179 |
ifeq ($(DEB_TARGET_ARCH),armhf) |
|
180 |
debian_patches += gcj-arm-mode |
|
181 |
else ifeq ($(DEB_TARGET_ARCH),armel) |
|
182 |
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise)) |
|
183 |
debian_patches += gcj-arm-mode |
|
184 |
endif
|
|
185 |
endif
|
|
186 |
||
187 |
ifeq ($(DEB_TARGET_ARCH),m68k) |
|
188 |
debian_patches += m68k-ada |
|
189 |
endif
|
|
190 |
||
191 |
ifeq ($(DEB_TARGET_ARCH),powerpcspe) |
|
192 |
debian_patches += powerpc_remove_many |
|
193 |
debian_patches += powerpc_nofprs |
|
194 |
endif
|
|
195 |
||
196 |
ifeq ($(DEB_TARGET_ARCH),ppc64) |
|
197 |
ifeq ($(distribution),Ubuntu) |
|
198 |
#debian_patches += ibm-branch
|
|
199 |
endif
|
|
200 |
endif
|
|
201 |
||
202 |
#debian_patches += link-libs
|
|
203 |
||
204 |
# all patches below this line are applied for gcc-snapshot builds as well
|
|
205 |
||
206 |
ifeq ($(single_package),yes) |
|
207 |
debian_patches = |
|
208 |
endif
|
|
209 |
||
210 |
debian_patches += gcc-sysroot |
|
211 |
debian_patches += \ |
|
212 |
ada-kfreebsd \ |
|
213 |
||
214 |
ifeq ($(with_softfloat),yes) |
|
215 |
debian_patches += arm-multilib-soft-float |
|
216 |
else ifeq ($(multilib),yes) |
|
217 |
ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise)) |
|
218 |
debian_patches += arm-multilib-softfp |
|
219 |
else
|
|
220 |
debian_patches += arm-multilib-soft |
|
221 |
endif
|
|
222 |
endif
|
|
223 |
debian_patches += arm-multilib-defaults |
|
224 |
||
225 |
ifeq ($(DEB_CROSS),yes) |
|
226 |
debian_patches += cross-fixes |
|
227 |
ifeq ($(with_deps_on_target_arch_pkgs),yes) |
|
228 |
debian_patches += cross-ma-install-location |
|
229 |
else
|
|
230 |
debian_patches += cross-install-location |
|
231 |
endif
|
|
232 |
endif
|
|
233 |
||
234 |
ifeq ($(DEB_TARGET_ARCH_OS),hurd) |
|
235 |
debian_patches += hurd-changes |
|
236 |
endif
|
|
237 |
||
238 |
debian_patches += gcc-ice-hack gcc-ice-apport |
|
239 |
#FIXME
|
|
240 |
#debian_patches += gold-and-ld
|
|
241 |
||
242 |
debian_patches += libjava-fixed-symlinks |
|
243 |
debian_patches += libstdc++-arm-wno-abi |
|
244 |
||
245 |
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel)) |
|
246 |
# timeouts on the buildd's, Debian
|
|
247 |
debian_patches += libstdc++-no-testsuite |
|
248 |
else ifeq ($(distribution),Ubuntu) |
|
249 |
# timeouts on the buildd's, Ubuntu only
|
|
250 |
ifneq (,$(filter $(DEB_TARGET_ARCH), armel ia64)) |
|
251 |
debian_patches += libstdc++-no-testsuite |
|
252 |
endif
|
|
253 |
endif
|
|
254 |
debian_patches += ada-mips |
|
255 |
debian_patches += libffi-ro-eh_frame_sect |
|
256 |
||
257 |
debian_patches += gcc-multiarch |
|
258 |
ifeq ($(with_multiarch_lib),yes) |
|
259 |
ifneq ($(single_package),yes) |
|
260 |
debian_patches += libjava-multiarch |
|
261 |
endif
|
|
262 |
endif
|
|
263 |
debian_patches += libjava-nobiarch-check |
|
264 |
debian_patches += config-ml |
|
265 |
ifneq ($(single_package),yes) |
|
266 |
ifeq ($(with_multiarch_cxxheaders),yes) |
|
267 |
debian_patches += g++-multiarch-incdir |
|
268 |
endif
|
|
269 |
endif
|
|
270 |
ifeq ($(DEB_CROSS),yes) |
|
271 |
debian_patches += cross-no-locale-include |
|
272 |
endif
|
|
273 |
ifeq ($(biarch64),yes) |
|
274 |
ifeq ($(DEB_CROSS),yes) |
|
275 |
debian_patches += cross-biarch |
|
276 |
endif
|
|
277 |
endif
|
|
278 |
debian_patches += gcc-multilib-multiarch |
|
279 |
||
280 |
ifeq (,$(filter $(distrelease),lenny squeeze wheezy sid experimental dapper hardy intrepid jaunty karmic lucid maverick)) |
|
281 |
debian_patches += gcc-as-needed |
|
282 |
endif
|
|
283 |
debian_patches += mips-fix-loongson2f-nop |
|
284 |
ifeq ($(distribution),Ubuntu) |
|
285 |
ifeq ($(DEB_TARGET_ARCH),ppc64) |
|
286 |
debian_patches += gcc-ppc64-O3 |
|
287 |
endif
|
|
288 |
endif
|
|
289 |
debian_patches += libgomp-kfreebsd-testsuite |
|
290 |
||
291 |
series_stamp = $(stampdir)/02-series-stamp |
|
292 |
series: $(series_stamp) |
|
293 |
$(series_stamp): |
|
294 |
echo $(strip $(addsuffix .diff,$(debian_patches))) \ |
|
295 |
| sed -r 's/ +/ /g' | tr " " "\n" > $(series_file) |
|
296 |
ifneq (,$(strip $(hardening_patches))) |
|
297 |
ifneq ($(trunk_build),yes) |
|
298 |
echo $(strip $(addsuffix .diff,$(hardening_patches))) \ |
|
299 |
| sed -r 's/ +/ /g' | tr " " "\n" >> $(series_file) |
|
300 |
endif
|
|
301 |
endif
|
|
302 |
sed -r 's/(.)$$/\1 -p1/' -i $(series_file) |
|
303 |
touch $@ |
|
304 |
||
305 |
autotools_files := $(addprefix ./,$(foreach file,$(shell lsdiff --no-filename \ |
|
306 |
$(foreach patch,$(debian_patches),$(patchdir)/$(patch).diff) \ |
|
307 |
| sed -r 's:[^/]+/src/:src/:' | sort | uniq),$(shell echo $(file) \ |
|
308 |
| egrep 'configure\.(ac|in)|Makefile\.(am|in)|acinclude.m4'))) |
|
309 |
||
310 |
autoconf_version = 2.64 |
|
311 |
ifeq ($(trunk_build),yes) |
|
312 |
# The actual version depends on the build-dependencies set by
|
|
313 |
# variable AUTO_BUILD_DEP in rules.conf. Here, we assume the
|
|
314 |
# correct version is installed.
|
|
315 |
#autoconf_version =
|
|
316 |
endif
|
|
317 |
||
318 |
# FIXME: the auto* stuff is done every time for every subdir, which
|
|
319 |
# leads to build errors. Idea: record the auto* calls in the patch
|
|
320 |
# files (AUTO <dir> <auto-command with options>) and run them separately,
|
|
321 |
# maybe only once per directory).
|
|
322 |
$(patch_stamp): $(unpack_stamp) $(series_stamp) |
|
323 |
QUILT_PATCHES=$(patchdir) \ |
|
324 |
quilt --quiltrc /dev/null push -a || test $$? = 2 |
|
325 |
||
326 |
ifneq (,$(filter svn-updates, $(debian_patches))) |
|
327 |
awk '/^EOF/ {exit} p==1 {print} /EOF$$/ {p=1}' \ |
|
328 |
$(patchdir)/svn-updates.diff > src/LAST_UPDATED |
|
329 |
endif
|
|
330 |
||
331 |
if ! test -f stamps/autotools_files ; then touch stamps/autotools_files ; fi |
|
332 |
||
333 |
cd $(srcdir)/fixincludes && ./genfixes |
|
334 |
||
335 |
for f in $(autotools_files) ; \ |
|
336 |
do case $$f in \ |
|
337 |
*/classpath/m4/acinclude.m4) \ |
|
338 |
: ;; \ |
|
339 |
*/configure.*|*/acinclude.m4) \ |
|
340 |
if grep ^"$$(md5sum $$f)"$$ stamps/autotools_files >/dev/null ; \ |
|
341 |
then echo "Skipping already regenerated file $$f." ; \ |
|
342 |
else \
|
|
343 |
echo "Running autoconf$(autoconf_version) in $$(dirname $$f)..." ; \ |
|
344 |
dir="$(CURDIR)"; cd $(CURDIR)/$$(dirname $$f) \ |
|
345 |
&& AUTOM4TE=/usr/bin/autom4te$(autoconf_version) autoconf$(autoconf_version) \ |
|
346 |
&& cd $$dir \ |
|
347 |
&& echo "$$(md5sum $$f)" >> stamps/autotools_files ; \ |
|
348 |
fi ;; \ |
|
349 |
*/Makefile.*) ;; \ |
|
350 |
*) echo "Unknown file: $$f"; false; \ |
|
351 |
esac; \ |
|
352 |
done
|
|
353 |
||
354 |
for i in $(debian_patches); do \ |
|
355 |
echo -e "\n$$i:" >> pxxx; \ |
|
356 |
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.diff >> pxxx; \ |
|
357 |
done
|
|
358 |
# -$(srcdir)/move-if-change pxxx $@
|
|
359 |
mv pxxx $@ |
|
360 |
||
361 |
unpatch: |
|
362 |
QUILT_PATCHES=$(patchdir) \ |
|
363 |
quilt --quiltrc /dev/null pop -a -R || test $$? = 2 |
|
364 |
rm -rf .pc |
|
365 |
for f in $(autotools_files); do \ |
|
366 |
rm -f $$(echo $$f | sed -r 's/\.(ac|am|in)$$//'); \ |
|
367 |
done
|
|
368 |
||
369 |
update-patches: $(series_stamp) |
|
370 |
export QUILT_PATCHES=$(patchdir); \ |
|
371 |
export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \ |
|
372 |
export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \ |
|
373 |
while quilt push; do quilt refresh; done |
|
374 |
||
375 |
patch: $(patch_stamp) |
|
376 |
.PHONY: patch series quilt autotools |