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