The log file is no longer configurable: it is always "${CT_PREFIX_DIR}/build.log".

Add an option to compress the log file upon successfull build.
Make rendering the toolchain read-only optional.
A few eye-candy fixes.
This commit is contained in:
Yann E. MORIN" 2007-06-17 14:51:37 +00:00
parent e1e7d871b2
commit 7746415b7d
5 changed files with 48 additions and 41 deletions

View File

@ -9,7 +9,7 @@ config FOOBAR
menu "Paths and misc options"
comment "Crosstool behavior"
comment "Crosstool-ng behavior"
config EXPERIMENTAL
bool
@ -194,6 +194,16 @@ config REMOVE_DOCS
Remove the installed documentation (man and info pages).
Gains around 8MiB for a uClibc-based, C and C++ compiler.
config INSTALL_DIR_RO
bool
prompt "Render the toolchain read-only"
default n
help
Render the directory of the toolchain (and its sub-directories)
read-only.
Usefull for toolchains destined for production.
comment "Downloading"
config FORCE_DOWNLOAD
@ -252,7 +262,7 @@ config LOG_ERROR
prompt "ERROR"
help
The build will be silent.
Only if there is an error will you see a mesage.
Only if there is an error will you see a message.
config LOG_WARN
bool
@ -297,17 +307,19 @@ config LOG_LEVEL_MAX
config LOG_SEE_TOOLS_WARN
bool
prompt "Warnings from the tool builds as CT warnings"
prompt "Warnings from the tools' builds"
default n
depends on ! LOG_ERROR
help
Treat warnings fron the different tools as crosstool warnings.
Treat warnings from the different tools as crosstool-ng warnings.
If you say 'y' here, then those warnings will be prefixed with
'[WARN ]' instead of the default '[ALL ]'.
You can safely say 'n' here. Those warnings will anyway be
recorded in the log file (provided you configured one).
Tools error will always be logged as crosstool-ng errors.
config LOG_PROGRESS_BAR
bool
prompt "Progress bar"
@ -330,19 +342,20 @@ config LOG_TO_FILE
default y
help
Save *full* logs to a file. Even log levels you didn't specify above
will be available in this file.
will be available in this file. The log file will be named build.log
and stored in the toolchain prefix dir (set above).
As a bonus, there is a script in tools/extractConfig.sh that is able
to extract the configuration of crosstool-NG from the log file.
Definitely, say Y.
config LOG_FILE
string
prompt "Log file"
default "${CT_PREFIX_DIR}/${CT_TARGET}.log"
config LOG_FILE_COMPRESS
bool
prompt "Compress the log file"
default n
depends on LOG_TO_FILE
help
File name into which to put logs.
Compress the log file once the toolchain is successfully built.
endmenu

View File

@ -133,10 +133,6 @@ CT_PREFIX_DIR:
This is where the toolchain will be installed in (and for now, where it
will run from).
CT_LOG_FILE:
The file where *all* log messages will go. Keep the default, in goes in
${CT_PREFIX_DIR}/${CT_TARGET}.log
CT_TARGET_VENDOR:
An identifier for your toolchain, will take place in the vendor part of the
target triplet. It shall *not* contain spaces or dashes. Usually, keep it

View File

@ -34,7 +34,6 @@ regtest:
sed -i -r -e 's:^.*(CT_LOG_ERROR).*$$:\1=y:;' .config && \
sed -i -r -e 's:^(CT_LOG_LEVEL_MAX)=.*$$:\1="ERROR":;' .config && \
sed -i -r -e 's:^.*(CT_LOG_TO_FILE).*$$:\1=y:;' .config && \
sed -i -r -e 's:^.*(CT_LOG_FILE).*$$:\1="$${CT_PREFIX_DIR}/build.log":;' .config && \
sed -i -r -e 's:^.*(CT_LOG_PROGRESS_BAR).*$$:\1=y:;' .config && \
yes "" |make -C $(CT_TOP_DIR) defoldconfig >/dev/null 2>&1 && \
make -C $(CT_TOP_DIR) && \

View File

@ -211,19 +211,14 @@ chmod -R u+w "${CT_INSTALL_DIR}" "${CT_PREFIX_DIR}"
# directory, so we must first ensure it exists and is writeable (above) before
# we can log there
exec >/dev/null
case "${CT_LOG_TO_FILE},${CT_LOG_FILE}" in
,*) rm -f "${tmp_log_file}"
;;
y,/*) mkdir -p "`dirname \"${CT_LOG_FILE}\"`"
cat "${tmp_log_file}" >>"${CT_LOG_FILE}"
rm -f "${tmp_log_file}"
exec >>"${CT_LOG_FILE}"
;;
y,*) mkdir -p "`pwd`/`dirname \"${CT_LOG_FILE}\"`"
cat "${tmp_log_file}" >>"`pwd`/${CT_LOG_FILE}"
rm -f "${tmp_log_file}"
exec >>"${CT_LOG_FILE}"
;;
case "${CT_LOG_TO_FILE}" in
y) CT_LOG_FILE="${CT_PREFIX_DIR}/build.log"
cat "${tmp_log_file}" >>"${CT_LOG_FILE}"
rm -f "${tmp_log_file}"
exec >>"${CT_LOG_FILE}"
;;
*) rm -f "${tmp_log_file}"
;;
esac
# Setting up the rest of the environment only is not restarting
@ -303,7 +298,7 @@ if [ -z "${CT_RESTART}" ]; then
# 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"
CT_DoLog DEBUG "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
@ -455,22 +450,24 @@ if [ "${CT_ONLY_DOWNLOAD}" != "y" -a "${CT_ONLY_EXTRACT}" != "y" ]; then
rm -rf "${CT_DEBUG_INSTALL_DIR}/"{,usr/}{man,info}
fi
CT_DoLog EXTRA "Removing access to the build system tools"
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
fi
# OK, now we're done, set the toolchain read-only
# Don't log, the log file may become read-only any moment...
chmod -R a-w "${CT_INSTALL_DIR}"
# We still have some small bits to log
chmod u+w "${CT_LOG_FILE}"
CT_DoEnd INFO
# All files should now be read-only, log file included
chmod a-w "${CT_LOG_FILE}"
if [ "${CT_LOG_FILE_COMPRESS}" = y ]; then
CT_DoLog EXTRA "Compressing log file"
exec >/dev/null
bzip2 -9 "${CT_LOG_FILE}"
fi
if [ "${CT_INSTALL_DIR_RO}" = "y" ]; then
# OK, now we're done, set the toolchain read-only
# Don't log, the log file may become read-only any moment...
chmod -R a-w "${CT_INSTALL_DIR}" >/dev/null 2>&1
fi
trap - EXIT

View File

@ -92,5 +92,7 @@ CT_DoLog DEBUG "Getting rid of working directories"
rm -f "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2"
rm -rf "${tempdir}"
# Render the install directory non-writable
chmod u-w "${CT_PREFIX_DIR}"
if [ "${CT_INSTALL_DIR_RO}" = "y" ]; then
# Render the install directory non-writable
chmod u-w "${CT_PREFIX_DIR}"
fi