diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/build/debug.sh | 2 | ||||
-rw-r--r-- | scripts/build/tools.sh | 2 | ||||
-rwxr-xr-x | scripts/crosstool.sh | 34 | ||||
-rw-r--r-- | scripts/functions | 24 | ||||
-rwxr-xr-x | scripts/saveSample.sh | 31 | ||||
-rwxr-xr-x | scripts/showSamples.sh | 13 | ||||
-rwxr-xr-x | scripts/tarball.sh.broken (renamed from scripts/tarball.sh) | 0 |
7 files changed, 60 insertions, 46 deletions
diff --git a/scripts/build/debug.sh b/scripts/build/debug.sh index 4a3a6cf2..d2cca62f 100644 --- a/scripts/build/debug.sh +++ b/scripts/build/debug.sh @@ -2,7 +2,7 @@ # List all debug facilities, and parse their scripts CT_DEBUG_FACILITY_LIST= -for f in "${CT_TOP_DIR}/scripts/build/debug/"*.sh; do +for f in "${CT_LIB_DIR}/scripts/build/debug/"*.sh; do is_enabled= . "${f}" f=`basename "${f}" .sh` diff --git a/scripts/build/tools.sh b/scripts/build/tools.sh index ebc81316..e61b16f8 100644 --- a/scripts/build/tools.sh +++ b/scripts/build/tools.sh @@ -2,7 +2,7 @@ # List all tools facilities, and parse their scripts CT_TOOLS_FACILITY_LIST= -for f in "${CT_TOP_DIR}/scripts/build/tools/"*.sh; do +for f in "${CT_LIB_DIR}/scripts/build/tools/"*.sh; do is_enabled= . "${f}" f=`basename "${f}" .sh` diff --git a/scripts/crosstool.sh b/scripts/crosstool.sh index 9b0fd955..4e4f2941 100755 --- a/scripts/crosstool.sh +++ b/scripts/crosstool.sh @@ -12,17 +12,8 @@ # options. It also checks the existing environment for un-friendly variables, # and builds the tools. -# CT_TOP_DIR is set by the makefile. If we don't have it, something's gone horribly wrong... -if [ -z "${CT_TOP_DIR}" -o ! -d "${CT_TOP_DIR}" ]; then - # We don't have the functions right now, because we don't have CT_TOP_DIR. - # Do the print stuff by hand: - echo "CT_TOP_DIR not set, or not a directory. Something's gone horribly wrong." - echo "Please send a bug report (see README)" - exit 1 -fi - # Parse the common functions -. "${CT_TOP_DIR}/scripts/functions" +. "${CT_LIB_DIR}/scripts/functions" CT_STAR_DATE=`CT_DoDate +%s%N` CT_STAR_DATE_HUMAN=`CT_DoDate +%Y%m%d.%H%M%S` @@ -41,7 +32,7 @@ renice ${CT_NICE} $$ |CT_DoLog DEBUG CT_DoLog INFO "Build started ${CT_STAR_DATE_HUMAN}" CT_DoStep DEBUG "Dumping crosstool-NG configuration" -cat ${CT_TOP_DIR}/.config |egrep '^(# |)CT_' |CT_DoLog DEBUG +cat "${CT_TOP_DIR}/.config" |egrep '^(# |)CT_' |CT_DoLog DEBUG CT_EndStep # Some sanity checks in the environment and needed tools @@ -143,7 +134,7 @@ CT_SYS_OS=`uname -o || echo "Unknown (maybe MacOS-X)"` CT_SYS_MACHINE=`uname -m` CT_SYS_PROCESSOR=`uname -p` CT_SYS_GCC=`gcc -dumpversion` -CT_SYS_TARGET=`${CT_TOP_DIR}/tools/config.guess` +CT_SYS_TARGET=`CT_DoConfigGuess` CT_TOOLCHAIN_ID="crosstool-${CT_VERSION} build ${CT_STAR_DATE_HUMAN} by ${CT_SYS_USER}@${CT_SYS_HOSTNAME}" CT_DoLog EXTRA "Preparing working directories" @@ -225,7 +216,8 @@ esac 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_TOP_DIR}/tools/config.sub \"${CT_BUILD:-\`${CT_TOP_DIR}/tools/config.guess\`}\"`" + CT_BUILD="${CT_BUILD:-`CT_DoConfigGuess`}" + CT_BUILD=`CT_DoConfigSub "${CT_BUILD}"` # Arrange paths depending on wether we use sys-root or not. if [ "${CT_USE_SYSROOT}" = "y" ]; then @@ -345,14 +337,14 @@ fi # Include sub-scripts instead of calling them: that way, we do not have to # export any variable, nor re-parse the configuration and functions files. -. "${CT_TOP_DIR}/scripts/build/kernel_${CT_KERNEL}.sh" -. "${CT_TOP_DIR}/scripts/build/binutils.sh" -. "${CT_TOP_DIR}/scripts/build/libfloat.sh" -. "${CT_TOP_DIR}/scripts/build/libc_${CT_LIBC}.sh" -. "${CT_TOP_DIR}/scripts/build/cc_core_${CT_CC_CORE}.sh" -. "${CT_TOP_DIR}/scripts/build/cc_${CT_CC}.sh" -. "${CT_TOP_DIR}/scripts/build/debug.sh" -. "${CT_TOP_DIR}/scripts/build/tools.sh" +. "${CT_LIB_DIR}/scripts/build/kernel_${CT_KERNEL}.sh" +. "${CT_LIB_DIR}/scripts/build/binutils.sh" +. "${CT_LIB_DIR}/scripts/build/libfloat.sh" +. "${CT_LIB_DIR}/scripts/build/libc_${CT_LIBC}.sh" +. "${CT_LIB_DIR}/scripts/build/cc_core_${CT_CC_CORE}.sh" +. "${CT_LIB_DIR}/scripts/build/cc_${CT_CC}.sh" +. "${CT_LIB_DIR}/scripts/build/debug.sh" +. "${CT_LIB_DIR}/scripts/build/tools.sh" if [ -z "${CT_RESTART}" ]; then CT_DoStep INFO "Retrieving needed toolchain components' tarballs" diff --git a/scripts/functions b/scripts/functions index d66fe22e..18ee9695 100644 --- a/scripts/functions +++ b/scripts/functions @@ -425,7 +425,9 @@ CT_ExtractAndPatch() { cd "${file}" fi - [ "${CUSTOM_PATCH_ONLY}" = "y" ] || official_patch_dir="${CT_TOP_DIR}/patches/${base_file}/${ver_file}" + official_patch_dir= + custom_patch_dir= + [ "${CUSTOM_PATCH_ONLY}" = "y" ] || official_patch_dir="${CT_LIB_DIR}/patches/${base_file}/${ver_file}" [ "${CT_CUSTOM_PATCH}" = "y" ] && custom_patch_dir="${CT_CUSTOM_PATCH_DIR}/${base_file}/${ver_file}" for patch_dir in "${official_patch_dir}" "${custom_patch_dir}"; do if [ -n "${patch_dir}" -a -d "${patch_dir}" ]; then @@ -442,6 +444,24 @@ CT_ExtractAndPatch() { CT_Popd } +# Two wrappers to call config.(guess|sub) either from CT_TOP_DIR or CT_LIB_DIR. +# Those from CT_TOP_DIR, if they exist, will be be more recent than those from CT_LIB_DIR. +CT_DoConfigGuess() { + if [ -x "${CT_TOP_DIR}/tools/config.guess" ]; then + "${CT_TOP_DIR}/tools/config.guess" + else + "${CT_LIB_DIR}/tools/config.guess" + fi +} + +CT_DoConfigSub() { + if [ -x "${CT_TOP_DIR}/tools/config.sub" ]; then + "${CT_TOP_DIR}/tools/config.sub" "$@" + else + "${CT_LIB_DIR}/tools/config.sub" "$@" + fi +} + # Compute the target triplet from what is provided by the user # Usage: CT_DoBuildTargetTriplet # In fact this function takes the environment variables to build the target @@ -482,7 +502,7 @@ CT_DoBuildTargetTriplet() { glibc) CT_TARGET="${CT_TARGET}-gnu";; uClibc) CT_TARGET="${CT_TARGET}-uclibc";; esac - CT_TARGET="`${CT_TOP_DIR}/tools/config.sub ${CT_TARGET}`" + CT_TARGET=`CT_DoConfigSub "${CT_TARGET}"` } # This function does pause the build until the user strikes "Return" diff --git a/scripts/saveSample.sh b/scripts/saveSample.sh index 7a5b57cc..4aee0eba 100755 --- a/scripts/saveSample.sh +++ b/scripts/saveSample.sh @@ -8,7 +8,7 @@ # - the kernel .config file if specified # - the uClibc .config file if uClibc selected -. "${CT_TOP_DIR}/scripts/functions" +. "${CT_LIB_DIR}/scripts/functions" # Don't care about any log file exec >/dev/null @@ -31,12 +31,8 @@ CT_LOG_INFO=y CT_LOG_LEVEL_MAX="INFO" # Create the sample directory -# In case it was manually made, add it to svn -if [ -d "${CT_TOP_DIR}/samples/${CT_TARGET}" ]; then - # svn won't fail when adding a directory already managed by svn - svn add "${CT_TOP_DIR}/samples/${CT_TARGET}" >/dev/null 2>&1 -else - svn mkdir "${CT_TOP_DIR}/samples/${CT_TARGET}" >/dev/null 2>&1 +if [ ! -d "${CT_TOP_DIR}/samples/${CT_TARGET}" ]; then + mkdir -p "${CT_TOP_DIR}/samples/${CT_TARGET}" fi # Save the crosstool-NG config file @@ -53,19 +49,24 @@ CT_DoAddFileToSample() { if [ "${inode_s}" != "${inode_d}" ]; then cp "${source}" "${dest}" fi - svn add "${dest}" >/dev/null 2>&1 } +if [ "${CT_TOP_DIR}" = "${CT_LIB_DIR}" ]; then + samp_top_dir="\${CT_LIB_DIR}" +else + samp_top_dir="\${CT_TOP_DIR}" +fi + # Save the kernel .config file if [ -n "${CT_KERNEL_LINUX_CONFIG_FILE}" ]; then # We save the file, and then point the saved sample to this file CT_DoAddFileToSample "${CT_KERNEL_LINUX_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config" - sed -r -i -e 's|^(CT_KERNEL_LINUX_CONFIG_FILE=).+$|\1"${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config"|;' \ + sed -r -i -e 's|^(CT_KERNEL_LINUX_CONFIG_FILE=).+$|\1"'"${samp_top_dir}"'/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config"|;' \ "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config" else # remove any dangling files for f in "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-"*.config; do - if [ -f "${f}" ]; then svn rm --force "${f}" >/dev/null 2>&1; fi + if [ -f "${f}" ]; then rm -f "${f}"; fi done fi @@ -73,17 +74,11 @@ fi if [ -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then # We save the file, and then point the saved sample to this file CT_DoAddFileToSample "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config" - sed -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE=).+$|\1"${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \ + sed -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE=).+$|\1"'"${samp_top_dir}"'/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \ "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config" else # remove any dangling files for f in "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-"*.config; do - if [ -f "${f}" ]; then svn rm --force "${f}" >/dev/null 2>&1; fi + if [ -f "${f}" ]; then rm -f "${f}"; fi done fi - -# We could svn add earlier, but it's better to -# add a frozen file than modifying it later -svn add "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config" >/dev/null 2>&1 - -svn stat "${CT_TOP_DIR}/samples/${CT_TARGET}" 2>/dev/null |CT_DoLog INFO diff --git a/scripts/showSamples.sh b/scripts/showSamples.sh index ac05e911..f814940c 100755 --- a/scripts/showSamples.sh +++ b/scripts/showSamples.sh @@ -10,9 +10,16 @@ export GREP_OPTIONS= dump_single_sample() { local width="$1" local sample="$2" - printf " %-*s" ${width} "${sample}" - [ -f "${CT_TOP_DIR}/samples/${sample}/broken" ] && printf " (broken)" - echo + if [ -f "${CT_TOP_DIR}/samples/${sample}/crosstool.config" ]; then + sample_top="${CT_TOP_DIR}" + sample_type="local" + else + sample_top="${CT_LIB_DIR}" + sample_type="global" + fi + printf " %-*s (%s" ${width} "${sample}" "${sample_type}" + [ -f "${sample_top}/samples/${sample}/broken" ] && printf ",broken" + echo ")" } # Get largest sample width diff --git a/scripts/tarball.sh b/scripts/tarball.sh.broken index 8e6c3122..8e6c3122 100755 --- a/scripts/tarball.sh +++ b/scripts/tarball.sh.broken |