summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build/arch/arm.sh1
-rw-r--r--scripts/build/arch/mips.sh11
-rw-r--r--scripts/build/arch/msp430.sh5
-rw-r--r--scripts/build/cc/100-gcc.sh12
-rw-r--r--scripts/build/companion_libs/050-zlib.sh49
-rw-r--r--scripts/build/debug/300-gdb.sh9
-rw-r--r--scripts/build/libc/bionic.sh43
-rw-r--r--scripts/crosstool-NG.sh.in2
-rw-r--r--scripts/functions1
-rwxr-xr-xscripts/gen_in_frags.sh161
-rw-r--r--scripts/saveSample.sh.in2
-rwxr-xr-xscripts/showSamples.sh2
12 files changed, 111 insertions, 187 deletions
diff --git a/scripts/build/arch/arm.sh b/scripts/build/arch/arm.sh
index eeffc7d..8733ac3 100644
--- a/scripts/build/arch/arm.sh
+++ b/scripts/build/arch/arm.sh
@@ -18,6 +18,7 @@ CT_DoArchTupleValues() {
*glibc,y) CT_TARGET_SYS=gnueabi;;
uClibc,y) CT_TARGET_SYS=uclibc${CT_LIBC_UCLIBC_USE_GNU_SUFFIX:+gnu}eabi;;
musl,y) CT_TARGET_SYS=musleabi;;
+ bionic,y) CT_TARGET_SYS=android;;
*,y) CT_TARGET_SYS=eabi;;
esac
diff --git a/scripts/build/arch/mips.sh b/scripts/build/arch/mips.sh
index f91a80a..acb8851 100644
--- a/scripts/build/arch/mips.sh
+++ b/scripts/build/arch/mips.sh
@@ -48,6 +48,17 @@ CT_DoArchUClibcConfig() {
CT_KconfigDeleteOption "CONFIG_MIPS_ISA_MIPS64R2" "${cfg}"
}
+CT_DoArchUClibcHeaderDir() {
+ local dir_var="${1}"
+ local cflags="${2}"
+
+ # If it is non-default multilib, add a suffix with architecture (reported by gcc)
+ # to the headers installation path.
+ if [ -n "${cflags}" ]; then
+ eval "${dir_var}="$( ${CT_TARGET}-${CT_CC} -print-multiarch ${cflags} )
+ fi
+}
+
CT_DoArchUClibcCflags() {
local cfg="${1}"
local cflags="${2}"
diff --git a/scripts/build/arch/msp430.sh b/scripts/build/arch/msp430.sh
new file mode 100644
index 0000000..8edb72a
--- /dev/null
+++ b/scripts/build/arch/msp430.sh
@@ -0,0 +1,5 @@
+# Compute MSP430-specific values
+
+CT_DoArchTupleValues() {
+ CT_TARGET_ARCH="${CT_ARCH}"
+}
diff --git a/scripts/build/cc/100-gcc.sh b/scripts/build/cc/100-gcc.sh
index 190aec8..c45253a 100644
--- a/scripts/build/cc/100-gcc.sh
+++ b/scripts/build/cc/100-gcc.sh
@@ -337,10 +337,8 @@ do_gcc_core_backend() {
CT_DoLog EXTRA "Configuring final gcc compiler"
extra_user_config=( "${CT_CC_GCC_EXTRA_CONFIG_ARRAY[@]}" )
log_txt="final gcc compiler"
- if [ "${CT_CC_GCC_TARGET_FINAL}" = "y" ]; then
- # to inhibit the libiberty and libgcc tricks later on
- build_libgcc=no
- fi
+ # 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' or 'gcc_host', not '${build_step:-(empty)}'"
@@ -663,10 +661,8 @@ do_gcc_core_backend() {
case "${build_step}" in
gcc_build|gcc_host)
- if [ "${CT_CC_GCC_TARGET_FINAL}" = "y" ]; then
- core_targets_all=all
- core_targets_install=install
- fi
+ core_targets_all=all
+ core_targets_install=install
;;
esac
diff --git a/scripts/build/companion_libs/050-zlib.sh b/scripts/build/companion_libs/050-zlib.sh
index 10779af..a3ba638 100644
--- a/scripts/build/companion_libs/050-zlib.sh
+++ b/scripts/build/companion_libs/050-zlib.sh
@@ -76,30 +76,51 @@ do_zlib_backend() {
local ldflags
local arg
local -a extra_config
+ local -a extra_make
for arg in "$@"; do
eval "${arg// /\\ }"
done
- CT_DoLog EXTRA "Configuring zlib"
-
- CT_DoExecLog CFG \
- CFLAGS="${cflags}" \
- LDFLAGS="${ldflags}" \
- CHOST="${host}" \
- ${CONFIG_SHELL} \
- "${CT_SRC_DIR}/zlib-${CT_ZLIB_VERSION}/configure" \
- --prefix="${prefix}" \
- --static \
- "${extra_config[@]}"
+ case "${host}" in
+ *-mingw32)
+ # zlib treats mingw host differently and requires using a different
+ # makefile rather than configure+make. It also does not support
+ # out-of-tree building.
+ cp -av "${CT_SRC_DIR}/zlib-${CT_ZLIB_VERSION}/." .
+ extra_make=( -f win32/Makefile.gcc \
+ PREFIX="${host}-" \
+ SHAREDLIB= \
+ IMPLIB= \
+ LIBRARY_PATH="${prefix}/lib" \
+ INCLUDE_PATH="${prefix}/include" \
+ BINARY_PATH="${prefix}/bin" \
+ prefix="${prefix}" \
+ )
+ ;;
+
+ *)
+ CT_DoLog EXTRA "Configuring zlib"
+
+ CT_DoExecLog CFG \
+ CFLAGS="${cflags}" \
+ LDFLAGS="${ldflags}" \
+ CHOST="${host}" \
+ ${CONFIG_SHELL} \
+ "${CT_SRC_DIR}/zlib-${CT_ZLIB_VERSION}/configure" \
+ --prefix="${prefix}" \
+ --static \
+ "${extra_config[@]}"
+ ;;
+ esac
CT_DoLog EXTRA "Building zlib"
- CT_DoExecLog ALL make ${JOBSFLAGS}
+ CT_DoExecLog ALL make "${extra_make[@]}" ${JOBSFLAGS}
if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
if [ "${host}" = "${CT_BUILD}" ]; then
CT_DoLog EXTRA "Checking zlib"
- CT_DoExecLog ALL make ${JOBSFLAGS} -s check
+ CT_DoExecLog ALL make "${extra_make[@]}" -s test
else
# Cannot run host binaries on build in a canadian cross
CT_DoLog EXTRA "Skipping check for zlib on the host"
@@ -107,7 +128,7 @@ do_zlib_backend() {
fi
CT_DoLog EXTRA "Installing zlib"
- CT_DoExecLog ALL make install
+ CT_DoExecLog ALL make "${extra_make[@]}" install
}
fi # CT_ZLIB
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
index 68510e1..98ef5e5 100644
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -190,6 +190,7 @@ do_debug_gdb_build() {
CT_EndStep
fi
+ # TBD combine GDB native and gdbserver backends, build either or both in a single pass.
if [ "${CT_GDB_NATIVE}" = "y" ]; then
local -a native_extra_config
@@ -198,7 +199,9 @@ do_debug_gdb_build() {
native_extra_config=("${extra_config[@]}")
# We may not have C++ language configured for target
- native_extra_config+=("--disable-build-with-cxx")
+ if [ "${GDB_TARGET_DISABLE_CXX_BUILD}" = "y" ]; then
+ native_extra_config+=("--disable-build-with-cxx")
+ fi
# GDB on Mingw depends on PDcurses, not ncurses
if [ "${CT_MINGW32}" != "y" ]; then
@@ -317,7 +320,9 @@ do_debug_gdb_build() {
gdbserver_extra_config=("${extra_config[@]}")
# We may not have C++ language configured for target
- gdbserver_extra_config+=("--disable-build-with-cxx")
+ if [ "${GDB_TARGET_DISABLE_CXX_BUILD}" = "y" ]; then
+ gdbserver_extra_config+=("--disable-build-with-cxx")
+ fi
if [ "${CT_GDB_GDBSERVER_HAS_IPA_LIB}" = "y" ]; then
if [ "${CT_GDB_GDBSERVER_BUILD_IPA_LIB}" = "y" ]; then
diff --git a/scripts/build/libc/bionic.sh b/scripts/build/libc/bionic.sh
new file mode 100644
index 0000000..fcdc57f
--- /dev/null
+++ b/scripts/build/libc/bionic.sh
@@ -0,0 +1,43 @@
+# This file adds functions to extract the bionic C library from the Android NDK
+# Copyright 2017 Howard Chu
+# Licensed under the GPL v2. See COPYING in the root of this package
+
+do_libc_get() {
+ if [ "${CT_LIBC_BIONIC_CUSTOM}" = "y" ]; then
+ CT_GetCustom "bionic" "${CT_LIBC_BIONIC_CUSTOM_VERSION}" \
+ "${CT_LIBC_BIONIC_CUSTOM_LOCATION}"
+ else # ! custom location
+ CT_GetFile "android-ndk-${CT_LIBC_VERSION}-linux-x86_64.zip" https://dl.google.com/android/repository
+ fi # ! custom location
+}
+
+do_libc_extract() {
+ CT_Extract "android-ndk-${CT_LIBC_VERSION}-linux-x86_64"
+ CT_Pushd "${CT_SRC_DIR}/android-ndk-${CT_LIBC_VERSION}/"
+ CT_Patch nochdir bionic "${CT_LIBC_VERSION}"
+ CT_Popd
+}
+
+# Install Unified headers
+do_libc_start_files() {
+ CT_DoStep INFO "Installing C library headers"
+ CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/android-ndk-${CT_LIBC_VERSION}/sysroot/usr" "${CT_SYSROOT_DIR}"
+}
+
+do_libc() {
+ local arch="${CT_ARCH}"
+ if [ "${CT_ARCH_64}" = "y" ]; then
+ if [ "${CT_ARCH}" = "x86" ]; then
+ arch="${arch}_"
+ fi
+ arch="${arch}64"
+ fi
+ CT_DoStep INFO "Installing C library binaries"
+ CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/android-ndk-${CT_LIBC_VERSION}/platforms/android-${CT_ANDROID_API}/arch-${arch}/usr" "${CT_SYSROOT_DIR}"
+ CT_EnvModify CT_TARGET_CFLAGS "${CT_TARGET_CFLAGS} -D__ANDROID_API__=${CT_ANDROID_API}"
+}
+
+do_libc_post_cc() {
+ :
+}
+
diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in
index 68d6847..1464f0f 100644
--- a/scripts/crosstool-NG.sh.in
+++ b/scripts/crosstool-NG.sh.in
@@ -60,6 +60,8 @@ CT_TestAndAbort "Don't set CPLUS_INCLUDE_PATH. It screws up the build." -n "${CP
CT_TestAndAbort "Don't set OBJC_INCLUDE_PATH. It screws up the build." -n "${OBJC_INCLUDE_PATH}"
CT_TestAndAbort "Don't set CFLAGS. It screws up the build." -n "${CFLAGS}"
CT_TestAndAbort "Don't set CXXFLAGS. It screws up the build." -n "${CXXFLAGS}"
+CT_TestAndAbort "Don't set CC. It screws up the build." -n "${CC}"
+CT_TestAndAbort "Don't set CXX. It screws up the build." -n "${CXX}"
CT_Test "GREP_OPTIONS screws up the build. Resetting." -n "${GREP_OPTIONS}"
export GREP_OPTIONS=
# Workaround against openSUSE 12.1 that breaks ./configure for cross-compilation:
diff --git a/scripts/functions b/scripts/functions
index 39ec2b4..c1b99ce 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -1368,6 +1368,7 @@ CT_DoBuildTargetTuple() {
*glibc) CT_TARGET_SYS=gnu;;
uClibc) CT_TARGET_SYS=uclibc;;
musl) CT_TARGET_SYS=musl;;
+ bionic) CT_TARGET_SYS=android;;
avr-libc)
# avr-libc only seems to work with the non-canonical "avr" target.
CT_TARGET_SKIP_CONFIG_SUB=y
diff --git a/scripts/gen_in_frags.sh b/scripts/gen_in_frags.sh
deleted file mode 100755
index 9fbb871..0000000
--- a/scripts/gen_in_frags.sh
+++ /dev/null
@@ -1,161 +0,0 @@
-#!/bin/sh
-set -e
-
-# This scripts generates either a choice or a menuconfig
-# with the specified entries.
-#
-# Usage:
-# generate a choice:
-# gen_in_frags.sh choice <out-file> <label> <config-prefix> <base-dir> <conditionals> entry [entry...]
-#
-# generate a menuconfig:
-# gen_in_frags.sh menu <out-file> <label> <config-prefix> <base-dir> entry [entry...]
-#
-# where:
-# out-file
-# put the generated choice/menuconfig into that file
-# for choices, it acts as the base bname of the file, the secondary
-# parts (the .in.2) are put in out-file.2
-#
-# label
-# name for the entries family
-# eg. Architecture, Kernel...
-#
-# config-prefix
-# prefix for the choice entries
-# eg. ARCH, KERNEL...
-#
-# base-dir
-# base directory containing config files
-# eg. config/arch, config/kernel...
-#
-# conditionals (valid only for choice)
-# generate backend conditionals if Y/y, don't if anything else
-# if 'Y' (or 'y'), a dependency on the backen mode will be added
-# to each entry
-#
-# entry [entry...]
-# a list of entry/ies toadd to the choice/menuconfig
-# eg.:
-# arm mips sh x86...
-# linux cygwin mingw32 solaris...
-# ...
-#
-#------------------------------------------------------------------------------
-
-# Generate a choice
-# See above for usage
-gen_choice() {
- local out_file="${1}"
- local label="${2}"
- local cfg_prefix="${3}"
- local base_dir="${4}"
- local cond="${5}"
- shift 5
- local file entry _entry
-
- # Generate the part-1
- exec >"${out_file}"
- printf '# %s menu\n' "${label}"
- printf '# Generated file, do not edit!!!\n'
- printf '\n'
- printf 'choice GEN_CHOICE_%s\n' "${cfg_prefix}"
- printf ' bool\n'
- printf ' prompt "%s"\n' "${label}"
- printf '\n'
- for entry in "${@}"; do
- file="${base_dir}/${entry}.in"
- _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
- printf 'config %s_%s\n' "${cfg_prefix}" "${_entry}"
- printf ' bool\n'
- printf ' prompt "%s"\n' "${entry}"
- if [ "${cond}" = "Y" -o "${cond}" = "y" ]; then
- printf ' depends on %s_%s_AVAILABLE\n' "${cfg_prefix}" "${_entry}"
- fi
- "${sed}" -r -e '/^## depends on /!d; s/^## / /;' ${file} 2>/dev/null
- "${sed}" -r -e '/^## select /!d; s/^## / /;' ${file} 2>/dev/null
- if "${grep}" -E '^## help' ${file} >/dev/null 2>&1; then
- printf ' help\n'
- "${sed}" -r -e '/^## help ?/!d; s/^## help ?/ /;' ${file} 2>/dev/null
- fi
- printf '\n'
- done
- printf 'endchoice\n'
-
- for entry in "${@}"; do
- file="${base_dir}/${entry}.in"
- _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
- printf '\n'
- if [ "${cond}" = "Y" -o "${cond}" = "y" ]; then
- printf 'config %s_%s_AVAILABLE\n' "${cfg_prefix}" "${_entry}"
- printf ' bool\n'
- printf ' default y if'
- printf ' BACKEND_%s = "%s"' "${cfg_prefix}" "${entry}"
- printf ' || BACKEND_%s = ""' "${cfg_prefix}"
- printf ' || ! BACKEND\n'
- fi
- printf 'if %s_%s\n' "${cfg_prefix}" "${_entry}"
- printf 'config %s\n' "${cfg_prefix}"
- printf ' default "%s" if %s_%s\n' "${entry}" "${cfg_prefix}" "${_entry}"
- printf 'source "%s"\n' "${file}"
- printf 'endif\n'
- done
-
- # Generate the part-2
- exec >"${out_file}.2"
- printf '# %s second part options\n' "${label}"
- printf '# Generated file, do not edit!!!\n'
- for entry in "${@}"; do
- file="${base_dir}/${entry}.in"
- _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
- if [ -f "${file}.2" ]; then
- printf '\n'
- printf 'if %s_%s\n' "${cfg_prefix}" "${_entry}"
- printf 'comment "%s other options"\n' "${entry}"
- printf 'source "%s.2"\n' "${file}"
- printf 'endif\n'
- fi
- done
-}
-
-# Generate a menuconfig
-# See above for usage
-gen_menu() {
- local out_file="${1}"
- local label="${2}"
- local cfg_prefix="${3}"
- local base_dir="${4}"
- shift 4
- local file entry _entry
-
- # Generate the menuconfig
- exec >"${out_file}"
- printf '# %s menu\n' "${label}"
- printf '# Generated file, do not edit!!!\n'
- printf '\n'
- for entry in "${@}"; do
- file="${base_dir}/${entry}.in"
- _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
- printf 'menuconfig %s_%s\n' "${cfg_prefix}" "${_entry}"
- printf ' bool\n'
- if "${grep}" -E '^## default' ${file} >/dev/null 2>&1; then
- "${sed}" -r -e '/^## default ?/!d; s/^## default ?/ default /;' ${file} 2>/dev/null
- fi
- printf ' prompt "%s"\n' "${entry}"
- "${sed}" -r -e '/^## depends on /!d; s/^## / /;' ${file} 2>/dev/null
- "${sed}" -r -e '/^## select /!d; s/^## / /;' ${file} 2>/dev/null
- if "${grep}" -E '^## help' ${file} >/dev/null 2>&1; then
- printf ' help\n'
- "${sed}" -r -e '/^## help ?/!d; s/^## help ?/ /;' ${file} 2>/dev/null
- fi
- printf '\n'
- printf 'if %s_%s\n' "${cfg_prefix}" "${_entry}"
- printf 'source "%s"\n' "${file}"
- printf 'endif\n'
- printf '\n'
- done
-}
-
-type="${1}"
-shift
-"gen_${type}" "${@}"
diff --git a/scripts/saveSample.sh.in b/scripts/saveSample.sh.in
index 2e413bd..2eb1f40 100644
--- a/scripts/saveSample.sh.in
+++ b/scripts/saveSample.sh.in
@@ -86,7 +86,7 @@ fi
# Now, actually save the defconfig
export KCONFIG_CONFIG="$(pwd)/.defconfig"
-${CONF} --savedefconfig="${samp_dir}/crosstool.config" "${KCONFIG_TOP}"
+srctree="${CT_LIB_DIR}" ${CONF} --savedefconfig="${samp_dir}/crosstool.config" "${KCONFIG_TOP}"
rm -f .defconfig
# Fill-in the reported-by info
diff --git a/scripts/showSamples.sh b/scripts/showSamples.sh
index f3a21d2..e60e29f 100755
--- a/scripts/showSamples.sh
+++ b/scripts/showSamples.sh
@@ -101,7 +101,7 @@ dump_single_sample() {
cc=$(echo ${CT_CC} | ${awk} '{ print toupper($0)}')
version=$(eval echo \${CT_CC_${cc}_VERSION})
compiler=$(echo $cc | ${awk} '{print tolower($0)}')
- printf " $compiler | $version"
+ printf " $compiler-$version"
printf "\n"
printf " %-*s : %s" ${width} "Languages" "C"
[ "${CT_CC_LANG_CXX}" = "y" ] && printf ",C++"