summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--config/global.in35
-rw-r--r--samples/armeb-unknown-linux-gnu/crosstool.config6
-rw-r--r--samples/armeb-unknown-linux-uclibc/crosstool.config7
-rw-r--r--samples/i586-geode-linux-uclibc/crosstool.config7
-rw-r--r--samples/mips-unknown-linux-uclibc/crosstool.config7
-rwxr-xr-xscripts/crosstool.sh122
-rw-r--r--scripts/functions87
8 files changed, 130 insertions, 147 deletions
diff --git a/Makefile b/Makefile
index be5e005..da7ae78 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ export PROJECTVERSION=0.0.2-svn
export CT_TOP_DIR=$(shell pwd)
.PHONY: all
-all: _ct_build
+all: build
HOST_CC = gcc -funsigned-char
@@ -39,10 +39,10 @@ help::
@test -f .config
# Actual build
-_ct_build: .config
+build: .config
@$(CT_TOP_DIR)/scripts/crosstool.sh
.PHONY: distclean
distclean:: clean
@rm -f .config* ..config.tmp
- @rm -rf "$(CT_TOP_DIR)/build"
+ @rm -rf "$(CT_TOP_DIR)/targets"
diff --git a/config/global.in b/config/global.in
index 9378bdf..ee23a5d 100644
--- a/config/global.in
+++ b/config/global.in
@@ -70,38 +70,13 @@ config USE_PIPES
comment "Paths"
-config TARBALLS_DIR
+config LOCAL_TARBALLS_DIR
string
- prompt "Tarballs directory"
- default "${CT_TOP_DIR}/build/tarballs"
- help
- This is the directory into which tarballs are going to be stored once
- they are downloaded (or otherwise retrieved).
-
-config SRC_DIR
- string
- prompt "Extract directory"
- default "${CT_TOP_DIR}/build/${CT_TARGET}/${CT_CC}-${CT_CC_VERSION}-${CT_LIBC}-${CT_LIBC_VERSION}/src"
- help
- This is the directory into which tarballs will be extracted.
-
- If you will build multiple toolchains, you should arrange to have one
- SRC_DIR for each toolchain, as different targets may require different
- patches to be applied.
-
- You should not need to change this from the default.
-
-config BUILD_DIR
- string
- prompt "Build directory"
- default "${CT_TOP_DIR}/build/${CT_TARGET}/${CT_CC}-${CT_CC_VERSION}-${CT_LIBC}-${CT_LIBC_VERSION}/build"
+ prompt "Local tarballs directory"
+ default ""
help
- This is the directory into which builds will occur.
-
- Once again, arrange for one build directory for each toolchain you build,
- to avoid collision.
-
- You should not need to change this from the default.
+ If you have previously downloaded the tarballs, enter the PATH where
+ you stored them here.
config PREFIX_DIR
string
diff --git a/samples/armeb-unknown-linux-gnu/crosstool.config b/samples/armeb-unknown-linux-gnu/crosstool.config
index be734dc..a14c4d6 100644
--- a/samples/armeb-unknown-linux-gnu/crosstool.config
+++ b/samples/armeb-unknown-linux-gnu/crosstool.config
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# crosstool-NG version: 0.0.2-svn
-# Tue May 8 18:48:51 2007
+# Thu May 10 23:28:59 2007
#
#
@@ -17,9 +17,7 @@ CT_USE_PIPES=y
#
# Paths
#
-CT_TARBALLS_DIR="${HOME}/dev/src"
-CT_SRC_DIR="${CT_TOP_DIR}/build/${CT_TARGET}/${CT_CC}-${CT_CC_VERSION}-${CT_LIBC}-${CT_LIBC_VERSION}/src"
-CT_BUILD_DIR="${CT_TOP_DIR}/build/${CT_TARGET}/${CT_CC}-${CT_CC_VERSION}-${CT_LIBC}-${CT_LIBC_VERSION}/build"
+CT_LOCAL_TARBALLS_DIR="${HOME}/dev/src"
CT_PREFIX_DIR="/opt/x-tools/${CT_TARGET}"
CT_INSTALL_DIR="${CT_PREFIX_DIR}"
# CT_CUSTOM_PATCH is not set
diff --git a/samples/armeb-unknown-linux-uclibc/crosstool.config b/samples/armeb-unknown-linux-uclibc/crosstool.config
index 644f1b9..a96d72f 100644
--- a/samples/armeb-unknown-linux-uclibc/crosstool.config
+++ b/samples/armeb-unknown-linux-uclibc/crosstool.config
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# crosstool-NG version: 0.0.2-svn
-# Mon May 7 23:45:42 2007
+# Thu May 10 23:29:27 2007
#
#
@@ -17,9 +17,7 @@ CT_USE_PIPES=y
#
# Paths
#
-CT_TARBALLS_DIR="${HOME}/dev/src"
-CT_SRC_DIR="${CT_TOP_DIR}/build/${CT_TARGET}/${CT_CC}-${CT_CC_VERSION}-${CT_LIBC}-${CT_LIBC_VERSION}/src"
-CT_BUILD_DIR="${CT_TOP_DIR}/build/${CT_TARGET}/${CT_CC}-${CT_CC_VERSION}-${CT_LIBC}-${CT_LIBC_VERSION}/build"
+CT_LOCAL_TARBALLS_DIR="${HOME}/dev/src"
CT_PREFIX_DIR="/opt/x-tools/${CT_TARGET}"
CT_INSTALL_DIR="${CT_PREFIX_DIR}"
# CT_CUSTOM_PATCH is not set
@@ -45,6 +43,7 @@ CT_REMOVE_DOCS=y
# CT_LOG_INFO is not set
CT_LOG_EXTRA=y
# CT_LOG_DEBUG is not set
+# CT_LOG_ALL is not set
CT_LOG_LEVEL_MAX="EXTRA"
# CT_LOG_SEE_TOOLS_WARN is not set
# CT_LOG_PROGRESS_BAR is not set
diff --git a/samples/i586-geode-linux-uclibc/crosstool.config b/samples/i586-geode-linux-uclibc/crosstool.config
index 308dae0..bcc894c 100644
--- a/samples/i586-geode-linux-uclibc/crosstool.config
+++ b/samples/i586-geode-linux-uclibc/crosstool.config
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# crosstool-NG version: 0.0.2-svn
-# Tue May 8 00:10:27 2007
+# Thu May 10 23:29:48 2007
#
#
@@ -17,9 +17,7 @@ CT_USE_PIPES=y
#
# Paths
#
-CT_TARBALLS_DIR="${HOME}/dev/src"
-CT_SRC_DIR="${HOME}/x-tools/src/${CT_TARGET}/${CT_CC}-${CT_CC_VERSION}-${CT_LIBC}-${CT_LIBC_VERSION}"
-CT_BUILD_DIR="${HOME}/x-tools/build/${CT_TARGET}/${CT_CC}-${CT_CC_VERSION}-${CT_LIBC}-${CT_LIBC_VERSION}"
+CT_LOCAL_TARBALLS_DIR="${HOME}/dev/src"
CT_PREFIX_DIR="${HOME}/x-tools/${CT_TARGET}"
CT_INSTALL_DIR="${CT_PREFIX_DIR}"
# CT_CUSTOM_PATCH is not set
@@ -45,6 +43,7 @@ CT_REMOVE_DOCS=y
# CT_LOG_INFO is not set
CT_LOG_EXTRA=y
# CT_LOG_DEBUG is not set
+# CT_LOG_ALL is not set
CT_LOG_LEVEL_MAX="EXTRA"
# CT_LOG_SEE_TOOLS_WARN is not set
# CT_LOG_PROGRESS_BAR is not set
diff --git a/samples/mips-unknown-linux-uclibc/crosstool.config b/samples/mips-unknown-linux-uclibc/crosstool.config
index 6a6fc74..2ba9b1a 100644
--- a/samples/mips-unknown-linux-uclibc/crosstool.config
+++ b/samples/mips-unknown-linux-uclibc/crosstool.config
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# crosstool-NG version: 0.0.2-svn
-# Mon May 7 23:45:56 2007
+# Thu May 10 23:30:10 2007
#
#
@@ -17,9 +17,7 @@ CT_USE_PIPES=y
#
# Paths
#
-CT_TARBALLS_DIR="${HOME}/dev/src"
-CT_SRC_DIR="${CT_TOP_DIR}/build/${CT_TARGET}/${CT_CC}-${CT_CC_VERSION}-${CT_LIBC}-${CT_LIBC_VERSION}/src"
-CT_BUILD_DIR="${CT_TOP_DIR}/build/${CT_TARGET}/${CT_CC}-${CT_CC_VERSION}-${CT_LIBC}-${CT_LIBC_VERSION}/build"
+CT_LOCAL_TARBALLS_DIR="${HOME}/dev/src"
CT_PREFIX_DIR="/opt/x-tools/${CT_TARGET}"
CT_INSTALL_DIR="${CT_PREFIX_DIR}"
# CT_CUSTOM_PATCH is not set
@@ -45,6 +43,7 @@ CT_REMOVE_DOCS=y
# CT_LOG_INFO is not set
CT_LOG_EXTRA=y
# CT_LOG_DEBUG is not set
+# CT_LOG_ALL is not set
CT_LOG_LEVEL_MAX="EXTRA"
# CT_LOG_SEE_TOOLS_WARN is not set
# CT_LOG_PROGRESS_BAR is not set
diff --git a/scripts/crosstool.sh b/scripts/crosstool.sh
index 65476d7..a3e284a 100755
--- a/scripts/crosstool.sh
+++ b/scripts/crosstool.sh
@@ -118,16 +118,56 @@ CT_LIBC_FILE="${CT_LIBC}-${CT_LIBC_VERSION}"
# then rescan the options file now:
. "${CT_TOP_DIR}/.config"
+# Where will we work?
+CT_TARBALLS_DIR="${CT_TOP_DIR}/targets/tarballs"
+CT_SRC_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/src"
+CT_BUILD_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/build"
+
+# Make all path absolute, it so much easier!
+CT_LOCAL_TARBALLS_DIR="`CT_MakeAbsolutePath \"${CT_LOCAL_TARBALLS_DIR}\"`"
+
# Some more sanity checks now that we have all paths set up
case "${CT_TARBALLS_DIR},${CT_SRC_DIR},${CT_BUILD_DIR},${CT_PREFIX_DIR},${CT_INSTALL_DIR}" in
*" "*) CT_Abort "Don't use spaces in paths, it breaks things.";;
esac
+# Check now if we can write to the destination directory:
+if [ -d "${CT_INSTALL_DIR}" ]; then
+ CT_TestAndAbort "Destination directory \"${CT_INSTALL_DIR}\" is not removable" ! -w `dirname "${CT_INSTALL_DIR}"`
+fi
+
+# Get rid of pre-existing installed toolchain and previous build directories.
+# We need to do that _before_ we can safely log, because the log file will
+# most probably be in the toolchain directory.
+if [ "${CT_FORCE_DOWNLOAD}" = "y" -a -d "${CT_TARBALLS_DIR}" ]; then
+ mv "${CT_TARBALLS_DIR}" "${CT_TARBALLS_DIR}.$$"
+ nohup rm -rf "${CT_TARBALLS_DIR}.$$" >/dev/null 2>&1 &
+fi
+if [ "${CT_FORCE_EXTRACT}" = "y" -a -d "${CT_SRC_DIR}" ]; then
+ mv "${CT_SRC_DIR}" "${CT_SRC_DIR}.$$"
+ nohup rm -rf "${CT_SRC_DIR}.$$" >/dev/null 2>&1 &
+fi
+if [ -d "${CT_BUILD_DIR}" ]; then
+ mv "${CT_BUILD_DIR}" "${CT_BUILD_DIR}.$$"
+ nohup rm -rf "${CT_BUILD_DIR}.$$" >/dev/null 2>&1 &
+fi
+if [ -d "${CT_INSTALL_DIR}" ]; then
+ mv "${CT_INSTALL_DIR}" "${CT_INSTALL_DIR}.$$"
+ nohup rm -rf "${CT_INSTALL_DIR}.$$" >/dev/null 2>&1 &
+fi
+
# Note: we'll always install the core compiler in its own directory, so as to
# not mix the two builds: core and final. Anyway, its generic, wether we use
# a different compiler as core, or not.
CT_CC_CORE_PREFIX_DIR="${CT_BUILD_DIR}/${CT_CC}-core"
+# Create the directories we'll use
+mkdir -p "${CT_TARBALLS_DIR}"
+mkdir -p "${CT_SRC_DIR}"
+mkdir -p "${CT_BUILD_DIR}"
+mkdir -p "${CT_INSTALL_DIR}"
+mkdir -p "${CT_CC_CORE_PREFIX_DIR}"
+
# Good, now grab a bit of informations on the system we're being run,
# just in case something goes awok, and it's not our fault:
CT_SYS_HOSTNAME=`hostname -f 2>/dev/null || true`
@@ -144,36 +184,6 @@ CT_SYS_DATE=`CT_DoDate +%Y%m%d.%H%M%S`
CT_SYS_GCC=`gcc -dumpversion`
CT_TOOLCHAIN_ID="crosstool-${CT_VERSION} build ${CT_SYS_DATE} by ${CT_SYS_USER}@${CT_SYS_HOSTNAME} for ${CT_TARGET}"
-# Check now if we can write to the destination directory:
-if [ -d "${CT_INSTALL_DIR}" ]; then
- CT_TestAndAbort "Destination directory \"${CT_INSTALL_DIR}\" is not removable" ! -w `dirname "${CT_INSTALL_DIR}"`
-fi
-
-# Get rid of pre-existing installed toolchain and previous build directories.
-# We need to do that _before_ we can safely log, because the log file will
-# most probably be in the toolchain directory.
-if [ -d "${CT_INSTALL_DIR}" ]; then
- mv "${CT_INSTALL_DIR}" "${CT_INSTALL_DIR}.$$"
- nohup rm -rf "${CT_INSTALL_DIR}.$$" >/dev/null 2>&1 &
-fi
-if [ -d "${CT_BUILD_DIR}" ]; then
- mv "${CT_BUILD_DIR}" "${CT_BUILD_DIR}.$$"
- nohup rm -rf "${CT_BUILD_DIR}.$$" >/dev/null 2>&1 &
-fi
-if [ "${CT_FORCE_EXTRACT}" = "y" -a -d "${CT_SRC_DIR}" ]; then
- mv "${CT_SRC_DIR}" "${CT_SRC_DIR}.$$"
- nohup rm -rf "${CT_SRC_DIR}.$$" >/dev/null 2>&1 &
-fi
-mkdir -p "${CT_INSTALL_DIR}"
-mkdir -p "${CT_BUILD_DIR}"
-mkdir -p "${CT_TARBALLS_DIR}"
-mkdir -p "${CT_SRC_DIR}"
-
-# Make all path absolute, it so much easier!
-# Now we have had the directories created, we even will get rid of embedded .. in paths:
-CT_SRC_DIR="`CT_MakeAbsolutePath \"${CT_SRC_DIR}\"`"
-CT_TARBALLS_DIR="`CT_MakeAbsolutePath \"${CT_TARBALLS_DIR}\"`"
-
# Redirect log to the actual log file now we can
# It's quite understandable that the log file will be installed in the install
# directory, so we must first ensure it exists and is writeable (above) before
@@ -312,16 +322,14 @@ CT_EndStep
. "${CT_TOP_DIR}/scripts/build/cc_${CT_CC}.sh"
# Now for the job by itself. Go have a coffee!
-if [ "${CT_NO_DOWNLOAD}" != "y" ]; then
- CT_DoStep INFO "Retrieving needed toolchain components' tarballs"
- do_kernel_get
- do_binutils_get
- do_cc_core_get
- do_libfloat_get
- do_libc_get
- do_cc_get
- CT_EndStep
-fi
+CT_DoStep INFO "Retrieving needed toolchain components' tarballs"
+do_kernel_get
+do_binutils_get
+do_cc_core_get
+do_libfloat_get
+do_libc_get
+do_cc_get
+CT_EndStep
if [ "${CT_ONLY_DOWNLOAD}" != "y" ]; then
if [ "${CT_FORCE_EXTRACT}" = "y" ]; then
@@ -348,23 +356,25 @@ if [ "${CT_ONLY_DOWNLOAD}" != "y" ]; then
do_libc
do_cc
do_libc_finish
- fi
-fi
-
-if [ -n "${CT_TARGET_ALIAS}" ]; then
- CT_DoLog EXTRA "Creating symlinks from \"${CT_TARGET}-*\" to \"${CT_TARGET_ALIAS}-*\""
- CT_Pushd "${CT_PREFIX_DIR}/bin"
- for t in "${CT_TARGET}-"*; do
- _t="`echo \"$t\" |sed -r -e 's/^'\"${CT_TARGET}\"'-/'\"${CT_TARGET_ALIAS}\"'-/;'`"
- CT_DoLog DEBUG "Linking \"${_t}\" -> \"${t}\""
- ln -s "${t}" "${_t}"
- done
- CT_Popd
-fi
-if [ "${CT_REMOVE_DOCS}" = "y" ]; then
- CT_DoLog INFO "Removing installed documentation"
- rm -rf "${CT_PREFIX_DIR}/"{man,info}
+ # Create the aliases to the target tools
+ if [ -n "${CT_TARGET_ALIAS}" ]; then
+ CT_DoLog EXTRA "Creating symlinks from \"${CT_TARGET}-*\" to \"${CT_TARGET_ALIAS}-*\""
+ CT_Pushd "${CT_PREFIX_DIR}/bin"
+ for t in "${CT_TARGET}-"*; do
+ _t="`echo \"$t\" |sed -r -e 's/^'\"${CT_TARGET}\"'-/'\"${CT_TARGET_ALIAS}\"'-/;'`"
+ CT_DoLog DEBUG "Linking \"${_t}\" -> \"${t}\""
+ ln -s "${t}" "${_t}"
+ done
+ CT_Popd
+ fi
+
+ # Remove the generated documentation files
+ if [ "${CT_REMOVE_DOCS}" = "y" ]; then
+ CT_DoLog INFO "Removing installed documentation"
+ rm -rf "${CT_PREFIX_DIR}/"{man,info}
+ fi
+ fi
fi
CT_STOP_DATE=`CT_DoDate +%s%N`
diff --git a/scripts/functions b/scripts/functions
index dd19fcd..da66d83 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -229,6 +229,28 @@ CT_DoYes() {
yes "$1" || true
}
+# Get the file name extension of a component
+# Usage: CT_GetFileExtension <component_name-component_version>
+# If found, echoes the extension to stdout
+# If not found, echoes nothing on stdout.
+CT_GetFileExtension() {
+ local ext
+ local file="$1"
+ local got_it=1
+
+ CT_Pushd "${CT_TARBALLS_DIR}"
+ for ext in .tar.gz .tar.bz2 .tgz .tar; do
+ if [ -f "${file}${ext}" ]; then
+ echo "${ext}"
+ got_it=0
+ break
+ fi
+ done
+ CT_Popd
+
+ return 0
+}
+
# Download an URL using wget
# Usage: CT_DoGetFileWget <URL>
CT_DoGetFileWget() {
@@ -276,58 +298,39 @@ CT_GetFile() {
# Do we already have it?
ext=`CT_GetFileExtension "${file}"`
if [ -n "${ext}" ]; then
- if [ "${CT_FORCE_DOWNLOAD}" = "y" ]; then
- CT_DoLog DEBUG "Removing already present \"${file}\""
- rm -f "${CT_TARBALLS_DIR}/${file}${ext}"
- else
- CT_DoLog DEBUG "Already have \"${file}\""
- return 0
- fi
+ CT_DoLog DEBUG "Already have \"${file}\""
+ return 0
fi
CT_DoLog EXTRA "Retrieving \"${file}\""
CT_Pushd "${CT_TARBALLS_DIR}"
# File not yet downloaded, try to get it
got_it=0
- if [ "${got_it}" != "y" ]; then
- # We'd rather have a bzip2'ed tarball, then gzipped, and finally plain tar.
- for ext in .tar.bz2 .tar.gz .tgz .tar; do
- # Try all urls in turn
- for url in "$@"; do
- case "${url}" in
- *) CT_DoLog DEBUG "Trying \"${url}/${file}${ext}\""
- CT_DoGetFile "${url}/${file}${ext}"
- ;;
- esac
- [ -f "${file}${ext}" ] && got_it=1 && break 2 || true
- done
- done
- fi
- CT_Popd
-
- CT_TestAndAbort "Could not download \"${file}\", and not present in \"${CT_TARBALLS_DIR}\"" ${got_it} -eq 0
-}
-
-# Get the file name extension of a component
-# Usage: CT_GetFileExtension <component_name-component_version>
-# If found, echoes the extension to stdout
-# If not found, echoes nothing on stdout.
-CT_GetFileExtension() {
- local ext
- local file="$1"
- local got_it=1
-
- CT_Pushd "${CT_TARBALLS_DIR}"
- for ext in .tar.gz .tar.bz2 .tgz .tar; do
- if [ -f "${file}${ext}" ]; then
- echo "${ext}"
- got_it=0
- break
+ # We'd rather have a bzip2'ed tarball, then gzipped, and finally plain tar.
+ for ext in .tar.bz2 .tar.gz .tgz .tar; do
+ if [ ${got_it} -ne 1 ]; then
+ # Try local copy first, if it exists
+ if [ -r "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" -a \
+ "${CT_FORCE_DOWNLOAD}" != "y" ]; then
+ cp -v "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" |CT_DoLog DEBUG
+ got_it=1
+ break 1
+ else
+ # Try all urls in turn
+ for url in "$@"; do
+ case "${url}" in
+ *) CT_DoLog DEBUG "Trying \"${url}/${file}${ext}\""
+ CT_DoGetFile "${url}/${file}${ext}"
+ ;;
+ esac
+ [ -f "${file}${ext}" ] && got_it=1 && break 2 || true
+ done
+ fi
fi
done
CT_Popd
- return 0
+ CT_TestAndAbort "Could not download \"${file}\", and not present in \"${CT_LOCAL_TARBALLS_DIR}\"" ${got_it} -eq 0
}
# Extract a tarball and patch the resulting sources if necessary.