diff options
Diffstat (limited to 'scripts/build')
-rw-r--r-- | scripts/build/arch/avr.sh | 7 | ||||
-rw-r--r-- | scripts/build/arch/moxie.sh | 11 | ||||
-rw-r--r-- | scripts/build/companion_tools/050-make.sh | 15 | ||||
-rw-r--r-- | scripts/build/companion_tools/100-m4.sh | 15 | ||||
-rw-r--r-- | scripts/build/companion_tools/200-autoconf.sh | 15 | ||||
-rw-r--r-- | scripts/build/companion_tools/300-automake.sh | 15 | ||||
-rw-r--r-- | scripts/build/companion_tools/400-libtool.sh | 15 | ||||
-rw-r--r-- | scripts/build/companion_tools/500-dtc.sh | 81 | ||||
-rw-r--r-- | scripts/build/kernel/windows.sh | 1 | ||||
-rw-r--r-- | scripts/build/libc.sh | 39 | ||||
-rw-r--r-- | scripts/build/libc/avr-libc.sh | 19 | ||||
-rw-r--r-- | scripts/build/libc/bionic.sh | 19 | ||||
-rw-r--r-- | scripts/build/libc/glibc.sh | 51 | ||||
-rw-r--r-- | scripts/build/libc/mingw-w64.sh | 25 | ||||
-rw-r--r-- | scripts/build/libc/moxiebox.sh | 84 | ||||
-rw-r--r-- | scripts/build/libc/musl.sh | 28 | ||||
-rw-r--r-- | scripts/build/libc/newlib.sh | 22 | ||||
-rw-r--r-- | scripts/build/libc/none.sh | 18 | ||||
-rw-r--r-- | scripts/build/libc/uClibc.sh | 34 |
19 files changed, 351 insertions, 163 deletions
diff --git a/scripts/build/arch/avr.sh b/scripts/build/arch/avr.sh index 501b020..fd8c8ed 100644 --- a/scripts/build/arch/avr.sh +++ b/scripts/build/arch/avr.sh @@ -2,4 +2,11 @@ CT_DoArchTupleValues() { CT_TARGET_ARCH="${CT_ARCH}" + case "${CT_LIBC}" in + avr-libc) + # avr-libc only seems to work with the non-canonical "avr" target. + CT_TARGET_SKIP_CONFIG_SUB=y + CT_TARGET_SYS= # CT_TARGET_SYS must be empty + ;; + esac } diff --git a/scripts/build/arch/moxie.sh b/scripts/build/arch/moxie.sh new file mode 100644 index 0000000..72c82c9 --- /dev/null +++ b/scripts/build/arch/moxie.sh @@ -0,0 +1,11 @@ +# Moxie-specific arch callbacks + +# No arch-specific overrides yet +CT_DoArchTupleValues() +{ + case "${CT_LIBC}" in + moxiebox) + CT_TARGET_SYS=moxiebox + ;; + esac +} diff --git a/scripts/build/companion_tools/050-make.sh b/scripts/build/companion_tools/050-make.sh index 3253f5b..4c6dc4c 100644 --- a/scripts/build/companion_tools/050-make.sh +++ b/scripts/build/companion_tools/050-make.sh @@ -1,14 +1,17 @@ # Build script for make -do_companion_tools_make_get() { +do_companion_tools_make_get() +{ CT_Fetch MAKE } -do_companion_tools_make_extract() { +do_companion_tools_make_extract() +{ CT_ExtractPatch MAKE } -do_companion_tools_make_for_build() { +do_companion_tools_make_for_build() +{ CT_DoStep INFO "Installing make for build" CT_mkdir_pushd "${CT_BUILD_DIR}/build-make-build" do_make_backend \ @@ -23,7 +26,8 @@ do_companion_tools_make_for_build() { CT_EndStep } -do_companion_tools_make_for_host() { +do_companion_tools_make_for_host() +{ CT_DoStep INFO "Installing make for host" CT_mkdir_pushd "${CT_BUILD_DIR}/build-make-host" do_make_backend \ @@ -38,7 +42,8 @@ do_companion_tools_make_for_host() { CT_EndStep } -do_make_backend() { +do_make_backend() +{ local host local prefix local cflags diff --git a/scripts/build/companion_tools/100-m4.sh b/scripts/build/companion_tools/100-m4.sh index 1707d64..4bbe8d3 100644 --- a/scripts/build/companion_tools/100-m4.sh +++ b/scripts/build/companion_tools/100-m4.sh @@ -1,14 +1,17 @@ # Build script for m4 -do_companion_tools_m4_get() { +do_companion_tools_m4_get() +{ CT_Fetch M4 } -do_companion_tools_m4_extract() { +do_companion_tools_m4_extract() +{ CT_ExtractPatch M4 } -do_companion_tools_m4_for_build() { +do_companion_tools_m4_for_build() +{ CT_DoStep INFO "Installing m4 for build" CT_mkdir_pushd "${CT_BUILD_DIR}/build-m4-build" do_m4_backend \ @@ -20,7 +23,8 @@ do_companion_tools_m4_for_build() { CT_EndStep } -do_companion_tools_m4_for_host() { +do_companion_tools_m4_for_host() +{ CT_DoStep INFO "Installing m4 for host" CT_mkdir_pushd "${CT_BUILD_DIR}/build-m4-host" do_m4_backend \ @@ -32,7 +36,8 @@ do_companion_tools_m4_for_host() { CT_EndStep } -do_m4_backend() { +do_m4_backend() +{ local host local prefix local cflags diff --git a/scripts/build/companion_tools/200-autoconf.sh b/scripts/build/companion_tools/200-autoconf.sh index 52149ea..28ff651 100644 --- a/scripts/build/companion_tools/200-autoconf.sh +++ b/scripts/build/companion_tools/200-autoconf.sh @@ -1,14 +1,17 @@ # Build script for autoconf -do_companion_tools_autoconf_get() { +do_companion_tools_autoconf_get() +{ CT_Fetch AUTOCONF } -do_companion_tools_autoconf_extract() { +do_companion_tools_autoconf_extract() +{ CT_ExtractPatch AUTOCONF } -do_companion_tools_autoconf_for_build() { +do_companion_tools_autoconf_for_build() +{ CT_DoStep INFO "Installing autoconf for build" CT_mkdir_pushd "${CT_BUILD_DIR}/build-autoconf-build" do_autoconf_backend host=${CT_BUILD} prefix="${CT_BUILD_COMPTOOLS_DIR}" @@ -16,7 +19,8 @@ do_companion_tools_autoconf_for_build() { CT_EndStep } -do_companion_tools_autoconf_for_host() { +do_companion_tools_autoconf_for_host() +{ CT_DoStep INFO "Installing autoconf for host" CT_mkdir_pushd "${CT_BUILD_DIR}/build-autoconf-host" do_autoconf_backend host=${CT_HOST} prefix="${CT_PREFIX_DIR}" @@ -24,7 +28,8 @@ do_companion_tools_autoconf_for_host() { CT_EndStep } -do_autoconf_backend() { +do_autoconf_backend() +{ local host local prefix diff --git a/scripts/build/companion_tools/300-automake.sh b/scripts/build/companion_tools/300-automake.sh index 2d7eded..9f7dd49 100644 --- a/scripts/build/companion_tools/300-automake.sh +++ b/scripts/build/companion_tools/300-automake.sh @@ -1,14 +1,17 @@ # Build script for automake -do_companion_tools_automake_get() { +do_companion_tools_automake_get() +{ CT_Fetch AUTOMAKE } -do_companion_tools_automake_extract() { +do_companion_tools_automake_extract() +{ CT_ExtractPatch AUTOMAKE } -do_companion_tools_automake_for_build() { +do_companion_tools_automake_for_build() +{ CT_DoStep INFO "Installing automake for build" CT_mkdir_pushd "${CT_BUILD_DIR}/build-automake-build" do_automake_backend host=${CT_BUILD} prefix="${CT_BUILD_COMPTOOLS_DIR}" @@ -16,7 +19,8 @@ do_companion_tools_automake_for_build() { CT_EndStep } -do_companion_tools_automake_for_host() { +do_companion_tools_automake_for_host() +{ CT_DoStep INFO "Installing automake for host" CT_mkdir_pushd "${CT_BUILD_DIR}/build-automake-host" do_automake_backend host=${CT_HOST} prefix="${CT_PREFIX_DIR}" @@ -24,7 +28,8 @@ do_companion_tools_automake_for_host() { CT_EndStep } -do_automake_backend() { +do_automake_backend() +{ local host local prefix diff --git a/scripts/build/companion_tools/400-libtool.sh b/scripts/build/companion_tools/400-libtool.sh index 3733072..f7aeb6c 100644 --- a/scripts/build/companion_tools/400-libtool.sh +++ b/scripts/build/companion_tools/400-libtool.sh @@ -1,14 +1,17 @@ # Build script for libtool -do_companion_tools_libtool_get() { +do_companion_tools_libtool_get() +{ CT_Fetch LIBTOOL } -do_companion_tools_libtool_extract() { +do_companion_tools_libtool_extract() +{ CT_ExtractPatch LIBTOOL } -do_companion_tools_libtool_for_build() { +do_companion_tools_libtool_for_build() +{ CT_DoStep INFO "Installing libtool for build" CT_mkdir_pushd "${CT_BUILD_DIR}/build-libtool-build" do_libtool_backend host=${CT_BUILD} prefix="${CT_BUILD_COMPTOOLS_DIR}" @@ -16,7 +19,8 @@ do_companion_tools_libtool_for_build() { CT_EndStep } -do_companion_tools_libtool_for_host() { +do_companion_tools_libtool_for_host() +{ CT_DoStep INFO "Installing libtool for host" CT_mkdir_pushd "${CT_BUILD_DIR}/build-libtool-host" do_libtool_backend host=${CT_HOST} prefix="${CT_PREFIX_DIR}" @@ -24,7 +28,8 @@ do_companion_tools_libtool_for_host() { CT_EndStep } -do_libtool_backend() { +do_libtool_backend() +{ local host local prefix diff --git a/scripts/build/companion_tools/500-dtc.sh b/scripts/build/companion_tools/500-dtc.sh new file mode 100644 index 0000000..ce0b303 --- /dev/null +++ b/scripts/build/companion_tools/500-dtc.sh @@ -0,0 +1,81 @@ +# Build script for DTC (device tree compiler) + +do_companion_tools_dtc_get() +{ + CT_Fetch DTC +} + +do_companion_tools_dtc_extract() +{ + CT_ExtractPatch DTC +} + +do_companion_tools_dtc_for_build() +{ + CT_DoStep INFO "Installing dtc for build" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-dtc-build" + do_dtc_backend \ + host=${CT_BUILD} \ + prefix="${CT_BUILD_COMPTOOLS_DIR}" \ + cflags="${CT_CFLAGS_FOR_BUILD}" \ + ldflags="${CT_LDFLAGS_FOR_BUILD}" + CT_Popd + CT_EndStep +} + +do_companion_tools_dtc_for_host() +{ + CT_DoStep INFO "Installing dtc for host" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-dtc-host" + do_dtc_backend \ + host=${CT_HOST} \ + prefix="${CT_PREFIX_DIR}" \ + cflags="${CT_CFLAGS_FOR_HOST}" \ + ldflags="${CT_LDFLAGS_FOR_HOST}" + CT_Popd + CT_EndStep +} + +do_dtc_backend() +{ + local host + local prefix + local cflags + local ldflags + local -a extra_opts + + for arg in "$@"; do + eval "${arg// /\\ }" + done + + extra_opts=( \ + CC="${host}-gcc" \ + AR="${host}-ar" \ + PREFIX="${prefix}" \ + NO_PYTHON=1 \ + BIN=dtc \ + ) + if [ -n "${CT_DTC_VERBOSE}" ]; then + extra_opts+=( V=1 ) + fi + case "${host}" in + *-mingw32) + # Turn off warnings: mingw32 hosts complain about %zd formats even though + # they seem to be supported by mingw32. Only build 'dtc', again, because + # other binaries use syscalls not available under mingw32, but we also + # do not need them. Hijack WARNINGS to override lstat with stat (Windows + # does not have symlinks). + extra_opts+=( BIN=dtc WARNINGS=-Dlstat=stat ) + ;; + esac + + CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/dtc/." . + + CT_DoLog EXTRA "Building dtc" + CT_DoExecLog ALL make all "${extra_opts[@]}" + + # Only install binaries, we don't support shared libraries in installation + # directory yet. + CT_DoLog EXTRA "Installing dtc" + CT_DoExecLog ALL make install-bin "${extra_opts[@]}" +} diff --git a/scripts/build/kernel/windows.sh b/scripts/build/kernel/windows.sh index 5e34420..7d6266c 100644 --- a/scripts/build/kernel/windows.sh +++ b/scripts/build/kernel/windows.sh @@ -6,7 +6,6 @@ CT_DoKernelTupleValues() { # Even we compile for x86_64 target architecture, the target OS have to # bet mingw32 (require by gcc and mingw-w64) CT_TARGET_KERNEL="mingw32" - CT_TARGET_SYS= } do_kernel_get() { diff --git a/scripts/build/libc.sh b/scripts/build/libc.sh new file mode 100644 index 0000000..fb1ebe5 --- /dev/null +++ b/scripts/build/libc.sh @@ -0,0 +1,39 @@ +# C library build routines. We don't invoke the corresponding functions directly +# because some of them build on top of another. E.g. moxiebox runtime requires +# newlib as a prerequisite. + +# Define default hooks - download/unpack just the main package; no-op build hooks. +# The actual implementation can override just what it needs then. +eval "${CT_LIBC//[^A-Za-z0-9]/_}_get() { CT_Fetch ${CT_LIBC_CHOICE_KSYM}; }" +eval "${CT_LIBC//[^A-Za-z0-9]/_}_extract() { CT_ExtractPatch ${CT_LIBC_CHOICE_KSYM}; }" +for _m in start_files main post_cc; do + eval "${CT_LIBC//[^A-Za-z0-9]/_}_${_m}() { :; }" +done + +# Source the selected libc. +. "${CT_LIB_DIR}/scripts/build/libc/${CT_LIBC}.sh" + +do_libc_get() +{ + eval "${CT_LIBC//[^A-Za-z0-9]/_}_get" +} + +do_libc_extract() +{ + eval "${CT_LIBC//[^A-Za-z0-9]/_}_extract" +} + +do_libc_start_files() +{ + eval "${CT_LIBC//[^A-Za-z0-9]/_}_start_files" +} + +do_libc_main() +{ + eval "${CT_LIBC//[^A-Za-z0-9]/_}_main" +} + +do_libc_post_cc() +{ + eval "${CT_LIBC//[^A-Za-z0-9]/_}_post_cc" +} diff --git a/scripts/build/libc/avr-libc.sh b/scripts/build/libc/avr-libc.sh index 7003f38..ce63b4a 100644 --- a/scripts/build/libc/avr-libc.sh +++ b/scripts/build/libc/avr-libc.sh @@ -1,22 +1,7 @@ # This file adds functions to build the avr-libc C library -do_libc_get() { - CT_Fetch AVR_LIBC -} - -do_libc_extract() { - CT_ExtractPatch AVR_LIBC -} - -do_libc_start_files() { - : -} - -do_libc() { - : -} - -do_libc_post_cc() { +avr_libc_post_cc() +{ CT_DoStep INFO "Installing C library" CT_DoLog EXTRA "Copying sources to build directory" diff --git a/scripts/build/libc/bionic.sh b/scripts/build/libc/bionic.sh index 93dcea0..9f04e61 100644 --- a/scripts/build/libc/bionic.sh +++ b/scripts/build/libc/bionic.sh @@ -2,21 +2,15 @@ # Copyright 2017 Howard Chu # Licensed under the GPL v2. See COPYING in the root of this package -do_libc_get() { - CT_Fetch ANDROID_NDK -} - -do_libc_extract() { - CT_ExtractPatch ANDROID_NDK -} - # Install Unified headers -do_libc_start_files() { +bionic_start_files() +{ CT_DoStep INFO "Installing C library headers" CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/android-ndk/sysroot/usr" "${CT_SYSROOT_DIR}" } -do_libc() { +bionic_main() +{ local arch="${CT_ARCH}" if [ "${CT_ARCH_64}" = "y" ]; then if [ "${CT_ARCH}" = "x86" ]; then @@ -34,8 +28,3 @@ do_libc() { # options isn't completely out of character. CT_EnvModify CT_TARGET_CFLAGS "${CT_TARGET_CFLAGS} -D__ANDROID_API__=${CT_ANDROID_API}" } - -do_libc_post_cc() { - : -} - diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index 125ccf7..a9adbbb 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -2,7 +2,8 @@ # Copyright 2007 Yann E. MORIN # Licensed under the GPL v2. See COPYING in the root of this package -do_libc_get() { +glibc_get() +{ local date local version @@ -13,7 +14,8 @@ do_libc_get() { return 0 } -do_libc_extract() { +glibc_extract() +{ CT_ExtractPatch GLIBC if [ "${CT_GLIBC_USE_PORTS_EXTERNAL}" = "y" ]; then CT_ExtractPatch GLIBC_PORTS @@ -29,27 +31,26 @@ do_libc_extract() { } # Build and install headers and start files -do_libc_start_files() { +glibc_start_files() +{ # Start files and Headers should be configured the same way as the # final libc, but built and installed differently. - do_libc_backend libc_mode=startfiles + glibc_backend libc_mode=startfiles } # This function builds and install the full C library -do_libc() { - do_libc_backend libc_mode=final -} - -do_libc_post_cc() { - : +glibc_main() +{ + glibc_backend libc_mode=final } # This backend builds the C library once for each multilib # variant the compiler gives us -# Usage: do_libc_backend param=value [...] +# Usage: glibc_backend param=value [...] # Parameter : Definition : Type : Default # libc_mode : 'startfiles' or 'final' : string : (none) -do_libc_backend() { +glibc_backend() +{ local libc_mode local arg @@ -70,17 +71,18 @@ do_libc_backend() { esac CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}" - CT_IterateMultilibs do_libc_backend_once multilib libc_mode="${libc_mode}" + CT_IterateMultilibs glibc_backend_once multilib libc_mode="${libc_mode}" CT_Popd CT_EndStep } # This backend builds the C library once -# Usage: do_libc_backend_once param=value [...] +# Usage: glibc_backend_once param=value [...] # Parameter : Definition : Type # libc_mode : 'startfiles' or 'final' : string : (empty) # multi_* : as defined in CT_IterateMultilibs : (varies) : -do_libc_backend_once() { +glibc_backend_once() +{ 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 @@ -136,7 +138,7 @@ do_libc_backend_once() { # values, as they CT_GLIBC_EXTRA_CONFIG_ARRAY is passed after # extra_config - extra_config+=("$(do_libc_min_kernel_config)") + extra_config+=("$(glibc_min_kernel_config)") case "${CT_THREADS}" in nptl) extra_config+=("--with-__thread" "--with-tls");; @@ -165,9 +167,9 @@ do_libc_backend_once() { extra_config+=("--enable-oldest-abi=${CT_GLIBC_OLDEST_ABI}") fi - case "$(do_libc_add_ons_list ,)" in + case "$(glibc_add_ons_list ,)" in "") extra_config+=("--enable-add-ons=no");; - *) extra_config+=("--enable-add-ons=$(do_libc_add_ons_list ,)");; + *) extra_config+=("--enable-add-ons=$(glibc_add_ons_list ,)");; esac [ "${CT_GLIBC_ENABLE_WERROR}" != "y" ] && extra_config+=("--disable-werror") @@ -241,7 +243,7 @@ do_libc_backend_once() { # Run explicitly through CONFIG_SHELL, or the build breaks badly (loop-of-death) # when the shell is not bash... Sigh... :-( - CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'" + 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}'" @@ -402,7 +404,7 @@ do_libc_backend_once() { fi if [ "${CT_GLIBC_LOCALES}" = "y" -a "${multi_index}" = "${multi_count}" ]; then - do_libc_locales + glibc_locales fi fi # libc_mode = final @@ -410,7 +412,8 @@ do_libc_backend_once() { } # Build up the addons list, separated with $1 -do_libc_add_ons_list() { +glibc_add_ons_list() +{ local sep="$1" local addons_list @@ -427,7 +430,8 @@ do_libc_add_ons_list() { } # Compute up the minimum supported Linux kernel version -do_libc_min_kernel_config() { +glibc_min_kernel_config() +{ local min_kernel_config case "${CT_GLIBC_EXTRA_CONFIG_ARRAY[*]}" in @@ -462,7 +466,8 @@ do_libc_min_kernel_config() { } # Build and install the libc locales -do_libc_locales() { +glibc_locales() +{ local src_dir="${CT_SRC_DIR}/glibc" local -a extra_config local glibc_cflags diff --git a/scripts/build/libc/mingw-w64.sh b/scripts/build/libc/mingw-w64.sh index 3026b87..6e87073 100644 --- a/scripts/build/libc/mingw-w64.sh +++ b/scripts/build/libc/mingw-w64.sh @@ -1,22 +1,15 @@ # Copyright 2012 Yann Diorcet # Licensed under the GPL v2. See COPYING in the root of this package -do_libc_get() { - CT_Fetch MINGW_W64 -} - -do_libc_extract() { - CT_ExtractPatch MINGW_W64 -} - -do_set_mingw_install_prefix(){ +mingw_w64_set_install_prefix() +{ MINGW_INSTALL_PREFIX=/usr/${CT_TARGET} if [[ ${CT_MINGW_W64_VERSION} == 2* ]]; then MINGW_INSTALL_PREFIX=/usr fi } -do_libc_start_files() { +mingw_w64_start_files() { local -a sdk_opts CT_DoStep INFO "Installing C library headers" @@ -36,7 +29,7 @@ do_libc_start_files() { CT_DoLog EXTRA "Configuring Headers" - do_set_mingw_install_prefix + mingw_w64_set_install_prefix CT_DoExecLog CFG \ ${CONFIG_SHELL} \ "${CT_SRC_DIR}/mingw-w64/mingw-w64-headers/configure" \ @@ -96,7 +89,7 @@ do_mingw_tools() --program-prefix=${CT_TARGET}- \ --prefix="${CT_PREFIX_DIR}" - # mingw-w64 has issues with parallel builds, see do_libc + # mingw-w64 has issues with parallel builds, see mingw_w64_main CT_DoLog EXTRA "Building ${f}" CT_DoExecLog ALL make CT_DoLog EXTRA "Installing ${f}" @@ -154,7 +147,7 @@ do_mingw_pthreads() --build=${CT_BUILD} \ --host=${multi_target} - # mingw-w64 has issues with parallel builds, see do_libc + # mingw-w64 has issues with parallel builds, see mingw_w64_main CT_DoLog EXTRA "Building mingw-w64-winpthreads" CT_DoExecLog ALL make @@ -179,7 +172,7 @@ do_mingw_pthreads() CT_EndStep } -do_libc() +mingw_w64_main() { # Used when iterating over libwinpthread local default_libprefix @@ -192,7 +185,7 @@ do_libc() CT_mkdir_pushd "${CT_BUILD_DIR}/build-mingw-w64-crt" - do_set_mingw_install_prefix + mingw_w64_set_install_prefix CT_DoExecLog CFG \ ${CONFIG_SHELL} \ "${CT_SRC_DIR}/mingw-w64/mingw-w64-crt/configure" \ @@ -228,6 +221,6 @@ do_libc() fi } -do_libc_post_cc() { +mingw_w64_post_cc() { : } diff --git a/scripts/build/libc/moxiebox.sh b/scripts/build/libc/moxiebox.sh new file mode 100644 index 0000000..376c742 --- /dev/null +++ b/scripts/build/libc/moxiebox.sh @@ -0,0 +1,84 @@ +# Functions to build the moxiebox runtime. + +. "${CT_LIB_DIR}/scripts/build/libc/newlib.sh" + +moxiebox_get() +{ + CT_Fetch NEWLIB + CT_Fetch MOXIEBOX +} + +moxiebox_extract() +{ + CT_ExtractPatch NEWLIB + CT_ExtractPatch MOXIEBOX +} + +moxiebox_start_files() +{ + newlib_start_files +} + +moxiebox_main() +{ + newlib_main + + # newlib installs the linker script, moxiebox.ld, to the + # PREFIX/moxie-unknown-moxiebox/lib, but ld searches PREFIX/lib when + # configured for that target. ld does find scripts in PREFIX/TARGET/lib + # for other targets, so this seems to be moxie architecture's quirk. + # Move it to PREFIX/lib. + # TBD CT_DoExecLog ALL mv -v "${CT_SYSROOT_DIR}/lib/"*.ld "${CT_PREFIX_DIR}/lib" + # TBD what about moxie-*-elf? Does it need the same? + + CT_DoStep INFO "Installing moxiebox runtime and VM" + + CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-moxiebox" + CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/moxiebox/." . + + CT_DoLog EXTRA "Building SHA256-only libcrypto" + # Moxiebox needs libcrypto on the host, but it only uses SHA256 digest functions + # from it. We don't want to pull the whole OpenSSL for the host; fortunately, + # moxiebox comes with a standalone SHA256 implementation - which it only uses + # for the target library. Help it use the same implementation for the host. + CT_mkdir_pushd openssl + CT_DoExecLog ALL cp -v "${CT_LIB_DIR}/packages/moxiebox/"sha*.[ch] ./ + CT_DoExecLog ALL "${CT_HOST}-gcc" -c sha256_wrap.c -O2 -Wall + CT_DoExecLog ALL "${CT_HOST}-ar" cru libcrypto.a sha256_wrap.o + CT_Popd + + # Moxiebox includes a VM which we're building for the + # host machine. + CT_DoLog EXTRA "Configuring moxiebox" + + CT_DoExecLog CFG ./autogen.sh + + # moxiebox build script create symlinks from the installation location to the build + # directory for the moxiebox library. This seems backwards. Instead, pass the search + # as part of the MOX_GCC definition. + # moxiebox also depends on the tools being named moxiebox-{gcc,as,ar}. However, failure + # to detect such tools is non-fatal in the configure and we need to override it in + # make's command line anyway. + CT_DoExecLog CFG \ + LDFLAGS="${CT_LDFLAGS_FOR_HOST} -L${CT_BUILD_DIR}/build-libc-moxiebox/openssl" \ + CFLAGS="${CT_CFLAGS_FOR_HOST} -I${CT_BUILD_DIR}/build-libc-moxiebox" \ + CXXFLAGS="${CT_CFLAGS_FOR_HOST} -I${CT_BUILD_DIR}/build-libc-moxiebox" \ + ./configure \ + --host="${CT_HOST}" + CT_DoLog EXTRA "Building moxiebox" + CT_DoExecLog CFG make all \ + MOX_GCC="${CT_TARGET}-gcc -B ${CT_BUILD_DIR}/build-libc-moxiebox/runtime -B ${CT_SYSROOT_DIR}/lib" \ + MOX_AS="${CT_TARGET}-as" \ + MOX_AR="${CT_TARGET}-ar" + + CT_DoLog EXTRA "Installing moxiebox" + + # moxiebox does not have install target. Copy the interesting stuff manually. + CT_DoExecLog ALL cp -v "${CT_BUILD_DIR}/build-libc-moxiebox/runtime/libsandboxrt.a" \ + "${CT_BUILD_DIR}/build-libc-moxiebox/runtime/crt0.o" \ + "${CT_SYSROOT_DIR}/lib/" + CT_DoExecLog ALL cp -v "${CT_BUILD_DIR}/build-libc-moxiebox/src/sandbox" \ + "${CT_PREFIX_DIR}/bin" + CT_Popd + CT_EndStep +} diff --git a/scripts/build/libc/musl.sh b/scripts/build/libc/musl.sh index 430fb8d..0a93d10 100644 --- a/scripts/build/libc/musl.sh +++ b/scripts/build/libc/musl.sh @@ -2,33 +2,27 @@ # Copyright 2013 Timo Teräs # Licensed under the GPL v2. See COPYING in the root of this package -do_libc_get() { - CT_Fetch MUSL -} - -do_libc_extract() { - CT_ExtractPatch MUSL -} - # Build and install headers and start files -do_libc_start_files() { +musl_start_files() +{ # Start files and Headers should be configured the same way as the # final libc, but built and installed differently. - do_libc_backend libc_mode=startfiles + musl_backend libc_mode=startfiles } # This function builds and install the full C library -do_libc() { - do_libc_backend libc_mode=final +musl_main() +{ + musl_backend libc_mode=final } -do_libc_post_cc() { +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 } -do_libc_backend() { +musl_backend() { local libc_mode local arg @@ -43,16 +37,16 @@ do_libc_backend() { esac CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}" - CT_IterateMultilibs do_libc_backend_once multilib libc_mode="${libc_mode}" + CT_IterateMultilibs musl_backend_once multilib libc_mode="${libc_mode}" CT_Popd CT_EndStep } # This backend builds the C library -# Usage: do_libc_backend param=value [...] +# Usage: musl_backend param=value [...] # Parameter : Definition : Type : Default # libc_mode : 'startfiles' or 'final' : string : (none) -do_libc_backend_once() { +musl_backend_once() { local libc_mode local -a extra_cflags local -a extra_config diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh index 6449d68..69d2b46 100644 --- a/scripts/build/libc/newlib.sh +++ b/scripts/build/libc/newlib.sh @@ -5,15 +5,8 @@ # Edited by Martin Lund <mgl@doredevelopment.dk> # -do_libc_get() { - CT_Fetch NEWLIB -} - -do_libc_extract() { - CT_ExtractPatch NEWLIB -} - -do_libc_start_files() { +newlib_start_files() +{ CT_DoStep INFO "Installing C library headers & start files" CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/newlib/newlib/libc/include/." \ "${CT_HEADERS_DIR}" @@ -25,14 +18,14 @@ do_libc_start_files() { CT_EndStep } -do_libc() { +newlib_main() +{ local -a newlib_opts local cflags_for_target CT_DoStep INFO "Installing C library" - mkdir -p "${CT_BUILD_DIR}/build-libc" - cd "${CT_BUILD_DIR}/build-libc" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc" CT_DoLog EXTRA "Configuring C library" @@ -135,9 +128,6 @@ ENABLE_TARGET_OPTSPACE:target-optspace "${CT_PREFIX_DIR}/share/doc/newlib" fi + CT_Popd CT_EndStep } - -do_libc_post_cc() { - : -} diff --git a/scripts/build/libc/none.sh b/scripts/build/libc/none.sh index 8537a8e..5173afb 100644 --- a/scripts/build/libc/none.sh +++ b/scripts/build/libc/none.sh @@ -2,22 +2,12 @@ # Copyright 2008 Yann E. MORIN # Licensed under the GPL v2. See COPYING in the root of this package -do_libc_get() { +none_get() +{ : } -do_libc_extract() { - : -} - -do_libc_start_files() { - : -} - -do_libc() { - : -} - -do_libc_post_cc() { +none_extract() +{ : } diff --git a/scripts/build/libc/uClibc.sh b/scripts/build/libc/uClibc.sh index eb6cf5b..ed2ea90 100644 --- a/scripts/build/libc/uClibc.sh +++ b/scripts/build/libc/uClibc.sh @@ -2,30 +2,23 @@ # Copyright 2007 Yann E. MORIN # Licensed under the GPL v2. See COPYING in the root of this package -# Download uClibc -do_libc_get() { - CT_Fetch UCLIBC -} - -# Extract uClibc -do_libc_extract() { - CT_ExtractPatch UCLIBC -} - # Build and install headers and start files -do_libc_start_files() { +uclibc_start_files() +{ # Start files and Headers should be configured the same way as the # final libc, but built and installed differently. - do_libc_backend libc_mode=startfiles + uclibc_backend libc_mode=startfiles } # This function builds and install the full C library -do_libc() { - do_libc_backend libc_mode=final +uclibc_main() +{ + uclibc_backend libc_mode=final } # Common backend for 1st and 2nd passes. -do_libc_backend() { +uclibc_backend() +{ local libc_mode local arg @@ -40,13 +33,14 @@ do_libc_backend() { esac CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}" - CT_IterateMultilibs do_libc_backend_once multilib libc_mode="${libc_mode}" + CT_IterateMultilibs uclibc_backend_once multilib libc_mode="${libc_mode}" CT_Popd CT_EndStep } # Common backend for 1st and 2nd passes, once per multilib. -do_libc_backend_once() { +uclibc_backend_once() +{ local libc_mode local multi_dir multi_os_dir multi_root multi_flags multi_index multi_count local multilib_dir startfiles_dir @@ -215,7 +209,8 @@ do_libc_backend_once() { # Initialises the .config file to sensible values # $1: original file # $2: modified file -manage_uClibc_config() { +manage_uClibc_config() +{ src="$1" dst="$2" flags="$3" @@ -408,7 +403,8 @@ manage_uClibc_config() { CT_DoArchUClibcCflags "${dst}" "${flags}" } -do_libc_post_cc() { +uclibc_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 # and expects it in /lib for the other. So, create a symlink from lib |