2006-08-29 20:16:27 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# $Id$
|
|
|
|
set -e
|
2013-10-30 16:44:46 +01:00
|
|
|
# Pass trap handlers to functions
|
|
|
|
set -E
|
2006-08-29 20:16:27 +02:00
|
|
|
|
|
|
|
# VT100 colors
|
|
|
|
declare -r BLACK=$'\e[1;30m'
|
|
|
|
declare -r DK_GRAY=$'\e[0;30m'
|
|
|
|
|
|
|
|
declare -r RED=$'\e[31m'
|
|
|
|
declare -r GREEN=$'\e[32m'
|
|
|
|
declare -r YELLOW=$'\e[33m'
|
|
|
|
declare -r BLUE=$'\e[34m'
|
|
|
|
declare -r MAGENTA=$'\e[35m'
|
|
|
|
declare -r CYAN=$'\e[36m'
|
|
|
|
declare -r WHITE=$'\e[37m'
|
|
|
|
|
|
|
|
declare -r OFF=$'\e[0m'
|
|
|
|
declare -r BOLD=$'\e[1m'
|
|
|
|
declare -r REVERSE=$'\e[7m'
|
|
|
|
declare -r HIDDEN=$'\e[8m'
|
|
|
|
|
|
|
|
declare -r tab_=$'\t'
|
|
|
|
declare -r nl_=$'\n'
|
|
|
|
|
|
|
|
declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
|
|
|
|
declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
|
|
|
|
declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
|
|
|
|
|
|
|
|
# bold yellow > < pair
|
|
|
|
declare -r R_arrow=$'\e[1;33m>\e[0m'
|
|
|
|
declare -r L_arrow=$'\e[1;33m<\e[0m'
|
|
|
|
|
|
|
|
|
|
|
|
#>>>>>>>>>>>>>>>ERROR TRAPPING >>>>>>>>>>>>>>>>>>>>
|
|
|
|
#-----------------------#
|
|
|
|
simple_error() { # Basic error trap.... JUST DIE
|
|
|
|
#-----------------------#
|
|
|
|
# If +e then disable text output
|
2006-10-24 04:49:37 +02:00
|
|
|
if [[ "$-" =~ e ]]; then
|
2013-10-30 16:44:46 +01:00
|
|
|
LASTLINE="$1"
|
|
|
|
LASTERR="$2"
|
|
|
|
LASTFUNC="$3"
|
|
|
|
LASTSOURCE="$4"
|
|
|
|
# echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
|
|
|
|
echo -e "\n${RED}ERROR:${GREEN} Error $LASTERR at $LASTSOURCE line ${LASTLINE}!${OFF}\n" >&2
|
2006-08-29 20:16:27 +02:00
|
|
|
fi
|
2013-10-30 16:44:46 +01:00
|
|
|
exit $LASTERR
|
2006-08-29 20:16:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
see_ya() {
|
2009-08-01 00:58:20 +02:00
|
|
|
echo -e "\n${L_arrow}${BOLD}jhalfs-trunk${R_arrow} exit${OFF}\n"
|
2006-08-29 20:16:27 +02:00
|
|
|
}
|
|
|
|
##### Simple error TRAPS
|
|
|
|
# ctrl-c SIGINT
|
|
|
|
# ctrl-y
|
|
|
|
# ctrl-z SIGTSTP
|
|
|
|
# SIGHUP 1 HANGUP
|
|
|
|
# SIGINT 2 INTRERRUPT FROM KEYBOARD Ctrl-C
|
|
|
|
# SIGQUIT 3
|
|
|
|
# SIGKILL 9 KILL
|
|
|
|
# SIGTERM 15 TERMINATION
|
|
|
|
# SIGSTOP 17,18,23 STOP THE PROCESS
|
|
|
|
#####
|
|
|
|
set -e
|
|
|
|
trap see_ya 0
|
2013-10-30 16:44:46 +01:00
|
|
|
trap 'simple_error "${LINENO}" "$?" "${FUNCNAME}" "${BASH_SOURCE}"' ERR
|
2006-08-29 20:16:27 +02:00
|
|
|
trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23
|
|
|
|
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
|
|
|
|
|
|
version="
|
2009-08-01 00:58:20 +02:00
|
|
|
${BOLD} \"jhalfs-trunk\"${OFF} builder tool (development) \$Rev$
|
2006-08-29 20:16:27 +02:00
|
|
|
\$Date$
|
|
|
|
|
|
|
|
Written by George Boudreau and Manuel Canales Esparcia,
|
|
|
|
plus several contributions.
|
|
|
|
|
|
|
|
Based on an idea from Jeremy Huntwork
|
|
|
|
|
|
|
|
This set of files are published under the
|
|
|
|
${BOLD}Gnu General Public License, Version 2.${OFF}
|
|
|
|
"
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
-v ) echo "$version" && exit 1 ;;
|
|
|
|
run ) : ;;
|
|
|
|
* )
|
|
|
|
echo "${nl_}${tab_}${BOLD}${RED}This script cannot be called directly: EXITING ${OFF}${nl_}"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2013-04-04 22:07:25 +02:00
|
|
|
# If the user has not saved his configuration file, let's ask
|
|
|
|
# if he or she really wants to run this stuff
|
|
|
|
if [ $(ls -l --time-style='+%Y%m%d%H%M%S' configuration.old | cut -d' ' -f 6) \
|
|
|
|
-ge $(ls -l --time-style='+%Y%m%d%H%M%S' configuration | cut -d' ' -f 6) ]
|
|
|
|
then echo -n "Do you want to run jhalfs? yes/no (yes): "
|
|
|
|
read ANSWER
|
|
|
|
if [ x${ANSWER:0:1} = "xn" -o x${ANSWER:0:1} = "xN" ] ; then
|
|
|
|
echo "${nl_}Exiting gracefully.${nl_}"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Change this to 0 to suppress almost all messages
|
2006-08-29 20:16:27 +02:00
|
|
|
VERBOSITY=1
|
|
|
|
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
|
|
|
|
source configuration
|
2012-02-02 00:29:37 +01:00
|
|
|
[[ $? > 0 ]] && echo "file: configuration did not load.." && exit 1
|
2006-08-29 20:16:27 +02:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
|
|
|
|
|
|
# These are boolean vars generated from Config.in.
|
2012-02-02 00:29:37 +01:00
|
|
|
# ISSUE: If a boolean parameter is not set to y(es) there
|
|
|
|
# is no variable defined by the menu app. This can
|
|
|
|
# cause a headache if you are not aware.
|
|
|
|
# The following variables MUST exist. If they don't, the
|
|
|
|
# default value is n(o).
|
2006-08-29 20:16:27 +02:00
|
|
|
RUNMAKE=${RUNMAKE:-n}
|
|
|
|
GETPKG=${GETPKG:-n}
|
|
|
|
COMPARE=${COMPARE:-n}
|
|
|
|
RUN_FARCE=${RUN_FARCE:-n}
|
|
|
|
RUN_ICA=${RUN_ICA:-n}
|
2012-02-02 00:29:37 +01:00
|
|
|
PKGMNGT=${PKGMNGT:-n}
|
2006-08-29 20:16:27 +02:00
|
|
|
BOMB_TEST=${BOMB_TEST:-n}
|
|
|
|
STRIP=${STRIP:=n}
|
|
|
|
REPORT=${REPORT:=n}
|
|
|
|
VIMLANG=${VIMLANG:-n}
|
2012-02-10 10:43:23 +01:00
|
|
|
FULL_LOCALE=${FULL_LOCALE:-n}
|
2006-08-29 20:16:27 +02:00
|
|
|
GRSECURITY_HOST=${GRSECURITY_HOST:-n}
|
2006-10-14 19:22:29 +02:00
|
|
|
CUSTOM_TOOLS=${CUSTOM_TOOLS:-n}
|
2006-10-19 19:27:18 +02:00
|
|
|
REBUILD_MAKEFILE=${REBUILD_MAKEFILE:-n}
|
2007-04-28 17:24:20 +02:00
|
|
|
INSTALL_LOG=${INSTALL_LOG:-n}
|
2007-05-30 21:47:27 +02:00
|
|
|
CLEAN=${CLEAN:=n}
|
2007-06-04 21:36:27 +02:00
|
|
|
SET_SSP=${SET_SSP:=n}
|
|
|
|
SET_ASLR=${SET_ASLR:=n}
|
|
|
|
SET_PAX=${SET_PAX:=n}
|
|
|
|
SET_HARDENED_TMP=${SET_HARDENED_TMP:=n}
|
|
|
|
SET_WARNINGS=${SET_WARNINGS:=n}
|
|
|
|
SET_MISC=${SET_MISC:=n}
|
|
|
|
SET_BLOWFISH=${SET_BLOWFISH:=n}
|
2015-12-13 16:28:33 +01:00
|
|
|
UNICODE=${UNICODE:=n}
|
2006-08-29 20:16:27 +02:00
|
|
|
|
2008-10-28 00:26:29 +01:00
|
|
|
if [[ "${NO_PROGRESS_BAR}" = "y" ]] ; then
|
|
|
|
NO_PROGRESS="#"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2007-09-14 18:56:24 +02:00
|
|
|
# Sanity check on the location of $BUILDDIR / $JHALFSDIR
|
|
|
|
CWD=$(cd `dirname $0` && pwd)
|
|
|
|
if [[ $JHALFSDIR == $CWD ]]; then
|
|
|
|
echo " The jhalfs source directory conflicts with the jhalfs build directory."
|
|
|
|
echo " Please move the source directory or change the build directory."
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
2009-10-23 17:53:53 +02:00
|
|
|
# Book sources envars
|
2006-08-29 20:18:06 +02:00
|
|
|
BRANCH_ID=${BRANCH_ID:=development}
|
|
|
|
|
|
|
|
case $BRANCH_ID in
|
|
|
|
development )
|
|
|
|
case $PROGNAME in
|
2013-09-14 12:13:04 +02:00
|
|
|
clfs* ) TREE="" ;;
|
2014-05-08 18:05:31 +02:00
|
|
|
* ) TREE=trunk/BOOK ;;
|
2006-08-29 20:18:06 +02:00
|
|
|
esac
|
|
|
|
LFSVRS=development
|
|
|
|
;;
|
|
|
|
*EDIT* ) echo " You forgot to set the branch or stable book version."
|
|
|
|
echo " Please rerun make and fix the configuration."
|
|
|
|
exit 2 ;;
|
|
|
|
branch-* )
|
2014-05-08 18:05:31 +02:00
|
|
|
case $PROGNAME in
|
|
|
|
lfs )
|
|
|
|
LFSVRS=${BRANCH_ID}
|
2014-08-25 15:14:38 +02:00
|
|
|
TREE=branches/${BRANCH_ID#branch-}
|
|
|
|
if [ ${BRANCH_ID#branch-} = 6 ]; then
|
|
|
|
TREE=${TREE}/BOOK
|
|
|
|
fi
|
2014-05-08 18:05:31 +02:00
|
|
|
;;
|
|
|
|
clfs* )
|
|
|
|
LFSVRS=${BRANCH_ID}
|
|
|
|
TREE=${BRANCH_ID#branch-}
|
|
|
|
;;
|
|
|
|
esac
|
2006-08-29 20:18:06 +02:00
|
|
|
;;
|
|
|
|
* )
|
|
|
|
case $PROGNAME in
|
2012-02-22 10:18:56 +01:00
|
|
|
lfs )
|
|
|
|
LFSVRS=${BRANCH_ID}
|
|
|
|
TREE=tags/${BRANCH_ID}
|
|
|
|
if (( ${BRANCH_ID:0:1} < 7 )) ; then
|
|
|
|
TREE=${TREE}/BOOK
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
hlfs )
|
2006-08-29 20:18:06 +02:00
|
|
|
LFSVRS=${BRANCH_ID}
|
|
|
|
TREE=tags/${BRANCH_ID}/BOOK
|
|
|
|
;;
|
2013-09-14 12:13:04 +02:00
|
|
|
clfs* )
|
2006-08-29 20:18:06 +02:00
|
|
|
LFSVRS=${BRANCH_ID}
|
2013-10-03 12:25:42 +02:00
|
|
|
TREE=clfs-${BRANCH_ID}
|
2006-08-29 20:18:06 +02:00
|
|
|
;;
|
2013-09-14 12:13:04 +02:00
|
|
|
* )
|
2006-08-29 20:18:06 +02:00
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2006-08-29 20:16:27 +02:00
|
|
|
# Set the document location...
|
2013-04-04 23:13:02 +02:00
|
|
|
BOOK=${BOOK:=$JHALFSDIR/$PROGNAME-$LFSVRS}
|
2006-08-29 20:16:27 +02:00
|
|
|
|
2006-08-29 20:18:06 +02:00
|
|
|
|
2006-10-05 22:25:52 +02:00
|
|
|
#--- Envars not sourced from configuration
|
|
|
|
case $PROGNAME in
|
2015-01-18 16:58:15 +01:00
|
|
|
clfs ) declare -r GIT="git://git.clfs.org/cross-lfs" ;;
|
|
|
|
clfs2 ) declare -r GIT="git://git.clfs.org/clfs-sysroot" ;;
|
|
|
|
clfs3 ) declare -r GIT="git://git.clfs.org/clfs-embedded" ;;
|
2013-09-14 12:13:04 +02:00
|
|
|
*) declare -r SVN="svn://svn.linuxfromscratch.org" ;;
|
2006-10-05 22:25:52 +02:00
|
|
|
esac
|
|
|
|
declare -r LOG=000-masterscript.log
|
2012-02-02 00:29:37 +01:00
|
|
|
# Needed for fetching BLFS book sources when building CLFS
|
2006-10-05 22:25:52 +02:00
|
|
|
declare -r SVN_2="svn://svn.linuxfromscratch.org"
|
|
|
|
|
2006-08-29 20:16:27 +02:00
|
|
|
# Set true internal variables
|
|
|
|
COMMON_DIR="common"
|
2007-07-06 02:59:01 +02:00
|
|
|
PACKAGE_DIR=$(echo $PROGNAME | tr '[a-z]' '[A-Z]')
|
2006-08-29 20:16:27 +02:00
|
|
|
MODULE=$PACKAGE_DIR/master.sh
|
2012-02-02 00:29:37 +01:00
|
|
|
PKGMNGTDIR="pkgmngt"
|
|
|
|
# The name packageManager.xml is hardcoded in *.xsl, so no variable.
|
2006-08-29 20:16:27 +02:00
|
|
|
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading common-functions module..."
|
|
|
|
source $COMMON_DIR/common-functions
|
|
|
|
[[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading code module <$MODULE>..."
|
|
|
|
source $MODULE
|
|
|
|
[[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
|
|
#
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
|
|
|
|
|
|
|
|
|
|
|
#*******************************************************************#
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
2006-11-11 18:21:38 +01:00
|
|
|
source $COMMON_DIR/libs/func_check_version.sh
|
2006-08-29 20:16:27 +02:00
|
|
|
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
|
|
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
2006-11-11 18:21:38 +01:00
|
|
|
source $COMMON_DIR/libs/func_validate_configs.sh
|
2006-08-29 20:16:27 +02:00
|
|
|
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
2006-10-14 19:22:29 +02:00
|
|
|
|
2006-11-11 20:06:46 +01:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_custom_pkgs>..."
|
|
|
|
source $COMMON_DIR/libs/func_custom_pkgs
|
2006-10-14 19:22:29 +02:00
|
|
|
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
|
|
|
|
|
|
|
2013-12-15 11:10:25 +01:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
|
|
|
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo Checking tools required for jhalfs
|
|
|
|
check_alfs_tools
|
|
|
|
|
2006-08-29 20:16:27 +02:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
|
|
|
|
2013-10-29 16:42:03 +01:00
|
|
|
# blfs-tool envars
|
|
|
|
BLFS_TOOL=${BLFS_TOOL:-n}
|
|
|
|
if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
2013-12-15 11:10:25 +01:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo Checking supplementary tools for installing BLFS
|
|
|
|
check_blfs_tools
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
2013-11-16 23:35:25 +01:00
|
|
|
BLFS_SVN=${BLFS_SVN:-n}
|
|
|
|
BLFS_WORKING_COPY=${BLFS_WORKING_COPY:-n}
|
|
|
|
BLFS_BRANCH=${BLFS_BRANCH:-n}
|
|
|
|
if [[ "${BLFS_SVN}" = "y" ]]; then
|
|
|
|
BLFS_BRANCH_ID=development
|
|
|
|
BLFS_TREE=trunk/BOOK
|
|
|
|
elif [[ "${BLFS_WORKING_COPY}" = "y" ]]; then
|
|
|
|
[[ -d "$BLFS_WC_LOCATION" ]] &&
|
|
|
|
[[ -d "$BLFS_WC_LOCATION/postlfs" ]] || {
|
|
|
|
echo " BLFS tools: This is not a working copy: $BLFS_WC_LOCATION."
|
|
|
|
echo " Please rerun make and fix the configuration."
|
|
|
|
exit 2
|
|
|
|
}
|
2014-03-03 15:34:58 +01:00
|
|
|
BLFS_TREE=$(cd $BLFS_WC_LOCATION; svn info | grep '^URL' | sed 's@.*BLFS/@@')
|
2013-11-16 23:35:25 +01:00
|
|
|
BLFS_BRANCH_ID=$(echo $BLFS_TREE | sed -e 's@trunk/BOOK@development@' \
|
|
|
|
-e 's@branches/@branch-@' \
|
|
|
|
-e 's@tags/@@' \
|
|
|
|
-e 's@/BOOK@@')
|
2013-11-17 21:13:04 +01:00
|
|
|
elif [[ "${BLFS_BRANCH}" = "y" ]] ; then
|
2013-11-16 23:35:25 +01:00
|
|
|
case $BLFS_BRANCH_ID in
|
|
|
|
*EDIT* ) echo " You forgot to set the BLFS branch or stable book version."
|
|
|
|
echo " Please rerun make and fix the configuration."
|
|
|
|
exit 2 ;;
|
|
|
|
branch-systemd ) BLFS_TREE=branches/systemd ;;
|
|
|
|
branch-* ) BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-}/BOOK ;;
|
2015-03-07 17:23:26 +01:00
|
|
|
6.2* | 7.* ) BLFS_TREE=tags/${BLFS_BRANCH_ID} ;;
|
2013-11-16 23:35:25 +01:00
|
|
|
* ) BLFS_TREE=tags/${BLFS_BRANCH_ID}/BOOK ;;
|
|
|
|
esac
|
|
|
|
fi
|
2013-10-29 16:42:03 +01:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading blfs tools installation function..."
|
|
|
|
source $COMMON_DIR/libs/func_install_blfs
|
|
|
|
[[ $? > 0 ]] && echo "function module did not load.." && exit 1
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
|
|
fi
|
2006-08-29 20:16:27 +02:00
|
|
|
|
|
|
|
###################################
|
|
|
|
### MAIN ###
|
|
|
|
###################################
|
|
|
|
|
|
|
|
|
|
|
|
validate_config
|
|
|
|
echo "${SD_BORDER}${nl_}"
|
|
|
|
echo -n "Are you happy with these settings? yes/no (no): "
|
|
|
|
read ANSWER
|
|
|
|
if [ x$ANSWER != "xyes" ] ; then
|
2006-10-07 20:50:15 +02:00
|
|
|
echo "${nl_}Rerun make to fix the configuration options.${nl_}"
|
2013-11-16 11:00:16 +01:00
|
|
|
exit
|
2006-08-29 20:16:27 +02:00
|
|
|
fi
|
|
|
|
echo "${nl_}${SD_BORDER}${nl_}"
|
|
|
|
|
|
|
|
# Load additional modules or configuration files based on global settings
|
|
|
|
# compare module
|
|
|
|
if [[ "$COMPARE" = "y" ]]; then
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..."
|
2006-11-11 18:21:38 +01:00
|
|
|
source $COMMON_DIR/libs/func_compare.sh
|
|
|
|
[[ $? > 0 ]] && echo "$COMMON_DIR/libs/func_compare.sh did not load.." && exit
|
2006-08-29 20:16:27 +02:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
|
|
fi
|
|
|
|
#
|
|
|
|
# optimize module
|
|
|
|
if [[ "$OPTIMIZE" != "0" ]]; then
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading optimization module..."
|
|
|
|
source optimize/optimize_functions
|
|
|
|
[[ $? > 0 ]] && echo " optimize/optimize_functions did not load.." && exit
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
|
|
#
|
|
|
|
# optimize configurations
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading optimization config..."
|
|
|
|
source optimize/opt_config
|
|
|
|
[[ $? > 0 ]] && echo " optimize/opt_config did not load.." && exit
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
2013-11-16 23:35:25 +01:00
|
|
|
# The number of parallel jobs is taken from configuration now
|
|
|
|
MAKEFLAGS="-j${N_PARALLEL}"
|
2006-08-29 20:16:27 +02:00
|
|
|
# Validate optimize settings, if required
|
|
|
|
validate_opt_settings
|
|
|
|
fi
|
|
|
|
#
|
|
|
|
|
2006-10-19 19:27:18 +02:00
|
|
|
if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
|
2006-08-29 20:16:27 +02:00
|
|
|
|
2006-10-18 21:28:47 +02:00
|
|
|
# If requested, clean the build directory
|
|
|
|
clean_builddir
|
2006-08-29 20:16:27 +02:00
|
|
|
|
2006-10-18 21:28:47 +02:00
|
|
|
if [[ ! -d $JHALFSDIR ]]; then
|
|
|
|
mkdir -p $JHALFSDIR
|
|
|
|
fi
|
2006-12-15 11:53:10 +01:00
|
|
|
|
2006-10-18 21:28:47 +02:00
|
|
|
# Create $BUILDDIR/sources even though it could be created by get_sources()
|
|
|
|
if [[ ! -d $BUILDDIR/sources ]]; then
|
|
|
|
mkdir -p $BUILDDIR/sources
|
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Create the log directory
|
|
|
|
if [[ ! -d $LOGDIR ]]; then
|
|
|
|
mkdir $LOGDIR
|
|
|
|
fi
|
|
|
|
>$LOGDIR/$LOG
|
|
|
|
#
|
2006-12-15 11:53:10 +01:00
|
|
|
# Copy common helper files
|
2014-01-12 22:40:20 +01:00
|
|
|
cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/
|
|
|
|
# Copy needed stylesheets
|
|
|
|
cp $COMMON_DIR/{packages.xsl,chroot.xsl} $JHALFSDIR/
|
2006-10-18 21:28:47 +02:00
|
|
|
#
|
2006-12-15 11:53:10 +01:00
|
|
|
# Fix the XSL book parser
|
2013-09-14 12:13:04 +02:00
|
|
|
case $PROGNAME in
|
|
|
|
clfs* ) sed 's,FAKEDIR,'${BOOK}/BOOK',' ${PACKAGE_DIR}/${XSL} > $JHALFSDIR/${XSL} ;;
|
|
|
|
lfs | hlfs ) sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL} ;;
|
|
|
|
* ) ;;
|
|
|
|
esac
|
2006-12-15 11:53:10 +01:00
|
|
|
export XSL=$JHALFSDIR/${XSL}
|
2006-10-18 21:28:47 +02:00
|
|
|
#
|
|
|
|
|
2012-02-02 00:29:37 +01:00
|
|
|
# Copy packageManager.xml, if needed
|
|
|
|
[[ "$PKGMNGT" = "y" ]] && [[ "$PROGNAME" = "lfs" ]] &&
|
|
|
|
cp $PKGMNGTDIR/packageManager.xml $JHALFSDIR/ &&
|
|
|
|
cp $PKGMNGTDIR/packInstall.sh $JHALFSDIR/
|
|
|
|
#
|
2006-12-15 11:53:10 +01:00
|
|
|
# Copy urls.xsl, if needed
|
|
|
|
[[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
|
2006-10-18 21:28:47 +02:00
|
|
|
#
|
2006-12-15 11:53:10 +01:00
|
|
|
# Create the test-log directory, if needed
|
|
|
|
[[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR
|
|
|
|
#
|
2007-04-28 17:24:20 +02:00
|
|
|
# Create the installed-files directory, if needed
|
|
|
|
[[ "$INSTALL_LOG" = "y" ]] && [[ ! -d $FILELOGDIR ]] && install -d -m 1777 $FILELOGDIR
|
|
|
|
#
|
2006-12-15 11:53:10 +01:00
|
|
|
# Prepare report creation, if needed
|
2006-10-18 21:28:47 +02:00
|
|
|
if [[ "$REPORT" = "y" ]]; then
|
|
|
|
cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/
|
2012-02-02 00:29:37 +01:00
|
|
|
# After making sure that all looks sane, dump the settings to a file
|
2006-10-18 21:28:47 +02:00
|
|
|
# This file will be used to create the REPORT header
|
|
|
|
validate_config > $JHALFSDIR/jhalfs.config
|
|
|
|
fi
|
|
|
|
#
|
2006-12-15 11:53:10 +01:00
|
|
|
# Copy optimize files, if needed
|
|
|
|
[[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
|
2006-10-18 21:28:47 +02:00
|
|
|
#
|
2006-12-15 11:53:10 +01:00
|
|
|
# Copy compare files, if needed
|
|
|
|
if [[ "$COMPARE" = "y" ]]; then
|
|
|
|
mkdir -p $JHALFSDIR/extras
|
|
|
|
cp extras/* $JHALFSDIR/extras
|
|
|
|
fi
|
2006-10-18 21:28:47 +02:00
|
|
|
#
|
2006-12-15 11:53:10 +01:00
|
|
|
# Copy custom tools config files, if requested
|
|
|
|
if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
|
|
|
|
echo "Copying custom tool scripts to $JHALFSDIR"
|
|
|
|
mkdir -p $JHALFSDIR/custom-commands
|
|
|
|
cp -f custom/config/* $JHALFSDIR/custom-commands
|
|
|
|
fi
|
|
|
|
#
|
2006-10-18 21:28:47 +02:00
|
|
|
# Install blfs-tool, if requested.
|
|
|
|
if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
2013-12-15 11:10:25 +01:00
|
|
|
echo Installing BLFS book and tools
|
2013-10-29 16:42:03 +01:00
|
|
|
install_blfs_tools 2>&1 | tee -a $LOGDIR/$LOG
|
2013-10-30 16:44:46 +01:00
|
|
|
[[ ${PIPESTATUS[0]} != 0 ]] && exit 1
|
2006-10-18 21:28:47 +02:00
|
|
|
fi
|
2006-12-15 11:53:10 +01:00
|
|
|
#
|
2006-10-18 21:28:47 +02:00
|
|
|
|
2013-04-04 23:13:02 +02:00
|
|
|
# Download or updates the book source
|
2006-10-18 21:28:47 +02:00
|
|
|
get_book
|
2013-04-04 23:13:02 +02:00
|
|
|
extract_commands
|
2006-08-29 20:18:06 +02:00
|
|
|
echo "${SD_BORDER}${nl_}"
|
2006-10-18 21:28:47 +02:00
|
|
|
|
2006-08-29 20:18:06 +02:00
|
|
|
fi
|
|
|
|
|
2013-10-29 16:42:03 +01:00
|
|
|
# When regenerating the Makefile, we need to know also the
|
|
|
|
# canonical book version
|
2006-10-19 19:27:18 +02:00
|
|
|
if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then
|
|
|
|
case $PROGNAME in
|
2013-09-14 12:13:04 +02:00
|
|
|
clfs* )
|
2006-10-19 19:27:18 +02:00
|
|
|
VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
2016-06-19 16:41:18 +02:00
|
|
|
lfs)
|
|
|
|
if [[ "$INITSYS" = "sysv" ]] ; then
|
|
|
|
VERSION=$(grep 'ENTITY version ' $JHALFSDIR/$BOOK/general.ent| cut -d\" -f2)
|
|
|
|
else
|
|
|
|
VERSION=$(grep 'ENTITY versiond' $JHALFSDIR/$BOOK/general.ent| cut -d\" -f2)
|
|
|
|
fi
|
|
|
|
;;
|
2006-10-19 19:27:18 +02:00
|
|
|
*)
|
2016-06-19 16:41:18 +02:00
|
|
|
VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
2006-10-19 19:27:18 +02:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2006-08-29 20:16:27 +02:00
|
|
|
build_Makefile
|
2006-12-15 11:53:10 +01:00
|
|
|
|
2006-08-29 20:16:27 +02:00
|
|
|
echo "${SD_BORDER}${nl_}"
|
|
|
|
|
2013-04-04 23:13:02 +02:00
|
|
|
# Check for build prerequisites.
|
|
|
|
echo
|
|
|
|
cd $CWD
|
|
|
|
check_prerequisites
|
|
|
|
echo "${SD_BORDER}${nl_}"
|
|
|
|
# All is well, run the build (if requested)
|
2006-08-29 20:16:27 +02:00
|
|
|
run_make
|