2006-08-29 20:16:27 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# $Id$
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# 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
|
2006-08-29 20:16:27 +02:00
|
|
|
echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
trap simple_error ERR
|
|
|
|
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
|
|
|
|
|
|
|
|
VERBOSITY=1
|
|
|
|
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
|
|
|
|
source configuration
|
|
|
|
[[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
|
|
|
|
|
|
# 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}
|
|
|
|
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}
|
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
|
|
|
|
|
2006-08-29 20:18:06 +02:00
|
|
|
# Book surces envars
|
|
|
|
BRANCH_ID=${BRANCH_ID:=development}
|
|
|
|
|
|
|
|
case $BRANCH_ID in
|
|
|
|
development )
|
|
|
|
case $PROGNAME in
|
2006-11-19 11:46:31 +01:00
|
|
|
clfs2 ) TREE=branches/clfs-sysroot/BOOK ;;
|
|
|
|
clfs3 ) TREE=branches/clfs-embedded/BOOK ;;
|
2006-08-29 20:18:06 +02:00
|
|
|
*) TREE=trunk/BOOK ;;
|
|
|
|
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-* )
|
|
|
|
LFSVRS=${BRANCH_ID}
|
|
|
|
TREE=branches/${BRANCH_ID#branch-}/BOOK
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
case $PROGNAME in
|
|
|
|
lfs | hlfs )
|
|
|
|
LFSVRS=${BRANCH_ID}
|
|
|
|
TREE=tags/${BRANCH_ID}/BOOK
|
|
|
|
;;
|
2006-11-11 01:09:42 +01:00
|
|
|
clfs | clfs2 | clfs3)
|
2006-08-29 20:18:06 +02:00
|
|
|
LFSVRS=${BRANCH_ID}
|
|
|
|
TREE=tags/${BRANCH_ID}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2006-08-29 20:16:27 +02:00
|
|
|
# Set the document location...
|
|
|
|
BOOK=${BOOK:=$PROGNAME-$LFSVRS}
|
|
|
|
|
2006-08-29 20:18:06 +02:00
|
|
|
# blfs-tool envars
|
|
|
|
BLFS_TOOL=${BLFS_TOOL:-n}
|
|
|
|
if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
|
|
|
BLFS_BRANCH_ID=${BLFS_BRANCH_ID:=development}
|
|
|
|
case $BLFS_BRANCH_ID in
|
|
|
|
development ) BLFS_TREE=trunk/BOOK ;;
|
|
|
|
*EDIT* ) echo " You forgot to set the BLFS branch or stable book version."
|
|
|
|
echo " Please rerun make and fix the configuration."
|
|
|
|
exit 2 ;;
|
2007-02-15 20:33:25 +01:00
|
|
|
branch-* ) BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-} ;;
|
|
|
|
* ) BLFS_TREE=tags/${BLFS_BRANCH_ID} ;;
|
2006-08-29 20:18:06 +02:00
|
|
|
esac
|
2006-10-02 21:32:06 +02:00
|
|
|
# Dependencies envars, to can update it more easy.
|
|
|
|
# Tidy and Unzip version are harcoded also in wrt_blfs_tool_targets()
|
2006-08-29 20:18:06 +02:00
|
|
|
# libxml2
|
2007-07-28 19:12:00 +02:00
|
|
|
LIBXML_PKG="libxml2-2.6.29.tar.gz"
|
2006-08-29 20:18:06 +02:00
|
|
|
LIBXML_URL="ftp://xmlsoft.org/libxml2/${LIBXML_PKG}"
|
2007-07-28 19:12:00 +02:00
|
|
|
LIBXML_MD5="8b99b6e8b08e838438d9e6b639d79ebd"
|
2006-08-29 20:18:06 +02:00
|
|
|
# libxslt
|
2007-07-28 19:12:00 +02:00
|
|
|
LIBXSLT_PKG="libxslt-1.1.21.tar.gz"
|
2006-08-29 20:18:06 +02:00
|
|
|
LIBXSLT_URL="ftp://xmlsoft.org/libxslt/${LIBXSLT_PKG}"
|
2007-07-28 19:12:00 +02:00
|
|
|
LIBXSLT_MD5="59fe34e85692f71df2a38c2ee291b3ca"
|
2006-10-02 21:32:06 +02:00
|
|
|
# tidy
|
2007-04-13 21:26:35 +02:00
|
|
|
TIDY_PKG="tidy-cvs_20070326.tar.bz2"
|
|
|
|
TIDY_URL="http://anduin.linuxfromscratch.org/files/BLFS/sources/${TIDY_PKG}"
|
|
|
|
TIDY_MD5="468bfaa5cf917a8ecbe7834c13a61376"
|
2006-10-02 21:32:06 +02:00
|
|
|
# unzip
|
|
|
|
UNZIP_PKG="unzip552.tar.gz"
|
2007-04-13 21:26:35 +02:00
|
|
|
UNZIP_URL="http://downloads.sourceforge.net/infozip/${UNZIP_PKG}"
|
2006-10-02 21:32:06 +02:00
|
|
|
UNZIP_MD5="9d23919999d6eac9217d1f41472034a9"
|
2007-04-13 21:26:35 +02:00
|
|
|
# unzip security patch
|
|
|
|
UNZIP_PATCH="unzip-5.52-security_fix-1.patch"
|
|
|
|
UNZIP_PATCH_URL="http://www.linuxfromscratch.org/patches/blfs/svn/${UNZIP_PATCH}"
|
|
|
|
UNZIP_PATCH_MD5="00ebf64fdda2ad54ddfc619f85f328bb"
|
2006-10-02 21:32:06 +02:00
|
|
|
# DocBook XML DTD
|
2007-04-13 21:26:35 +02:00
|
|
|
DBXML_PKG="docbook-xml-4.5.zip"
|
|
|
|
DBXML_URL="http://www.docbook.org/xml/4.5/${DBXML_PKG}"
|
|
|
|
DBXML_MD5="03083e288e87a7e829e437358da7ef9e"
|
2006-08-29 20:18:06 +02:00
|
|
|
# DocBook XSL
|
2007-07-24 23:04:34 +02:00
|
|
|
# DBXSL_PKG="docbook-xsl-1.69.1.tar.bz2"
|
|
|
|
# DBXSL_URL="http://prdownloads.sourceforge.net/docbook/${DBXSL_PKG}"
|
|
|
|
# DBXSL_MD5="6ebd29a67f2dcc3f2220f475ee6f6552"
|
2006-08-29 20:18:06 +02:00
|
|
|
# Links
|
2007-08-08 19:24:58 +02:00
|
|
|
LYNX_PKG="lynx2.8.6.tar.bz2"
|
|
|
|
LYNX_URL="http://lynx.isc.org/release/${LYNX_PKG}"
|
|
|
|
LYNX_MD5="dc80497b7dda6a28fd80404684d27548"
|
2006-08-29 20:18:06 +02:00
|
|
|
# sudo
|
|
|
|
SUDO_PKG="sudo-1.6.8p12.tar.gz"
|
2007-07-28 19:12:00 +02:00
|
|
|
SUDO_URL="http://anduin.linuxfromscratch.org/sources/BLFS/svn/s/${SUDO_PKG}"
|
2006-08-29 20:18:06 +02:00
|
|
|
SUDO_MD5="b29893c06192df6230dd5f340f3badf5"
|
|
|
|
# sudo envar fix patch
|
|
|
|
SUDO_PATCH="sudo-1.6.8p12-envvar_fix-1.patch"
|
|
|
|
SUDO_PATCH_URL="http://www.linuxfromscratch.org/patches/blfs/svn/${SUDO_PATCH}"
|
|
|
|
SUDO_PATCH_MD5="454925aedfe054dff8fe0d03b209f986"
|
|
|
|
# wget
|
|
|
|
WGET_PKG="wget-1.10.2.tar.gz"
|
|
|
|
WGET_URL="ftp://ftp.gnu.org/gnu/wget/${WGET_PKG}"
|
|
|
|
WGET_MD5="795fefbb7099f93e2d346b026785c4b8"
|
|
|
|
# Subversion
|
|
|
|
SVN_PKG="subversion-1.3.1.tar.bz2"
|
|
|
|
SVN_URL="http://subversion.tigris.org/tarballs/${SVN_PKG}"
|
|
|
|
SVN_MD5="07b95963968ae345541ca99d0e7bf082"
|
|
|
|
# GPM
|
|
|
|
GPM_PKG="gpm-1.20.1.tar.bz2"
|
2007-07-28 19:12:00 +02:00
|
|
|
GPM_URL="ftp://ftp.linux.ee/pub/gentoo/distfiles/distfiles/${GPM_PKG}"
|
2006-08-29 20:18:06 +02:00
|
|
|
GPM_MD5="2c63e827d755527950d9d13fe3d87692"
|
|
|
|
# GPM segfaul patch
|
|
|
|
GPM_PATCH_1="gpm-1.20.1-segfault-1.patch"
|
|
|
|
GPM_PATCH_1_URL="http://www.linuxfromscratch.org/patches/blfs/svn/${GPM_PATCH_1}"
|
|
|
|
GPM_PATCH_1_MD5="8c88f92990ba7613014fcd1db14ca7ac"
|
|
|
|
# GPM silent patch
|
|
|
|
GPM_PATCH_2="gpm-1.20.1-silent-1.patch"
|
|
|
|
GPM_PATCH_2_URL="http://www.linuxfromscratch.org/patches/blfs/svn/${GPM_PATCH_2}"
|
|
|
|
GPM_PATCH_2_MD5="bf6cbefe20c6f15b587f19ebc1c8a37a"
|
|
|
|
fi
|
|
|
|
|
2006-10-05 22:25:52 +02:00
|
|
|
#--- Envars not sourced from configuration
|
|
|
|
case $PROGNAME in
|
|
|
|
clfs* ) declare -r SVN="http://svn.cross-lfs.org/svn/repos" ;;
|
|
|
|
* ) declare -r SVN="svn://svn.linuxfromscratch.org" ;;
|
|
|
|
esac
|
|
|
|
declare -r LOG=000-masterscript.log
|
|
|
|
# Needed to can fetch BLFS book sources when building CLFS
|
|
|
|
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
|
|
|
|
|
|
|
|
[[ $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"
|
|
|
|
|
|
|
|
|
2006-08-29 20:16:27 +02:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
|
|
|
|
|
|
|
|
|
|
|
###################################
|
|
|
|
### MAIN ###
|
|
|
|
###################################
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
# Check for build prereequisites.
|
2006-08-29 20:16:27 +02:00
|
|
|
echo
|
2006-10-02 21:32:06 +02:00
|
|
|
check_prerequisites
|
2006-08-29 20:16:27 +02:00
|
|
|
echo "${SD_BORDER}${nl_}"
|
|
|
|
|
|
|
|
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_}"
|
2006-08-29 20:16:27 +02:00
|
|
|
exit 1
|
|
|
|
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"
|
|
|
|
# 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 $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"
|
2006-10-14 19:22:29 +02:00
|
|
|
fi
|
2006-08-29 20:18:06 +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
|
|
|
|
cp $COMMON_DIR/{makefile-functions,progress_bar.sh,packages.xsl} $JHALFSDIR/
|
2006-10-18 21:28:47 +02:00
|
|
|
#
|
2006-12-15 11:53:10 +01:00
|
|
|
# Fix the XSL book parser
|
|
|
|
sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
|
|
|
|
export XSL=$JHALFSDIR/${XSL}
|
2006-10-18 21:28:47 +02:00
|
|
|
#
|
|
|
|
|
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/
|
|
|
|
# After being sure that all looks sane, dump the settings to a file
|
|
|
|
# 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
|
|
|
|
# Install the files
|
|
|
|
[[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -p ${BUILDDIR}${BLFS_ROOT}
|
|
|
|
cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
|
|
|
|
cp -r menu ${BUILDDIR}${BLFS_ROOT}
|
|
|
|
cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
|
|
|
|
cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
|
|
|
|
# Clean-up
|
|
|
|
rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
|
|
|
|
rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
|
|
|
|
rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
|
|
|
|
# Set some harcoded envars to their proper values
|
|
|
|
sed -i 's,blfs-xml,'$BLFS_XML',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,libs/book.xsl}
|
|
|
|
sed -i 's,tracking-dir,'$TRACKING_DIR',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,gen-makefile.sh}
|
|
|
|
# Copy the dependencies build scripts
|
|
|
|
cp -r $COMMON_DIR/blfs-tool-deps $JHALFSDIR/
|
|
|
|
rm -rf $JHALFSDIR/blfs-tool-deps/.svn
|
|
|
|
fi
|
2006-12-15 11:53:10 +01:00
|
|
|
#
|
2006-10-18 21:28:47 +02:00
|
|
|
|
|
|
|
get_book
|
2006-08-29 20:18:06 +02:00
|
|
|
echo "${SD_BORDER}${nl_}"
|
2006-10-18 21:28:47 +02:00
|
|
|
|
|
|
|
# Get the BLFS book, if requested.
|
|
|
|
if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
|
|
|
echo -n "Downloading the BLFS document, $BLFS_BRANCH_ID version... "
|
|
|
|
if [[ ! -d ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} ]] ; then
|
|
|
|
mkdir -p ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML}
|
|
|
|
svn co $SVN_2/BLFS/$BLFS_TREE ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} >>$LOGDIR/$LOG 2>&1
|
|
|
|
else
|
|
|
|
pushd ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} 1> /dev/null
|
|
|
|
svn up >>$LOGDIR/$LOG 2>&1
|
|
|
|
popd 1> /dev/null
|
|
|
|
fi
|
|
|
|
echo -ne "done\n"
|
|
|
|
echo "${SD_BORDER}${nl_}"
|
|
|
|
fi
|
|
|
|
|
2006-08-29 20:18:06 +02:00
|
|
|
fi
|
|
|
|
|
2006-10-19 19:27:18 +02:00
|
|
|
# When regeneration the Makefile we need to know also the canonical book version
|
|
|
|
if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then
|
|
|
|
case $PROGNAME in
|
2006-11-11 01:09:42 +01:00
|
|
|
clfs | clfs2 | clfs3 )
|
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/<\/.*//') ;;
|
|
|
|
*)
|
|
|
|
VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
|
|
|
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_}"
|
|
|
|
|
|
|
|
run_make
|