[4da2512] | 1 | #!/bin/bash
|
---|
| 2 | # $Id$
|
---|
| 3 | set -e
|
---|
| 4 |
|
---|
| 5 | # VT100 colors
|
---|
| 6 | declare -r BLACK=$'\e[1;30m'
|
---|
| 7 | declare -r DK_GRAY=$'\e[0;30m'
|
---|
| 8 |
|
---|
| 9 | declare -r RED=$'\e[31m'
|
---|
| 10 | declare -r GREEN=$'\e[32m'
|
---|
| 11 | declare -r YELLOW=$'\e[33m'
|
---|
| 12 | declare -r BLUE=$'\e[34m'
|
---|
| 13 | declare -r MAGENTA=$'\e[35m'
|
---|
| 14 | declare -r CYAN=$'\e[36m'
|
---|
| 15 | declare -r WHITE=$'\e[37m'
|
---|
| 16 |
|
---|
| 17 | declare -r OFF=$'\e[0m'
|
---|
| 18 | declare -r BOLD=$'\e[1m'
|
---|
| 19 | declare -r REVERSE=$'\e[7m'
|
---|
| 20 | declare -r HIDDEN=$'\e[8m'
|
---|
| 21 |
|
---|
| 22 | declare -r tab_=$'\t'
|
---|
| 23 | declare -r nl_=$'\n'
|
---|
| 24 |
|
---|
| 25 | declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
|
---|
| 26 | declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
|
---|
| 27 | declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
|
---|
| 28 |
|
---|
| 29 | # bold yellow > < pair
|
---|
| 30 | declare -r R_arrow=$'\e[1;33m>\e[0m'
|
---|
| 31 | declare -r L_arrow=$'\e[1;33m<\e[0m'
|
---|
| 32 |
|
---|
| 33 |
|
---|
| 34 | #>>>>>>>>>>>>>>>ERROR TRAPPING >>>>>>>>>>>>>>>>>>>>
|
---|
| 35 | #-----------------------#
|
---|
| 36 | simple_error() { # Basic error trap.... JUST DIE
|
---|
| 37 | #-----------------------#
|
---|
| 38 | # If +e then disable text output
|
---|
[a96109a] | 39 | if [[ "$-" =~ e ]]; then
|
---|
[4da2512] | 40 | echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
|
---|
| 41 | fi
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | see_ya() {
|
---|
[401aac8] | 45 | echo -e "\n${L_arrow}${BOLD}jhalfs-trunk${R_arrow} exit${OFF}\n"
|
---|
[4da2512] | 46 | }
|
---|
| 47 | ##### Simple error TRAPS
|
---|
| 48 | # ctrl-c SIGINT
|
---|
| 49 | # ctrl-y
|
---|
| 50 | # ctrl-z SIGTSTP
|
---|
| 51 | # SIGHUP 1 HANGUP
|
---|
| 52 | # SIGINT 2 INTRERRUPT FROM KEYBOARD Ctrl-C
|
---|
| 53 | # SIGQUIT 3
|
---|
| 54 | # SIGKILL 9 KILL
|
---|
| 55 | # SIGTERM 15 TERMINATION
|
---|
| 56 | # SIGSTOP 17,18,23 STOP THE PROCESS
|
---|
| 57 | #####
|
---|
| 58 | set -e
|
---|
| 59 | trap see_ya 0
|
---|
| 60 | trap simple_error ERR
|
---|
| 61 | trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23
|
---|
| 62 | #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
---|
| 63 |
|
---|
| 64 | version="
|
---|
[401aac8] | 65 | ${BOLD} \"jhalfs-trunk\"${OFF} builder tool (development) \$Rev$
|
---|
[4da2512] | 66 | \$Date$
|
---|
| 67 |
|
---|
| 68 | Written by George Boudreau and Manuel Canales Esparcia,
|
---|
| 69 | plus several contributions.
|
---|
| 70 |
|
---|
| 71 | Based on an idea from Jeremy Huntwork
|
---|
| 72 |
|
---|
| 73 | This set of files are published under the
|
---|
| 74 | ${BOLD}Gnu General Public License, Version 2.${OFF}
|
---|
| 75 | "
|
---|
| 76 |
|
---|
| 77 | case $1 in
|
---|
| 78 | -v ) echo "$version" && exit 1 ;;
|
---|
| 79 | run ) : ;;
|
---|
| 80 | * )
|
---|
| 81 | echo "${nl_}${tab_}${BOLD}${RED}This script cannot be called directly: EXITING ${OFF}${nl_}"
|
---|
| 82 | exit 1
|
---|
| 83 | ;;
|
---|
| 84 | esac
|
---|
| 85 |
|
---|
[65c998b] | 86 | # If the user has not saved his configuration file, let's ask
|
---|
| 87 | # if he or she really wants to run this stuff
|
---|
| 88 | if [ $(ls -l --time-style='+%Y%m%d%H%M%S' configuration.old | cut -d' ' -f 6) \
|
---|
| 89 | -ge $(ls -l --time-style='+%Y%m%d%H%M%S' configuration | cut -d' ' -f 6) ]
|
---|
| 90 | then echo -n "Do you want to run jhalfs? yes/no (yes): "
|
---|
| 91 | read ANSWER
|
---|
| 92 | if [ x${ANSWER:0:1} = "xn" -o x${ANSWER:0:1} = "xN" ] ; then
|
---|
| 93 | echo "${nl_}Exiting gracefully.${nl_}"
|
---|
| 94 | exit
|
---|
| 95 | fi
|
---|
| 96 | fi
|
---|
| 97 |
|
---|
| 98 | # Change this to 0 to suppress almost all messages
|
---|
[4da2512] | 99 | VERBOSITY=1
|
---|
| 100 |
|
---|
| 101 | [[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
|
---|
| 102 | source configuration
|
---|
[7072e1f] | 103 | [[ $? > 0 ]] && echo "file: configuration did not load.." && exit 1
|
---|
[4da2512] | 104 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 105 |
|
---|
| 106 | # These are boolean vars generated from Config.in.
|
---|
[7072e1f] | 107 | # ISSUE: If a boolean parameter is not set to y(es) there
|
---|
| 108 | # is no variable defined by the menu app. This can
|
---|
| 109 | # cause a headache if you are not aware.
|
---|
| 110 | # The following variables MUST exist. If they don't, the
|
---|
| 111 | # default value is n(o).
|
---|
[4da2512] | 112 | RUNMAKE=${RUNMAKE:-n}
|
---|
| 113 | GETPKG=${GETPKG:-n}
|
---|
| 114 | COMPARE=${COMPARE:-n}
|
---|
| 115 | RUN_FARCE=${RUN_FARCE:-n}
|
---|
| 116 | RUN_ICA=${RUN_ICA:-n}
|
---|
[7072e1f] | 117 | PKGMNGT=${PKGMNGT:-n}
|
---|
[4da2512] | 118 | BOMB_TEST=${BOMB_TEST:-n}
|
---|
| 119 | STRIP=${STRIP:=n}
|
---|
| 120 | REPORT=${REPORT:=n}
|
---|
| 121 | VIMLANG=${VIMLANG:-n}
|
---|
[b339c94] | 122 | FULL_LOCALE=${FULL_LOCALE:-n}
|
---|
[4da2512] | 123 | GRSECURITY_HOST=${GRSECURITY_HOST:-n}
|
---|
[9a536f7] | 124 | CUSTOM_TOOLS=${CUSTOM_TOOLS:-n}
|
---|
[a16f769] | 125 | REBUILD_MAKEFILE=${REBUILD_MAKEFILE:-n}
|
---|
[93346ee] | 126 | INSTALL_LOG=${INSTALL_LOG:-n}
|
---|
[486e9a7] | 127 | CLEAN=${CLEAN:=n}
|
---|
[d035526] | 128 | SET_SSP=${SET_SSP:=n}
|
---|
| 129 | SET_ASLR=${SET_ASLR:=n}
|
---|
| 130 | SET_PAX=${SET_PAX:=n}
|
---|
| 131 | SET_HARDENED_TMP=${SET_HARDENED_TMP:=n}
|
---|
| 132 | SET_WARNINGS=${SET_WARNINGS:=n}
|
---|
| 133 | SET_MISC=${SET_MISC:=n}
|
---|
| 134 | SET_BLOWFISH=${SET_BLOWFISH:=n}
|
---|
[4da2512] | 135 |
|
---|
[75d6d1c] | 136 | if [[ "${NO_PROGRESS_BAR}" = "y" ]] ; then
|
---|
| 137 | NO_PROGRESS="#"
|
---|
| 138 | fi
|
---|
| 139 |
|
---|
| 140 |
|
---|
[38ae01f] | 141 | # Sanity check on the location of $BUILDDIR / $JHALFSDIR
|
---|
| 142 | CWD=$(cd `dirname $0` && pwd)
|
---|
| 143 | if [[ $JHALFSDIR == $CWD ]]; then
|
---|
| 144 | echo " The jhalfs source directory conflicts with the jhalfs build directory."
|
---|
| 145 | echo " Please move the source directory or change the build directory."
|
---|
| 146 | exit 2
|
---|
| 147 | fi
|
---|
| 148 |
|
---|
[0873ccc] | 149 | # Book sources envars
|
---|
[4965fa8] | 150 | BRANCH_ID=${BRANCH_ID:=development}
|
---|
| 151 |
|
---|
| 152 | case $BRANCH_ID in
|
---|
| 153 | development )
|
---|
| 154 | case $PROGNAME in
|
---|
[abf2c47] | 155 | clfs2 ) TREE=branches/clfs-sysroot/BOOK ;;
|
---|
| 156 | clfs3 ) TREE=branches/clfs-embedded/BOOK ;;
|
---|
[4965fa8] | 157 | *) TREE=trunk/BOOK ;;
|
---|
| 158 | esac
|
---|
| 159 | LFSVRS=development
|
---|
| 160 | ;;
|
---|
| 161 | *EDIT* ) echo " You forgot to set the branch or stable book version."
|
---|
| 162 | echo " Please rerun make and fix the configuration."
|
---|
| 163 | exit 2 ;;
|
---|
| 164 | branch-* )
|
---|
| 165 | LFSVRS=${BRANCH_ID}
|
---|
| 166 | TREE=branches/${BRANCH_ID#branch-}/BOOK
|
---|
| 167 | ;;
|
---|
| 168 | * )
|
---|
| 169 | case $PROGNAME in
|
---|
[e650dc7] | 170 | lfs )
|
---|
| 171 | LFSVRS=${BRANCH_ID}
|
---|
| 172 | TREE=tags/${BRANCH_ID}
|
---|
| 173 | if (( ${BRANCH_ID:0:1} < 7 )) ; then
|
---|
| 174 | TREE=${TREE}/BOOK
|
---|
| 175 | fi
|
---|
| 176 | ;;
|
---|
| 177 | hlfs )
|
---|
[4965fa8] | 178 | LFSVRS=${BRANCH_ID}
|
---|
| 179 | TREE=tags/${BRANCH_ID}/BOOK
|
---|
| 180 | ;;
|
---|
[2639f65] | 181 | clfs | clfs2 | clfs3)
|
---|
[4965fa8] | 182 | LFSVRS=${BRANCH_ID}
|
---|
| 183 | TREE=tags/${BRANCH_ID}
|
---|
| 184 | ;;
|
---|
| 185 | esac
|
---|
| 186 | ;;
|
---|
| 187 | esac
|
---|
| 188 |
|
---|
[4da2512] | 189 | # Set the document location...
|
---|
| 190 | BOOK=${BOOK:=$PROGNAME-$LFSVRS}
|
---|
| 191 |
|
---|
[4965fa8] | 192 | # blfs-tool envars
|
---|
| 193 | BLFS_TOOL=${BLFS_TOOL:-n}
|
---|
| 194 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
| 195 | BLFS_BRANCH_ID=${BLFS_BRANCH_ID:=development}
|
---|
| 196 | case $BLFS_BRANCH_ID in
|
---|
| 197 | development ) BLFS_TREE=trunk/BOOK ;;
|
---|
| 198 | *EDIT* ) echo " You forgot to set the BLFS branch or stable book version."
|
---|
| 199 | echo " Please rerun make and fix the configuration."
|
---|
| 200 | exit 2 ;;
|
---|
[0c2d20a] | 201 | branch-* ) BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-} ;;
|
---|
| 202 | * ) BLFS_TREE=tags/${BLFS_BRANCH_ID} ;;
|
---|
[4965fa8] | 203 | esac
|
---|
[7072e1f] | 204 | # Dependencies envars, easier to update.
|
---|
[045b2dc] | 205 | # Tidy and Unzip version are harcoded also in wrt_blfs_tool_targets()
|
---|
[4965fa8] | 206 | # libxml2
|
---|
[7072e1f] | 207 | LIBXML_PKG="libxml2-2.7.8.tar.gz"
|
---|
[4965fa8] | 208 | LIBXML_URL="ftp://xmlsoft.org/libxml2/${LIBXML_PKG}"
|
---|
[7072e1f] | 209 | LIBXML_MD5="8127a65e8c3b08856093099b52599c86"
|
---|
[4965fa8] | 210 | # libxslt
|
---|
[7072e1f] | 211 | LIBXSLT_PKG="libxslt-1.1.26.tar.gz"
|
---|
[4965fa8] | 212 | LIBXSLT_URL="ftp://xmlsoft.org/libxslt/${LIBXSLT_PKG}"
|
---|
[7072e1f] | 213 | LIBXSLT_MD5="e61d0364a30146aaa3001296f853b2b9"
|
---|
[045b2dc] | 214 | # tidy
|
---|
[7072e1f] | 215 | TIDY_PKG="tidy-cvs_20101110.tar.bz2"
|
---|
| 216 | TIDY_URL="http://anduin.linuxfromscratch.org/sources/BLFS/svn/t/${TIDY_PKG}"
|
---|
| 217 | TIDY_MD5="dd1fe109b4259ad3f364b175787ad5e9"
|
---|
[045b2dc] | 218 | # unzip
|
---|
[7072e1f] | 219 | UNZIP_PKG="unzip60.tar.gz"
|
---|
[16938b0] | 220 | UNZIP_URL="http://downloads.sourceforge.net/infozip/${UNZIP_PKG}"
|
---|
[7072e1f] | 221 | UNZIP_MD5="62b490407489521db863b523a7f86375"
|
---|
[045b2dc] | 222 | # DocBook XML DTD
|
---|
[16938b0] | 223 | DBXML_PKG="docbook-xml-4.5.zip"
|
---|
| 224 | DBXML_URL="http://www.docbook.org/xml/4.5/${DBXML_PKG}"
|
---|
| 225 | DBXML_MD5="03083e288e87a7e829e437358da7ef9e"
|
---|
[4965fa8] | 226 | # DocBook XSL
|
---|
[e05fba2] | 227 | # DBXSL_PKG="docbook-xsl-1.69.1.tar.bz2"
|
---|
| 228 | # DBXSL_URL="http://prdownloads.sourceforge.net/docbook/${DBXSL_PKG}"
|
---|
| 229 | # DBXSL_MD5="6ebd29a67f2dcc3f2220f475ee6f6552"
|
---|
[7072e1f] | 230 | # Lynx
|
---|
[eddf6650] | 231 | LYNX_PKG="lynx2.8.8dev.10.tar.bz2"
|
---|
[7072e1f] | 232 | LYNX_URL="http://lynx.isc.org/current/${LYNX_PKG}"
|
---|
[eddf6650] | 233 | LYNX_MD5="1c9ef3746520c69914b461f88de6b12e"
|
---|
[4965fa8] | 234 | # sudo
|
---|
[7072e1f] | 235 | SUDO_PKG="sudo-1.8.2.tar.gz"
|
---|
| 236 | SUDO_URL="http://www.sudo.ws/sudo/dist/${SUDO_PKG}"
|
---|
| 237 | SUDO_MD5="000f458e7391be9fdf459a9ad6a4912a"
|
---|
[4965fa8] | 238 | # wget
|
---|
[7072e1f] | 239 | WGET_PKG="wget-1.13.4.tar.xz"
|
---|
[4965fa8] | 240 | WGET_URL="ftp://ftp.gnu.org/gnu/wget/${WGET_PKG}"
|
---|
[7072e1f] | 241 | WGET_MD5="7f518b3a71e9efd330e9a0c3714f8463"
|
---|
| 242 | # SQLite (for subversion)
|
---|
[256e833] | 243 | SQLITE_PKG="sqlite-autoconf-3071000.tar.gz"
|
---|
[7072e1f] | 244 | SQLITE_URL="http://sqlite.org/${SQLITE_PKG}"
|
---|
[256e833] | 245 | SQLITE_MD5="9ed2ca93577b58cfa0d01f64b9312ab9"
|
---|
[7072e1f] | 246 | # Apache Portable Runtime (for subversion)
|
---|
| 247 | APR_PKG="apr-1.4.5.tar.bz2"
|
---|
| 248 | APR_URL="http://mirror.speednetwork.de/apache/apr/$APR_PKG"
|
---|
| 249 | APR_MD5="8b53f5a5669d0597f2da889a2f576eb6"
|
---|
| 250 | # APR config patch
|
---|
| 251 | APR_PATCH_1="apr-1.4.5-config.patch"
|
---|
| 252 | APR_PATCH_1_URL="file:///sources/local-patches/${APR_PATCH_1}"
|
---|
| 253 | APR_PATCH_1_MD5="fff6eddf998f4e956915f8053c15e41e"
|
---|
| 254 | # Apache Portable Runtime Utilities (for subversion)
|
---|
| 255 | APR_U_PKG="apr-util-1.4.1.tar.bz2"
|
---|
| 256 | APR_U_URL="http://mirrors.ircam.fr/pub/apache/apr/$APR_U_PKG"
|
---|
| 257 | APR_U_MD5="52b31b33fb1aa16e65ddaefc76e41151"
|
---|
| 258 | # APR-util config patch
|
---|
| 259 | APR_U_PATCH_1="apr-util-1.4.1-config.patch"
|
---|
| 260 | APR_U_PATCH_1_URL="file:///sources/local-patches/${APR_U_PATCH_1}"
|
---|
| 261 | APR_U_PATCH_1_MD5="4c07cb0d298ae9ddc75cd2d5acdedb2b"
|
---|
[4965fa8] | 262 | # Subversion
|
---|
[7072e1f] | 263 | SVN_PKG="subversion-1.7.1.tar.bz2"
|
---|
| 264 | SVN_URL="http://archive.apache.org/dist/subversion/${SVN_PKG}"
|
---|
| 265 | SVN_MD5="8a4fa74385df85a9702141b6b68b8307"
|
---|
[4965fa8] | 266 | # GPM
|
---|
[7072e1f] | 267 | GPM_PKG="gpm-1.20.6.tar.bz2"
|
---|
| 268 | GPM_URL="http://www.nico.schottelius.org/software/gpm/archives/$GPM_PKG"
|
---|
| 269 | GPM_MD5="6b534da16dc1b28ba828dea89e520f6f"
|
---|
[4965fa8] | 270 | fi
|
---|
| 271 |
|
---|
[728955b] | 272 | #--- Envars not sourced from configuration
|
---|
| 273 | case $PROGNAME in
|
---|
[7072e1f] | 274 | # TODO: clfs is now on git
|
---|
| 275 | # clfs* ) declare -r SVN="http://svn.cross-lfs.org/svn/repos" ;;
|
---|
[728955b] | 276 | * ) declare -r SVN="svn://svn.linuxfromscratch.org" ;;
|
---|
| 277 | esac
|
---|
| 278 | declare -r LOG=000-masterscript.log
|
---|
[7072e1f] | 279 | # Needed for fetching BLFS book sources when building CLFS
|
---|
[728955b] | 280 | declare -r SVN_2="svn://svn.linuxfromscratch.org"
|
---|
| 281 |
|
---|
[4da2512] | 282 | # Set true internal variables
|
---|
| 283 | COMMON_DIR="common"
|
---|
[52b0d10] | 284 | PACKAGE_DIR=$(echo $PROGNAME | tr '[a-z]' '[A-Z]')
|
---|
[4da2512] | 285 | MODULE=$PACKAGE_DIR/master.sh
|
---|
[7072e1f] | 286 | PKGMNGTDIR="pkgmngt"
|
---|
| 287 | # The name packageManager.xml is hardcoded in *.xsl, so no variable.
|
---|
[4da2512] | 288 |
|
---|
| 289 | [[ $VERBOSITY > 0 ]] && echo -n "Loading common-functions module..."
|
---|
| 290 | source $COMMON_DIR/common-functions
|
---|
| 291 | [[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit
|
---|
| 292 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 293 | [[ $VERBOSITY > 0 ]] && echo -n "Loading code module <$MODULE>..."
|
---|
| 294 | source $MODULE
|
---|
| 295 | [[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2
|
---|
| 296 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 297 | #
|
---|
| 298 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
| 299 |
|
---|
| 300 |
|
---|
| 301 | #*******************************************************************#
|
---|
| 302 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
---|
[d517356] | 303 | source $COMMON_DIR/libs/func_check_version.sh
|
---|
[4da2512] | 304 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
| 305 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 306 |
|
---|
| 307 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
---|
[d517356] | 308 | source $COMMON_DIR/libs/func_validate_configs.sh
|
---|
[4da2512] | 309 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
| 310 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[9a536f7] | 311 |
|
---|
[fe30c61] | 312 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_custom_pkgs>..."
|
---|
| 313 | source $COMMON_DIR/libs/func_custom_pkgs
|
---|
[9a536f7] | 314 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
| 315 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 316 |
|
---|
| 317 |
|
---|
[4da2512] | 318 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
| 319 |
|
---|
| 320 |
|
---|
| 321 | ###################################
|
---|
| 322 | ### MAIN ###
|
---|
| 323 | ###################################
|
---|
| 324 |
|
---|
[0873ccc] | 325 | # Check for build prerequisites.
|
---|
[4da2512] | 326 | echo
|
---|
[045b2dc] | 327 | check_prerequisites
|
---|
[4da2512] | 328 | echo "${SD_BORDER}${nl_}"
|
---|
| 329 |
|
---|
| 330 | validate_config
|
---|
| 331 | echo "${SD_BORDER}${nl_}"
|
---|
| 332 | echo -n "Are you happy with these settings? yes/no (no): "
|
---|
| 333 | read ANSWER
|
---|
| 334 | if [ x$ANSWER != "xyes" ] ; then
|
---|
[881c96f] | 335 | echo "${nl_}Rerun make to fix the configuration options.${nl_}"
|
---|
[4da2512] | 336 | exit 1
|
---|
| 337 | fi
|
---|
| 338 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
| 339 |
|
---|
| 340 | # Load additional modules or configuration files based on global settings
|
---|
| 341 | # compare module
|
---|
| 342 | if [[ "$COMPARE" = "y" ]]; then
|
---|
| 343 | [[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..."
|
---|
[d517356] | 344 | source $COMMON_DIR/libs/func_compare.sh
|
---|
| 345 | [[ $? > 0 ]] && echo "$COMMON_DIR/libs/func_compare.sh did not load.." && exit
|
---|
[4da2512] | 346 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 347 | fi
|
---|
| 348 | #
|
---|
| 349 | # optimize module
|
---|
| 350 | if [[ "$OPTIMIZE" != "0" ]]; then
|
---|
| 351 | [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization module..."
|
---|
| 352 | source optimize/optimize_functions
|
---|
| 353 | [[ $? > 0 ]] && echo " optimize/optimize_functions did not load.." && exit
|
---|
| 354 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 355 | #
|
---|
| 356 | # optimize configurations
|
---|
| 357 | [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization config..."
|
---|
| 358 | source optimize/opt_config
|
---|
| 359 | [[ $? > 0 ]] && echo " optimize/opt_config did not load.." && exit
|
---|
| 360 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 361 | # Validate optimize settings, if required
|
---|
| 362 | validate_opt_settings
|
---|
| 363 | fi
|
---|
| 364 | #
|
---|
| 365 |
|
---|
[a16f769] | 366 | if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
|
---|
[4da2512] | 367 |
|
---|
[7b6ecc5] | 368 | # If $BUILDDIR has subdirectories like tools/ or bin/, stop the run
|
---|
| 369 | # and notify the user about that.
|
---|
| 370 | if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] && [ -z $CLEAN ] ; then
|
---|
| 371 | eval "$no_empty_builddir"
|
---|
[9a536f7] | 372 | fi
|
---|
[4965fa8] | 373 |
|
---|
[7b6ecc5] | 374 | # If requested, clean the build directory
|
---|
| 375 | clean_builddir
|
---|
[4da2512] | 376 |
|
---|
[7b6ecc5] | 377 | if [[ ! -d $JHALFSDIR ]]; then
|
---|
| 378 | mkdir -p $JHALFSDIR
|
---|
| 379 | fi
|
---|
[3e7ceed] | 380 |
|
---|
[7b6ecc5] | 381 | # Create $BUILDDIR/sources even though it could be created by get_sources()
|
---|
| 382 | if [[ ! -d $BUILDDIR/sources ]]; then
|
---|
| 383 | mkdir -p $BUILDDIR/sources
|
---|
| 384 | fi
|
---|
| 385 | #
|
---|
| 386 | # Create the log directory
|
---|
| 387 | if [[ ! -d $LOGDIR ]]; then
|
---|
| 388 | mkdir $LOGDIR
|
---|
| 389 | fi
|
---|
| 390 | >$LOGDIR/$LOG
|
---|
| 391 | #
|
---|
[3e7ceed] | 392 | # Copy common helper files
|
---|
| 393 | cp $COMMON_DIR/{makefile-functions,progress_bar.sh,packages.xsl} $JHALFSDIR/
|
---|
[7b6ecc5] | 394 | #
|
---|
[3e7ceed] | 395 | # Fix the XSL book parser
|
---|
| 396 | sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
|
---|
| 397 | export XSL=$JHALFSDIR/${XSL}
|
---|
[7b6ecc5] | 398 | #
|
---|
| 399 |
|
---|
[7072e1f] | 400 | # Copy packageManager.xml, if needed
|
---|
| 401 | [[ "$PKGMNGT" = "y" ]] && [[ "$PROGNAME" = "lfs" ]] &&
|
---|
| 402 | cp $PKGMNGTDIR/packageManager.xml $JHALFSDIR/ &&
|
---|
| 403 | cp $PKGMNGTDIR/packInstall.sh $JHALFSDIR/
|
---|
| 404 | #
|
---|
[3e7ceed] | 405 | # Copy urls.xsl, if needed
|
---|
| 406 | [[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
|
---|
[7b6ecc5] | 407 | #
|
---|
[7072e1f] | 408 | # Copy APR patches, if needed
|
---|
| 409 | [[ "$DEP_SVN" = "y" ]] &&
|
---|
| 410 | cp $COMMON_DIR/blfs-tool-deps/apr*.patch $BUILDDIR/sources
|
---|
| 411 | #
|
---|
[3e7ceed] | 412 | # Create the test-log directory, if needed
|
---|
| 413 | [[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR
|
---|
| 414 | #
|
---|
[93346ee] | 415 | # Create the installed-files directory, if needed
|
---|
| 416 | [[ "$INSTALL_LOG" = "y" ]] && [[ ! -d $FILELOGDIR ]] && install -d -m 1777 $FILELOGDIR
|
---|
| 417 | #
|
---|
[3e7ceed] | 418 | # Prepare report creation, if needed
|
---|
[7b6ecc5] | 419 | if [[ "$REPORT" = "y" ]]; then
|
---|
| 420 | cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/
|
---|
[7072e1f] | 421 | # After making sure that all looks sane, dump the settings to a file
|
---|
[7b6ecc5] | 422 | # This file will be used to create the REPORT header
|
---|
| 423 | validate_config > $JHALFSDIR/jhalfs.config
|
---|
| 424 | fi
|
---|
| 425 | #
|
---|
[3e7ceed] | 426 | # Copy optimize files, if needed
|
---|
| 427 | [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
|
---|
[7b6ecc5] | 428 | #
|
---|
[3e7ceed] | 429 | # Copy compare files, if needed
|
---|
| 430 | if [[ "$COMPARE" = "y" ]]; then
|
---|
| 431 | mkdir -p $JHALFSDIR/extras
|
---|
| 432 | cp extras/* $JHALFSDIR/extras
|
---|
| 433 | fi
|
---|
[7b6ecc5] | 434 | #
|
---|
| 435 |
|
---|
[3e7ceed] | 436 | # Copy custom tools config files, if requested
|
---|
| 437 | if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
|
---|
| 438 | echo "Copying custom tool scripts to $JHALFSDIR"
|
---|
| 439 | mkdir -p $JHALFSDIR/custom-commands
|
---|
| 440 | cp -f custom/config/* $JHALFSDIR/custom-commands
|
---|
| 441 | fi
|
---|
| 442 | #
|
---|
[7b6ecc5] | 443 | # Install blfs-tool, if requested.
|
---|
| 444 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
| 445 | # Install the files
|
---|
| 446 | [[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -p ${BUILDDIR}${BLFS_ROOT}
|
---|
| 447 | cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
|
---|
| 448 | cp -r menu ${BUILDDIR}${BLFS_ROOT}
|
---|
| 449 | cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
|
---|
| 450 | cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
|
---|
| 451 | # Clean-up
|
---|
| 452 | rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
|
---|
| 453 | rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
|
---|
| 454 | rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
|
---|
| 455 | # Set some harcoded envars to their proper values
|
---|
| 456 | sed -i 's,blfs-xml,'$BLFS_XML',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,libs/book.xsl}
|
---|
| 457 | sed -i 's,tracking-dir,'$TRACKING_DIR',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,gen-makefile.sh}
|
---|
| 458 | # Copy the dependencies build scripts
|
---|
| 459 | cp -r $COMMON_DIR/blfs-tool-deps $JHALFSDIR/
|
---|
| 460 | rm -rf $JHALFSDIR/blfs-tool-deps/.svn
|
---|
| 461 | fi
|
---|
[3e7ceed] | 462 | #
|
---|
[7b6ecc5] | 463 |
|
---|
| 464 | get_book
|
---|
[4965fa8] | 465 | echo "${SD_BORDER}${nl_}"
|
---|
[7b6ecc5] | 466 |
|
---|
| 467 | # Get the BLFS book, if requested.
|
---|
| 468 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
| 469 | echo -n "Downloading the BLFS document, $BLFS_BRANCH_ID version... "
|
---|
| 470 | if [[ ! -d ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} ]] ; then
|
---|
| 471 | mkdir -p ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML}
|
---|
| 472 | svn co $SVN_2/BLFS/$BLFS_TREE ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} >>$LOGDIR/$LOG 2>&1
|
---|
| 473 | else
|
---|
| 474 | pushd ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} 1> /dev/null
|
---|
| 475 | svn up >>$LOGDIR/$LOG 2>&1
|
---|
| 476 | popd 1> /dev/null
|
---|
| 477 | fi
|
---|
| 478 | echo -ne "done\n"
|
---|
| 479 | echo "${SD_BORDER}${nl_}"
|
---|
| 480 | fi
|
---|
| 481 |
|
---|
[4965fa8] | 482 | fi
|
---|
| 483 |
|
---|
[0873ccc] | 484 | # When regenerating the Makefile, we need to know also the canonical book version
|
---|
[a16f769] | 485 | if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then
|
---|
| 486 | case $PROGNAME in
|
---|
[2639f65] | 487 | clfs | clfs2 | clfs3 )
|
---|
[a16f769] | 488 | VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
| 489 | *)
|
---|
| 490 | VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
| 491 | esac
|
---|
| 492 | fi
|
---|
| 493 |
|
---|
[4da2512] | 494 | build_Makefile
|
---|
[3e7ceed] | 495 |
|
---|
[4da2512] | 496 | echo "${SD_BORDER}${nl_}"
|
---|
| 497 |
|
---|
| 498 | run_make
|
---|