Merge branch 'newlib-nano-target' of git://github.com/galak/crosstool-ng

This commit is contained in:
Chris Packham 2021-04-19 20:25:49 +12:00
commit e27def9d3b
2 changed files with 37 additions and 1 deletions

View File

@ -18,6 +18,17 @@ config NEWLIB_NANO_GCC_LIBSTDCXX
This option compiles an additional target libstdc++ for use with This option compiles an additional target libstdc++ for use with
newlib-nano. newlib-nano.
config NEWLIB_NANO_INSTALL_IN_TARGET
bool
prompt "Additionally install newlib-nano libs into TARGET dir"
help
This option will install a copy of newlib-nano lib*.a file in the target
dir but renamed with a nano.a suffix (eg: libc_nano.a) as some default
nano.spec files from newlib expect this setup.
Additionally the newlib-nano version of newlib.h will get copied to
include/newlib-nano/newlib.h.
# maybe older versions of newlib will support it too, but this # maybe older versions of newlib will support it too, but this
# needs to be checked # needs to be checked
config NEWLIB_NANO_CXA_ATEXIT config NEWLIB_NANO_CXA_ATEXIT

View File

@ -216,6 +216,31 @@ EOF
CT_EndStep CT_EndStep
do_cc_libstdcxx_newlib_nano do_cc_libstdcxx_newlib_nano
if [ "${CT_NEWLIB_NANO_INSTALL_IN_TARGET}" = "y" ]; then
CT_DoExecLog ALL mkdir -p "${CT_PREFIX_DIR}/${CT_TARGET}/include/newlib-nano"
CT_DoExecLog ALL cp -f "${CT_PREFIX_DIR}/newlib-nano/${CT_TARGET}/include/newlib.h" \
"${CT_PREFIX_DIR}/${CT_TARGET}/include/newlib-nano/newlib.h"
CT_IterateMultilibs newlib_nano_copy_multilibs copylibs
fi
}
newlib_nano_copy_multilibs()
{
local nano_lib_dir="${CT_PREFIX_DIR}/newlib-nano"
local multi_flags multi_dir multi_os_dir multi_os_dir_gcc multi_root multi_index multi_count
for arg in "$@"; do
eval "${arg// /\\ }"
done
for lib_a in "${nano_lib_dir}/${CT_TARGET}/lib/${multi_dir}/"*.a; do
if [ -f ${lib_a} ] && [ ! -L ${lib_a} ]; then
_f=$(basename "${lib_a}")
CT_DoExecLog ALL cp -f "${lib_a}" \
"${CT_PREFIX_DIR}/${CT_TARGET}/lib/${multi_dir}/${_f%.*}_nano.a"
fi
done
} }
fi fi