diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/build/cc/gcc.sh (renamed from scripts/build/cc_gcc.sh) | 58 | ||||
-rw-r--r-- | scripts/build/kernel/none.sh | 19 | ||||
-rw-r--r-- | scripts/build/libc/eglibc.sh (renamed from scripts/build/libc_eglibc.sh) | 0 | ||||
-rw-r--r-- | scripts/build/libc/glibc.sh (renamed from scripts/build/libc_glibc.sh) | 0 | ||||
-rw-r--r-- | scripts/build/libc/none.sh | 36 | ||||
-rw-r--r-- | scripts/build/libc/uClibc.sh (renamed from scripts/build/libc_uClibc.sh) | 0 | ||||
-rwxr-xr-x | scripts/crosstool.sh | 17 | ||||
-rw-r--r-- | scripts/functions | 6 | ||||
-rwxr-xr-x | scripts/showSamples.sh | 6 |
9 files changed, 112 insertions, 30 deletions
diff --git a/scripts/build/cc_gcc.sh b/scripts/build/cc/gcc.sh index f1f42fc..24ee3c3 100644 --- a/scripts/build/cc_gcc.sh +++ b/scripts/build/cc/gcc.sh @@ -1,4 +1,5 @@ # This file adds the function to build the gcc C compiler + ${extra_config} \ # Copyright 2007 Yann E. MORIN # Licensed under the GPL v2. See COPYING in the root of this package @@ -27,20 +28,26 @@ do_cc_extract() { #------------------------------------------------------------------------------ # Core gcc pass 1 do_cc_core_pass_1() { - # In case we're NPTL, build the static core gcc; - # in any other case, do nothing. - case "${CT_THREADS}" in - nptl) do_cc_core mode=static build_libgcc=no;; + # If we're building for bare metal, build the static core gcc, + # with libgcc. + # In case we're not bare metal, and we're NPTL, build the static core gcc. + # In any other case, do nothing. + case "${CT_BARE_METAL},${CT_THREADS}" in + y,*) do_cc_core mode=baremetal build_libgcc=yes;; + ,nptl) do_cc_core mode=static build_libgcc=no;; *) ;; esac } # Core gcc pass 2 do_cc_core_pass_2() { - # In case we're NPTL, build the shared core gcc, - # in any other case, build the static core gcc and the target libgcc. - case "${CT_THREADS}" in - nptl) do_cc_core mode=shared build_libgcc=yes;; + # In case we're building for bare metal, do nothing, we already have + # our compiler. + # In case we're NPTL, build the shared core gcc. + # In any other case, build the static core gcc and the target libgcc. + case "${CT_BARE_METAL},${CT_THREADS}" in + y,*) ;; + ,nptl) do_cc_core mode=shared build_libgcc=yes;; *) do_cc_core mode=static build_libgcc=yes;; esac } @@ -49,9 +56,9 @@ do_cc_core_pass_2() { # Build core gcc # This function is used to build both the static and the shared core C conpiler, # with or without the target libgcc. We need to know wether: -# - we're building static or shared: mode=[static|shared] -# - we need to build libgcc or not: build_libgcc=[yes|no] -# Usage: do_cc_core_static mode=[static|shared] build_libgcc=[yes|no] +# - we're building static, shared or bare metal: mode=[static|shared|baremetal] +# - we need to build libgcc or not : build_libgcc=[yes|no] +# Usage: do_cc_core_static mode=[static|shared|baremetal] build_libgcc=[yes|no] do_cc_core() { local mode local build_libgcc @@ -60,7 +67,7 @@ do_cc_core() { eval $1 eval $2 - CT_TestOrAbort "Internal Error: 'mode' must either 'static' or 'shared', not '${mode:-(empty)}'" "${mode}" = "static" -o "${mode}" = "shared" + CT_TestOrAbort "Internal Error: 'mode' must either 'static', 'shared' or 'baremetal', not '${mode:-(empty)}'" "${mode}" = "static" -o "${mode}" = "shared" -o "${mode}" = "baremetal" CT_TestOrAbort "Internal Error: 'build_libgcc' must be either 'yes' or 'no', not '${build_libgcc:-(empty)}'" "${build_libgcc}" = "yes" -o "${build_libgcc}" = "no" # In normal conditions, ( "${mode}" = "shared" ) implies # ( "${build_libgcc}" = "yes" ), but I won't check for that @@ -73,16 +80,25 @@ do_cc_core() { static) core_prefix_dir="${CT_CC_CORE_STATIC_PREFIX_DIR}" extra_config="${extra_config} --with-newlib --enable-threads=no --disable-shared" + copy_headers=y ;; shared) core_prefix_dir="${CT_CC_CORE_SHARED_PREFIX_DIR}" extra_config="${extra_config} --enable-shared" + copy_headers=y + ;; + baremetal) + core_prefix_dir="${CT_PREFIX_DIR}" + extra_config="${extra_config} --with-newlib --enable-threads=no --disable-shared" + copy_headers=n ;; esac - CT_DoLog DEBUG "Copying headers to install area of bootstrap gcc, so it can build libgcc2" - CT_DoExecLog ALL mkdir -p "${core_prefix_dir}/${CT_TARGET}/include" - CT_DoExecLog ALL cp -r "${CT_HEADERS_DIR}"/* "${core_prefix_dir}/${CT_TARGET}/include" + if [ "${copy_headers}" = "y" ]; then + CT_DoLog DEBUG "Copying headers to install area of bootstrap gcc, so it can build libgcc2" + CT_DoExecLog ALL mkdir -p "${core_prefix_dir}/${CT_TARGET}/include" + CT_DoExecLog ALL cp -r "${CT_HEADERS_DIR}"/* "${core_prefix_dir}/${CT_TARGET}/include" + fi CT_DoLog EXTRA "Configuring ${mode} core C compiler" @@ -193,6 +209,9 @@ do_cc_core() { #------------------------------------------------------------------------------ # Build final gcc do_cc() { + # If building for bare metal, nothing to be done here, the static core conpiler is enough! + [ "${CT_BARE_METAL}" = "y" ] && return 0 + CT_DoStep INFO "Installing final compiler" mkdir -p "${CT_BUILD_DIR}/build-cc" @@ -216,8 +235,13 @@ do_cc() { extra_config="--enable-languages=${lang_opt}" extra_config="${extra_config} --disable-multilib" - extra_config="${extra_config} ${CT_ARCH_WITH_ARCH} ${CT_ARCH_WITH_ABI} ${CT_ARCH_WITH_CPU} ${CT_ARCH_WITH_TUNE} ${CT_ARCH_WITH_FPU} ${CT_ARCH_WITH_FLOAT}" - [ "${CT_SHARED_LIBS}" = "y" ] || extra_config="${extra_config} --disable-shared" + extra_config="${extra_config} ${CT_ARCH_WITH_ARCH}" + extra_config="${extra_config} ${CT_ARCH_WITH_ABI}" + extra_config="${extra_config} ${CT_ARCH_WITH_CPU}" + extra_config="${extra_config} ${CT_ARCH_WITH_TUNE}" + extra_config="${extra_config} ${CT_ARCH_WITH_FPU}" + extra_config="${extra_config} ${CT_ARCH_WITH_FLOAT}" + [ "${CT_SHARED_LIBS}" = "y" ] || extra_config="${extra_config} --disable-shared" [ "${CT_GMP_MPFR}" = "y" ] && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}" [ -n "${CT_CC_PKGVERSION}" ] && extra_config="${extra_config} --with-pkgversion=${CT_CC_PKGVERSION}" [ -n "${CT_CC_BUGURL}" ] && extra_config="${extra_config} --with-bugurl=${CT_CC_BUGURL}" diff --git a/scripts/build/kernel/none.sh b/scripts/build/kernel/none.sh new file mode 100644 index 0000000..2dfda41 --- /dev/null +++ b/scripts/build/kernel/none.sh @@ -0,0 +1,19 @@ +# This file declares functions for bare metal kernel (IE. none) +# Copyright 2008 Yann E. MORIN +# Licensed under the GPL v2. See COPYING in the root of this package + +do_print_filename() { + : +} + +do_kernel_get() { + : +} + +do_kernel_extract() { + : +} + +do_kernel_headers() { + : +} diff --git a/scripts/build/libc_eglibc.sh b/scripts/build/libc/eglibc.sh index 6b6e718..6b6e718 100644 --- a/scripts/build/libc_eglibc.sh +++ b/scripts/build/libc/eglibc.sh diff --git a/scripts/build/libc_glibc.sh b/scripts/build/libc/glibc.sh index b864a5b..b864a5b 100644 --- a/scripts/build/libc_glibc.sh +++ b/scripts/build/libc/glibc.sh diff --git a/scripts/build/libc/none.sh b/scripts/build/libc/none.sh new file mode 100644 index 0000000..4053459 --- /dev/null +++ b/scripts/build/libc/none.sh @@ -0,0 +1,36 @@ +# This file adds functions to build the C library for bare metal (IE. none) +# Copyright 2008 Yann E. MORIN +# Licensed under the GPL v2. See COPYING in the root of this package + +do_print_filename() { + : +} + +do_libc_get() { + : +} + +do_libc_extract() { + : +} + +do_libc_check_config() { + : +} + +do_libc_headers() { + : +} + +# Build and install start files +do_libc_start_files() { + : +} + +do_libc() { + : +} + +do_libc_finish() { + : +} diff --git a/scripts/build/libc_uClibc.sh b/scripts/build/libc/uClibc.sh index 85f5997..85f5997 100644 --- a/scripts/build/libc_uClibc.sh +++ b/scripts/build/libc/uClibc.sh diff --git a/scripts/crosstool.sh b/scripts/crosstool.sh index f0eaa82..35aa247 100755 --- a/scripts/crosstool.sh +++ b/scripts/crosstool.sh @@ -356,8 +356,8 @@ fi . "${CT_LIB_DIR}/scripts/build/gmp.sh" . "${CT_LIB_DIR}/scripts/build/mpfr.sh" . "${CT_LIB_DIR}/scripts/build/binutils.sh" -. "${CT_LIB_DIR}/scripts/build/libc_${CT_LIBC}.sh" -. "${CT_LIB_DIR}/scripts/build/cc_${CT_CC}.sh" +. "${CT_LIB_DIR}/scripts/build/libc/${CT_LIBC}.sh" +. "${CT_LIB_DIR}/scripts/build/cc/${CT_CC}.sh" . "${CT_LIB_DIR}/scripts/build/debug.sh" . "${CT_LIB_DIR}/scripts/build/tools.sh" @@ -433,12 +433,13 @@ if [ "${CT_ONLY_DOWNLOAD}" != "y" -a "${CT_ONLY_EXTRACT}" != "y" ]; then find "${CT_PREFIX_DIR}/bin" -name "${CT_HOST}-"'*' -exec rm -fv {} \; |CT_DoLog DEBUG rm -fv "${CT_PREFIX_DIR}/bin/makeinfo" |CT_DoLog DEBUG - # Install the /populator/ - CT_DoLog EXTRA "Installing the populate helper" - sed -r -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \ - "${CT_LIB_DIR}/tools/populate.in" \ - >"${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate" - chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate" + if [ "${CT_BARE_METAL}" != "y" ]; then + CT_DoLog EXTRA "Installing the populate helper" + sed -r -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \ + "${CT_LIB_DIR}/tools/populate.in" \ + >"${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate" + chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate" + fi # Create the aliases to the target tools CT_DoLog EXTRA "Creating toolchain aliases" diff --git a/scripts/functions b/scripts/functions index d80e2fa..829539f 100644 --- a/scripts/functions +++ b/scripts/functions @@ -673,6 +673,7 @@ CT_DoBuildTargetTuple() { # Set defaults for the system part of the tuple. Can be overriden # by architecture-specific values. case "${CT_LIBC}" in + none) CT_TARGET_SYS=elf;; *glibc) CT_TARGET_SYS=gnu;; uClibc) CT_TARGET_SYS=uclibc;; esac @@ -695,9 +696,10 @@ CT_DoBuildTargetTuple() { # Finish the target tuple construction case "${CT_KERNEL}" in - linux*) CT_TARGET_KERNEL=linux;; + none) CT_TARGET_KERNEL=;; + linux) CT_TARGET_KERNEL=linux-;; esac - CT_TARGET=$(CT_DoConfigSub "${CT_TARGET_ARCH}-${CT_TARGET_VENDOR:-unknown}-${CT_TARGET_KERNEL}-${CT_TARGET_SYS}") + CT_TARGET=$(CT_DoConfigSub "${CT_TARGET_ARCH}-${CT_TARGET_VENDOR:-unknown}-${CT_TARGET_KERNEL}${CT_TARGET_SYS}") # Prepare the target CFLAGS CT_ARCH_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_ARCH_ENDIAN_CFLAG}" diff --git a/scripts/showSamples.sh b/scripts/showSamples.sh index eab9edf..666656f 100755 --- a/scripts/showSamples.sh +++ b/scripts/showSamples.sh @@ -30,7 +30,7 @@ dump_single_sample() { [ "${CT_EXPERIMENTAL}" = "y" ] && printf "X" || printf " " echo "]" if [ ${verbose} -ne 0 ]; then - echo " OS : ${CT_KERNEL}-${CT_KERNEL_VERSION}" + echo " OS : ${CT_KERNEL}${CT_KERNEL_VERSION:+-}${CT_KERNEL_VERSION}" if [ "${CT_GMP_MPFR}" = "y" ]; then echo " GMP/MPFR : gmp-${CT_GMP_VERSION} / mpfr-${CT_MPFR_VERSION}" fi @@ -44,7 +44,7 @@ dump_single_sample() { [ "${CT_CC_LANG_OBJCXX}" = "y" ] && printf ",Objective-C++" [ -n "${CT_CC_LANG_OTHERS}" ] && printf ",${CT_CC_LANG_OTHERS}" echo ")" - echo " C library : ${CT_LIBC}-${CT_LIBC_VERSION}" + echo " C library : ${CT_LIBC}${CT_LIBC_VERSION:+-}${CT_LIBC_VERSION}" printf " Tools :" [ "${CT_LIBELF}" ] && printf " libelf-${CT_LIBELF_VERSION}" [ "${CT_SSTRIP}" ] && printf " sstrip" @@ -133,7 +133,7 @@ for sample in "${@}"; do done if [ "${opt}" = -w ]; then - printf "^ Total: ${#@} samples | ''X'': sample uses features marked as being EXPERIMENTAL.\\\\\\\\ ''B'': Samples is curently BROKEN. |||||||||||||" + printf "^ Total: ${#@} samples | ''X'': sample uses features marked as being EXPERIMENTAL.\\\\\\\\ ''B'': sample is curently BROKEN. |||||||||||||" echo "" elif [ -z "${opt}" ]; then echo ' l (local) : sample was found in current directory' |