diff options
author | Zach van Rijn <me@zv.io> | 2024-01-15 09:52:46 -0600 |
---|---|---|
committer | Zach van Rijn <me@zv.io> | 2024-01-15 11:18:51 -0600 |
commit | d1b8b6ea04ef53220f29adf9c0ef3a3de73762c5 (patch) | |
tree | 7f14f18f134903b21a4619021fdf5fb546810e4b | |
parent | b7f844e5e097a67aefe4fa739dba60d1087ddc26 (diff) | |
download | bootstrap-d1b8b6ea04ef53220f29adf9c0ef3a3de73762c5.tar.gz bootstrap-d1b8b6ea04ef53220f29adf9c0ef3a3de73762c5.tar.bz2 bootstrap-d1b8b6ea04ef53220f29adf9c0ef3a3de73762c5.tar.xz bootstrap-d1b8b6ea04ef53220f29adf9c0ef3a3de73762c5.zip |
Move 'config.mak' customization to the correct place.
-rwxr-xr-x | bootstrap | 113 |
1 files changed, 72 insertions, 41 deletions
@@ -5,7 +5,7 @@ # Purpose : Bootstraps Adélie from source for any architecture. # Authors : Zach van Rijn <me@zv.io> # License : MIT -# Revision : 20240111 +# Revision : 20240114 #=============================================================== #=============================================================== @@ -329,31 +329,15 @@ EOF case "${1}" in # adelie gcc qemu # ------ --- ---- - aarch64) m=aarch64: ; q=aarch64 ; - g="--with-arch=armv8-a --with-abi=lp64 --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419"; - ;; - armv7) m=armv7l:eabihf ; q=arm ; - g="--with-arch=armv7-a --with-tune=generic-armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-abi=aapcs-linux --with-mode=thumb"; - ;; - ppc) m=powerpc: ; q=ppc ; - g="--enable-secureplt --enable-decimal-float=no"; - ;; - ppc64) m=powerpc64: ; q=ppc64 ; - g="--with-abi=elfv2 --enable-secureplt --enable-decimal-float=no"; - ;; - x86_64) m=x86_64: ; q=x86_64 ; - g=""; # (none needed) - ;; - pmmx) m=i586: ; q=i386 ; - g="--with-arch=i586 --with-tune=pentium2 --enable-cld --enable-mmx"; - ;; - - riscv64) m=riscv64: ; q=riscv64 ; - g="--with-arch=rv64gc --with-abi=lp64d --enable-autolink-libatomic"; - ;; - s390x) m=s390x: ; q=s390x ; - g="--with-arch=z196 --with-tune=zEC12 --with-zarch --with-long-double-128 --enable-decimal-float"; - ;; + aarch64) m=aarch64: ; q=aarch64 ; ;; + armv7) m=armv7l:eabihf ; q=arm ; ;; + ppc) m=powerpc: ; q=ppc ; ;; + ppc64) m=powerpc64: ; q=ppc64 ; ;; + x86_64) m=x86_64: ; q=x86_64 ; ;; + pmmx) m=i586: ; q=i386 ; ;; + + riscv64) m=riscv64: ; q=riscv64 ; ;; + s390x) m=s390x: ; q=s390x ; ;; *) usage ;; esac @@ -411,14 +395,11 @@ mkdir -p "${BASE}"; # mcmtools (seed) ## -# Allow the user to supply an existing mcmtools installation. It -# is not ideal but we can allow the user to save some CPU cycles -# at the cost of adding new tools to the existing installation. +# This uses upstream default configuration to build a reasonably +# sane mcmtools environment, plus static QEMU user emulators. # -# If they wish to keep the existing mcmtools installation clean, -# the 'binsub' tool can be used to relocate it. A temporary dir -# is used if this environment variable is omitted. Another case -# for providing a custom value is if '/tmp' is mounted weird. +# The default configuration is copied elsewhere and updated with +# Adélie-specific configuration. This is used in a later step. # if ! test -d "${MTOOLS}"/sys/emus/bin; then # FIXME: no hard code cd "${BASE}"; @@ -426,31 +407,79 @@ if ! test -d "${MTOOLS}"/sys/emus/bin; then # FIXME: no hard code test -d bootstrap \ || git clone ${CHAINS}/bootstrap.git; cd bootstrap; - git checkout f7a470d4a6a56991af44d64419d59d6b58130429; + git checkout 3f1007074c2f81bfe0bead7f6f0a19640060d708; ## seed rootfs # # This will build absolutely everything that is needed to be # self-reliant, except for some build deps for QEMU. # - # We copy 'config.mak' from mcmtools bootstrap to the rootfs - # so that when we build "real" toolchain they are the same, - # except for target-specific GCC configure options above. + # The 'config.mak' file providing sane defaults is generated + # by the 'bootstrap' script below, however, if one already + # exists then it will be used instead. # DEST="${MTOOLS}" \ ARCH=${BUILDS} \ ./bootstrap \ ; + + ## config.mak + # + # We copy 'config.mak' from mcmtools bootstrap to the rootfs + # so that we can safely modify it and then use it later. + # + # Note: mcmtools has already been built and is not using the + # custom configuration. The musl-cross-make toolchains built + # in a later step will use the custom configuration. + # test -f "${MTOOLS}"/config.mak || \ cp "${MTOOLS}"/tmp/musl-cross-make/config.mak \ "${MTOOLS}"/config.mak \ ; - sent=HAVE_GCC_CONFIG; # sentinel + + sent=HAVE_ADELIE_CONFIG; # sentinel grep ${sent} "${MTOOLS}"/config.mak >/dev/null || \ - cat >> "${MTOOLS}"/config.mak <<EOF -GCC_CONFIG += ${g} -# ${sent} + cat >> "${MTOOLS}"/config.mak <<"EOF" +# __SENTINEL__ + +# supported targets +ifneq ($(findstring aarch64-,$(TARGET)),) +GCC_CONFIG_FOR_TARGET += --with-arch=armv8-a --with-abi=lp64 --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419 +endif + +ifneq ($(findstring armv7l-,$(TARGET)),) +GCC_CONFIG_FOR_TARGET += --with-arch=armv7-a --with-tune=generic-armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-abi=aapcs-linux --with-mode=thumb +endif + +ifneq ($(findstring powerpc64-,$(TARGET)),) +GCC_CONFIG_FOR_TARGET += --enable-secureplt --enable-decimal-float=no --with-abi=elfv2 +endif + +ifneq ($(findstring powerpc-,$(TARGET)),) +GCC_CONFIG_FOR_TARGET += --enable-secureplt --enable-decimal-float=no +endif + +ifneq ($(findstring x86_64-,$(TARGET)),) +GCC_CONFIG_FOR_TARGET += +endif + +ifneq ($(findstring i586-,$(TARGET)),) +GCC_CONFIG_FOR_TARGET += --with-arch=i586 --with-tune=pentium2 --enable-cld --enable-mmx +endif + +# experimental targets +ifneq ($(findstring riscv64-,$(TARGET)),) +GCC_CONFIG_FOR_TARGET += --with-arch=rv64gc --with-abi=lp64d --enable-autolink-libatomic +endif + +ifneq ($(findstring s390x-,$(TARGET)),) +GCC_CONFIG_FOR_TARGET += --with-arch=z196 --with-tune=zEC12 --with-zarch --with-long-double-128 --enable-decimal-float +endif EOF + sed -i "${MTOOLS}"/config.mak \ + -e "s/__SENTINEL__/${sent}/g" \ + ; + # cleaning ( cd "${MTOOLS}"; @@ -503,6 +532,8 @@ fi # # Build both. We will eventually need both toolchains, anyway. # +# Note: these toolchains will use the updated 'config.mak' file. +# if ! test -d "${MTOOLS}"/sys/tc/native; then # FIXME: no hard code cd "${BASE}"; |