diff options
Diffstat (limited to 'scripts')
23 files changed, 231 insertions, 557 deletions
diff --git a/scripts/build/arch/arm.sh b/scripts/build/arch/arm.sh index 9a53bc4..01a40bd 100644 --- a/scripts/build/arch/arm.sh +++ b/scripts/build/arch/arm.sh @@ -16,7 +16,7 @@ CT_DoArchTupleValues() { # The system part of the tuple: case "${CT_LIBC},${CT_ARCH_ARM_EABI}" in glibc,y) CT_TARGET_SYS=gnueabi;; - uClibc,y) CT_TARGET_SYS=uclibc${CT_LIBC_UCLIBC_USE_GNU_SUFFIX:+gnu}eabi;; + uClibc-ng,y)CT_TARGET_SYS=uclibc${CT_LIBC_UCLIBC_USE_GNU_SUFFIX:+gnu}eabi;; musl,y) CT_TARGET_SYS=musleabi;; bionic,y) CT_TARGET_SYS=androideabi;; *,y) CT_TARGET_SYS=eabi;; diff --git a/scripts/build/arch/powerpc.sh b/scripts/build/arch/powerpc.sh index 85c64d1..245adbe 100644 --- a/scripts/build/arch/powerpc.sh +++ b/scripts/build/arch/powerpc.sh @@ -14,7 +14,7 @@ CT_DoArchTupleValues () { case "${CT_LIBC}" in none|newlib|picolibc) CT_TARGET_SYS="elfspe";; *glibc) CT_TARGET_SYS="gnuspe";; - uClibc) CT_TARGET_SYS="uclibcgnuspe";; + uClibc-ng) CT_TARGET_SYS="uclibcgnuspe";; esac ;; esac diff --git a/scripts/build/arch/sparc.sh b/scripts/build/arch/sparc.sh index 97c9b9d..22d98e4 100644 --- a/scripts/build/arch/sparc.sh +++ b/scripts/build/arch/sparc.sh @@ -4,31 +4,31 @@ CT_DoArchTupleValues() { CT_TARGET_ARCH="sparc${target_bits_64}${CT_ARCH_SUFFIX}" if [ "${CT_KERNEL}" = "linux" -a -z "${CT_ARCH_CPU}" ]; then - if [ "${CT_ARCH_64}" = "y" ]; then - # By default, sparc64-*-linux is configured with -mcpu=v9. However, - # according to https://sourceware.org/ml/libc-alpha/2005-12/msg00027.html, - # "There is no Linux sparc64 port that runs on non-UltraSPARC-I+ ISA CPUs." - # There is a patch that would change the default to -mcpu=ultrasparc for - # sparc64-*-linux configuration: https://patchwork.ozlabs.org/patch/409424/ - # but that patch has not been integrated (yet). One concern raised about - # this patch was that -mcpu=ultrasparc can suboptimally schedule instructions - # for newer SPARC CPUs. So, override to -mcpu=ultrasparc and warn the user. - CT_DoLog WARN "Setting CPU to UltraSPARC-I for sparc64-linux. Set CT_ARCH_CPU if a different CPU is desired." - CT_ARCH_WITH_CPU="--with-cpu=ultrasparc" - if [ -n "${CT_ARCH_SUPPORTS_WITH_32_64}" -a -n "${CT_MULTILIB}" ]; then - CT_ARCH_WITH_CPU_32="--with-cpu-32=ultrasparc" - CT_ARCH_WITH_CPU_64="--with-cpu-64=ultrasparc" - fi - else - # Similarly, sparc-*-linux defaults to v7. GLIBC 2.31 started to reject - # pre-v8 configurations with 2.31, and default v8 fails a subsequent test for - # using atomics (which are presumably, only available on some v8 CPUs). - # Therefore, default to v9. - if [ -z "${CT_GLIBC_SPARC_ALLOW_V7}" ]; then - CT_DoLog WARN "Setting CPU to V9 for sparc-linux. Set CT_ARCH_CPU if a different CPU is desired." - CT_ARCH_WITH_CPU="--with-cpu=v9" - fi - fi + if [ "${CT_ARCH_64}" = "y" ]; then + # By default, sparc64-*-linux is configured with -mcpu=v9. However, + # according to https://sourceware.org/ml/libc-alpha/2005-12/msg00027.html, + # "There is no Linux sparc64 port that runs on non-UltraSPARC-I+ ISA CPUs." + # There is a patch that would change the default to -mcpu=ultrasparc for + # sparc64-*-linux configuration: https://patchwork.ozlabs.org/patch/409424/ + # but that patch has not been integrated (yet). One concern raised about + # this patch was that -mcpu=ultrasparc can suboptimally schedule instructions + # for newer SPARC CPUs. So, override to -mcpu=ultrasparc and warn the user. + CT_DoLog WARN "Setting CPU to UltraSPARC-I for sparc64-linux. Set CT_ARCH_CPU if a different CPU is desired." + CT_ARCH_WITH_CPU="--with-cpu=ultrasparc" + if [ -n "${CT_ARCH_SUPPORTS_WITH_32_64}" -a -n "${CT_MULTILIB}" ]; then + CT_ARCH_WITH_CPU_32="--with-cpu-32=ultrasparc" + CT_ARCH_WITH_CPU_64="--with-cpu-64=ultrasparc" + fi + else + # Similarly, sparc-*-linux defaults to v7. GLIBC 2.31 started to reject + # pre-v8 configurations with 2.31, and default v8 fails a subsequent test for + # using atomics (which are presumably, only available on some v8 CPUs). + # Therefore, default to v9. + if [ -z "${CT_GLIBC_SPARC_ALLOW_V7}" ]; then + CT_DoLog WARN "Setting CPU to V9 for sparc-linux. Set CT_ARCH_CPU if a different CPU is desired." + CT_ARCH_WITH_CPU="--with-cpu=v9" + fi + fi fi } diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh index 0b41c29..9623d6c 100644 --- a/scripts/build/cc/gcc.sh +++ b/scripts/build/cc/gcc.sh @@ -134,7 +134,7 @@ evaluate_multilib_cflags() # 1. On MIPS target, gcc (or rather, ld, which it invokes under the hood) chokes # if supplied with two -mabi=* options. I.e., 'gcc -mabi=n32' and 'gcc -mabi=32' both # work, but 'gcc -mabi=32 -mabi=n32' produces an internal error in ld. Thus we do -# not supply target's CFLAGS in multilib builds - and after compiling pass-1 gcc, +# not supply target's CFLAGS in multilib builds - and after compiling core gcc, # attempt to determine which CFLAGS need to be filtered out. # # 2. If "demultilibing" is in effect, create top-level directories for any @@ -186,11 +186,10 @@ cc_gcc_multilib_housekeeping() { } #------------------------------------------------------------------------------ -# Core gcc pass 1 -do_cc_core_pass_1() { +do_cc_core() { local -a core_opts - if [ "${CT_CC_CORE_PASS_1_NEEDED}" != "y" ]; then + if [ "${CT_CC_CORE_NEEDED}" != "y" ]; then return 0 fi @@ -201,62 +200,12 @@ do_cc_core_pass_1() { core_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" ) core_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" ) core_opts+=( "lang_list=c" ) - core_opts+=( "build_step=core1" ) + core_opts+=( "build_step=core" ) core_opts+=( "mode=static" ) core_opts+=( "build_libgcc=yes" ) - CT_DoStep INFO "Installing pass-1 core C gcc compiler" - CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-gcc-core-pass-1" - - do_gcc_core_backend "${core_opts[@]}" - - CT_Popd - CT_EndStep -} - -# Core gcc pass 2 -do_cc_core_pass_2() { - local -a core_opts - - if [ "${CT_CC_CORE_PASS_2_NEEDED}" != "y" ]; then - return 0 - fi - - # Common options: - core_opts+=( "host=${CT_BUILD}" ) - core_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" ) - core_opts+=( "complibs=${CT_BUILDTOOLS_PREFIX_DIR}" ) - core_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" ) - core_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" ) - core_opts+=( "lang_list=c" ) - core_opts+=( "build_step=core2" ) - - # Different conditions are at stake here: - # - In case the threading model is NPTL, we need a shared-capable core - # gcc; in all other cases, we need a static-only core gcc. - # - In case the threading model is NPTL or win32, or gcc is 4.3 or - # later, we need to build libgcc - case "${CT_THREADS}" in - nptl) - if [ "${CT_SHARED_LIBS}" = "y" ]; then - core_opts+=( "mode=shared" ) - else - core_opts+=( "mode=static" ) - fi - core_opts+=( "build_libgcc=yes" ) - ;; - win32) - core_opts+=( "mode=static" ) - core_opts+=( "build_libgcc=yes" ) - ;; - *) - core_opts+=( "mode=static" ) - core_opts+=( "build_libgcc=yes" ) - ;; - esac - - CT_DoStep INFO "Installing pass-2 core C gcc compiler" - CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-gcc-core-pass-2" + CT_DoStep INFO "Installing core C gcc compiler" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-gcc-core" do_gcc_core_backend "${core_opts[@]}" @@ -281,9 +230,8 @@ do_cc_core_pass_2() { # build_manuals : whether to build manuals or not : bool : no # cflags : cflags to use : string : (empty) # ldflags : ldflags to use : string : (empty) -# build_step : build step 'core1', 'core2', 'gcc_build', -# 'libstdcxx' -# or 'gcc_host' : string : (none) +# build_step : build step 'core', 'gcc_build', +# 'libstdcxx' or 'gcc_host' : string : (none) # Usage: do_gcc_core_backend mode=[static|shared|baremetal] build_libgcc=[yes|no] build_staticlinked=[yes|no] do_gcc_core_backend() { local mode @@ -321,7 +269,7 @@ do_gcc_core_backend() { # This function gets called in case of a bare metal compiler for the final gcc, too. case "${build_step}" in - core1|core2) + core) CT_DoLog EXTRA "Configuring core C gcc compiler" log_txt="gcc" extra_config+=( "${CT_CC_CORE_SYSROOT_ARG[@]}" ) @@ -337,26 +285,26 @@ do_gcc_core_backend() { ;; libstdcxx) CT_DoLog EXTRA "Configuring libstdc++ for ${libstdcxx_name}" - if [ "${header_dir}" = "" ]; then - header_dir="${CT_PREFIX_DIR}/${libstdcxx_name}/include" - fi - if [ "${exec_prefix}" = "" ]; then - exec_prefix="${CT_PREFIX_DIR}/${libstdcxx_name}" - fi + if [ "${header_dir}" = "" ]; then + header_dir="${CT_PREFIX_DIR}/${libstdcxx_name}/include" + fi + if [ "${exec_prefix}" = "" ]; then + exec_prefix="${CT_PREFIX_DIR}/${libstdcxx_name}" + fi extra_config+=( "${CT_CC_SYSROOT_ARG[@]}" ) - extra_config+=( "--with-headers=${header_dir}" ) + extra_config+=( "--with-headers=${header_dir}" ) extra_user_config=( "${CT_CC_GCC_EXTRA_CONFIG_ARRAY[@]}" ) log_txt="libstdc++ ${libstdcxx_name} library" # to inhibit the libiberty and libgcc tricks later on build_libgcc=no ;; *) - CT_Abort "Internal Error: 'build_step' must be one of: 'core1', 'core2', 'gcc_build', 'gcc_host' or 'libstdcxx', not '${build_step:-(empty)}'" + CT_Abort "Internal Error: 'build_step' must be one of: 'core', 'gcc_build', 'gcc_host' or 'libstdcxx', not '${build_step:-(empty)}'" ;; esac if [ "${exec_prefix}" = "" ]; then - exec_prefix="${prefix}" + exec_prefix="${prefix}" fi case "${mode}" in @@ -501,8 +449,6 @@ do_gcc_core_backend() { if [ "${CT_LIBC_GLIBC}" = "y" ]; then # Report GLIBC's version to GCC, it affects the defaults on other options. - # Pass-2 should be able to get it from the headers, but for some options - # (such as --with-long-double-128) we need to get it right even in pass-1. # GCC expects just two numbers separated by a dot. local glibc_version @@ -571,11 +517,10 @@ do_gcc_core_backend() { # 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, pass-1 - # compiler is configured as multilib/no-multiarch and pass-2/final - # are multilib/multiarch (because gcc autodetects multiarch based on - # multiple instances of crt*.o in the install directory - which do - # not exist in pass-1). + # also enable multiarch. Without explicit --enable-multiarch, core + # compiler is configured as multilib/no-multiarch (because gcc autodetects + # multiarch based on multiple instances of crt*.o in the install directory + # which do not exist in the core pass). if [ "${CT_MULTILIB}" != "y" ]; then extra_config+=("--disable-multilib") else @@ -609,7 +554,7 @@ do_gcc_core_backend() { fi # For non-sysrooted toolchain, GCC doesn't search except at the installation - # prefix; in core-1/2 stage we use a temporary installation prefix - but + # prefix; in core stage we use a temporary installation prefix - but # we may have installed something into the final prefix. This is less than ideal: # in the installation prefix GCC also handles subdirectories for multilibs # (e.g. first trying ${prefix}/include/${arch-triplet}) but @@ -654,7 +599,7 @@ do_gcc_core_backend() { --host=${host} \ --target=${CT_TARGET} \ --prefix="${prefix}" \ - --exec_prefix="${exec_prefix}" \ + --exec_prefix="${exec_prefix}" \ --with-local-prefix="${CT_SYSROOT_DIR}" \ "${extra_config[@]}" \ --enable-languages="${lang_list}" \ @@ -726,11 +671,11 @@ do_gcc_core_backend() { core_targets_all=all core_targets_install=install ;; - libstdcxx) - core_targets=( target-libstdc++-v3 ) - core_targets_all="${core_targets[@]/#/all-}" - core_targets_install="${core_targets[@]/#/install-}" - ;; + libstdcxx) + core_targets=( target-libstdc++-v3 ) + core_targets_all="${core_targets[@]/#/all-}" + core_targets_install="${core_targets[@]/#/install-}" + ;; esac CT_DoLog EXTRA "Building ${log_txt}" @@ -807,9 +752,9 @@ do_cc_for_build() { # lack of such a compiler, but better safe than sorry... build_final_opts+=( "mode=baremetal" ) build_final_opts+=( "build_libgcc=yes" ) - if [ "${CT_LIBC_NONE}" != "y" ]; then + if [ "${CT_LIBC_NONE}" != "y" ]; then build_final_opts+=( "build_libstdcxx=yes" ) - fi + fi build_final_opts+=( "build_libgfortran=yes" ) if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then build_final_opts+=( "build_staticlinked=yes" ) @@ -898,9 +843,9 @@ do_cc_for_host() { if [ "${CT_BARE_METAL}" = "y" ]; then final_opts+=( "mode=baremetal" ) final_opts+=( "build_libgcc=yes" ) - if [ "${CT_LIBC_NONE}" != "y" ]; then + if [ "${CT_LIBC_NONE}" != "y" ]; then final_opts+=( "build_libstdcxx=yes" ) - fi + fi final_opts+=( "build_libgfortran=yes" ) if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then final_opts+=( "build_staticlinked=yes" ) @@ -969,7 +914,7 @@ do_gcc_backend() { done if [ "${exec_prefix}" = "" ]; then - exec_prefix="${prefix}" + exec_prefix="${prefix}" fi # This function gets called for final gcc and libstdcxx. @@ -1280,7 +1225,7 @@ do_gcc_backend() { --host=${host} \ --target=${CT_TARGET} \ --prefix="${prefix}" \ - --exec_prefix="${exec_prefix}" \ + --exec_prefix="${exec_prefix}" \ ${CT_CC_SYSROOT_ARG} \ "${extra_config[@]}" \ --with-local-prefix="${CT_SYSROOT_DIR}" \ diff --git a/scripts/build/companion_libs/100-gmp.sh b/scripts/build/companion_libs/100-gmp.sh index 3655787..a17eda9 100644 --- a/scripts/build/companion_libs/100-gmp.sh +++ b/scripts/build/companion_libs/100-gmp.sh @@ -109,12 +109,6 @@ do_gmp_backend() { CT_DoLog EXTRA "Configuring GMP" - # FIXME is it needed even for older versions? They seem to compile fine - # without it. - if [ "${CT_GMP_HAS_MPBSD}" = "y" ]; then - extra_config+=("--enable-mpbsd") - fi - # To avoind “illegal text-relocation” linking error against # the static library, see: # https://github.com/Homebrew/homebrew-core/pull/25470 diff --git a/scripts/build/companion_libs/121-isl.sh b/scripts/build/companion_libs/121-isl.sh index 8b1b720..3577b75 100644 --- a/scripts/build/companion_libs/121-isl.sh +++ b/scripts/build/companion_libs/121-isl.sh @@ -84,15 +84,6 @@ do_isl_backend() { CT_DoLog EXTRA "Configuring ISL" - if [ "${CT_ISL_NEEDS_WITH_GMP}" != "y" ]; then - extra_config+=("--with-libgmp-prefix=${prefix}") - extra_config+=("--with-libgmpxx-prefix=${prefix}") - fi - - if [ "${CT_ISL_HAS_WITH_PIPLIB}" != "y" ]; then - extra_config+=("--with-piplib=no") - fi - CT_DoExecLog CFG \ CFLAGS="${cflags}" \ CXXFLAGS="${cxxflags}" \ diff --git a/scripts/build/companion_libs/330-gettext.sh b/scripts/build/companion_libs/330-gettext.sh index 149d7d7..9fa3bdc 100644 --- a/scripts/build/companion_libs/330-gettext.sh +++ b/scripts/build/companion_libs/330-gettext.sh @@ -80,6 +80,28 @@ do_gettext_backend() { return ;; + # Starting with 0.21, gettext cannot build against uClibc-NG: gettext + # checks if it needs to use fopen wrapper (using gnulib) and newer versions + # of gnulib also check if fopen provided by the system supports 'e' and 'x' + # modes. In cross-compile environment, gnulib falls back to assuming fopen + # does not support these modes unless the target tuple is glibc or musl + # (rightly so, since these fopen modes are optional in uClibc-NG). + # Unfortunately, the fopen() wrapper does not compile against uClibc-NG's + # stdio.h then because it includes <stdio.h> after defining __need_FILE macro. + # It looks like two bugs, one in each of uClibc-ng and gnulib: + # - uClibc-ng does not include its internal headers with the definitions for the + # __BEGIN_NAMESPACE_STD/__END_NAMESPACE_STD macros, which therefore escape + # unsubstituted into the including code. + # - gnulib shouldn't expect the fopen() prototype if it only asked for FILE + # structure definition by defining the __need_FILE macro. + # Until the maintainers sort this out, disallow newer gettext versions if + # linking against uClibc-NG. + *-uclibc*) + if [ "${CT_GETTEXT_INCOMPATIBLE_WITH_UCLIBC_NG}" = "y" ]; then + CT_Abort "This version of gettext is incompatible with uClibc-NG" + fi + ;; + # A bit ugly. D__USE_MINGW_ANSI_STDIO=1 has its own {v}asprintf functions # but gettext configure doesn't see this flag when it checks for that. An # alternative may be to use CC="${host}-gcc ${cflags}" but that didn't diff --git a/scripts/build/companion_libs/340-picolibc.sh b/scripts/build/companion_libs/340-picolibc.sh index cb96e71..e879005 100644 --- a/scripts/build/companion_libs/340-picolibc.sh +++ b/scripts/build/companion_libs/340-picolibc.sh @@ -32,18 +32,18 @@ do_cc_libstdcxx_picolibc() if [ "${CT_LIBC_PICOLIBC_GCC_LIBSTDCXX}" = "y" ]; then final_opts+=( "host=${CT_HOST}" ) - final_opts+=( "libstdcxx_name=picolibc" ) + final_opts+=( "libstdcxx_name=picolibc" ) final_opts+=( "prefix=${CT_PREFIX_DIR}" ) final_opts+=( "complibs=${CT_HOST_COMPLIBS_DIR}" ) final_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) final_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) final_opts+=( "lang_list=c,c++" ) final_opts+=( "build_step=libstdcxx" ) - final_opts+=( "extra_config+=('--enable-stdio=stdio_pure')" ) - final_opts+=( "extra_config+=('--disable-wchar_t')" ) - if [ "${CT_LIBC_PICOLIBC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then - final_opts+=( "enable_optspace=yes" ) - fi + final_opts+=( "extra_config+=('--enable-stdio=stdio_pure')" ) + final_opts+=( "extra_config+=('--disable-wchar_t')" ) + if [ "${CT_LIBC_PICOLIBC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then + final_opts+=( "enable_optspace=yes" ) + fi if [ "${CT_BARE_METAL}" = "y" ]; then final_opts+=( "mode=baremetal" ) @@ -107,7 +107,7 @@ RETARGETABLE_LOCKING:newlib-retargetable-locking done [ "${CT_USE_SYSROOT}" = "y" ] && \ - picolibc_opts+=( "-Dsysroot-install=true" ) + picolibc_opts+=( "-Dsysroot-install=true" ) [ "${CT_LIBC_PICOLIBC_EXTRA_SECTIONS}" = "y" ] && \ CT_LIBC_PICOLIBC_TARGET_CFLAGS="${CT_LIBC_PICOLIBC_TARGET_CFLAGS} -ffunction-sections -fdata-sections" @@ -122,11 +122,11 @@ RETARGETABLE_LOCKING:newlib-retargetable-locking # build : not used # host : the machine building picolibc # target : the machine picolibc runs on - meson_cflags="" - for cflag in ${cflags_for_target}; do - meson_cflags="${meson_cflags} '${cflag}'," - done - cat << EOF > picolibc-cross.txt + meson_cflags="" + for cflag in ${cflags_for_target}; do + meson_cflags="${meson_cflags} '${cflag}'," + done + cat << EOF > picolibc-cross.txt [binaries] c = '${CT_TARGET}-gcc' ar = '${CT_TARGET}-ar' @@ -149,9 +149,9 @@ EOF meson \ --cross-file picolibc-cross.txt \ --prefix="${CT_PREFIX_DIR}" \ - -Dincludedir=picolibc/include \ - -Dlibdir=picolibc/${CT_TARGET}/lib \ - -Dspecsdir="${CT_SYSROOT_DIR}"/lib \ + -Dincludedir=picolibc/include \ + -Dlibdir=picolibc/${CT_TARGET}/lib \ + -Dspecsdir="${CT_SYSROOT_DIR}"/lib \ "${CT_SRC_DIR}/picolibc" \ "${picolibc_opts[@]}" \ "${CT_LIBC_PICOLIBC_EXTRA_CONFIG_ARRAY[@]}" diff --git a/scripts/build/companion_libs/350-newlib_nano.sh b/scripts/build/companion_libs/350-newlib_nano.sh index f521be1..ad6ea9a 100644 --- a/scripts/build/companion_libs/350-newlib_nano.sh +++ b/scripts/build/companion_libs/350-newlib_nano.sh @@ -57,16 +57,16 @@ do_cc_libstdcxx_newlib_nano() if [ "${CT_NEWLIB_NANO_GCC_LIBSTDCXX}" = "y" ]; then final_opts+=( "host=${CT_HOST}" ) - final_opts+=( "libstdcxx_name=newlib-nano" ) + final_opts+=( "libstdcxx_name=newlib-nano" ) final_opts+=( "prefix=${CT_PREFIX_DIR}" ) final_opts+=( "complibs=${CT_HOST_COMPLIBS_DIR}" ) final_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) final_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) final_opts+=( "lang_list=c,c++" ) final_opts+=( "build_step=libstdcxx" ) - if [ "${CT_LIBC_NEWLIB_NANO_ENABLE_TARGET_OPTSPACE}" = "y" ]; then - final_opts+=( "enable_optspace=yes" ) - fi + if [ "${CT_LIBC_NEWLIB_NANO_ENABLE_TARGET_OPTSPACE}" = "y" ]; then + final_opts+=( "enable_optspace=yes" ) + fi if [ -n "${CT_NEWLIB_NANO_GCC_LIBSTDCXX_TARGET_CXXFLAGS}" ]; then final_opts+=( "extra_cxxflags_for_target=${CT_NEWLIB_NANO_GCC_LIBSTDCXX_TARGET_CXXFLAGS}" ) fi @@ -185,8 +185,8 @@ ENABLE_TARGET_OPTSPACE:target-optspace --host=${CT_BUILD} \ --target=${CT_TARGET} \ --prefix=${CT_PREFIX_DIR} \ - --exec-prefix=${CT_PREFIX_DIR}/newlib-nano \ - --libdir=${CT_PREFIX_DIR}/newlib-nano/${CT_TARGET}/lib \ + --exec-prefix=${CT_PREFIX_DIR}/newlib-nano \ + --libdir=${CT_PREFIX_DIR}/newlib-nano/${CT_TARGET}/lib \ "${newlib_opts[@]}" \ "${CT_LIBC_NEWLIB_NANO_EXTRA_CONFIG_ARRAY[@]}" diff --git a/scripts/build/companion_tools/050-make.sh b/scripts/build/companion_tools/050-make.sh index aecea1a..df77d5b 100644 --- a/scripts/build/companion_tools/050-make.sh +++ b/scripts/build/companion_tools/050-make.sh @@ -72,7 +72,7 @@ do_make_backend() "${CT_SRC_DIR}/make/configure" \ --host="${host}" \ --prefix="${prefix}" \ - "${extra_config[@]}" + "${extra_config[@]}" CT_DoLog EXTRA "Building make" CT_DoExecLog ALL make diff --git a/scripts/build/companion_tools/510-bison.sh b/scripts/build/companion_tools/510-bison.sh index 9379ea8..90bf9ec 100644 --- a/scripts/build/companion_tools/510-bison.sh +++ b/scripts/build/companion_tools/510-bison.sh @@ -56,7 +56,7 @@ do_bison_backend() "${CT_SRC_DIR}/bison/configure" \ --host="${host}" \ --prefix="${prefix}" \ - "${extra_config[@]}" + "${extra_config[@]}" CT_DoLog EXTRA "Building bison" CT_DoExecLog ALL make diff --git a/scripts/build/debug/400-ltrace.sh b/scripts/build/debug/400-ltrace.sh index 3f08226..9c9052a 100644 --- a/scripts/build/debug/400-ltrace.sh +++ b/scripts/build/debug/400-ltrace.sh @@ -19,32 +19,12 @@ do_debug_ltrace_build() { CT_Pushd "${CT_BUILD_DIR}/build-ltrace" CT_DoLog EXTRA "Configuring ltrace" - # ltrace-0.5.3 has a unique hand-crafted configure script. Releases - # 0.5.2 and earlier as well as 0.6.0 and later use GNU autotools. - if [ "${LTRACE_0_5_3_CONFIGURE}" = "y" ]; then - case "${CT_ARCH}:${CT_ARCH_BITNESS}" in - x86:32) ltrace_host="i386";; - x86:64) ltrace_host="x86_64";; - powerpc:*) ltrace_host="ppc";; - mips:*) ltrace_host="mipsel";; - *) ltrace_host="${CT_ARCH}";; - esac - CT_DoExecLog CFG \ - CC="${CT_TARGET}-${CT_CC}" \ - AR="${CT_TARGET}-ar" \ - HOST="${ltrace_host}" \ - HOST_OS="${CT_TARGET_KERNEL}" \ - CFLAGS="${CT_ALL_TARGET_CFLAGS}"\ - ${CONFIG_SHELL} \ - ./configure --prefix=/usr - else - CT_DoExecLog CFG \ - ${CONFIG_SHELL} \ - ./configure \ - --build=${CT_BUILD} \ - --host=${CT_TARGET} \ - --prefix=/usr - fi + CT_DoExecLog CFG \ + ${CONFIG_SHELL} \ + ./configure \ + --build=${CT_BUILD} \ + --host=${CT_TARGET} \ + --prefix=/usr CT_DoLog EXTRA "Building ltrace" CT_DoExecLog ALL make diff --git a/scripts/build/libc.sh b/scripts/build/libc.sh index 0d03bf0..5f5aa6f 100644 --- a/scripts/build/libc.sh +++ b/scripts/build/libc.sh @@ -6,7 +6,7 @@ # The actual implementation can override just what it needs then. eval "${CT_LIBC//[^A-Za-z0-9]/_}_get() { CT_Fetch \"\${CT_LIBC_${CT_LIBC_CHOICE_KSYM}_PKG_KSYM}\"; }" eval "${CT_LIBC//[^A-Za-z0-9]/_}_extract() { CT_ExtractPatch \"\${CT_LIBC_${CT_LIBC_CHOICE_KSYM}_PKG_KSYM}\"; }" -for _m in start_files main post_cc; do +for _m in headers main post_cc; do eval "${CT_LIBC//[^A-Za-z0-9]/_}_${_m}() { :; }" done @@ -23,9 +23,9 @@ do_libc_extract() eval "${CT_LIBC//[^A-Za-z0-9]/_}_extract" } -do_libc_start_files() +do_libc_headers() { - eval "${CT_LIBC//[^A-Za-z0-9]/_}_start_files" + eval "${CT_LIBC//[^A-Za-z0-9]/_}_headers" } do_libc_main() diff --git a/scripts/build/libc/bionic.sh b/scripts/build/libc/bionic.sh index e122d86..0ffd4d8 100644 --- a/scripts/build/libc/bionic.sh +++ b/scripts/build/libc/bionic.sh @@ -3,7 +3,7 @@ # Licensed under the GPL v2. See COPYING in the root of this package # Install Unified headers -bionic_start_files() +bionic_headers() { CT_DoStep INFO "Installing C library headers" CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/android-ndk/sysroot/usr" "${CT_SYSROOT_DIR}" diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index 0db7c1c..c78f069 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -30,48 +30,14 @@ glibc_extract() fi } -# Build and install headers and start files -glibc_start_files() -{ - # Start files and Headers should be configured the same way as the - # final libc, but built and installed differently. - glibc_backend libc_mode=startfiles -} - # This function builds and install the full C library glibc_main() { - glibc_backend libc_mode=final -} - -# This backend builds the C library once for each multilib -# variant the compiler gives us -# Usage: glibc_backend param=value [...] -# Parameter : Definition : Type : Default -# libc_mode : 'startfiles' or 'final' : string : (none) -glibc_backend() -{ - local libc_mode local arg - for arg in "$@"; do - eval "${arg// /\\ }" - done - - case "${libc_mode}" in - startfiles) - CT_DoStep INFO "Installing C library headers & start files" - ;; - final) - CT_DoStep INFO "Installing C library" - ;; - *) - CT_Abort "Unsupported (or unset) libc_mode='${libc_mode}'" - ;; - esac - - CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}" - CT_IterateMultilibs glibc_backend_once multilib libc_mode="${libc_mode}" + CT_DoStep INFO "Installing C library" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc" + CT_IterateMultilibs glibc_backend_once multilib CT_Popd CT_EndStep } @@ -79,13 +45,14 @@ glibc_backend() # This backend builds the C library once # Usage: glibc_backend_once param=value [...] # Parameter : Definition : Type -# libc_mode : 'startfiles' or 'final' : string : (empty) # multi_* : as defined in CT_IterateMultilibs : (varies) : glibc_backend_once() { + # Glibc seems to be smart enough to know about the cases that can coexist + # in the same root and installs them into proper multilib-os directory; all + # we need is to point to the right root. local multi_flags multi_dir multi_os_dir multi_root multi_index multi_count multi_target local build_cflags build_cppflags build_ldflags - local startfiles_dir local src_dir="${CT_SRC_DIR}/glibc" local -a extra_config local -a extra_make_args @@ -104,29 +71,9 @@ glibc_backend_once() # Adjust target tuple according GLIBC quirks CT_DoArchGlibcAdjustTuple multi_target - # Glibc seems to be smart enough to know about the cases that can coexist - # in the same root and installs them into proper multilib-os directory; all - # we need is to point to the right root. We do need to handle multilib-os - # here, though, for the first pass where we install crt*.o and a dummy - # libc.so; we therefore install it to the most specific location of - # <sysroot>/<suffix>/usr/lib/<multilib-os> where it is least likely to clash - # with other multilib variants. We then remove these temporary files at - # the beginning of the libc-final step and allow glibc to install them - # where it thinks is proper. - startfiles_dir="${multi_root}/usr/lib/${multi_os_dir}" - CT_SanitizeVarDir startfiles_dir - - if [ "${libc_mode}" = "final" ]; then - CT_DoLog EXTRA "Cleaning up start files" - CT_DoExecLog ALL rm -f "${startfiles_dir}/crt1.o" \ - "${startfiles_dir}/crti.o" \ - "${startfiles_dir}/crtn.o" \ - "${startfiles_dir}/libc.so" - fi - CT_DoLog EXTRA "Configuring C library" - # Also, if those two are missing, iconv build breaks + # If those two are missing, iconv build breaks extra_config+=( --disable-debug --disable-sanity-checks ) if [ "${CT_GLIBC_ENABLE_OBSOLETE_RPC}" = "y" ]; then @@ -259,7 +206,6 @@ glibc_backend_once() CT_DoLog DEBUG "Configuring with addons : '$(glibc_add_ons_list ,)'" CT_DoLog DEBUG "Extra config args passed : '${extra_config[*]}'" CT_DoLog DEBUG "Extra CFLAGS passed : '${glibc_cflags}'" - CT_DoLog DEBUG "Placing startfiles into : '${startfiles_dir}'" CT_DoLog DEBUG "Configuring with --host : '${multi_target}'" # CFLAGS are only applied when compiling .c files. .S files are compiled with ASFLAGS, @@ -324,111 +270,34 @@ glibc_backend_once() extra_make_args+=( "BUILD_CPPFLAGS=${build_cppflags}" ) extra_make_args+=( "BUILD_LDFLAGS=${build_ldflags}" ) - if [ "${libc_mode}" = "startfiles" -a ! -r "${multi_root}/.libc_headers_installed" ]; then - CT_DoLog EXTRA "Installing C library headers" - CT_DoExecLog ALL touch "${multi_root}/.libc_headers_installed" - - # use the 'install-headers' makefile target to install the - # headers - CT_DoExecLog ALL make ${CT_JOBSFLAGS} \ - install_root=${multi_root} \ - install-bootstrap-headers=yes \ - "${extra_make_args[@]}" \ - install-headers - - # Two headers -- stubs.h and features.h -- aren't installed by install-headers, - # so do them by hand. We can tolerate an empty stubs.h for the moment. - # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html - mkdir -p "${CT_HEADERS_DIR}/gnu" - CT_DoExecLog ALL touch "${CT_HEADERS_DIR}/gnu/stubs.h" - CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc/include/features.h" \ - "${CT_HEADERS_DIR}/features.h" - - # Building the bootstrap gcc requires either setting inhibit_libc, or - # having a copy of stdio_lim.h... see - # http://sources.redhat.com/ml/libc-alpha/2003-11/msg00045.html - CT_DoExecLog ALL cp -v bits/stdio_lim.h "${CT_HEADERS_DIR}/bits/stdio_lim.h" - - # Following error building gcc-4.0.0's gcj: - # error: bits/syscall.h: No such file or directory - # solved by following copy; see http://sourceware.org/ml/crossgcc/2005-05/msg00168.html - # but it breaks arm, see http://sourceware.org/ml/crossgcc/2006-01/msg00091.html - # Of course, only copy it if it does not already exist - case "${CT_ARCH}" in - arm) ;; - *) if [ -f "${CT_HEADERS_DIR}/bits/syscall.h" ]; then - CT_DoLog ALL "Not over-writing existing bits/syscall.h" - elif [ -f "misc/bits/syscall.h" ]; then - CT_DoExecLog ALL cp -v "misc/bits/syscall.h" \ - "${CT_HEADERS_DIR}/bits/syscall.h" - else - # "Old" glibces do not have the above file, - # but provide this one: - CT_DoExecLog ALL cp -v "misc/syscall-list.h" \ - "${CT_HEADERS_DIR}/bits/syscall.h" - fi - ;; - esac - elif [ "${libc_mode}" = "final" -a -r "${multi_root}/.libc_headers_installed" ]; then - CT_DoExecLog ALL rm -f "${multi_root}/.libc_headers_installed" - fi # installing headers - - if [ "${libc_mode}" = "startfiles" ]; then - if [ "${CT_THREADS}" = "nptl" ]; then - CT_DoLog EXTRA "Installing C library start files" - - # there are a few object files needed to link shared libraries, - # which we build and install by hand - CT_DoExecLog ALL mkdir -p "${startfiles_dir}" - CT_DoExecLog ALL make ${CT_JOBSFLAGS} \ - "${extra_make_args[@]}" \ - csu/subdir_lib - CT_DoExecLog ALL cp csu/crt1.o csu/crti.o csu/crtn.o \ - "${startfiles_dir}" - - # Finally, 'libgcc_s.so' requires a 'libc.so' to link against. - # However, since we will never actually execute its code, - # it doesn't matter what it contains. So, treating '/dev/null' - # as a C source file, we produce a dummy 'libc.so' in one step - CT_DoExecLog ALL "${CT_TARGET}-${CT_CC}" ${multi_flags} \ - -nostdlib \ - -nostartfiles \ - -shared \ - -x c /dev/null \ - -o "${startfiles_dir}/libc.so" - fi # threads == nptl - fi # libc_mode = startfiles - - if [ "${libc_mode}" = "final" ]; then - CT_DoLog EXTRA "Building C library" - CT_DoExecLog ALL make ${CT_JOBSFLAGS} \ - "${extra_make_args[@]}" \ - all - - CT_DoLog EXTRA "Installing C library" - CT_DoExecLog ALL make ${CT_JOBSFLAGS} \ - "${extra_make_args[@]}" \ - install_root="${multi_root}" \ - install - - if [ "${CT_BUILD_MANUALS}" = "y" -a "${multi_index}" = "${multi_count}" ]; then - # We only need to build the manuals once. Only build them on the - # last multilib target. If it's not multilib, it will happen on the - # only target. - CT_DoLog EXTRA "Building and installing the C library manual" - # Omit CT_JOBSFLAGS as GLIBC has problems building the - # manuals in parallel - CT_DoExecLog ALL make pdf html - CT_DoExecLog ALL mkdir -p ${CT_PREFIX_DIR}/share/doc - CT_DoExecLog ALL cp -av manual/*.pdf \ - manual/libc \ - ${CT_PREFIX_DIR}/share/doc - fi - - if [ "${CT_GLIBC_LOCALES}" = "y" -a "${multi_index}" = "${multi_count}" ]; then - glibc_locales - fi - fi # libc_mode = final + CT_DoLog EXTRA "Building C library" + CT_DoExecLog ALL make ${CT_JOBSFLAGS} \ + "${extra_make_args[@]}" \ + all + + CT_DoLog EXTRA "Installing C library" + CT_DoExecLog ALL make ${CT_JOBSFLAGS} \ + "${extra_make_args[@]}" \ + install_root="${multi_root}" \ + install + + if [ "${CT_BUILD_MANUALS}" = "y" -a "${multi_index}" = "${multi_count}" ]; then + # We only need to build the manuals once. Only build them on the + # last multilib target. If it's not multilib, it will happen on the + # only target. + CT_DoLog EXTRA "Building and installing the C library manual" + # Omit CT_JOBSFLAGS as GLIBC has problems building the + # manuals in parallel + CT_DoExecLog ALL make pdf html + CT_DoExecLog ALL mkdir -p ${CT_PREFIX_DIR}/share/doc + CT_DoExecLog ALL cp -av manual/*.pdf \ + manual/libc \ + ${CT_PREFIX_DIR}/share/doc + fi + + if [ "${CT_GLIBC_LOCALES}" = "y" -a "${multi_index}" = "${multi_count}" ]; then + glibc_locales + fi CT_EndStep } diff --git a/scripts/build/libc/mingw-w64.sh b/scripts/build/libc/mingw-w64.sh index 683f8be..54e8d07 100644 --- a/scripts/build/libc/mingw-w64.sh +++ b/scripts/build/libc/mingw-w64.sh @@ -9,7 +9,7 @@ mingw_w64_set_install_prefix() fi } -mingw_w64_start_files() { +mingw_w64_headers() { local -a sdk_opts CT_DoStep INFO "Installing C library headers" @@ -56,15 +56,13 @@ mingw_w64_start_files() { do_check_mingw_vendor_tuple() { - if [ "${CT_MINGW_W64_REQUIRES_W64_VENDOR}" = "y" ]; then - CT_DoStep INFO "Checking configured vendor tuple" - if [ ${CT_TARGET_VENDOR} = "w64" ]; then - CT_DoLog DEBUG "The tuple is set to '${CT_TARGET_VENDOR}', as recommended by mingw-64 developers." - else - CT_DoLog WARN "The tuple vendor is '${CT_TARGET_VENDOR}', not equal to 'w64' and might break the toolchain!" - fi - CT_EndStep - fi + CT_DoStep INFO "Checking configured vendor tuple" + if [ ${CT_TARGET_VENDOR} = "w64" ]; then + CT_DoLog DEBUG "The tuple is set to '${CT_TARGET_VENDOR}', as recommended by mingw-64 developers." + else + CT_DoLog WARN "The tuple vendor is '${CT_TARGET_VENDOR}', not equal to 'w64' and might break the toolchain!" + fi + CT_EndStep } do_mingw_tools() diff --git a/scripts/build/libc/moxiebox.sh b/scripts/build/libc/moxiebox.sh index 25ef6e7..35e2ea4 100644 --- a/scripts/build/libc/moxiebox.sh +++ b/scripts/build/libc/moxiebox.sh @@ -14,9 +14,9 @@ moxiebox_extract() CT_ExtractPatch MOXIEBOX } -moxiebox_start_files() +moxiebox_headers() { - newlib_start_files + newlib_headers } moxiebox_main() diff --git a/scripts/build/libc/musl.sh b/scripts/build/libc/musl.sh index 05da1d4..bc2a2e6 100644 --- a/scripts/build/libc/musl.sh +++ b/scripts/build/libc/musl.sh @@ -2,42 +2,18 @@ # Copyright 2013 Timo Teräs # Licensed under the GPL v2. See COPYING in the root of this package -# Build and install headers and start files -musl_start_files() +musl_post_cc() { - # Start files and Headers should be configured the same way as the - # final libc, but built and installed differently. - musl_backend libc_mode=startfiles -} - -# This function builds and install the full C library -musl_main() -{ - musl_backend libc_mode=final -} - -musl_post_cc() { # MUSL creates dynamic linker symlink with absolute path - which works on the # target but not on the host. We want our cross-ldd tool to work. CT_MultilibFixupLDSO } -musl_backend() { - local libc_mode - local arg - - for arg in "$@"; do - eval "${arg// /\\ }" - done - - case "${libc_mode}" in - startfiles) CT_DoStep INFO "Installing C library headers & start files";; - final) CT_DoStep INFO "Installing C library";; - *) CT_Abort "Unsupported (or unset) libc_mode='${libc_mode}'";; - esac - - CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}" - CT_IterateMultilibs musl_backend_once multilib libc_mode="${libc_mode}" +musl_main() +{ + CT_DoStep INFO "Installing C library" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc" + CT_IterateMultilibs musl_backend_once multilib CT_Popd CT_EndStep } @@ -45,9 +21,9 @@ musl_backend() { # This backend builds the C library # Usage: musl_backend param=value [...] # Parameter : Definition : Type : Default -# libc_mode : 'startfiles' or 'final' : string : (none) -musl_backend_once() { - local libc_mode +# multi_* : as defined in CT_IterateMultilibs : (varies) : +musl_backend_once() +{ local -a extra_cflags local -a extra_config local src_dir="${CT_SRC_DIR}/musl" @@ -110,45 +86,26 @@ musl_backend_once() { --disable-gcc-wrapper \ "${extra_config[@]}" - if [ "${libc_mode}" = "startfiles" ]; then - CT_DoLog EXTRA "Installing C library headers" - CT_DoExecLog ALL make DESTDIR="${multi_root}" install-headers - CT_DoLog EXTRA "Building C library start files" - CT_DoExecLog ALL make DESTDIR="${multi_root}" \ - obj/crt/crt1.o obj/crt/crti.o obj/crt/crtn.o - CT_DoLog EXTRA "Installing C library start files" - CT_DoExecLog ALL cp -av obj/crt/crt*.o "${multi_root}${multilib_dir}" - CT_DoExecLog ALL ${CT_TARGET}-${CT_CC} -nostdlib \ - -nostartfiles -shared -x c /dev/null -o "${multi_root}${multilib_dir}/libc.so" - fi - if [ "${libc_mode}" = "final" ]; then - CT_DoLog EXTRA "Cleaning up start files" - CT_DoExecLog ALL rm -f "${multi_root}${multilib_dir}/crt1.o" \ - "${multi_root}${multilib_dir}/crti.o" \ - "${multi_root}${multilib_dir}/crtn.o" \ - "${multi_root}${multilib_dir}/libc.so" - - CT_DoLog EXTRA "Building C library" - CT_DoExecLog ALL make ${CT_JOBSFLAGS} - - CT_DoLog EXTRA "Installing C library" - CT_DoExecLog ALL make DESTDIR="${multi_root}" install - - # Convert /lib/ld-* symlinks to relative paths so that they are valid - # both on the host and on the target. - for f in ${multi_root}/ld-musl-*; do - [ -L "${f}" ] || continue - l=$( readlink ${f} ) - case "${l}" in - ${multilib_dir}/*) - CT_DoExecLog ALL ln -sf "../${l}" "${f}" - ;; - esac - done - - # Any additional actions for this architecture - CT_DoArchMUSLPostInstall - fi + CT_DoLog EXTRA "Building C library" + CT_DoExecLog ALL make ${CT_JOBSFLAGS} + + CT_DoLog EXTRA "Installing C library" + CT_DoExecLog ALL make DESTDIR="${multi_root}" install + + # Convert /lib/ld-* symlinks to relative paths so that they are valid + # both on the host and on the target. + for f in ${multi_root}/ld-musl-*; do + [ -L "${f}" ] || continue + l=$( readlink ${f} ) + case "${l}" in + ${multilib_dir}/*) + CT_DoExecLog ALL ln -sf "../${l}" "${f}" + ;; + esac + done + + # Any additional actions for this architecture + CT_DoArchMUSLPostInstall CT_EndStep } diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh index ddecdb1..72111a9 100644 --- a/scripts/build/libc/newlib.sh +++ b/scripts/build/libc/newlib.sh @@ -5,11 +5,10 @@ # Edited by Martin Lund <mgl@doredevelopment.dk> # -newlib_start_files() +newlib_headers() { - CT_DoStep INFO "Installing C library headers & start files" - CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/newlib/newlib/libc/include/." \ - "${CT_HEADERS_DIR}" + CT_DoStep INFO "Installing C library headers" + CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/newlib/newlib/libc/include/." "${CT_HEADERS_DIR}" if [ "${CT_ARCH_XTENSA}" = "y" ]; then CT_DoLog EXTRA "Installing Xtensa headers" CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/newlib/newlib/libc/sys/xtensa/include/." \ diff --git a/scripts/build/libc/uClibc.sh b/scripts/build/libc/uClibc-ng.sh index 4328542..7b81d92 100644 --- a/scripts/build/libc/uClibc.sh +++ b/scripts/build/libc/uClibc-ng.sh @@ -2,64 +2,30 @@ # Copyright 2007 Yann E. MORIN # Licensed under the GPL v2. See COPYING in the root of this package -# Build and install headers and start files -uClibc_start_files() -{ - # Start files and Headers should be configured the same way as the - # final libc, but built and installed differently. - uClibc_backend libc_mode=startfiles -} - # This function builds and install the full C library -uClibc_main() -{ - uClibc_backend libc_mode=final -} - -# Common backend for 1st and 2nd passes. -uClibc_backend() +uClibc_ng_main() { - local libc_mode - local arg - - for arg in "$@"; do - eval "${arg// /\\ }" - done - - case "${libc_mode}" in - startfiles) CT_DoStep INFO "Installing C library headers & start files";; - final) CT_DoStep INFO "Installing C library";; - *) CT_Abort "Unsupported (or unset) libc_mode='${libc_mode}'";; - esac - - CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}" - CT_IterateMultilibs uClibc_backend_once multilib libc_mode="${libc_mode}" + CT_DoStep INFO "Installing C library" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc" + CT_IterateMultilibs uClibc_ng_backend_once multilib CT_Popd CT_EndStep } # Common backend for 1st and 2nd passes, once per multilib. -uClibc_backend_once() +uClibc_ng_backend_once() { - local libc_mode local multi_dir multi_os_dir multi_root multi_flags multi_index multi_count local multilib_dir startfiles_dir - local jflag=${CT_LIBC_UCLIBC_PARALLEL:+${CT_JOBSFLAGS}} + local jflag=${CT_JOBSFLAGS} local -a make_args local extra_cflags f cfg_cflags cf local hdr_install_subdir - local uClibc_name for arg in "$@"; do eval "${arg// /\\ }" done - if [ "${CT_UCLIBC_USE_UCLIBC_NG_ORG}" = "y" ]; then - uClibc_name="uClibc-ng" - elif [ "${CT_UCLIBC_USE_UCLIBC_ORG}" = "y" ]; then - uClibc_name="uClibc" - fi - CT_DoStep INFO "Building for multilib ${multi_index}/${multi_count}: '${multi_flags}'" multilib_dir="lib/${multi_os_dir}" @@ -68,7 +34,7 @@ uClibc_backend_once() # Construct make arguments: # - uClibc uses the CROSS environment variable as a prefix to the compiler - # tools to use. Since it requires core pass-1, thusly named compiler is + # tools to use. Since it requires core compiler, thusly named compiler is # already available. # - Note about CFLAGS: In uClibc, CFLAGS are generated by Rules.mak, # depending on the configuration of the library. That is, they are tailored @@ -86,7 +52,7 @@ uClibc_backend_once() # Simply copy files until uClibc has the ability to build out-of-tree CT_DoLog EXTRA "Copying sources to build dir" - CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/uClibc/." . + CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/uClibc-ng/." . # Force the date of the pregen locale data, as the # newer ones that are referenced are not available @@ -94,7 +60,7 @@ uClibc_backend_once() # Use the default config if the user did not provide one. if [ -z "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then - CT_LIBC_UCLIBC_CONFIG_FILE="${CT_LIB_DIR}/packages/${uClibc_name}/config" + CT_LIBC_UCLIBC_CONFIG_FILE="${CT_LIB_DIR}/packages/uClibc-ng/config" fi manage_uClibc_config "${CT_LIBC_UCLIBC_CONFIG_FILE}" .config "${multi_flags}" @@ -136,65 +102,11 @@ uClibc_backend_once() CT_DoExecLog ALL cp -a "${multi_root}/usr/include" "${multi_root}/usr/include.saved" fi - if [ "${libc_mode}" = "startfiles" ]; then - CT_DoLog EXTRA "Building headers" - CT_DoExecLog ALL make "${make_args[@]}" headers - - # Ensure the directory for installing multilib-specific binaries exists. - CT_DoExecLog ALL mkdir -p "${startfiles_dir}" - - CT_DoLog EXTRA "Installing headers" - CT_DoExecLog ALL make "${make_args[@]}" install_headers - - # The check might look bogus, but it is the same condition as is used - # by GCC build script to enable/disable shared library support. - if [ "${CT_THREADS}" = "nptl" ]; then - CT_DoLog EXTRA "Building start files" - CT_DoExecLog ALL make ${jflag} "${make_args[@]}" \ - lib/crt1.o lib/crti.o lib/crtn.o - - if [ "${CT_SHARED_LIBS}" = "y" ]; then - # From: http://git.openembedded.org/cgit.cgi/openembedded/commit/?id=ad5668a7ac7e0436db92e55caaf3fdf782b6ba3b - # libm.so is needed for ppc, as libgcc is linked against libm.so - # No problem to create it for other archs. - CT_DoLog EXTRA "Building dummy shared libs" - CT_DoExecLog ALL "${CT_TARGET}-${CT_CC}" -nostdlib -nostartfiles \ - -shared ${multi_flags} -x c /dev/null -o libdummy.so - - CT_DoLog EXTRA "Installing start files" - CT_DoExecLog ALL install -m 0644 lib/crt1.o lib/crti.o lib/crtn.o \ - "${startfiles_dir}" - - CT_DoLog EXTRA "Installing dummy shared libs" - CT_DoExecLog ALL install -m 0755 libdummy.so "${startfiles_dir}/libc.so" - CT_DoExecLog ALL install -m 0755 libdummy.so "${startfiles_dir}/libm.so" - fi # CT_SHARED_LIBS == y - fi # CT_THREADS == nptl - fi # libc_mode == startfiles - - if [ "${libc_mode}" = "final" ]; then - CT_DoLog EXTRA "Cleaning up startfiles" - CT_DoExecLog ALL rm -f "${startfiles_dir}/crt1.o" \ - "${startfiles_dir}/crti.o" \ - "${startfiles_dir}/crtn.o" \ - "${startfiles_dir}/libc.so" \ - "${startfiles_dir}/libm.so" - - CT_DoLog EXTRA "Building C library" - CT_DoExecLog ALL make "${make_args[@]}" pregen - CT_DoExecLog ALL make ${jflag} "${make_args[@]}" all - - # YEM-FIXME: - # - we want to install 'runtime' files, eg. lib*.{a,so*}, crti.o and - # such files, except the headers as they already are installed - # - "make install_dev" installs the headers, the crti.o... and the - # static libs, but not the dynamic libs - # - "make install_runtime" installs the dynamic libs only - # - "make install" calls install_runtime and install_dev - # - so we're left with re-installing the headers... Sigh... - CT_DoLog EXTRA "Installing C library" - CT_DoExecLog ALL make "${make_args[@]}" install install_utils - fi # libc_mode == final + CT_DoLog EXTRA "Building C library" + CT_DoExecLog ALL make "${make_args[@]}" pregen + CT_DoExecLog ALL make ${jflag} "${make_args[@]}" all + CT_DoLog EXTRA "Installing C library" + CT_DoExecLog ALL make "${make_args[@]}" install install_utils # Now, if installing headers into a subdirectory, put everything in its place. # Remove the header subdirectory if it existed already. @@ -350,28 +262,19 @@ manage_uClibc_config() CT_KconfigDisableOption "LINUXTHREADS_OLD" "${dst}" CT_KconfigDisableOption "LINUXTHREADS_NEW" "${dst}" CT_KconfigDisableOption "UCLIBC_HAS_THREADS_NATIVE" "${dst}" - case "${CT_THREADS}:${CT_LIBC_UCLIBC_LNXTHRD}" in - none:) + case "${CT_THREADS}" in + none) ;; - linuxthreads:) - # Newer version of uClibc-ng, no old/new dichotomy + linuxthreads) CT_KconfigEnableOption "UCLIBC_HAS_THREADS" "${dst}" CT_KconfigEnableOption "UCLIBC_HAS_LINUXTHREADS" "${dst}" ;; - linuxthreads:old) - CT_KconfigEnableOption "UCLIBC_HAS_THREADS" "${dst}" - CT_KconfigEnableOption "LINUXTHREADS_OLD" "${dst}" - ;; - linuxthreads:new) - CT_KconfigEnableOption "UCLIBC_HAS_THREADS" "${dst}" - CT_KconfigEnableOption "LINUXTHREADS_NEW" "${dst}" - ;; - nptl:) + nptl) CT_KconfigEnableOption "UCLIBC_HAS_THREADS" "${dst}" CT_KconfigEnableOption "UCLIBC_HAS_THREADS_NATIVE" "${dst}" ;; *) - CT_Abort "Incorrect thread settings: CT_THREADS='${CT_THREAD}' CT_LIBC_UCLIBC_LNXTHRD='${CT_LIBC_UCLIBC_LNXTHRD}'" + CT_Abort "Incorrect thread settings: CT_THREADS='${CT_THREADS}'" ;; esac @@ -420,7 +323,7 @@ manage_uClibc_config() CT_DoExecLog ALL cp "${dst}" "${dst}.created-by-ct-ng" } -uClibc_post_cc() +uClibc_ng_post_cc() { # uClibc and GCC disagree where the dynamic linker lives. uClibc always # places it in the MULTILIB_DIR, while gcc does that for *some* variants diff --git a/scripts/functions b/scripts/functions index da90980..2446342 100644 --- a/scripts/functions +++ b/scripts/functions @@ -1132,7 +1132,7 @@ CT_DoBuildTargetTuple() # values. case "${CT_LIBC}" in glibc) CT_TARGET_SYS=gnu;; - uClibc) CT_TARGET_SYS=uclibc;; + uClibc-ng) CT_TARGET_SYS=uclibc;; musl) CT_TARGET_SYS=musl;; bionic) CT_TARGET_SYS=android;; none|newlib|picolibc) CT_TARGET_SYS=elf;; diff --git a/scripts/saveSample.sh b/scripts/saveSample.sh index 2f4a10b..e367e6e 100644 --- a/scripts/saveSample.sh +++ b/scripts/saveSample.sh @@ -11,6 +11,10 @@ CT_LoadConfig +# Override CT_VCHECK: we're going to be saving it so need to force saving of +# the config version. +export CT_VCHECK=save + # We can not reliably save a sample which either uses local patches # and/or custom Linux kernel headers. Warn the user about this issue # and continue if he/she confirms sving the sample. diff --git a/scripts/upgrade/v3 b/scripts/upgrade/v3 new file mode 100644 index 0000000..1b8fce8 --- /dev/null +++ b/scripts/upgrade/v3 @@ -0,0 +1,12 @@ +# vim: set filetype=sh : + +# Upgrade v3 -> v4: +# - uClibc retired, leaving only uClibc-ng +upgrade() +{ + case "${opt}" in + CT_LIBC_UCLIBC) + replace CT_LIBC_UCLIBC_NG + ;; + esac +} |