| @@ -1,20 +1,20 @@ | | | @@ -1,20 +1,20 @@ |
1 | #!/bin/sh | | 1 | #!/bin/sh |
2 | # $NetBSD: mknative-gcc.old,v 1.10 2021/04/11 01:44:14 mrg Exp $ | | 2 | # $NetBSD: mknative-gcc.old,v 1.11 2023/07/28 08:05:29 mrg Exp $ |
3 | # | | 3 | # |
4 | # Shell script for generating all the constants needed for a native | | 4 | # Shell script for generating all the constants needed for a native |
5 | # platform build of gcc. | | 5 | # platform build of gcc. |
6 | # | | 6 | # |
7 | # This version is for GCC 9.3 | | 7 | # This version is for GCC 10.3 |
8 | | | 8 | |
9 | # initialise | | 9 | # initialise |
10 | | | 10 | |
11 | _TMPDIR=$2 | | 11 | _TMPDIR=$2 |
12 | _TOP=$3 | | 12 | _TOP=$3 |
13 | _SRC=$4 | | 13 | _SRC=$4 |
14 | _PLATFORM=$5 | | 14 | _PLATFORM=$5 |
15 | _MACHINE_ARCH=$6 | | 15 | _MACHINE_ARCH=$6 |
16 | _DESTDIR=$7 | | 16 | _DESTDIR=$7 |
17 | _TOOLDIR=$8 | | 17 | _TOOLDIR=$8 |
18 | _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'` | | 18 | _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'` |
19 | _GNU_DIST=`cd ${_VPATH}; pwd` | | 19 | _GNU_DIST=`cd ${_VPATH}; pwd` |
20 | | | 20 | |
| @@ -224,28 +224,30 @@ get_libstdcxx_v3 () { | | | @@ -224,28 +224,30 @@ get_libstdcxx_v3 () { |
224 | _ver="$2" | | 224 | _ver="$2" |
225 | | | 225 | |
226 | mkdir -p $_OUTDIR/lib/$_subdir/arch/$_MACHINE_ARCH | | 226 | mkdir -p $_OUTDIR/lib/$_subdir/arch/$_MACHINE_ARCH |
227 | | | 227 | |
228 | _build_headers="c++config.h cxxabi_tweaks.h" | | 228 | _build_headers="c++config.h cxxabi_tweaks.h" |
229 | _headers1="backward_headers c_base_headers_extra" | | 229 | _headers1="backward_headers c_base_headers_extra" |
230 | _headers1="$_headers1 c_base_headers_extra_install" | | 230 | _headers1="$_headers1 c_base_headers_extra_install" |
231 | _headers1="$_headers1 tr1_headers tr2_headers" | | 231 | _headers1="$_headers1 tr1_headers tr2_headers" |
232 | _headers1="$_headers1 decimal_headers c_compatibility_headers_install" | | 232 | _headers1="$_headers1 decimal_headers c_compatibility_headers_install" |
233 | _headers1="$_headers1 debug_headers parallel_headers" | | 233 | _headers1="$_headers1 debug_headers parallel_headers" |
234 | _headers1="$_headers1 pb_headers1 pb_headers2 pb_headers3 pb_headers4" | | 234 | _headers1="$_headers1 pb_headers1 pb_headers2 pb_headers3 pb_headers4" |
235 | _headers1="$_headers1 pb_headers5 pb_headers6 pb_headers7" | | 235 | _headers1="$_headers1 pb_headers5 pb_headers6 pb_headers7" |
236 | _headers1="$_headers1 bits_headers ext_headers host_headers" | | 236 | _headers1="$_headers1 bits_headers ext_headers host_headers" |
237 | _headers1="$_headers1 thread_host_headers pstl_headers" | | 237 | _headers1="$_headers1 pstl_headers" |
238 | _headers1="$_headers1 profile_headers profile_impl_headers" | | 238 | _headers1="$_headers1 profile_headers profile_impl_headers" |
| | | 239 | _headers1="$_headers1 experimental_headers experimental_bits_headers" |
| | | 240 | _headers1="$_headers1 ext_host_headers" |
239 | | | 241 | |
240 | # build files | | 242 | # build files |
241 | for h in $_build_headers; do | | 243 | for h in $_build_headers; do |
242 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/$h \ | | 244 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/$h \ |
243 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h | | 245 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h |
244 | done | | 246 | done |
245 | | | 247 | |
246 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/gstdint.h \ | | 248 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/gstdint.h \ |
247 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/gstdint.h | | 249 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/gstdint.h |
248 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/symver-config.h \ | | 250 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/symver-config.h \ |
249 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/config.h | | 251 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/config.h |
250 | | | 252 | |
251 | { | | 253 | { |
| @@ -264,32 +266,30 @@ get_libstdcxx_v3 () { | | | @@ -264,32 +266,30 @@ get_libstdcxx_v3 () { |
264 | | | 266 | |
265 | # includes | | 267 | # includes |
266 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ | | 268 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
267 | c_base_headers std_headers | sed -e 's#/[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' | | 269 | c_base_headers std_headers | sed -e 's#/[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' |
268 | | | 270 | |
269 | # src | | 271 | # src |
270 | getvars $_PLATFORM/libstdc++-v3/src/Makefile \ | | 272 | getvars $_PLATFORM/libstdc++-v3/src/Makefile \ |
271 | libstdc___la_SOURCES | sed 's/^G_libstdc___la_SOURCES=/G_SRC_SOURCES=/' | | 273 | libstdc___la_SOURCES | sed 's/^G_libstdc___la_SOURCES=/G_SRC_SOURCES=/' |
272 | getvars $_PLATFORM/libstdc++-v3/src/c++17/Makefile \ | | 274 | getvars $_PLATFORM/libstdc++-v3/src/c++17/Makefile \ |
273 | libc__17convenience_la_SOURCES | \ | | 275 | libc__17convenience_la_SOURCES | \ |
274 | sed -e 's/^G_libc__17convenience_la_SOURCES=/G_CPP17_SOURCES=/' | | 276 | sed -e 's/^G_libc__17convenience_la_SOURCES=/G_CPP17_SOURCES=/' |
275 | getvars $_PLATFORM/libstdc++-v3/src/c++11/Makefile \ | | 277 | getvars $_PLATFORM/libstdc++-v3/src/c++11/Makefile \ |
276 | libc__11convenience_la_SOURCES | \ | | 278 | libc__11convenience_la_SOURCES | \ |
277 | sed -e 's/^G_libc__11convenience_la_SOURCES=/G_CPP11_SOURCES=/' \ | | 279 | sed -e 's/^G_libc__11convenience_la_SOURCES=/G_CPP11_SOURCES=/' |
278 | -e 's/codecvt.cc/c11-codecvt.cc/' | | | |
279 | getvars $_PLATFORM/libstdc++-v3/src/c++98/Makefile \ | | 280 | getvars $_PLATFORM/libstdc++-v3/src/c++98/Makefile \ |
280 | GLIBCXX_ABI_FLAGS libc__98convenience_la_SOURCES | \ | | 281 | GLIBCXX_ABI_FLAGS libc__98convenience_la_SOURCES | \ |
281 | sed -e 's/^G_libc__98convenience_la_SOURCES=/G_CPP98_SOURCES=/' \ | | 282 | sed -e 's/^G_libc__98convenience_la_SOURCES=/G_CPP98_SOURCES=/' |
282 | -e 's/codecvt.cc/c98-codecvt.cc/' | | | |
283 | getvars $_PLATFORM/libstdc++-v3/src/filesystem/Makefile \ | | 283 | getvars $_PLATFORM/libstdc++-v3/src/filesystem/Makefile \ |
284 | libstdc__fs_la_SOURCES | \ | | 284 | libstdc__fs_la_SOURCES | \ |
285 | sed -e 's/^G_libstdc__fs_la_SOURCES=/G_FILESYSTEM_SOURCES=/' | | 285 | sed -e 's/^G_libstdc__fs_la_SOURCES=/G_FILESYSTEM_SOURCES=/' |
286 | getvars $_PLATFORM/libstdc++-v3/Makefile ATOMICITY_SRCDIR \ | | 286 | getvars $_PLATFORM/libstdc++-v3/Makefile ATOMICITY_SRCDIR \ |
287 | BASIC_FILE_CC CLOCALE_CC CCODECVT_CC CCOLLATE_CC \ | | 287 | BASIC_FILE_CC CLOCALE_CC CCODECVT_CC CCOLLATE_CC \ |
288 | CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC \ | | 288 | CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC \ |
289 | CPU_OPT_BITS_RANDOM | | 289 | CPU_OPT_BITS_RANDOM |
290 | | | 290 | |
291 | # includes | | 291 | # includes |
292 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ | | 292 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
293 | $_headers1 | \ | | 293 | $_headers1 | \ |
294 | sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/##g' \ | | 294 | sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/##g' \ |
295 | -e 's#\${GNUHOSTDIST}/libstdc++-v3/config/##g' | | 295 | -e 's#\${GNUHOSTDIST}/libstdc++-v3/config/##g' |
| @@ -302,29 +302,31 @@ get_libstdcxx_v3 () { | | | @@ -302,29 +302,31 @@ get_libstdcxx_v3 () { |
302 | ##### lib/libsanitizer ##### | | 302 | ##### lib/libsanitizer ##### |
303 | | | 303 | |
304 | get_libsanitizer () { | | 304 | get_libsanitizer () { |
305 | _subdir="$1" | | 305 | _subdir="$1" |
306 | | | 306 | |
307 | mkdir -p $_OUTDIR/lib/$_subdir/arch/$_MACHINE_ARCH | | 307 | mkdir -p $_OUTDIR/lib/$_subdir/arch/$_MACHINE_ARCH |
308 | | | 308 | |
309 | { | | 309 | { |
310 | getvars $_PLATFORM/libsanitizer/asan/Makefile \ | | 310 | getvars $_PLATFORM/libsanitizer/asan/Makefile \ |
311 | asan_files | | 311 | asan_files |
312 | getvars $_PLATFORM/libsanitizer/lsan/Makefile \ | | 312 | getvars $_PLATFORM/libsanitizer/lsan/Makefile \ |
313 | lsan_files | | 313 | lsan_files |
314 | getvars $_PLATFORM/libsanitizer/tsan/Makefile \ | | 314 | getvars $_PLATFORM/libsanitizer/tsan/Makefile \ |
315 | tsan_plugin_files | | 315 | tsan_files |
316 | getvars $_PLATFORM/libsanitizer/ubsan/Makefile \ | | 316 | getvars $_PLATFORM/libsanitizer/ubsan/Makefile \ |
317 | ubsan_plugin_files | | 317 | ubsan_files |
| | | 318 | getvars $_PLATFORM/libsanitizer/interception/Makefile \ |
| | | 319 | interception_files |
318 | | | 320 | |
319 | } | sanitise_includes \ | | 321 | } | sanitise_includes \ |
320 | | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/defs.mk | | 322 | | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/defs.mk |
321 | } | | 323 | } |
322 | | | 324 | |
323 | ##### usr.bin/gcc* ##### | | 325 | ##### usr.bin/gcc* ##### |
324 | | | 326 | |
325 | get_gcc_bootstrap () { | | 327 | get_gcc_bootstrap () { |
326 | _subdir="$1" | | 328 | _subdir="$1" |
327 | mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH | | 329 | mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH |
328 | for f in auto-host tm config; do | | 330 | for f in auto-host tm config; do |
329 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h | | 331 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h |
330 | done | | 332 | done |
| @@ -389,27 +391,27 @@ get_gcc () { | | | @@ -389,27 +391,27 @@ get_gcc () { |
389 | | | 391 | |
390 | getvars gcc/Makefile \ | | 392 | getvars gcc/Makefile \ |
391 | EXTRA_HEADERS \ | | 393 | EXTRA_HEADERS \ |
392 | | write_mk $_OUTDIRBASE/usr.bin/include/arch/$_MACHINE_ARCH.mk | | 394 | | write_mk $_OUTDIRBASE/usr.bin/include/arch/$_MACHINE_ARCH.mk |
393 | | | 395 | |
394 | getvars gcc/Makefile \ | | 396 | getvars gcc/Makefile \ |
395 | OBJS-libcommon \ | | 397 | OBJS-libcommon \ |
396 | | write_mk $_OUTDIRBASE/usr.bin/common/defs.mk | | 398 | | write_mk $_OUTDIRBASE/usr.bin/common/defs.mk |
397 | getvars gcc/Makefile \ | | 399 | getvars gcc/Makefile \ |
398 | OBJS-libcommon-target \ | | 400 | OBJS-libcommon-target \ |
399 | | write_mk $_OUTDIRBASE/usr.bin/common-target/arch/$_MACHINE_ARCH.mk | | 401 | | write_mk $_OUTDIRBASE/usr.bin/common-target/arch/$_MACHINE_ARCH.mk |
400 | | | 402 | |
401 | write_c $_OUTDIRBASE/usr.bin/libcpp/arch/$_MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h | | 403 | write_c $_OUTDIRBASE/usr.bin/libcpp/arch/$_MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h |
402 | hfiles='auto-host configargs config bconfig bversion plugin-version multilib tm' | | 404 | hfiles='auto-host configargs config bconfig bversion plugin-version multilib tm omp-device-properties' |
403 | for f in $hfiles; do | | 405 | for f in $hfiles; do |
404 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h | | 406 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h |
405 | if [ "${_MACHINE_ARCH}" = "powerpc" -a "${f}" = "configargs" ] | | 407 | if [ "${_MACHINE_ARCH}" = "powerpc" -a "${f}" = "configargs" ] |
406 | then | | 408 | then |
407 | ex <<__EOF__ $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h | | 409 | ex <<__EOF__ $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h |
408 | /configuration_arguments/ s/$// | | 410 | /configuration_arguments/ s/$// |
409 | ya | | 411 | ya |
410 | i | | 412 | i |
411 | #ifdef _SOFT_FLOAT | | 413 | #ifdef _SOFT_FLOAT |
412 | . | | 414 | . |
413 | pu | | 415 | pu |
414 | s/";$/ -with-float=soft";/ | | 416 | s/";$/ -with-float=soft";/ |
415 | a | | 417 | a |
| @@ -481,27 +483,27 @@ libgcc*-bootstrap) | | | @@ -481,27 +483,27 @@ libgcc*-bootstrap) |
481 | libstdc++-bootstrap) | | 483 | libstdc++-bootstrap) |
482 | get_libstdcxx_v3 libstdc++-v3 gcc | | 484 | get_libstdcxx_v3 libstdc++-v3 gcc |
483 | exit 0 | | 485 | exit 0 |
484 | ;; | | 486 | ;; |
485 | | | 487 | |
486 | gcc*) | | 488 | gcc*) |
487 | get_gcc gcc | | 489 | get_gcc gcc |
488 | get_libgcc gcc | | 490 | get_libgcc gcc |
489 | get_libgcov gcc $_PLATFORM/libgcc/Makefile | | 491 | get_libgcov gcc $_PLATFORM/libgcc/Makefile |
490 | get_gcc_bootstrap gcc | | 492 | get_gcc_bootstrap gcc |
491 | get_gcc_libiberty gcc | | 493 | get_gcc_libiberty gcc |
492 | get_libobjc libobjc | | 494 | get_libobjc libobjc |
493 | get_libstdcxx_v3 libstdc++-v3 gcc | | 495 | get_libstdcxx_v3 libstdc++-v3 gcc |
494 | # XXX not yet | | 496 | # wants libstdc++-v3 built |
495 | # get_libsanitizer libsanitizer | | 497 | # get_libsanitizer libsanitizer |
496 | get_libdecnumber libdecnumber | | 498 | get_libdecnumber libdecnumber |
497 | get_libgomp libgomp | | 499 | get_libgomp libgomp |
498 | get_libbacktrace libbacktrace | | 500 | get_libbacktrace libbacktrace |
499 | exit 0 | | 501 | exit 0 |
500 | ;; | | 502 | ;; |
501 | | | 503 | |
502 | | | 504 | |
503 | *) | | 505 | *) |
504 | echo invalid arguments; | | 506 | echo invalid arguments; |
505 | exit 1 | | 507 | exit 1 |
506 | ;; | | 508 | ;; |
507 | esac | | 509 | esac |