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