mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-01-29 15:44:03 +00:00
- Get rid of CT_CC_NATIVE - Get rid of CT_CANADIAN_OPT - Sanitise CT_BUILD vs. CT_HOST /trunk/scripts/build/tools/200-sstrip.sh | 4 2 2 0 /trunk/scripts/build/binutils.sh | 1 0 1 0 - /trunk/scripts/build/cc/gcc.sh | 11 6 5 0 +- /trunk/scripts/build/debug/200-duma.sh | 3 1 2 0 - /trunk/scripts/build/libc/glibc.sh | 10 5 5 0 +- /trunk/scripts/build/libc/eglibc.sh | 8 4 4 0 +- /trunk/scripts/crosstool.sh | 168 113 55 0 ++++++++++++++++++++++++++------------ /trunk/config/toolchain.in | 160 137 23 0 +++++++++++++++++++++++++++++++----- 8 files changed, 268 insertions(+), 97 deletions(-)
This commit is contained in:
parent
301fbac58e
commit
8fba8c2732
@ -81,7 +81,7 @@ choice
|
||||
|
||||
config NATIVE
|
||||
bool
|
||||
prompt "Native (EXPERIMENTAL)"
|
||||
prompt "Native (NO CODE!) (EXPERIMENTAL)"
|
||||
depends on EXPERIMENTAL
|
||||
help
|
||||
Build a native toolchain.
|
||||
@ -96,7 +96,7 @@ config CROSS
|
||||
|
||||
config CROSS_NATIVE
|
||||
bool
|
||||
prompt "Cross-native (EXPERIMENTAL)"
|
||||
prompt "Cross-native (NO CODE!) (EXPERIMENTAL)"
|
||||
depends on EXPERIMENTAL
|
||||
help
|
||||
Build a cross-native toolchain.
|
||||
@ -104,7 +104,7 @@ config CROSS_NATIVE
|
||||
|
||||
config CANADIAN
|
||||
bool
|
||||
prompt "Canadian (EXPERIMENTAL)"
|
||||
prompt "Canadian (NO CODE!) (EXPERIMENTAL)"
|
||||
depends on EXPERIMENTAL
|
||||
help
|
||||
Build a canadian-toolchain.
|
||||
@ -119,48 +119,162 @@ config TOOLCHAIN_TYPE
|
||||
default "cross-native" if CROSS_NATIVE
|
||||
default "canadian" if CANADIAN
|
||||
|
||||
comment "Build system"
|
||||
|
||||
config BUILD
|
||||
string
|
||||
prompt "Build system tuple"
|
||||
prompt "| Tuple (READ HELP!)"
|
||||
default ""
|
||||
help
|
||||
Canonical name of the machine building the toolchain.
|
||||
You should leave empty, unless you really now what you're doing.
|
||||
|
||||
config CC_NATIVE
|
||||
config BUILD_PREFIX
|
||||
string
|
||||
prompt "Native gcc"
|
||||
default "gcc"
|
||||
prompt "| Tools prefix (READ HELP!)"
|
||||
default ""
|
||||
help
|
||||
The native C compiler.
|
||||
If you have your *build system* tools in a weird location, and/or
|
||||
they have an unusual prefix, enter it here.
|
||||
|
||||
You can set this to an alternative compiler if you have more than one
|
||||
installed (eg. gcc is gcc-4.1.1 and you want to use gcc-3.4.6).
|
||||
Usually, you should leave that empty!
|
||||
|
||||
You can leave this empty as well, in which case gcc will be used.
|
||||
Eg.:
|
||||
If your *build* gcc is /opt/build-tools/bin/weird-gcc then you
|
||||
should enter:
|
||||
/opt/build-tools/bin/weird-
|
||||
|
||||
If your *build* gcc is /opt/build-tools/bin/weird-gcc and
|
||||
/opt/build-tools/bin is in your PATH, you should enter:
|
||||
weird-
|
||||
|
||||
If your *build* gcc is /opt/build-tools/bin/gcc then you
|
||||
should enter (do not forget to add the trailing '/'):
|
||||
/opt/build-tools/bin/
|
||||
|
||||
config BUILD_SUFFIX
|
||||
string
|
||||
prompt "| Tools suffix (READ HELP!)"
|
||||
default ""
|
||||
help
|
||||
If your *build system* tools have an unusual suffix, enter it
|
||||
here.
|
||||
|
||||
Usually, you should leave that empty!
|
||||
|
||||
Eg.:
|
||||
If your 'default' gcc is gcc 4.3.1, but you also have gcc-3.4.2
|
||||
installed as gcc-3.4, then you should enter:
|
||||
-3.4
|
||||
|
||||
It can happen that some of the tools have a suffix, when others
|
||||
don't, eg. you can have 'gcc-3.4' and 'ar'. crosstool-NG accounts
|
||||
for that by checking the tools without the suffix in case it can
|
||||
not find some of the tool.
|
||||
|
||||
if CANADIAN
|
||||
|
||||
comment "Host system"
|
||||
|
||||
config HOST
|
||||
string
|
||||
prompt "Host system tuple"
|
||||
prompt "| Tuple (READ HELP!)"
|
||||
default ""
|
||||
depends on NATIVE || CANADIAN
|
||||
help
|
||||
Canonical name of the machine running the toolchain.
|
||||
|
||||
config HOST_CC
|
||||
config HOST_PREFIX
|
||||
string
|
||||
prompt "Cross-compiler prefix for host system"
|
||||
default "${CT_HOST}-"
|
||||
depends on NATIVE || CANADIAN
|
||||
prompt "| Tools prefix (READ HELP!)"
|
||||
default ""
|
||||
help
|
||||
C compiler targeting the host system.
|
||||
If you have your *host system* tools in a weird location, and/or
|
||||
they have an unusual prefix, enter it here.
|
||||
|
||||
Usually, you should leave that empty!
|
||||
|
||||
Eg.:
|
||||
If your *host* gcc is /opt/host-tools/bin/weird-gcc then you
|
||||
should enter:
|
||||
/opt/host-tools/bin/weird-
|
||||
|
||||
If your *host* gcc is /opt/host-tools/bin/weird-gcc and
|
||||
/opt/host-tools/bin is in your PATH, you should enter:
|
||||
weird-
|
||||
|
||||
If your *host* gcc is /opt/host-tools/bin/gcc then you
|
||||
should enter (do not forget to add the trailing '/'):
|
||||
/opt/host-tools/bin/
|
||||
|
||||
config TARGET_CC
|
||||
config HOST_SUFFIX
|
||||
string
|
||||
prompt "Cross-compiler prefix for target system"
|
||||
default "${CT_TARGET}-"
|
||||
depends on CANADIAN
|
||||
prompt "| Tools suffix (READ HELP!)"
|
||||
default ""
|
||||
help
|
||||
C compiler targeting the target system.
|
||||
If your *host system* tools have an unusual suffix, enter it
|
||||
here.
|
||||
|
||||
Usually, you should leave that empty!
|
||||
|
||||
Eg.:
|
||||
If your 'default' gcc is gcc 4.3.1, but you also have gcc-3.4.2
|
||||
installed as gcc-3.4, then you should enter:
|
||||
-3.4
|
||||
|
||||
It can happen that some of the tools have a suffix, when others
|
||||
don't, eg. you can have 'gcc-3.4' and 'ar'. crosstool-NG accounts
|
||||
for that by checking the tools without the suffix in case it can
|
||||
not find some of the tool.
|
||||
|
||||
endif # CANADIAN
|
||||
|
||||
if CROSS_NATIVE || CANADIAN
|
||||
|
||||
comment "Target system"
|
||||
|
||||
config TARGET_PREFIX
|
||||
string
|
||||
prompt "| Tools prefix (READ HELP!)"
|
||||
default ""
|
||||
help
|
||||
If you have your *target system* tools in a weird location, and/or
|
||||
they have an unusual prefix, enter it here.
|
||||
|
||||
Usually, you should leave that empty!
|
||||
|
||||
Eg.:
|
||||
If your *target* gcc is /opt/target-tools/bin/weird-gcc then you
|
||||
should enter:
|
||||
/opt/target-tools/bin/weird-
|
||||
|
||||
If your *target* gcc is /opt/target-tools/bin/weird-gcc and
|
||||
/opt/target-tools/bin is in your PATH, you should enter:
|
||||
weird-
|
||||
|
||||
If your *target* gcc is /opt/target-tools/bin/gcc then you
|
||||
should enter (do not forget to add the trailing '/'):
|
||||
/opt/target-tools/bin/
|
||||
|
||||
config TARGET_SUFFIX
|
||||
string
|
||||
prompt "| Tools suffix (READ HELP!)"
|
||||
default ""
|
||||
help
|
||||
If your *target system* tools have an unusual suffix, enter it
|
||||
here.
|
||||
|
||||
Usually, you should leave that empty!
|
||||
|
||||
Eg.:
|
||||
If your 'default' gcc is gcc 4.3.1, but you also have gcc-3.4.2
|
||||
installed as gcc-3.4, then you should enter:
|
||||
-3.4
|
||||
|
||||
It can happen that some of the tools have a suffix, when others
|
||||
don't, eg. you can have 'gcc-3.4' and 'ar'. crosstool-NG accounts
|
||||
for that by checking the tools without the suffix in case it can
|
||||
not find some of the tool.
|
||||
|
||||
endif # CROSS_NATIVE || CANADIAN
|
||||
|
||||
endmenu
|
||||
|
@ -36,7 +36,6 @@ do_binutils() {
|
||||
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
|
||||
CT_DoExecLog ALL \
|
||||
"${CT_SRC_DIR}/${CT_BINUTILS_FILE}/configure" \
|
||||
${CT_CANADIAN_OPT} \
|
||||
--build=${CT_BUILD} \
|
||||
--host=${CT_HOST} \
|
||||
--target=${CT_TARGET} \
|
||||
|
@ -126,11 +126,11 @@ do_cc_core() {
|
||||
CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
|
||||
|
||||
# Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532)
|
||||
CC_FOR_BUILD="${CT_CC_NATIVE}" \
|
||||
CC_FOR_BUILD="${CT_BUILD}-gcc" \
|
||||
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
|
||||
CT_DoExecLog ALL \
|
||||
"${CT_SRC_DIR}/${CT_CC_FILE}/configure" \
|
||||
${CT_CANADIAN_OPT} \
|
||||
--build=${CT_BUILD} \
|
||||
--host=${CT_HOST} \
|
||||
--target=${CT_TARGET} \
|
||||
--prefix="${core_prefix_dir}" \
|
||||
@ -263,15 +263,16 @@ do_cc() {
|
||||
# detection problem only matters for gcc-3.2.x and later, I think.
|
||||
# --disable-nls to work around crash bug on ppc405, but also because
|
||||
# embedded systems don't really need message catalogs...
|
||||
CC_FOR_BUILD="${CT_CC_NATIVE}" \
|
||||
CC_FOR_BUILD="${CT_BUILD}-gcc" \
|
||||
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
|
||||
CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \
|
||||
CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \
|
||||
LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}" \
|
||||
CT_DoExecLog ALL \
|
||||
"${CT_SRC_DIR}/${CT_CC_FILE}/configure" \
|
||||
${CT_CANADIAN_OPT} \
|
||||
--target=${CT_TARGET} --host=${CT_HOST} \
|
||||
--build=${CT_BUILD} \
|
||||
--host=${CT_HOST} \
|
||||
--target=${CT_TARGET} \
|
||||
--prefix="${CT_PREFIX_DIR}" \
|
||||
${CC_SYSROOT_ARG} \
|
||||
${extra_config} \
|
||||
|
@ -44,8 +44,7 @@ do_debug_duma_build() {
|
||||
libs="${libs# }"
|
||||
CT_DoLog EXTRA "Building libraries '${libs}'"
|
||||
CT_DoExecLog ALL \
|
||||
make HOSTCC="${CT_CC_NATIVE}" \
|
||||
HOSTCXX="${CT_CC_NATIVE}" \
|
||||
make HOSTCC="${CT_BUILD}-gcc" \
|
||||
CC="${CT_TARGET}-gcc" \
|
||||
CXX="${CT_TARGET}-gcc" \
|
||||
RANLIB="${CT_TARGET}-ranlib" \
|
||||
|
@ -149,7 +149,7 @@ do_libc_start_files() {
|
||||
CT_DoLog DEBUG "Using ar for target: '${cross_ar}'"
|
||||
CT_DoLog DEBUG "Using ranlib for target: '${cross_ranlib}'"
|
||||
|
||||
BUILD_CC=${CT_CC_NATIVE} \
|
||||
BUILD_CC="${CT_BUILD}-gcc" \
|
||||
CC=${cross_cc} \
|
||||
CXX=${cross_cxx} \
|
||||
AR=${cross_ar} \
|
||||
@ -158,7 +158,7 @@ do_libc_start_files() {
|
||||
"${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
|
||||
--prefix=/usr \
|
||||
--with-headers="${CT_HEADERS_DIR}" \
|
||||
--build="${CT_UNIQ_BUILD}" \
|
||||
--build="${CT_BUILD}" \
|
||||
--host="${CT_TARGET}" \
|
||||
--disable-profile \
|
||||
--without-gd \
|
||||
@ -245,7 +245,7 @@ do_libc() {
|
||||
CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
|
||||
CT_DoLog DEBUG "Extra CC args passed : '${extra_cc_args}'"
|
||||
|
||||
BUILD_CC=${CT_CC_NATIVE} \
|
||||
BUILD_CC="${CT_BUILD}-gcc" \
|
||||
CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O" \
|
||||
CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
|
||||
AR=${CT_TARGET}-ar \
|
||||
@ -254,7 +254,7 @@ do_libc() {
|
||||
"${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
|
||||
--prefix=/usr \
|
||||
--with-headers="${CT_HEADERS_DIR}" \
|
||||
--build=${CT_UNIQ_BUILD} \
|
||||
--build=${CT_BUILD} \
|
||||
--host=${CT_TARGET} \
|
||||
--disable-profile \
|
||||
--without-gd \
|
||||
|
@ -105,7 +105,7 @@ do_libc_headers() {
|
||||
CC=${cross_cc} \
|
||||
CT_DoExecLog ALL \
|
||||
"${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
|
||||
--build="${CT_UNIQ_BUILD}" \
|
||||
--build="${CT_BUILD}" \
|
||||
--host="${CT_TARGET}" \
|
||||
--prefix=/usr \
|
||||
--with-headers="${CT_HEADERS_DIR}" \
|
||||
@ -272,7 +272,7 @@ do_libc_start_files() {
|
||||
|
||||
# Please see the comment for the configure step in do_libc().
|
||||
|
||||
BUILD_CC=${CT_CC_NATIVE} \
|
||||
BUILD_CC="${CT_BUILD}-gcc" \
|
||||
CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O " \
|
||||
CC="${cross_cc} ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
|
||||
AR=${CT_TARGET}-ar \
|
||||
@ -280,7 +280,7 @@ do_libc_start_files() {
|
||||
CT_DoExecLog ALL \
|
||||
"${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
|
||||
--prefix=/usr \
|
||||
--build="${CT_UNIQ_BUILD}" \
|
||||
--build="${CT_BUILD}" \
|
||||
--host=${CT_TARGET} \
|
||||
--without-cvs \
|
||||
--disable-profile \
|
||||
@ -400,7 +400,7 @@ do_libc() {
|
||||
# I don't want nptl! --disable-sanity-checks will shut up those
|
||||
# silly messages. GNU folks again, he?
|
||||
|
||||
BUILD_CC=${CT_CC_NATIVE} \
|
||||
BUILD_CC="${CT_BUILD}-gcc" \
|
||||
CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O" \
|
||||
CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
|
||||
AR=${CT_TARGET}-ar \
|
||||
@ -408,7 +408,7 @@ do_libc() {
|
||||
CT_DoExecLog ALL \
|
||||
"${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
|
||||
--prefix=/usr \
|
||||
--build=${CT_UNIQ_BUILD} \
|
||||
--build=${CT_BUILD} \
|
||||
--host=${CT_TARGET} \
|
||||
--without-cvs \
|
||||
--disable-profile \
|
||||
|
@ -19,7 +19,7 @@ case "${CT_SSTRIP_FROM}" in
|
||||
( cd "${CT_SRC_DIR}/ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}/sstrip"; tar cf - . ) |tar xf -
|
||||
|
||||
CT_DoLog EXTRA "Building sstrip"
|
||||
CT_DoExecLog ALL make CC="${CT_CC_NATIVE}" sstrip
|
||||
CT_DoExecLog ALL make CC="${CT_HOST}-gcc" sstrip
|
||||
|
||||
CT_DoLog EXTRA "Installing sstrip"
|
||||
CT_DoExecLog ALL install -m 755 sstrip "${CT_PREFIX_DIR}/bin/${CT_TARGET}-sstrip"
|
||||
@ -48,7 +48,7 @@ case "${CT_SSTRIP_FROM}" in
|
||||
cd "${CT_BUILD_DIR}/build-sstrip"
|
||||
|
||||
CT_DoLog EXTRA "Building sstrip"
|
||||
CT_DoExecLog ALL ${CT_CC_NATIVE} -Wall -o sstrip "${CT_SRC_DIR}/sstrip/sstrip.c"
|
||||
CT_DoExecLog ALL "${CT_HOST}-gcc" -Wall -o sstrip "${CT_SRC_DIR}/sstrip/sstrip.c"
|
||||
|
||||
CT_DoLog EXTRA "Installing sstrip"
|
||||
CT_DoExecLog ALL install -m 755 sstrip "${CT_PREFIX_DIR}/bin/${CT_TARGET}-sstrip"
|
||||
|
@ -223,10 +223,11 @@ esac
|
||||
|
||||
# Setting up the rest of the environment only if not restarting
|
||||
if [ -z "${CT_RESTART}" ]; then
|
||||
# Determine build system if not set by the user
|
||||
CT_Test "You did not specify the build system. That's OK, I can guess..." -z "${CT_BUILD}"
|
||||
CT_BUILD="${CT_BUILD:-$(CT_DoConfigGuess)}"
|
||||
CT_BUILD=$(CT_DoConfigSub "${CT_BUILD}")
|
||||
# What's our shell?
|
||||
# Will be plain /bin/sh on most systems, except if we have /bin/ash and we
|
||||
# _explictly_ required using it
|
||||
CT_SHELL="/bin/sh"
|
||||
[ "${CT_CONFIG_SHELL_ASH}" = "y" -a -x "/bin/ash" ] && CT_SHELL="/bin/ash"
|
||||
|
||||
# Arrange paths depending on wether we use sys-root or not.
|
||||
if [ "${CT_USE_SYSROOT}" = "y" ]; then
|
||||
@ -273,63 +274,121 @@ if [ -z "${CT_RESTART}" ]; then
|
||||
ln -sf "sys-root/lib" "${CT_PREFIX_DIR}/${CT_TARGET}/lib64"
|
||||
fi
|
||||
|
||||
# Canadian-cross are really picky on the way they are built. Tweak the values.
|
||||
CT_UNIQ_BUILD=$(echo "${CT_BUILD}" |sed -r -e 's/-/-build_/')
|
||||
if [ "${CT_CANADIAN}" = "y" ]; then
|
||||
# Arrange so that gcc never, ever think that build system == host system
|
||||
CT_CANADIAN_OPT="--build=${CT_UNIQ_BUILD}"
|
||||
# We shall have a compiler for this target!
|
||||
# Do test here...
|
||||
else
|
||||
CT_HOST="${CT_BUILD}"
|
||||
CT_CANADIAN_OPT="--build=${CT_BUILD}"
|
||||
# Add the target toolchain in the path so that we can build the C library
|
||||
# Carefully add paths in the order we want them:
|
||||
# - first try in ${CT_PREFIX_DIR}/bin
|
||||
# - then try in ${CT_CC_CORE_SHARED_PREFIX_DIR}/bin
|
||||
# - then try in ${CT_CC_CORE_STATIC_PREFIX_DIR}/bin
|
||||
# - fall back to searching user's PATH
|
||||
export PATH="${CT_PREFIX_DIR}/bin:${CT_CC_CORE_SHARED_PREFIX_DIR}/bin:${CT_CC_CORE_STATIC_PREFIX_DIR}/bin:${PATH}"
|
||||
fi
|
||||
|
||||
# Modify GCC_HOST to never be equal to $BUILD or $TARGET
|
||||
# This strange operation causes gcc to always generate a cross-compiler
|
||||
# even if the build machine is the same kind as the host.
|
||||
# This is why CC has to be set when doing a canadian cross; you can't find a
|
||||
# host compiler by appending -gcc to our whacky $GCC_HOST
|
||||
# Kludge: it is reported that the above causes canadian crosses with cygwin
|
||||
# hosts to fail, so avoid it just in that one case. It would be cleaner to
|
||||
# just move this into the non-canadian case above, but I'm afraid that might
|
||||
# cause some configure script somewhere to decide that since build==host, they
|
||||
# could run host binaries.
|
||||
# (Copied almost as-is from original crosstool):
|
||||
case "${CT_KERNEL},${CT_CANADIAN}" in
|
||||
cygwin,y) ;;
|
||||
*,y) CT_HOST=$(echo "${CT_HOST}" |sed -r -e 's/-/-host_/;');;
|
||||
# Determine build system if not set by the user
|
||||
CT_Test "You did not specify the build system. That's OK, I can guess..." -z "${CT_BUILD}"
|
||||
case "${CT_BUILD}" in
|
||||
"") CT_BUILD=$(gcc -dumpmachine);;
|
||||
*) CT_BUILD=$(CT_DoConfigSub "${CT_BUILD}");;
|
||||
esac
|
||||
|
||||
# What's our shell?
|
||||
# Will be plain /bin/sh on most systems, except if we have /bin/ash and we
|
||||
# _explictly_ required using it
|
||||
CT_SHELL="/bin/sh"
|
||||
[ "${CT_CONFIG_SHELL_ASH}" = "y" -a -x "/bin/ash" ] && CT_SHELL="/bin/ash"
|
||||
# Prepare mangling patterns to later modifyu BUILD and HOST (see below)
|
||||
case "${CT_TOOLCHAIN_TYPE}" in
|
||||
cross)
|
||||
CT_HOST="${CT_BUILD}"
|
||||
build_mangle="build_"
|
||||
host_mangle="build_"
|
||||
;;
|
||||
*) CT_Abort "No code for '${CT_TOOLCHAIN_TYPE}' toolchain type!"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Ah! Recent versions of binutils need some of the build and/or host system
|
||||
# (read CT_BUILD and CT_HOST) tools to be accessible (ar is but an example).
|
||||
# Do that:
|
||||
# Save the real tuples to generate shell-wrappers to the real tools
|
||||
CT_REAL_BUILD="${CT_BUILD}"
|
||||
CT_REAL_HOST="${CT_HOST}"
|
||||
|
||||
# Make BUILD and HOST full-fledge four-part tuples (gcc -dumpmachine
|
||||
# might be only three-part tuple, and I don't know wether config.guess
|
||||
# can return 3-part tuples...)
|
||||
case "${CT_BUILD}" in
|
||||
*-*-*-*-*) CT_Abort "Unexpected 5-part (or more) build tuple: '${CT_BUILD}'";;
|
||||
*-*-*-*) ;;
|
||||
*-*-*) CT_BUILD="${CT_BUILD/-/-unknown-}";;
|
||||
*) CT_Abort "Unepxected 1- or 2-part build tuple: '${CT_BUILD}'";;
|
||||
esac
|
||||
case "${CT_HOST}" in
|
||||
*-*-*-*-*) CT_Abort "Unexpected 5-part (or more) host tuple: '${CT_HOST}'";;
|
||||
*-*-*-*) ;;
|
||||
*-*-*) CT_HOST="${CT_HOST/-/-unknown-}";;
|
||||
*) CT_Abort "Unepxected 1- or 2-part host tuple: '${CT_HOST}'";;
|
||||
esac
|
||||
|
||||
# Modify BUILD and HOST so that gcc always generate a cross-compiler
|
||||
# even if any of the build, host or target machines are the same.
|
||||
# NOTE: we'll have to mangle the (BUILD|HOST)->TARGET x-compiler to
|
||||
# support canadain build, later...
|
||||
CT_BUILD="${CT_BUILD/-/-${build_mangle}}"
|
||||
CT_HOST="${CT_HOST/-/-${host_mangle}}"
|
||||
|
||||
# Now we have mangled our BUILD and HOST tuples, we must fake the new
|
||||
# cross-tools for those mangled tuples.
|
||||
BANG='!'
|
||||
CT_DoLog DEBUG "Making build system tools available"
|
||||
mkdir -p "${CT_PREFIX_DIR}/bin"
|
||||
for tool in ar as dlltool ${CT_CC_NATIVE:=gcc} gnatbind gnatmake ld nm ranlib strip windres objcopy objdump; do
|
||||
tmp=$(CT_Which ${tool})
|
||||
if [ -n "${tmp}" ]; then
|
||||
printf "#${BANG}${CT_SHELL}\nexec '${tmp}' \"\${@}\"\n" >"${CT_PREFIX_DIR}/bin/${CT_BUILD}-${tool}"
|
||||
printf "#${BANG}${CT_SHELL}\nexec '${tmp}' \"\${@}\"\n" >"${CT_PREFIX_DIR}/bin/${CT_UNIQ_BUILD}-${tool}"
|
||||
printf "#${BANG}${CT_SHELL}\nexec '${tmp}' \"\${@}\"\n" >"${CT_PREFIX_DIR}/bin/${CT_HOST}-${tool}"
|
||||
chmod 700 "${CT_PREFIX_DIR}/bin/${CT_BUILD}-${tool}" "${CT_PREFIX_DIR}/bin/${CT_UNIQ_BUILD}-${tool}" "${CT_PREFIX_DIR}/bin/${CT_HOST}-${tool}"
|
||||
fi |CT_DoLog DEBUG
|
||||
for m in BUILD HOST; do
|
||||
r="CT_REAL_${m}"
|
||||
v="CT_${m}"
|
||||
p="CT_${m}_PREFIX"
|
||||
s="CT_${m}_SUFFIX"
|
||||
if [ -n "${!p}" ]; then
|
||||
t="${!p}"
|
||||
else
|
||||
t="${!r}-"
|
||||
fi
|
||||
|
||||
for tool in ar as dlltool gcc g++ gnatbind gnatmake ld nm objcopy objdump ranlib strip windres; do
|
||||
# First try with prefix + suffix
|
||||
# Then try with prefix only
|
||||
# Then try with suffix only, but only for BUILD, and HOST iff REAL_BUILD == REAL_HOST
|
||||
# Finally try with neither prefix nor suffix, but only for BUILD, and HOST iff REAL_BUILD == REAL_HOST
|
||||
# This is needed, because some tools have a prefix and
|
||||
# a suffix (eg. gcc), while others may have only one,
|
||||
# or even none (eg. binutils)
|
||||
where=$(CT_Which "${t}${tool}${!s}")
|
||||
[ -z "${where}" ] && where=$(CT_Which "${t}${tool}")
|
||||
if [ -z "${where}" \
|
||||
-a \( "${m}" = "BUILD" \
|
||||
-o "${CT_REAL_BUILD}" = "${!r}" \) ]; then
|
||||
where=$(CT_Which "${tool}${!s}")
|
||||
fi
|
||||
if [ -z "${where}" \
|
||||
-a \( "${m}" = "BUILD" \
|
||||
-o "${CT_REAL_BUILD}" = "${!r}" \) ]; then
|
||||
where=$(CT_Which "${tool}")
|
||||
fi
|
||||
|
||||
# Not all tools are available for all platforms, but some are really,
|
||||
# bally needed
|
||||
if [ -n "${where}" ]; then
|
||||
CT_DoLog DEBUG " '${!v}-${tool}' -> '${where}'"
|
||||
printf "#${BANG}${CT_SHELL}\nexec '${where}' \"\${@}\"\n" >"${CT_PREFIX_DIR}/bin/${!v}-${tool}"
|
||||
chmod 700 "${CT_PREFIX_DIR}/bin/${!v}-${tool}"
|
||||
else
|
||||
# We'll at least need some of them...
|
||||
case "${tool}" in
|
||||
ar|as|gcc|ld|nm|objcopy|objdump|ranlib)
|
||||
CT_Abort "Missing: '${t}${tool}${!s}' or '${t}${tool}' or '${tool}' : either needed!"
|
||||
;;
|
||||
*)
|
||||
# It does not deserve a WARN level.
|
||||
CT_DoLog DEBUG " Missing: '${t}${tool}${!s}' or '${t}${tool}' or '${tool}' : not required."
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# Carefully add paths in the order we want them:
|
||||
# - first try in ${CT_PREFIX_DIR}/bin
|
||||
# - then try in ${CT_CC_CORE_SHARED_PREFIX_DIR}/bin
|
||||
# - then try in ${CT_CC_CORE_STATIC_PREFIX_DIR}/bin
|
||||
# - fall back to searching user's PATH
|
||||
# Of course, neither cross-native nor canadian can run on BUILD,
|
||||
# so don't add those PATHs in this case...
|
||||
case "${CT_TOOLCHAIN_TYPE}" in
|
||||
cross) export PATH="${CT_PREFIX_DIR}/bin:${CT_CC_CORE_SHARED_PREFIX_DIR}/bin:${CT_CC_CORE_STATIC_PREFIX_DIR}/bin:${PATH}";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
# Some makeinfo versions are a pain in [put your most sensible body part here].
|
||||
# Go ahead with those, by creating a wrapper that keeps partial files, and that
|
||||
# never fails:
|
||||
@ -359,8 +418,8 @@ if [ -z "${CT_RESTART}" ]; then
|
||||
|
||||
CT_DoStep EXTRA "Dumping internal crosstool-NG configuration"
|
||||
CT_DoLog EXTRA "Building a toolchain for:"
|
||||
CT_DoLog EXTRA " build = ${CT_BUILD}"
|
||||
CT_DoLog EXTRA " host = ${CT_HOST}"
|
||||
CT_DoLog EXTRA " build = ${CT_REAL_BUILD}"
|
||||
CT_DoLog EXTRA " host = ${CT_REAL_HOST}"
|
||||
CT_DoLog EXTRA " target = ${CT_TARGET}"
|
||||
set |egrep '^CT_.+=' |sort |CT_DoLog DEBUG
|
||||
CT_EndStep
|
||||
@ -434,7 +493,6 @@ if [ "${CT_ONLY_DOWNLOAD}" != "y" -a "${CT_ONLY_EXTRACT}" != "y" ]; then
|
||||
|
||||
CT_DoLog DEBUG "Removing access to the build system tools"
|
||||
find "${CT_PREFIX_DIR}/bin" -name "${CT_BUILD}-"'*' -exec rm -fv {} \; |CT_DoLog DEBUG
|
||||
find "${CT_PREFIX_DIR}/bin" -name "${CT_UNIQ_BUILD}-"'*' -exec rm -fv {} \; |CT_DoLog DEBUG
|
||||
find "${CT_PREFIX_DIR}/bin" -name "${CT_HOST}-"'*' -exec rm -fv {} \; |CT_DoLog DEBUG
|
||||
rm -fv "${CT_PREFIX_DIR}/bin/makeinfo" |CT_DoLog DEBUG
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user