2006-03-07 21:02:53 +01:00
|
|
|
#!/bin/bash
|
2006-03-10 02:44:55 +01:00
|
|
|
# $Id$
|
2006-03-07 21:02:53 +01:00
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
|
|
#>>>>>>>>>>>>>>>ERROR TRAPPING >>>>>>>>>>>>>>>>>>>>
|
|
|
|
#-----------------------#
|
|
|
|
simple_error() { # Basic error trap.... JUST DIE
|
|
|
|
#-----------------------#
|
|
|
|
# If +e then disable text output
|
|
|
|
if [[ "$-" =~ "e" ]]; then
|
|
|
|
echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
see_ya() {
|
2006-04-05 00:45:09 +02:00
|
|
|
echo -e "\n\t${BOLD}Goodbye and thank you for choosing ${L_arrow}jhalfs-X${R_arrow}\n"
|
2006-03-07 21:02:53 +01: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
|
|
|
|
trap simple_error ERR
|
|
|
|
trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23
|
|
|
|
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
|
|
|
|
|
|
|
|
|
|
if [ ! -L $0 ] ; then
|
|
|
|
echo "${nl_}${tab_}${BOLD}${RED}This script cannot be called directly: EXITING ${OFF}${nl_}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2006-03-10 02:44:55 +01:00
|
|
|
PROGNAME=$(basename $0)
|
|
|
|
COMMON_DIR="common"
|
2006-03-28 20:21:47 +02:00
|
|
|
PACKAGE_DIR=$(echo $PROGNAME | tr [a-z] [A-Z])
|
2006-03-10 02:44:55 +01:00
|
|
|
MODULE=$PACKAGE_DIR/master.sh
|
|
|
|
MODULE_CONFIG=$PACKAGE_DIR/config
|
2006-03-28 20:21:47 +02:00
|
|
|
VERBOSITY=0
|
2006-03-10 02:44:55 +01:00
|
|
|
|
2006-03-07 21:02:53 +01:00
|
|
|
|
2006-07-27 00:34:27 +02:00
|
|
|
if [[ -e using_menuconfig ]]; then
|
2006-08-11 05:34:10 +02:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
|
2006-07-27 00:34:27 +02:00
|
|
|
source configuration
|
2006-08-11 05:34:10 +02:00
|
|
|
[[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
2006-08-04 22:06:15 +02:00
|
|
|
|
2006-07-27 00:34:27 +02:00
|
|
|
#--- Working directories
|
|
|
|
SCRIPT_ROOT=jhalfs
|
|
|
|
JHALFSDIR=$BUILDDIR/$SCRIPT_ROOT
|
|
|
|
LOGDIR=$JHALFSDIR/logs
|
|
|
|
TESTLOGDIR=$JHALFSDIR/test-logs
|
|
|
|
MKFILE=$JHALFSDIR/Makefile
|
|
|
|
#--- ICA report log directory
|
|
|
|
ICALOGDIR=$LOGDIR/ICA
|
|
|
|
#--- farce report log directory
|
|
|
|
FARCELOGDIR=$LOGDIR/farce
|
2006-08-12 21:59:11 +02:00
|
|
|
XSL=$PROGNAME.xsl
|
2006-07-27 00:34:27 +02:00
|
|
|
|
2006-08-12 21:59:11 +02:00
|
|
|
case $PROGNAME in
|
|
|
|
clfs2) LFSVRS=development; TREE=branches/clfs-2.0/BOOK ;;
|
|
|
|
*) LFSVRS=development; TREE=trunk/BOOK ;;
|
|
|
|
esac
|
|
|
|
|
2006-08-11 05:34:10 +02:00
|
|
|
if [[ ! -z ${BRANCH_ID} ]]; then
|
|
|
|
case $BRANCH_ID in
|
|
|
|
dev* | SVN | trunk )
|
|
|
|
case $PROGNAME in
|
|
|
|
clfs2 ) TREE=branches/clfs-2.0/BOOK ;;
|
|
|
|
*) TREE=trunk/BOOK ;;
|
|
|
|
esac
|
|
|
|
LFSVRS=development
|
|
|
|
;;
|
|
|
|
branch-* )
|
|
|
|
LFSVRS=${BRANCH_ID}
|
|
|
|
TREE=branches/${BRANCH_ID#branch-}/BOOK
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
case $PROGNAME in
|
|
|
|
lfs | hlfs )
|
|
|
|
LFSVRS=${BRANCH_ID}
|
|
|
|
TREE=tags/${BRANCH_ID}/BOOK
|
|
|
|
;;
|
|
|
|
clfs | clfs2 )
|
|
|
|
LFSVRS=${BRANCH_ID}
|
|
|
|
TREE=tags/${BRANCH_ID}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2006-07-27 00:34:27 +02:00
|
|
|
esac
|
2006-08-11 05:34:10 +02:00
|
|
|
fi
|
2006-08-12 21:59:11 +02:00
|
|
|
# These are boolean vars generated from Config.in.
|
|
|
|
# ISSUE: If a boolean parameter is not set <true> that
|
|
|
|
# variable is not defined by the menu app. This can
|
|
|
|
# cause a headache if you are not careful.
|
|
|
|
# The following parameters MUST be created and have a
|
|
|
|
# default value.
|
|
|
|
RUNMAKE=${RUNMAKE:-n}
|
|
|
|
GETPKG=${GETPKG:-n}
|
|
|
|
GETKERNEL=${GETKERNEL:-n}
|
|
|
|
COMPARE=${COMPARE:-n}
|
|
|
|
RUN_FARCE=${RUN_FARCE:-n}
|
|
|
|
RUN_ICA=${RUN_ICA:-n}
|
|
|
|
BOMB_TEST=${BOMB_TEST:-n}
|
|
|
|
STRIP=${STRIP:=n}
|
|
|
|
REPORT=${REPORT:=n}
|
|
|
|
VIMLANG=${VIMLANG:-n}
|
|
|
|
KEYMAP=${KEYMAP:=none}
|
|
|
|
GRSECURITY_HOST=${GRSECURITY_HOST:-n}
|
|
|
|
|
|
|
|
else
|
|
|
|
#
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading masterscript conf..."
|
|
|
|
source $COMMON_DIR/config
|
|
|
|
[[ $? > 0 ]] && echo "$COMMON_DIR/conf did not load.." && exit
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
|
|
#
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading config module <$MODULE_CONFIG>..."
|
|
|
|
source $MODULE_CONFIG
|
|
|
|
[[ $? > 0 ]] && echo "$MODULE_CONFIG did not load.." && exit 1
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
|
|
#
|
2006-07-27 00:34:27 +02:00
|
|
|
fi
|
2006-03-07 21:02:53 +01:00
|
|
|
|
2006-08-12 21:59:11 +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_}"
|
|
|
|
|
|
|
|
|
2006-03-07 21:02:53 +01:00
|
|
|
#===========================================================
|
|
|
|
# If the var BOOK contains something then, maybe, it points
|
|
|
|
# to a working doc.. set WC=1, else 'null'
|
|
|
|
#===========================================================
|
|
|
|
WC=${BOOK:+1}
|
|
|
|
#===========================================================
|
|
|
|
|
|
|
|
|
|
|
|
#*******************************************************************#
|
2006-03-28 20:21:47 +02:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
2006-03-10 02:44:55 +01:00
|
|
|
source $COMMON_DIR/func_check_version.sh
|
|
|
|
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
2006-03-28 20:21:47 +02:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
2006-03-07 21:02:53 +01:00
|
|
|
|
2006-03-28 20:21:47 +02:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
2006-03-10 02:44:55 +01:00
|
|
|
source $COMMON_DIR/func_validate_configs.sh
|
|
|
|
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
2006-03-28 20:21:47 +02:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
2006-05-03 21:35:01 +02:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
2006-03-07 21:02:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
###################################
|
2006-04-09 12:27:06 +02:00
|
|
|
### MAIN ###
|
2006-03-07 21:02:53 +01:00
|
|
|
###################################
|
|
|
|
|
|
|
|
# Evaluate any command line switches
|
|
|
|
|
|
|
|
while test $# -gt 0 ; do
|
|
|
|
case $1 in
|
2006-05-18 20:44:10 +02:00
|
|
|
# Common options for {C,H}LFS books
|
2006-03-27 20:33:53 +02:00
|
|
|
--book | -B )
|
2006-03-07 21:02:53 +01:00
|
|
|
test $# = 1 && eval "$exit_missing_arg"
|
|
|
|
shift
|
|
|
|
case $1 in
|
|
|
|
dev* | SVN | trunk )
|
|
|
|
LFSVRS=development
|
2006-07-26 20:42:01 +02:00
|
|
|
TREE=trunk/BOOK
|
2006-03-07 21:02:53 +01:00
|
|
|
;;
|
2006-07-26 20:42:01 +02:00
|
|
|
branch-* )
|
|
|
|
LFSVRS=$1
|
|
|
|
TREE=branches/${1#branch-}/BOOK
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
case $PROGNAME in
|
|
|
|
lfs | hlfs )
|
|
|
|
LFSVRS=$1
|
|
|
|
TREE=tags/$1/BOOK
|
|
|
|
;;
|
|
|
|
clfs )
|
|
|
|
LFSVRS=$1
|
|
|
|
TREE=tags/$1
|
|
|
|
;;
|
|
|
|
esac
|
2006-03-07 21:02:53 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
|
2006-03-27 20:58:46 +02:00
|
|
|
--directory | -D )
|
2006-03-07 21:02:53 +01:00
|
|
|
test $# = 1 && eval "$exit_missing_arg"
|
|
|
|
shift
|
2006-03-27 22:21:11 +02:00
|
|
|
case $1 in
|
|
|
|
-* )
|
2006-03-27 22:26:16 +02:00
|
|
|
echo -e "\n$1 isn't a valid build directory."
|
2006-03-27 22:21:11 +02:00
|
|
|
echo -e "Directory names can't start with - .\n"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
BUILDDIR=$1
|
2006-06-02 19:53:17 +02:00
|
|
|
JHALFSDIR=$BUILDDIR/${SCRIPT_ROOT}
|
2006-03-27 22:21:11 +02:00
|
|
|
LOGDIR=$JHALFSDIR/logs
|
2006-06-04 19:59:02 +02:00
|
|
|
TESTLOGDIR=$JHALFSDIR/test-logs
|
2006-03-27 22:21:11 +02:00
|
|
|
MKFILE=$JHALFSDIR/Makefile
|
|
|
|
;;
|
|
|
|
esac
|
2006-03-07 21:02:53 +01:00
|
|
|
;;
|
|
|
|
|
2006-08-12 21:59:11 +02:00
|
|
|
--get-packages | -G ) GETPKG=y ;;
|
2006-03-27 20:58:46 +02:00
|
|
|
|
2006-03-28 20:49:13 +02:00
|
|
|
--help | -h ) usage | more && exit ;;
|
2006-03-27 20:58:46 +02:00
|
|
|
|
2006-05-05 19:41:56 +02:00
|
|
|
--optimize | -O )
|
|
|
|
test $# = 1 && eval "$exit_missing_arg"
|
|
|
|
shift
|
|
|
|
case $1 in
|
|
|
|
0 | 1 | 2 )
|
|
|
|
OPTIMIZE=$1
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
echo -e "\n$1 isn't a valid optimize level value."
|
|
|
|
echo -e "You must use 0, 1, or 2.\n"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
|
2006-03-27 20:58:46 +02:00
|
|
|
--testsuites | -T )
|
|
|
|
test $# = 1 && eval "$exit_missing_arg"
|
|
|
|
shift
|
|
|
|
case $1 in
|
|
|
|
0 | 1 | 2 | 3 )
|
|
|
|
TEST=$1
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
echo -e "\n$1 isn't a valid testsuites level value."
|
|
|
|
echo -e "You must to use 0, 1, 2, or 3.\n"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
|
|
|
|
--version | -V )
|
|
|
|
echo "$version"
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
|
2006-03-07 21:02:53 +01:00
|
|
|
--working-copy | -W )
|
|
|
|
test $# = 1 && eval "$exit_missing_arg"
|
|
|
|
shift
|
2006-03-27 20:33:53 +02:00
|
|
|
case $PROGNAME in # Poor checks. We should find better ones.
|
|
|
|
lfs)
|
2006-05-18 20:53:39 +02:00
|
|
|
if [ -d $1/chapter09 ] ; then
|
2006-03-27 20:33:53 +02:00
|
|
|
WC=1
|
|
|
|
BOOK=$1
|
|
|
|
else
|
2006-07-26 20:42:01 +02:00
|
|
|
echo -e "\nLooks like $1 isn't an LFS working copy."
|
2006-03-27 20:33:53 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
clfs)
|
2006-05-18 20:53:39 +02:00
|
|
|
if [ -d $1/cross-tools ] ; then
|
2006-03-27 20:33:53 +02:00
|
|
|
WC=1
|
|
|
|
BOOK=$1
|
|
|
|
else
|
2006-04-05 00:50:28 +02:00
|
|
|
echo -e "\nLooks like $1 isn't a CLFS working copy."
|
2006-03-27 20:33:53 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
hlfs)
|
|
|
|
if [ -f $1/template.xml ] ; then
|
|
|
|
WC=1
|
|
|
|
BOOK=$1
|
|
|
|
else
|
2006-07-26 20:42:01 +02:00
|
|
|
echo -e "\nLooks like $1 isn't an HLFS working copy."
|
2006-03-27 20:33:53 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
2006-03-27 22:24:17 +02:00
|
|
|
esac
|
|
|
|
;;
|
2006-03-07 21:02:53 +01:00
|
|
|
|
2006-07-26 20:42:01 +02:00
|
|
|
--comparison | -C )
|
2006-04-09 12:27:06 +02:00
|
|
|
test $# = 1 && eval "$exit_missing_arg"
|
|
|
|
shift
|
2006-04-09 12:44:09 +02:00
|
|
|
case $1 in
|
2006-08-12 21:59:11 +02:00
|
|
|
ICA) RUN_ICA=y; RUN_FARCE=n; COMPARE=y ;;
|
|
|
|
farce) RUN_ICA=n; RUN_FARCE=y; COMPARE=y ;;
|
|
|
|
both) RUN_ICA=y; RUN_FARCE=y; COMPARE=y ;;
|
2006-04-09 12:27:06 +02:00
|
|
|
*)
|
2006-04-29 17:11:30 +02:00
|
|
|
echo -e "\n$1 is an unknown analysis method."
|
2006-04-09 12:27:06 +02:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2006-04-08 14:21:34 +02:00
|
|
|
|
2006-03-27 21:08:37 +02:00
|
|
|
--fstab | -F )
|
|
|
|
test $# = 1 && eval "$exit_missing_arg"
|
|
|
|
shift
|
|
|
|
if [ -f $1 ] ; then
|
|
|
|
FSTAB=$1
|
|
|
|
else
|
|
|
|
echo -e "\nFile $1 not found. Verify your command line.\n"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
--kernel-config | -K )
|
|
|
|
test $# = 1 && eval "$exit_missing_arg"
|
|
|
|
shift
|
|
|
|
if [ -f $1 ] ; then
|
|
|
|
CONFIG=$1
|
|
|
|
else
|
|
|
|
echo -e "\nFile $1 not found. Verify your command line.\n"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
2006-07-26 20:42:01 +02:00
|
|
|
--run-make | -M ) RUNMAKE=1 ;;
|
2006-03-27 21:08:37 +02:00
|
|
|
|
|
|
|
--rebuild | -R ) CLEAN=1 ;;
|
|
|
|
|
2006-03-27 21:58:08 +02:00
|
|
|
# CLFS options
|
|
|
|
--arch | -A )
|
|
|
|
test $# = 1 && eval "$exit_missing_arg"
|
|
|
|
shift
|
2006-08-12 21:59:11 +02:00
|
|
|
case $PROGNAME in
|
|
|
|
CLFS2)
|
|
|
|
case $1 in
|
|
|
|
arm) ARCH=arm; TARGET="arm-unknown-linux-gnu" ;;
|
|
|
|
x86) ARCH=x86; TARGET="i686-pc-linux-gnu" ;;
|
|
|
|
*) echo -e "\n$1 is an unknown or unsupported arch."; exit 1
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
CLFS)
|
|
|
|
case $1 in
|
|
|
|
arm ) ARCH=arm; TARGET="arm-unknown-linux-gnu" ;;
|
|
|
|
x86 ) ARCH=x86; TARGET="i686-pc-linux-gnu" ;;
|
|
|
|
i486 ) ARCH=x86; TARGET="i486-pc-linux-gnu" ;;
|
|
|
|
i586 ) ARCH=x86; TARGET="i586-pc-linux-gnu" ;;
|
|
|
|
ppc ) ARCH=ppc; TARGET="powerpc-unknown-linux-gnu" ;;
|
|
|
|
mips ) ARCH=mips; TARGET="mips-unknown-linux-gnu" ;;
|
|
|
|
mipsel ) ARCH=mips; TARGET="mipsel-unknown-linux-gnu" ;;
|
|
|
|
sparc ) ARCH=sparc; TARGET="sparcv9-unknown-linux-gnu" ;;
|
|
|
|
|
|
|
|
x86_64-64 ) ARCH=x86_64-64; TARGET="x86_64-unknown-linux-gnu" ;;
|
|
|
|
mips64-64 ) ARCH=mips64-64; TARGET="mips-unknown-linux-gnu" ;;
|
|
|
|
mipsel64-64 ) ARCH=mips64-64; TARGET="mipsel-unknown-linux-gnu" ;;
|
|
|
|
sparc64-64 ) ARCH=sparc64-64; TARGET="sparc64-unknown-linux-gnu" ;;
|
|
|
|
alpha ) ARCH=alpha; TARGET="alpha-unknown-linux-gnu" ;;
|
|
|
|
|
|
|
|
x86_64 ) ARCH=x86_64; TARGET="x86_64-unknown-linux-gnu"; TARGET32="i686-pc-linux-gnu" ;;
|
|
|
|
mips64 ) ARCH=mips64; TARGET="mips-unknown-linux-gnu"; TARGET32="mips-unknown-linux-gnu" ;;
|
|
|
|
mipsel64 ) ARCH=mips64; TARGET="mipsel-unknown-linux-gnu"; TARGET32="mipsel-unknown-linux-gnu" ;;
|
|
|
|
sparc64 ) ARCH=sparc64; TARGET="sparc64-unknown-linux-gnu"; TARGET32="sparcv9-unknown-linux-gnu" ;;
|
|
|
|
ppc64 ) ARCH=ppc64; TARGET="powerpc64-unknown-linux-gnu"; TARGET32="powerpc-unknown-linux-gnu" ;;
|
|
|
|
|
|
|
|
* ) echo -e "\n$1 is an unknown or unsupported arch."; exit 1 ;;
|
|
|
|
esac
|
|
|
|
;;
|
2006-03-27 21:58:08 +02:00
|
|
|
esac
|
|
|
|
;;
|
|
|
|
|
2006-03-27 22:34:26 +02:00
|
|
|
--boot-config )
|
|
|
|
test $# = 1 && eval "$exit_missing_arg"
|
|
|
|
shift
|
|
|
|
if [ -f $1 ] ; then
|
|
|
|
BOOT_CONFIG=$1
|
|
|
|
else
|
|
|
|
echo -e "\nFile $1 not found. Verify your command line.\n"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
2006-03-27 21:58:08 +02:00
|
|
|
--method )
|
|
|
|
test $# = 1 && eval "$exit_missing_arg"
|
|
|
|
shift
|
|
|
|
case $1 in
|
|
|
|
chroot | boot )
|
|
|
|
METHOD=$1
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
echo -e "\n$1 isn't a valid build method."
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
|
2006-03-27 22:07:17 +02:00
|
|
|
# HLFS options
|
|
|
|
--model )
|
|
|
|
test $# = 1 && eval "$exit_missing_arg"
|
|
|
|
shift
|
|
|
|
case $1 in
|
|
|
|
glibc | uclibc )
|
|
|
|
MODEL=$1
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
echo -e "\n$1 isn't a valid libc model."
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
|
2006-03-27 21:58:08 +02:00
|
|
|
# Unknown options
|
2006-03-28 01:49:09 +02:00
|
|
|
* ) usage ;;
|
2006-03-07 21:02:53 +01:00
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2006-08-12 21:59:11 +02:00
|
|
|
|
2006-03-07 21:02:53 +01:00
|
|
|
#===================================================
|
|
|
|
# Set the document location...
|
2006-03-12 12:28:15 +01:00
|
|
|
# BOOK is either defined in
|
2006-03-07 21:02:53 +01:00
|
|
|
# xxx.config
|
|
|
|
# comand line
|
2006-03-12 12:28:15 +01:00
|
|
|
# default
|
2006-03-26 16:12:55 +02:00
|
|
|
# If set by conf file or cmd line leave it
|
2006-03-07 21:02:53 +01:00
|
|
|
# alone otherwise load the default version
|
|
|
|
#===================================================
|
|
|
|
BOOK=${BOOK:=$PROGNAME-$LFSVRS}
|
|
|
|
#===================================================
|
|
|
|
|
2006-03-12 12:28:15 +01:00
|
|
|
|
2006-08-12 21:59:11 +02:00
|
|
|
# Check for minimum bash,tar,gcc and kernel versions
|
2006-03-29 05:50:33 +02:00
|
|
|
echo
|
2006-03-12 12:28:15 +01:00
|
|
|
check_version "2.6.2" "`uname -r`" "KERNEL"
|
|
|
|
check_version "3.0" "$BASH_VERSION" "BASH"
|
|
|
|
check_version "3.0" "`gcc -dumpversion`" "GCC"
|
2006-06-04 19:59:02 +02:00
|
|
|
tarVer=`tar --version | head -n1 | cut -d " " -f4`
|
|
|
|
check_version "1.15.0" "${tarVer}" "TAR"
|
2006-05-03 21:35:01 +02:00
|
|
|
echo "${SD_BORDER}${nl_}"
|
2006-03-12 12:28:15 +01:00
|
|
|
|
2006-03-29 21:47:45 +02:00
|
|
|
validate_config
|
2006-05-03 21:35:01 +02:00
|
|
|
echo "${SD_BORDER}${nl_}"
|
2006-04-05 00:59:08 +02:00
|
|
|
echo -n "Are you happy with these settings? yes/no (no): "
|
2006-03-12 12:28:15 +01:00
|
|
|
read ANSWER
|
|
|
|
if [ x$ANSWER != "xyes" ] ; then
|
|
|
|
echo "${nl_}Fix the configuration options and rerun the script.${nl_}"
|
|
|
|
exit 1
|
|
|
|
fi
|
2006-05-03 21:35:01 +02:00
|
|
|
echo "${nl_}${SD_BORDER}${nl_}"
|
2006-03-12 12:28:15 +01:00
|
|
|
|
2006-05-16 20:27:02 +02:00
|
|
|
# Load additional modules or configuration files based on global settings
|
2006-05-05 21:09:01 +02:00
|
|
|
# compare module
|
2006-08-12 21:59:11 +02:00
|
|
|
if [[ "$COMPARE" = "y" ]]; then
|
2006-05-05 21:09:01 +02:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..."
|
|
|
|
source $COMMON_DIR/func_compare.sh
|
|
|
|
[[ $? > 0 ]] && echo "$COMMON_DIR/func_compare.sh did not load.." && exit
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
|
|
fi
|
|
|
|
#
|
2006-05-06 12:35:19 +02:00
|
|
|
# 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"
|
2006-05-16 20:27:02 +02:00
|
|
|
#
|
|
|
|
# optimize configurations
|
2006-05-05 21:09:01 +02:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading optimization config..."
|
|
|
|
source optimize/opt_config
|
|
|
|
[[ $? > 0 ]] && echo " optimize/opt_config did not load.." && exit
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
2006-05-16 20:27:02 +02:00
|
|
|
# Validate optimize settings, if required
|
|
|
|
validate_opt_settings
|
2006-05-05 21:09:01 +02:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
|
2006-03-12 12:28:15 +01:00
|
|
|
# If $BUILDDIR has subdirectories like tools/ or bin/, stop the run
|
|
|
|
# and notify the user about that.
|
|
|
|
if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] && [ -z $CLEAN ] ; then
|
|
|
|
eval "$no_empty_builddir"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If requested, clean the build directory
|
|
|
|
clean_builddir
|
|
|
|
|
2006-03-07 21:02:53 +01:00
|
|
|
if [[ ! -d $JHALFSDIR ]]; then
|
2006-03-29 21:31:38 +02:00
|
|
|
mkdir -p $JHALFSDIR
|
2006-03-07 21:02:53 +01:00
|
|
|
fi
|
2006-05-16 20:27:02 +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-06-04 19:59:02 +02:00
|
|
|
[[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR
|
2006-05-16 20:27:02 +02:00
|
|
|
#
|
2006-03-12 12:28:15 +01:00
|
|
|
if [[ "$PWD" != "$JHALFSDIR" ]]; then
|
2006-06-02 19:53:17 +02:00
|
|
|
cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/
|
2006-06-04 19:59:02 +02:00
|
|
|
#
|
2006-05-05 19:51:56 +02:00
|
|
|
[[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
|
2006-06-04 19:59:02 +02:00
|
|
|
#
|
2006-08-12 21:59:11 +02:00
|
|
|
if [[ "$COMPARE" = "y" ]]; then
|
2006-04-09 16:27:24 +02:00
|
|
|
mkdir -p $JHALFSDIR/extras
|
2006-04-09 12:27:06 +02:00
|
|
|
cp extras/* $JHALFSDIR/extras
|
2006-04-08 19:01:40 +02:00
|
|
|
fi
|
2006-05-16 20:27:02 +02:00
|
|
|
#
|
2006-03-07 21:02:53 +01:00
|
|
|
if [[ -n "$FILES" ]]; then
|
2006-07-26 20:42:01 +02:00
|
|
|
# pushd/popd necessary to deal with multiple files
|
2006-03-29 21:31:38 +02:00
|
|
|
pushd $PACKAGE_DIR 1> /dev/null
|
|
|
|
cp $FILES $JHALFSDIR/
|
|
|
|
popd 1> /dev/null
|
2006-03-07 21:02:53 +01:00
|
|
|
fi
|
2006-05-16 20:27:02 +02:00
|
|
|
#
|
2006-08-12 21:59:11 +02:00
|
|
|
if [[ "$REPORT" = "y" ]]; then
|
2006-05-18 20:44:10 +02:00
|
|
|
cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/
|
2006-07-26 20:42:01 +02:00
|
|
|
# After being sure that all looks sane, dump the settings to a file
|
2006-05-18 20:44:10 +02:00
|
|
|
# This file will be used to create the REPORT header
|
|
|
|
validate_config > $JHALFSDIR/jhalfs.config
|
2006-05-07 18:03:08 +02:00
|
|
|
fi
|
2006-05-16 20:27:02 +02:00
|
|
|
#
|
2006-08-12 21:59:11 +02:00
|
|
|
[[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
|
2006-05-18 20:44:10 +02:00
|
|
|
#
|
2006-07-26 20:42:01 +02:00
|
|
|
cp $COMMON_DIR/packages.xsl $JHALFSDIR/
|
|
|
|
#
|
2006-03-10 02:44:55 +01:00
|
|
|
sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
|
2006-03-07 21:02:53 +01:00
|
|
|
export XSL=$JHALFSDIR/${XSL}
|
|
|
|
fi
|
|
|
|
|
|
|
|
get_book
|
2006-05-03 21:35:01 +02:00
|
|
|
echo "${SD_BORDER}${nl_}"
|
2006-03-10 02:44:55 +01:00
|
|
|
|
2006-03-07 21:02:53 +01:00
|
|
|
build_Makefile
|
2006-05-03 21:35:01 +02:00
|
|
|
echo "${SD_BORDER}${nl_}"
|
2006-03-10 02:44:55 +01:00
|
|
|
|
2006-03-21 02:03:35 +01:00
|
|
|
run_make
|