From d4953677cdb286c12409b2b5b215de56c521a8b8 Mon Sep 17 00:00:00 2001 From: Marc Poulhiès Date: Mon, 25 Sep 2023 21:52:25 +0200 Subject: Allow for Runtime-less build of GDC and GNAT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both D and GNAT have their own runtimes (resp. libphotos and libada). It is still possible to build the compiler proper without any runtime, and have an external runtime installed later. This is most commonly found in embedded systems. An example for D is: https://github.com/KitsunebiGames/tinyd-rt An example for Ada: https://github.com/Fabien-Chouteau/bare_runtime Signed-off-by: Marc Poulhiès --- scripts/build/cc/gcc.sh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh index 275e239c..afcbeb2b 100644 --- a/scripts/build/cc/gcc.sh +++ b/scripts/build/cc/gcc.sh @@ -43,7 +43,7 @@ cc_gcc_lang_list() { [ "${CT_CC_LANG_CXX}" = "y" ] && lang_list+=",c++" [ "${CT_CC_LANG_FORTRAN}" = "y" ] && lang_list+=",fortran" [ "${CT_CC_LANG_ADA}" = "y" ] && lang_list+=",ada" - [ "${CT_CC_LANG_D}" = "y" ] && lang_list+=",d" + [ "${CT_CC_LANG_D}" = "y" ] && lang_list+=",d" [ "${CT_CC_LANG_JAVA}" = "y" ] && lang_list+=",java" [ "${CT_CC_LANG_JIT}" = "y" ] && lang_list+=",jit" [ "${CT_CC_LANG_OBJC}" = "y" ] && lang_list+=",objc" @@ -528,6 +528,22 @@ do_gcc_core_backend() { "") extra_config+=("--disable-tls");; esac + # In baremetal, we only build the Ada compiler without its runtime. + # The runtime will need to be provided externaly by the user. + if [ "${mode}" = "baremetal" \ + -a "${CT_CC_LANG_ADA}" = "y" \ + ]; then + extra_config+=("--disable-libada" ) + fi + + # In baremetal, we only build the D compiler without its runtime. + # The runtime will need to be provided externaly by the user. + if [ "${mode}" = "baremetal" \ + -a "${CT_CC_LANG_D}" = "y" \ + ]; then + extra_config+=("--disable-libphobos" ) + fi + # Some versions of gcc have a defective --enable-multilib. # Since that's the default, only pass --disable-multilib. For multilib, # also enable multiarch. Without explicit --enable-multiarch, core @@ -710,6 +726,14 @@ do_gcc_core_backend() { CT_DoLog EXTRA "Building ${log_txt}" CT_DoExecLog ALL make ${CT_JOBSFLAGS} ${core_targets_all} + # In case of baremetal, the gnat* tools are not built automatically. + if [ "${mode}" = "baremetal" \ + -a "${CT_CC_LANG_ADA}" = "y" \ + ]; then + CT_DoLog EXTRA "Building gnattools for baremetal" + CT_DoExecLog ALL make -C gcc ${CT_JOBSFLAGS} cross-gnattools + fi + # Do not pass ${CT_JOBSFLAGS} here: recent GCC builds have been failing # in parallel 'make install' at random locations: libitm, libcilk, # always for the files that are installed more than once to the same -- cgit v1.2.3