mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-06-17 14:58:12 +00:00
Implement a restart facility.
If you select to debug ct-ng, then you have two new options: - DEBUG_CT_PAUSE_STEPS : pause between every steps, - DEBUG_CT_SAVE_STEPS : save state between every steps. To restart a saved state, just set the RESTART make variable when calling make: - make RESTART=<step_name>
This commit is contained in:
3
Makefile
3
Makefile
@ -9,6 +9,8 @@ export CT_TOP_DIR=$(shell pwd)
|
|||||||
# This is crosstool-ng version string
|
# This is crosstool-ng version string
|
||||||
export CT_VERSION=$(shell cat $(CT_TOP_DIR)/version)
|
export CT_VERSION=$(shell cat $(CT_TOP_DIR)/version)
|
||||||
|
|
||||||
|
export CT_RESTART=$(RESTART)
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
@ -32,6 +34,7 @@ include $(CT_TOP_DIR)/tools/Makefile
|
|||||||
|
|
||||||
help::
|
help::
|
||||||
@echo 'Execute "make" or "make all" to build all targets marked with [*]'
|
@echo 'Execute "make" or "make all" to build all targets marked with [*]'
|
||||||
|
@echo 'Pass RESTART=<step> to restart a previously saved step (read doc first!)'
|
||||||
|
|
||||||
.config: $(CONFIG_FILES) $(CT_TOP_DIR)/config/debug.in
|
.config: $(CONFIG_FILES) $(CT_TOP_DIR)/config/debug.in
|
||||||
@make oldconfig
|
@make oldconfig
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
# Overall toolchain configuration: paths, jobs, etc...
|
# Overall toolchain configuration: paths, jobs, etc...
|
||||||
|
|
||||||
|
# Ah, this option is here to break the dependency tracking, and allow
|
||||||
|
# dependent option to line-up with the options they depend on ,rather
|
||||||
|
# than being indented
|
||||||
|
config FOOBAR
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
|
||||||
menu "Paths and misc options"
|
menu "Paths and misc options"
|
||||||
|
|
||||||
|
comment "Crosstool behavior"
|
||||||
|
|
||||||
config EXPERIMENTAL
|
config EXPERIMENTAL
|
||||||
bool
|
bool
|
||||||
prompt "Try features marked as EXPERIMENTAL"
|
prompt "Try features marked as EXPERIMENTAL"
|
||||||
@ -26,6 +35,64 @@ config OBSOLETE
|
|||||||
Such obsolete features are the use of old kernel headers, old
|
Such obsolete features are the use of old kernel headers, old
|
||||||
gcc versions, etc...
|
gcc versions, etc...
|
||||||
|
|
||||||
|
config DEBUG_CT
|
||||||
|
bool
|
||||||
|
prompt "Debug crosstool-NG"
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Say 'y' here to get some debugging options
|
||||||
|
|
||||||
|
if DEBUG_CT
|
||||||
|
|
||||||
|
config DEBUG_CT_PAUSE_STEPS
|
||||||
|
bool
|
||||||
|
prompt "Pause between every steps"
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Say 'y' if you intend to attend the build, and want to investigate
|
||||||
|
the result of each steps before running the next one.
|
||||||
|
|
||||||
|
config DEBUG_CT_SAVE_STEPS
|
||||||
|
bool
|
||||||
|
prompt "Save intermediate steps"
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
If you say 'y' here, then you will be able to restart crosstool-NG at
|
||||||
|
any step by typing:
|
||||||
|
make RESTART=<step_nane>
|
||||||
|
|
||||||
|
where step_name is one of:
|
||||||
|
- kernel_hdr
|
||||||
|
- binutils
|
||||||
|
- libc_hdr
|
||||||
|
- cc_core
|
||||||
|
- libfloat
|
||||||
|
- libc
|
||||||
|
- cc
|
||||||
|
- libc_fin
|
||||||
|
- debug
|
||||||
|
|
||||||
|
It is not currently possible to rstart at any of the debug facility.
|
||||||
|
They are treated a s a whole.
|
||||||
|
|
||||||
|
config DEBUG_CT_SAVE_STEPS_GZIP
|
||||||
|
bool
|
||||||
|
prompt "gzip saved states"
|
||||||
|
default y
|
||||||
|
depends on DEBUG_CT_SAVE_STEPS
|
||||||
|
help
|
||||||
|
If you are tight on space, then you can ask to gzip the saved states
|
||||||
|
tarballs. On the other hand, this takes some longer time...
|
||||||
|
|
||||||
|
To lose as less time as possible, the gzip process is done with a low
|
||||||
|
compression ratio (-3), which gives roughly 70% gain in size. Going
|
||||||
|
further doesn't gain much, and takes far more time (believe me, I've
|
||||||
|
got figures here! :-) ).
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
comment "Build behavior"
|
||||||
|
|
||||||
config PARALLEL_JOBS
|
config PARALLEL_JOBS
|
||||||
int
|
int
|
||||||
prompt "Number of parallel jobs"
|
prompt "Number of parallel jobs"
|
||||||
@ -157,6 +224,8 @@ config ONLY_DOWNLOAD
|
|||||||
|
|
||||||
Usefull to pre-retrieve the tarballs before going off-line.
|
Usefull to pre-retrieve the tarballs before going off-line.
|
||||||
|
|
||||||
|
config FOOBAR
|
||||||
|
|
||||||
comment "Extracting"
|
comment "Extracting"
|
||||||
depends on ! ONLY_DOWNLOAD
|
depends on ! ONLY_DOWNLOAD
|
||||||
|
|
||||||
|
@ -28,10 +28,10 @@ CT_STAR_DATE=`CT_DoDate +%s%N`
|
|||||||
CT_STAR_DATE_HUMAN=`CT_DoDate +%Y%m%d.%H%M%S`
|
CT_STAR_DATE_HUMAN=`CT_DoDate +%Y%m%d.%H%M%S`
|
||||||
|
|
||||||
# Log policy:
|
# Log policy:
|
||||||
# - what goes to the log file goes to fd #1 (stdout)
|
# - first of all, save stdout so we can see the live logs: fd #6
|
||||||
# - what goes to the screen goes to fd #6
|
|
||||||
tmp_log_file="${CT_TOP_DIR}/$$.log"
|
|
||||||
exec 6>&1
|
exec 6>&1
|
||||||
|
# - then point stdout to the log file (temporary for now)
|
||||||
|
tmp_log_file="${CT_TOP_DIR}/$$.log"
|
||||||
exec >>"${tmp_log_file}"
|
exec >>"${tmp_log_file}"
|
||||||
|
|
||||||
# Are we configured? We'll need that later...
|
# Are we configured? We'll need that later...
|
||||||
@ -54,6 +54,13 @@ CT_EndStep
|
|||||||
# Some sanity checks in the environment and needed tools
|
# Some sanity checks in the environment and needed tools
|
||||||
CT_DoLog INFO "Checking environment sanity"
|
CT_DoLog INFO "Checking environment sanity"
|
||||||
|
|
||||||
|
# First of really first of really all, **must not** move lower than here!
|
||||||
|
if [ -n "${CT_RESTART}" -a -z "${CT_DEBUG_CT_SAVE_STEPS}" ]; then
|
||||||
|
CT_DoLog ERROR "You asked to restart a non-restartable build"
|
||||||
|
CT_DoLog ERROR "This happened because you didn't set CT_DEBUG_CT_SAVE_STEPS in the config options"
|
||||||
|
CT_Abort "I will stop here to avoid any carnage"
|
||||||
|
fi
|
||||||
|
|
||||||
# Enable known ordering of files in directory listings:
|
# Enable known ordering of files in directory listings:
|
||||||
CT_Test "Crosstool-NG might not work as expected with LANG=\"${LANG}\"" -n "${LANG}"
|
CT_Test "Crosstool-NG might not work as expected with LANG=\"${LANG}\"" -n "${LANG}"
|
||||||
case "${LC_COLLATE},${LC_ALL}" in
|
case "${LC_COLLATE},${LC_ALL}" in
|
||||||
@ -108,6 +115,11 @@ CT_TARBALLS_DIR="${CT_TOP_DIR}/targets/tarballs"
|
|||||||
CT_SRC_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/src"
|
CT_SRC_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/src"
|
||||||
CT_BUILD_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/build"
|
CT_BUILD_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/build"
|
||||||
CT_DEBUG_INSTALL_DIR="${CT_INSTALL_DIR}/${CT_TARGET}/debug-root"
|
CT_DEBUG_INSTALL_DIR="${CT_INSTALL_DIR}/${CT_TARGET}/debug-root"
|
||||||
|
# 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"
|
||||||
|
CT_STATE_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/state"
|
||||||
|
|
||||||
# Make all path absolute, it so much easier!
|
# Make all path absolute, it so much easier!
|
||||||
CT_LOCAL_TARBALLS_DIR="`CT_MakeAbsolutePath \"${CT_LOCAL_TARBALLS_DIR}\"`"
|
CT_LOCAL_TARBALLS_DIR="`CT_MakeAbsolutePath \"${CT_LOCAL_TARBALLS_DIR}\"`"
|
||||||
@ -140,47 +152,62 @@ CT_TOOLCHAIN_ID="crosstool-${CT_VERSION} build ${CT_STAR_DATE_HUMAN} by ${CT_SYS
|
|||||||
|
|
||||||
CT_DoLog EXTRA "Preparing working directories"
|
CT_DoLog EXTRA "Preparing working directories"
|
||||||
|
|
||||||
# Get rid of pre-existing installed toolchain and previous build directories.
|
# Ah! The build directory shall be eradicated, even if we restart!
|
||||||
# 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}.$$"
|
|
||||||
chmod -R u+w "${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}.$$"
|
|
||||||
chmod -R u+w "${CT_SRC_DIR}.$$"
|
|
||||||
nohup rm -rf "${CT_SRC_DIR}.$$" >/dev/null 2>&1 &
|
|
||||||
fi
|
|
||||||
if [ -d "${CT_BUILD_DIR}" ]; then
|
if [ -d "${CT_BUILD_DIR}" ]; then
|
||||||
mv "${CT_BUILD_DIR}" "${CT_BUILD_DIR}.$$"
|
mv "${CT_BUILD_DIR}" "${CT_BUILD_DIR}.$$"
|
||||||
chmod -R u+w "${CT_BUILD_DIR}.$$"
|
chmod -R u+w "${CT_BUILD_DIR}.$$"
|
||||||
nohup rm -rf "${CT_BUILD_DIR}.$$" >/dev/null 2>&1 &
|
nohup rm -rf "${CT_BUILD_DIR}.$$" >/dev/null 2>&1 &
|
||||||
fi
|
fi
|
||||||
if [ -d "${CT_INSTALL_DIR}" ]; then
|
|
||||||
mv "${CT_INSTALL_DIR}" "${CT_INSTALL_DIR}.$$"
|
# Don't eradicate directories if we need to restart
|
||||||
chmod -R u+w "${CT_INSTALL_DIR}.$$"
|
if [ -z "${CT_RESTART}" ]; then
|
||||||
nohup rm -rf "${CT_INSTALL_DIR}.$$" >/dev/null 2>&1 &
|
# Get rid of pre-existing installed toolchain and previous build directories.
|
||||||
fi
|
# We need to do that _before_ we can safely log, because the log file will
|
||||||
if [ -d "${CT_DEBUG_INSTALL_DIR}" ]; then
|
# most probably be in the toolchain directory.
|
||||||
mv "${CT_DEBUG_INSTALL_DIR}" "${CT_DEBUG_INSTALL_DIR}.$$"
|
if [ "${CT_FORCE_DOWNLOAD}" = "y" -a -d "${CT_TARBALLS_DIR}" ]; then
|
||||||
chmod -R u+w "${CT_DEBUG_INSTALL_DIR}.$$"
|
mv "${CT_TARBALLS_DIR}" "${CT_TARBALLS_DIR}.$$"
|
||||||
nohup rm -rf "${CT_DEBUG_INSTALL_DIR}.$$" >/dev/null 2>&1 &
|
chmod -R u+w "${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}.$$"
|
||||||
|
chmod -R u+w "${CT_SRC_DIR}.$$"
|
||||||
|
nohup rm -rf "${CT_SRC_DIR}.$$" >/dev/null 2>&1 &
|
||||||
|
fi
|
||||||
|
if [ -d "${CT_INSTALL_DIR}" ]; then
|
||||||
|
mv "${CT_INSTALL_DIR}" "${CT_INSTALL_DIR}.$$"
|
||||||
|
chmod -R u+w "${CT_INSTALL_DIR}.$$"
|
||||||
|
nohup rm -rf "${CT_INSTALL_DIR}.$$" >/dev/null 2>&1 &
|
||||||
|
fi
|
||||||
|
if [ -d "${CT_DEBUG_INSTALL_DIR}" ]; then
|
||||||
|
mv "${CT_DEBUG_INSTALL_DIR}" "${CT_DEBUG_INSTALL_DIR}.$$"
|
||||||
|
chmod -R u+w "${CT_DEBUG_INSTALL_DIR}.$$"
|
||||||
|
nohup rm -rf "${CT_DEBUG_INSTALL_DIR}.$$" >/dev/null 2>&1 &
|
||||||
|
fi
|
||||||
|
# In case we start anew, get rid of the previously saved state directory
|
||||||
|
if [ -d "${CT_STATE_DIR}" ]; then
|
||||||
|
mv "${CT_STATE_DIR}" "${CT_STATE_DIR}.$$"
|
||||||
|
chmod -R u+w "${CT_STATE_DIR}.$$"
|
||||||
|
nohup rm -rf "${CT_STATE_DIR}.$$" >/dev/null 2>&1 &
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Note: we'll always install the core compiler in its own directory, so as to
|
# Create the directories we'll use, even if restarting: it does no harm to
|
||||||
# not mix the two builds: core and final. Anyway, its generic, wether we use
|
# create already existent directories, and CT_BUILD_DIR needs to be created
|
||||||
# a different compiler as core, or not.
|
# anyway
|
||||||
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_TARBALLS_DIR}"
|
||||||
mkdir -p "${CT_SRC_DIR}"
|
mkdir -p "${CT_SRC_DIR}"
|
||||||
mkdir -p "${CT_BUILD_DIR}"
|
mkdir -p "${CT_BUILD_DIR}"
|
||||||
mkdir -p "${CT_INSTALL_DIR}"
|
mkdir -p "${CT_INSTALL_DIR}"
|
||||||
|
mkdir -p "${CT_PREFIX_DIR}"
|
||||||
mkdir -p "${CT_DEBUG_INSTALL_DIR}"
|
mkdir -p "${CT_DEBUG_INSTALL_DIR}"
|
||||||
mkdir -p "${CT_CC_CORE_PREFIX_DIR}"
|
mkdir -p "${CT_CC_CORE_PREFIX_DIR}"
|
||||||
|
mkdir -p "${CT_STATE_DIR}"
|
||||||
|
|
||||||
|
# Kludge: CT_INSTALL_DIR and CT_PREFIX_DIR might have grown read-only if
|
||||||
|
# the previous build was successfull. To ba able to move the logfile there,
|
||||||
|
# switch them back to read/write
|
||||||
|
chmod -R u+w "${CT_INSTALL_DIR}" "${CT_PREFIX_DIR}"
|
||||||
|
|
||||||
# Redirect log to the actual log file now we can
|
# Redirect log to the actual log file now we can
|
||||||
# It's quite understandable that the log file will be installed in the install
|
# It's quite understandable that the log file will be installed in the install
|
||||||
@ -191,126 +218,133 @@ case "${CT_LOG_TO_FILE},${CT_LOG_FILE}" in
|
|||||||
,*) rm -f "${tmp_log_file}"
|
,*) rm -f "${tmp_log_file}"
|
||||||
;;
|
;;
|
||||||
y,/*) mkdir -p "`dirname \"${CT_LOG_FILE}\"`"
|
y,/*) mkdir -p "`dirname \"${CT_LOG_FILE}\"`"
|
||||||
mv "${tmp_log_file}" "${CT_LOG_FILE}"
|
cat "${tmp_log_file}" >>"${CT_LOG_FILE}"
|
||||||
|
rm -f "${tmp_log_file}"
|
||||||
exec >>"${CT_LOG_FILE}"
|
exec >>"${CT_LOG_FILE}"
|
||||||
;;
|
;;
|
||||||
y,*) mkdir -p "`pwd`/`dirname \"${CT_LOG_FILE}\"`"
|
y,*) mkdir -p "`pwd`/`dirname \"${CT_LOG_FILE}\"`"
|
||||||
mv "${tmp_log_file}" "`pwd`/${CT_LOG_FILE}"
|
cat "${tmp_log_file}" >>"`pwd`/${CT_LOG_FILE}"
|
||||||
|
rm -f "${tmp_log_file}"
|
||||||
exec >>"${CT_LOG_FILE}"
|
exec >>"${CT_LOG_FILE}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Determine build system if not set by the user
|
# Setting up the rest of the environment only is not restarting
|
||||||
CT_Test "You did not specify the build system. That's OK, I can guess..." -z "${CT_BUILD}"
|
if [ -z "${CT_RESTART}" ]; then
|
||||||
CT_BUILD="`${CT_TOP_DIR}/tools/config.sub \"${CT_BUILD:-\`${CT_TOP_DIR}/tools/config.guess\`}\"`"
|
# 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\`}\"`"
|
||||||
|
|
||||||
# Arrange paths depending on wether we use sys-root or not.
|
# Arrange paths depending on wether we use sys-root or not.
|
||||||
if [ "${CT_USE_SYSROOT}" = "y" ]; then
|
if [ "${CT_USE_SYSROOT}" = "y" ]; then
|
||||||
CT_SYSROOT_DIR="${CT_PREFIX_DIR}/${CT_TARGET}/sys-root"
|
CT_SYSROOT_DIR="${CT_PREFIX_DIR}/${CT_TARGET}/sys-root"
|
||||||
CT_HEADERS_DIR="${CT_SYSROOT_DIR}/usr/include"
|
CT_HEADERS_DIR="${CT_SYSROOT_DIR}/usr/include"
|
||||||
BINUTILS_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
|
BINUTILS_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
|
||||||
CC_CORE_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
|
CC_CORE_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
|
||||||
CC_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
|
CC_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
|
||||||
LIBC_SYSROOT_ARG=""
|
LIBC_SYSROOT_ARG=""
|
||||||
# glibc's prefix must be exactly /usr, else --with-sysroot'd gcc will get
|
# glibc's prefix must be exactly /usr, else --with-sysroot'd gcc will get
|
||||||
# confused when $sysroot/usr/include is not present.
|
# confused when $sysroot/usr/include is not present.
|
||||||
# Note: --prefix=/usr is magic!
|
# Note: --prefix=/usr is magic!
|
||||||
# See http://www.gnu.org/software/libc/FAQ.html#s-2.2
|
# See http://www.gnu.org/software/libc/FAQ.html#s-2.2
|
||||||
else
|
else
|
||||||
# plain old way. All libraries in prefix/target/lib
|
# plain old way. All libraries in prefix/target/lib
|
||||||
CT_SYSROOT_DIR="${CT_PREFIX_DIR}/${CT_TARGET}"
|
CT_SYSROOT_DIR="${CT_PREFIX_DIR}/${CT_TARGET}"
|
||||||
CT_HEADERS_DIR="${CT_SYSROOT_DIR}/include"
|
CT_HEADERS_DIR="${CT_SYSROOT_DIR}/include"
|
||||||
# hack! Always use --with-sysroot for binutils.
|
# hack! Always use --with-sysroot for binutils.
|
||||||
# binutils 2.14 and later obey it, older binutils ignore it.
|
# binutils 2.14 and later obey it, older binutils ignore it.
|
||||||
# Lets you build a working 32->64 bit cross gcc
|
# Lets you build a working 32->64 bit cross gcc
|
||||||
BINUTILS_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
|
BINUTILS_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
|
||||||
# Use --with-headers, else final gcc will define disable_glibc while
|
# Use --with-headers, else final gcc will define disable_glibc while
|
||||||
# building libgcc, and you'll have no profiling
|
# building libgcc, and you'll have no profiling
|
||||||
CC_CORE_SYSROOT_ARG="--without-headers"
|
CC_CORE_SYSROOT_ARG="--without-headers"
|
||||||
CC_SYSROOT_ARG="--with-headers=${CT_HEADERS_DIR}"
|
CC_SYSROOT_ARG="--with-headers=${CT_HEADERS_DIR}"
|
||||||
LIBC_SYSROOT_ARG="prefix="
|
LIBC_SYSROOT_ARG="prefix="
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prepare the 'lib' directories in sysroot, else the ../lib64 hack used by
|
# Prepare the 'lib' directories in sysroot, else the ../lib64 hack used by
|
||||||
# 32 -> 64 bit crosscompilers won't work, and build of final gcc will fail with
|
# 32 -> 64 bit crosscompilers won't work, and build of final gcc will fail with
|
||||||
# "ld: cannot open crti.o: No such file or directory"
|
# "ld: cannot open crti.o: No such file or directory"
|
||||||
mkdir -p "${CT_SYSROOT_DIR}/lib"
|
mkdir -p "${CT_SYSROOT_DIR}/lib"
|
||||||
mkdir -p "${CT_SYSROOT_DIR}/usr/lib"
|
mkdir -p "${CT_SYSROOT_DIR}/usr/lib"
|
||||||
|
|
||||||
# Canadian-cross are really picky on the way they are built. Tweak the values.
|
# Canadian-cross are really picky on the way they are built. Tweak the values.
|
||||||
if [ "${CT_CANADIAN}" = "y" ]; then
|
if [ "${CT_CANADIAN}" = "y" ]; then
|
||||||
# Arrange so that gcc never, ever think that build system == host system
|
# Arrange so that gcc never, ever think that build system == host system
|
||||||
CT_CANADIAN_OPT="--build=`echo \"${CT_BUILD}\" |sed -r -e 's/-/-build_/'`"
|
CT_CANADIAN_OPT="--build=`echo \"${CT_BUILD}\" |sed -r -e 's/-/-build_/'`"
|
||||||
# We shall have a compiler for this target!
|
# We shall have a compiler for this target!
|
||||||
# Do test here...
|
# Do test here...
|
||||||
else
|
else
|
||||||
CT_HOST="${CT_BUILD}"
|
CT_HOST="${CT_BUILD}"
|
||||||
CT_CANADIAN_OPT=
|
CT_CANADIAN_OPT=
|
||||||
# Add the target toolchain in the path so that we can build the C library
|
# Add the target toolchain in the path so that we can build the C library
|
||||||
export PATH="${CT_PREFIX_DIR}/bin:${CT_CC_CORE_PREFIX_DIR}/bin:${PATH}"
|
export PATH="${CT_PREFIX_DIR}/bin:${CT_CC_CORE_PREFIX_DIR}/bin:${PATH}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Modify GCC_HOST to never be equal to $BUILD or $TARGET
|
# Modify GCC_HOST to never be equal to $BUILD or $TARGET
|
||||||
# This strange operation causes gcc to always generate a cross-compiler
|
# This strange operation causes gcc to always generate a cross-compiler
|
||||||
# even if the build machine is the same kind as the host.
|
# 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
|
# 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
|
# host compiler by appending -gcc to our whacky $GCC_HOST
|
||||||
# Kludge: it is reported that the above causes canadian crosses with cygwin
|
# 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
|
# 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
|
# 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
|
# cause some configure script somewhere to decide that since build==host, they
|
||||||
# could run host binaries.
|
# could run host binaries.
|
||||||
# (Copied almost as-is from original crosstool):
|
# (Copied almost as-is from original crosstool):
|
||||||
case "${CT_KERNEL},${CT_CANADIAN}" in
|
case "${CT_KERNEL},${CT_CANADIAN}" in
|
||||||
cygwin,y) ;;
|
cygwin,y) ;;
|
||||||
*) CT_HOST="`echo \"${CT_HOST}\" |sed -r -e 's/-/-host_/;'`";;
|
*) CT_HOST="`echo \"${CT_HOST}\" |sed -r -e 's/-/-host_/;'`";;
|
||||||
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:
|
|
||||||
CT_DoLog EXTRA "Making build system tools available"
|
|
||||||
mkdir -p "${CT_PREFIX_DIR}/bin"
|
|
||||||
for tool in ar gcc; do
|
|
||||||
ln -s "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_BUILD}-${tool}"
|
|
||||||
case "${CT_TOOLCHAIN_TYPE}" in
|
|
||||||
cross|native) ln -s "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_HOST}-${tool}";;
|
|
||||||
esac
|
esac
|
||||||
done
|
|
||||||
|
|
||||||
# Ha. cygwin host have an .exe suffix (extension) for executables.
|
# Ah! Recent versions of binutils need some of the build and/or host system
|
||||||
[ "${CT_KERNEL}" = "cygwin" ] && EXEEXT=".exe" || EXEEXT=""
|
# (read CT_BUILD and CT_HOST) tools to be accessible (ar is but an example).
|
||||||
|
# Do that:
|
||||||
|
CT_DoLog EXTRA "Making build system tools available"
|
||||||
|
mkdir -p "${CT_PREFIX_DIR}/bin"
|
||||||
|
for tool in ar as dlltool gcc g++ gnatbind gnatmake ld nm ranlib strip windres objcopy objdump; do
|
||||||
|
if [ -n "`which ${tool}`" ]; then
|
||||||
|
ln -s "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_BUILD}-${tool}"
|
||||||
|
case "${CT_TOOLCHAIN_TYPE}" in
|
||||||
|
cross|native) ln -s "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_HOST}-${tool}";;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# Transform the ARCH into a kernel-understandable ARCH
|
# Ha. cygwin host have an .exe suffix (extension) for executables.
|
||||||
case "${CT_ARCH}" in
|
[ "${CT_KERNEL}" = "cygwin" ] && EXEEXT=".exe" || EXEEXT=""
|
||||||
x86) CT_KERNEL_ARCH=i386;;
|
|
||||||
ppc) CT_KERNEL_ARCH=powerpc;;
|
|
||||||
*) CT_KERNEL_ARCH="${CT_ARCH}";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Build up the TARGET_CFLAGS from user-provided options
|
# Transform the ARCH into a kernel-understandable ARCH
|
||||||
# Override with user-specified CFLAGS
|
case "${CT_ARCH}" in
|
||||||
[ -n "${CT_ARCH_CPU}" ] && CT_TARGET_CFLAGS="-mcpu=${CT_ARCH_CPU} ${CT_TARGET_CFLAGS}"
|
x86) CT_KERNEL_ARCH=i386;;
|
||||||
[ -n "${CT_ARCH_TUNE}" ] && CT_TARGET_CFLAGS="-mtune=${CT_ARCH_TUNE} ${CT_TARGET_CFLAGS}"
|
ppc) CT_KERNEL_ARCH=powerpc;;
|
||||||
[ -n "${CT_ARCH_ARCH}" ] && CT_TARGET_CFLAGS="-march=${CT_ARCH_ARCH} ${CT_TARGET_CFLAGS}"
|
*) CT_KERNEL_ARCH="${CT_ARCH}";;
|
||||||
[ -n "${CT_ARCH_FPU}" ] && CT_TARGET_CFLAGS="-mfpu=${CT_ARCH_FPU} ${CT_TARGET_CFLAGS}"
|
esac
|
||||||
|
|
||||||
# Help gcc
|
# Build up the TARGET_CFLAGS from user-provided options
|
||||||
CT_CFLAGS_FOR_HOST=
|
# Override with user-specified CFLAGS
|
||||||
[ "${CT_USE_PIPES}" = "y" ] && CT_CFLAGS_FOR_HOST="${CT_CFLAGS_FOR_HOST} -pipe"
|
[ -n "${CT_ARCH_CPU}" ] && CT_TARGET_CFLAGS="-mcpu=${CT_ARCH_CPU} ${CT_TARGET_CFLAGS}"
|
||||||
|
[ -n "${CT_ARCH_TUNE}" ] && CT_TARGET_CFLAGS="-mtune=${CT_ARCH_TUNE} ${CT_TARGET_CFLAGS}"
|
||||||
|
[ -n "${CT_ARCH_ARCH}" ] && CT_TARGET_CFLAGS="-march=${CT_ARCH_ARCH} ${CT_TARGET_CFLAGS}"
|
||||||
|
[ -n "${CT_ARCH_FPU}" ] && CT_TARGET_CFLAGS="-mfpu=${CT_ARCH_FPU} ${CT_TARGET_CFLAGS}"
|
||||||
|
|
||||||
# And help make go faster
|
# Help gcc
|
||||||
PARALLELMFLAGS=
|
CT_CFLAGS_FOR_HOST=
|
||||||
[ ${CT_PARALLEL_JOBS} -ne 0 ] && PARALLELMFLAGS="${PARALLELMFLAGS} -j${CT_PARALLEL_JOBS}"
|
[ "${CT_USE_PIPES}" = "y" ] && CT_CFLAGS_FOR_HOST="${CT_CFLAGS_FOR_HOST} -pipe"
|
||||||
[ ${CT_LOAD} -ne 0 ] && PARALLELMFLAGS="${PARALLELMFLAGS} -l${CT_LOAD}"
|
|
||||||
|
|
||||||
CT_DoStep EXTRA "Dumping internal crosstool-NG configuration"
|
# And help make go faster
|
||||||
CT_DoLog EXTRA "Building a toolchain for:"
|
PARALLELMFLAGS=
|
||||||
CT_DoLog EXTRA " build = ${CT_BUILD}"
|
[ ${CT_PARALLEL_JOBS} -ne 0 ] && PARALLELMFLAGS="${PARALLELMFLAGS} -j${CT_PARALLEL_JOBS}"
|
||||||
CT_DoLog EXTRA " host = ${CT_HOST}"
|
[ ${CT_LOAD} -ne 0 ] && PARALLELMFLAGS="${PARALLELMFLAGS} -l${CT_LOAD}"
|
||||||
CT_DoLog EXTRA " target = ${CT_TARGET}"
|
|
||||||
set |egrep '^CT_.+=' |sort |CT_DoLog DEBUG
|
CT_DoStep EXTRA "Dumping internal crosstool-NG configuration"
|
||||||
CT_EndStep
|
CT_DoLog EXTRA "Building a toolchain for:"
|
||||||
|
CT_DoLog EXTRA " build = ${CT_BUILD}"
|
||||||
|
CT_DoLog EXTRA " host = ${CT_HOST}"
|
||||||
|
CT_DoLog EXTRA " target = ${CT_TARGET}"
|
||||||
|
set |egrep '^CT_.+=' |sort |CT_DoLog DEBUG
|
||||||
|
CT_EndStep
|
||||||
|
fi
|
||||||
|
|
||||||
# Include sub-scripts instead of calling them: that way, we do not have to
|
# 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.
|
# export any variable, nor re-parse the configuration and functions files.
|
||||||
@ -322,64 +356,84 @@ CT_EndStep
|
|||||||
. "${CT_TOP_DIR}/scripts/build/cc_${CT_CC}.sh"
|
. "${CT_TOP_DIR}/scripts/build/cc_${CT_CC}.sh"
|
||||||
. "${CT_TOP_DIR}/scripts/build/debug.sh"
|
. "${CT_TOP_DIR}/scripts/build/debug.sh"
|
||||||
|
|
||||||
# Now for the job by itself. Go have a coffee!
|
if [ -z "${CT_RESTART}" ]; then
|
||||||
CT_DoStep INFO "Retrieving needed toolchain components' tarballs"
|
CT_DoStep INFO "Retrieving needed toolchain components' tarballs"
|
||||||
do_kernel_get
|
do_kernel_get
|
||||||
do_binutils_get
|
do_binutils_get
|
||||||
do_cc_core_get
|
do_cc_core_get
|
||||||
do_libfloat_get
|
do_libfloat_get
|
||||||
do_libc_get
|
do_libc_get
|
||||||
do_cc_get
|
do_cc_get
|
||||||
do_debug_get
|
do_debug_get
|
||||||
CT_EndStep
|
|
||||||
|
|
||||||
if [ "${CT_ONLY_DOWNLOAD}" != "y" ]; then
|
|
||||||
if [ "${CT_FORCE_EXTRACT}" = "y" ]; then
|
|
||||||
mv "${CT_SRC_DIR}" "${CT_SRC_DIR}.$$"
|
|
||||||
nohup rm -rf "${CT_SRC_DIR}.$$" >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
CT_DoStep INFO "Extracting and patching toolchain components"
|
|
||||||
do_kernel_extract
|
|
||||||
do_binutils_extract
|
|
||||||
do_cc_core_extract
|
|
||||||
do_libfloat_extract
|
|
||||||
do_libc_extract
|
|
||||||
do_cc_extract
|
|
||||||
do_debug_extract
|
|
||||||
CT_EndStep
|
CT_EndStep
|
||||||
|
|
||||||
if [ "${CT_ONLY_EXTRACT}" != "y" ]; then
|
if [ "${CT_ONLY_DOWNLOAD}" != "y" ]; then
|
||||||
do_libc_check_config
|
if [ "${CT_FORCE_EXTRACT}" = "y" ]; then
|
||||||
do_kernel_check_config
|
mv "${CT_SRC_DIR}" "${CT_SRC_DIR}.$$"
|
||||||
do_kernel_headers
|
nohup rm -rf "${CT_SRC_DIR}.$$" >/dev/null 2>&1
|
||||||
do_binutils
|
|
||||||
do_libc_headers
|
|
||||||
do_cc_core
|
|
||||||
do_libfloat
|
|
||||||
do_libc
|
|
||||||
do_cc
|
|
||||||
do_libc_finish
|
|
||||||
do_debug
|
|
||||||
|
|
||||||
# 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
|
fi
|
||||||
|
CT_DoStep INFO "Extracting and patching toolchain components"
|
||||||
|
do_kernel_extract
|
||||||
|
do_binutils_extract
|
||||||
|
do_cc_core_extract
|
||||||
|
do_libfloat_extract
|
||||||
|
do_libc_extract
|
||||||
|
do_cc_extract
|
||||||
|
do_debug_extract
|
||||||
|
CT_EndStep
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Remove the generated documentation files
|
# Now for the job by itself. Go have a coffee!
|
||||||
if [ "${CT_REMOVE_DOCS}" = "y" ]; then
|
if [ "${CT_ONLY_DOWNLOAD}" != "y" -a "${CT_ONLY_EXTRACT}" != "y" ]; then
|
||||||
CT_DoLog INFO "Removing installed documentation"
|
# Because of CT_RESTART, this becomes quite complex
|
||||||
rm -rf "${CT_PREFIX_DIR}/"{,usr/}{man,info}
|
[ -n "${CT_RESTART}" ] && do_it=0 || do_it=1
|
||||||
rm -rf "${CT_SYSROOT_DIR}/"{,usr/}{man,info}
|
for step in libc_check_config \
|
||||||
rm -rf "${CT_DEBUG_INSTALL_DIR}/"{,usr/}{man,info}
|
kernel_check_config \
|
||||||
|
kernel_headers \
|
||||||
|
binutils \
|
||||||
|
libc_headers \
|
||||||
|
cc_core \
|
||||||
|
libfloat \
|
||||||
|
libc \
|
||||||
|
cc \
|
||||||
|
libc_finish \
|
||||||
|
debug \
|
||||||
|
; do
|
||||||
|
if [ ${do_it} -eq 0 ]; then
|
||||||
|
if [ "${CT_RESTART}" = "${step}" ]; then
|
||||||
|
CT_DoLoadState "${step}"
|
||||||
|
do_it=1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
CT_DoSaveState ${step}
|
||||||
fi
|
fi
|
||||||
|
if [ ${do_it} -eq 1 ]; then
|
||||||
|
do_${step}
|
||||||
|
if [ "${CTDEBUG_CT_PAUSE_STEPS}" = "y" ]; then
|
||||||
|
CT_DoPause "Step \"${step}\" finished"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# 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}/"{,usr/}{man,info}
|
||||||
|
rm -rf "${CT_SYSROOT_DIR}/"{,usr/}{man,info}
|
||||||
|
rm -rf "${CT_DEBUG_INSTALL_DIR}/"{,usr/}{man,info}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ CT_GetFile() {
|
|||||||
if [ -r "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" -a \
|
if [ -r "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" -a \
|
||||||
"${CT_FORCE_DOWNLOAD}" != "y" ]; then
|
"${CT_FORCE_DOWNLOAD}" != "y" ]; then
|
||||||
CT_DoLog EXTRA "Copying \"${file}\" from local copy"
|
CT_DoLog EXTRA "Copying \"${file}\" from local copy"
|
||||||
cp -v "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" |CT_DoLog DEBUG
|
cp -v "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" |CT_DoLog ALL
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -460,3 +460,112 @@ CT_DoBuildTargetTriplet() {
|
|||||||
esac
|
esac
|
||||||
CT_TARGET="`${CT_TOP_DIR}/tools/config.sub ${CT_TARGET}`"
|
CT_TARGET="`${CT_TOP_DIR}/tools/config.sub ${CT_TARGET}`"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# This function does pause the build until the user strikes "Return"
|
||||||
|
# Usage: CT_DoPause [optional_message]
|
||||||
|
CT_DoPause() {
|
||||||
|
local foo
|
||||||
|
local message="${1:-Pausing for your pleasure}"
|
||||||
|
CT_DoLog INFO "${message}"
|
||||||
|
read -p "Press \"Enter\" to continue, or Ctrl-C to stop..." foo >&6
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function saves the state of the toolchain to be able to restart
|
||||||
|
# at any one point
|
||||||
|
# Usage: CT_DoSaveState <next_step_name>
|
||||||
|
CT_DoSaveState() {
|
||||||
|
[ "${CT_DEBUG_CT_SAVE_STEPS}" = "y" ] || return 0
|
||||||
|
local state_name="$1"
|
||||||
|
local state_dir="${CT_STATE_DIR}/${state_name}"
|
||||||
|
|
||||||
|
CT_DoLog DEBUG "Saving state to restart at step \"${state_name}\"..."
|
||||||
|
rm -rf "${state_dir}"
|
||||||
|
mkdir -p "${state_dir}"
|
||||||
|
|
||||||
|
case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
|
||||||
|
y) tar_opt=czf; tar_ext=".tar.gz";;
|
||||||
|
*) tar_opt=cf; tar_ext=".tar";;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CT_DoLog DEBUG " Saving environment and aliases"
|
||||||
|
# We must omit shell functions
|
||||||
|
# 'isgrep' is here because I don't seem to
|
||||||
|
# be able to remove the functions names.
|
||||||
|
set |awk '
|
||||||
|
BEGIN { _p = 1; }
|
||||||
|
$0~/^[^ ] ()/ { _p = 0; }
|
||||||
|
_p == 1
|
||||||
|
$0 == "}" { _p = 1; }
|
||||||
|
' |egrep -v '^[^ ]+ \(\)' >"${state_dir}/env.sh"
|
||||||
|
|
||||||
|
CT_DoLog DEBUG " Saving CT_CC_CORE_PREFIX_DIR=\"${CT_CC_CORE_PREFIX_DIR}\""
|
||||||
|
CT_Pushd "${CT_CC_CORE_PREFIX_DIR}"
|
||||||
|
tar ${tar_opt} "${state_dir}/cc_core_prefix_dir${tar_ext}" .
|
||||||
|
CT_Popd
|
||||||
|
|
||||||
|
CT_DoLog DEBUG " Saving CT_PREFIX_DIR=\"${CT_PREFIX_DIR}\""
|
||||||
|
CT_Pushd "${CT_PREFIX_DIR}"
|
||||||
|
tar ${tar_opt} "${state_dir}/prefix_dir${tar_ext}" .
|
||||||
|
CT_Popd
|
||||||
|
|
||||||
|
if [ "${CT_LOG_TO_FILE}" = "y" ]; then
|
||||||
|
CT_DoLog DEBUG " Saving log file"
|
||||||
|
exec >/dev/null
|
||||||
|
case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
|
||||||
|
y) gzip -3 -c "${CT_LOG_FILE}" >"${state_dir}/log.gz";;
|
||||||
|
*) cat "${CT_LOG_FILE}" >"${state_dir}/log";;
|
||||||
|
esac
|
||||||
|
exec >>"${CT_LOG_FILE}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# This functions restores a previously saved state
|
||||||
|
# Usage: CT_DoLoadState <state_name>
|
||||||
|
CT_DoLoadState(){
|
||||||
|
local state_name="$1"
|
||||||
|
local state_dir="${CT_STATE_DIR}/${state_name}"
|
||||||
|
|
||||||
|
# We need to do something special with the log file!
|
||||||
|
if [ "${CT_LOG_TO_FILE}" = "y" ]; then
|
||||||
|
exec >"${state_dir}/tail.log"
|
||||||
|
fi
|
||||||
|
CT_DoLog DEBUG "Restoring state at step \"${state_name}\"..."
|
||||||
|
|
||||||
|
case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
|
||||||
|
y) tar_opt=xzf; tar_ext=".tar.gz";;
|
||||||
|
*) tar_opt=cf; tar_ext=".tar";;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CT_DoLog DEBUG " Removing previous build directories"
|
||||||
|
chmod -R u+rwX "${CT_PREFIX_DIR}" "${CT_CC_CORE_PREFIX_DIR}"
|
||||||
|
rm -rf "${CT_PREFIX_DIR}" "${CT_CC_CORE_PREFIX_DIR}"
|
||||||
|
mkdir -p "${CT_PREFIX_DIR}" "${CT_CC_CORE_PREFIX_DIR}"
|
||||||
|
|
||||||
|
CT_DoLog DEBUG " Restoring CT_PREFIX_DIR=\"${CT_PREFIX_DIR}\""
|
||||||
|
CT_Pushd "${CT_PREFIX_DIR}"
|
||||||
|
tar ${tar_opt} "${state_dir}/prefix_dir${tar_ext}"
|
||||||
|
CT_Popd
|
||||||
|
|
||||||
|
CT_DoLog DEBUG " Restoring CT_CC_CORE_PREFIX_DIR=\"${CT_CC_CORE_PREFIX_DIR}\""
|
||||||
|
CT_Pushd "${CT_CC_CORE_PREFIX_DIR}"
|
||||||
|
tar ${tar_opt} "${state_dir}/cc_core_prefix_dir${tar_ext}"
|
||||||
|
CT_Popd
|
||||||
|
|
||||||
|
# Restore the environment, discarding any error message
|
||||||
|
# (for example, read-only bash internals)
|
||||||
|
CT_DoLog DEBUG " Restoring environment"
|
||||||
|
. "${state_dir}/env.sh" >/dev/null 2>&1 || true
|
||||||
|
|
||||||
|
if [ "${CT_LOG_TO_FILE}" = "y" ]; then
|
||||||
|
CT_DoLog DEBUG " Restoring log file"
|
||||||
|
exec >/dev/null
|
||||||
|
case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
|
||||||
|
y) zcat "${state_dir}/log.gz" >"${CT_LOG_FILE}";;
|
||||||
|
*) cat "${state_dir}/log" >"${CT_LOG_FILE}";;
|
||||||
|
esac
|
||||||
|
cat "${state_dir}/tail.log" >>"${CT_LOG_FILE}"
|
||||||
|
exec >>"${CT_LOG_FILE}"
|
||||||
|
rm -f "${state_dir}/tail.log"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user