[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
|
---|
[92b7cb8] | 155 | clfs* ) TREE="" ;;
|
---|
[4965fa8] | 156 | *) TREE=trunk/BOOK ;;
|
---|
| 157 | esac
|
---|
| 158 | LFSVRS=development
|
---|
| 159 | ;;
|
---|
| 160 | *EDIT* ) echo " You forgot to set the branch or stable book version."
|
---|
| 161 | echo " Please rerun make and fix the configuration."
|
---|
| 162 | exit 2 ;;
|
---|
| 163 | branch-* )
|
---|
| 164 | LFSVRS=${BRANCH_ID}
|
---|
| 165 | TREE=branches/${BRANCH_ID#branch-}/BOOK
|
---|
| 166 | ;;
|
---|
| 167 | * )
|
---|
| 168 | case $PROGNAME in
|
---|
[e650dc7] | 169 | lfs )
|
---|
| 170 | LFSVRS=${BRANCH_ID}
|
---|
| 171 | TREE=tags/${BRANCH_ID}
|
---|
| 172 | if (( ${BRANCH_ID:0:1} < 7 )) ; then
|
---|
| 173 | TREE=${TREE}/BOOK
|
---|
| 174 | fi
|
---|
| 175 | ;;
|
---|
| 176 | hlfs )
|
---|
[4965fa8] | 177 | LFSVRS=${BRANCH_ID}
|
---|
| 178 | TREE=tags/${BRANCH_ID}/BOOK
|
---|
| 179 | ;;
|
---|
[92b7cb8] | 180 | clfs* )
|
---|
[4965fa8] | 181 | LFSVRS=${BRANCH_ID}
|
---|
[34d1b6a] | 182 | TREE=clfs-${BRANCH_ID}
|
---|
[4965fa8] | 183 | ;;
|
---|
[92b7cb8] | 184 | * )
|
---|
[4965fa8] | 185 | esac
|
---|
| 186 | ;;
|
---|
| 187 | esac
|
---|
| 188 |
|
---|
[4da2512] | 189 | # Set the document location...
|
---|
[1cf621b] | 190 | BOOK=${BOOK:=$JHALFSDIR/$PROGNAME-$LFSVRS}
|
---|
[4da2512] | 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
|
---|
[92b7cb8] | 275 | clfs ) declare -r GIT="git://git.cross-lfs.org/cross-lfs" ;;
|
---|
| 276 | clfs2 ) declare -r GIT="git://git.cross-lfs.org/clfs-sysroot" ;;
|
---|
| 277 | clfs3 ) declare -r GIT="git://git.cross-lfs.org/clfs-embedded" ;;
|
---|
| 278 | *) declare -r SVN="svn://svn.linuxfromscratch.org" ;;
|
---|
[728955b] | 279 | esac
|
---|
| 280 | declare -r LOG=000-masterscript.log
|
---|
[7072e1f] | 281 | # Needed for fetching BLFS book sources when building CLFS
|
---|
[728955b] | 282 | declare -r SVN_2="svn://svn.linuxfromscratch.org"
|
---|
| 283 |
|
---|
[4da2512] | 284 | # Set true internal variables
|
---|
| 285 | COMMON_DIR="common"
|
---|
[52b0d10] | 286 | PACKAGE_DIR=$(echo $PROGNAME | tr '[a-z]' '[A-Z]')
|
---|
[4da2512] | 287 | MODULE=$PACKAGE_DIR/master.sh
|
---|
[7072e1f] | 288 | PKGMNGTDIR="pkgmngt"
|
---|
| 289 | # The name packageManager.xml is hardcoded in *.xsl, so no variable.
|
---|
[4da2512] | 290 |
|
---|
| 291 | [[ $VERBOSITY > 0 ]] && echo -n "Loading common-functions module..."
|
---|
| 292 | source $COMMON_DIR/common-functions
|
---|
| 293 | [[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit
|
---|
| 294 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 295 | [[ $VERBOSITY > 0 ]] && echo -n "Loading code module <$MODULE>..."
|
---|
| 296 | source $MODULE
|
---|
| 297 | [[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2
|
---|
| 298 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 299 | #
|
---|
| 300 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
| 301 |
|
---|
| 302 |
|
---|
| 303 | #*******************************************************************#
|
---|
| 304 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
---|
[d517356] | 305 | source $COMMON_DIR/libs/func_check_version.sh
|
---|
[4da2512] | 306 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
| 307 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 308 |
|
---|
| 309 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
---|
[d517356] | 310 | source $COMMON_DIR/libs/func_validate_configs.sh
|
---|
[4da2512] | 311 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
| 312 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[9a536f7] | 313 |
|
---|
[fe30c61] | 314 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_custom_pkgs>..."
|
---|
| 315 | source $COMMON_DIR/libs/func_custom_pkgs
|
---|
[9a536f7] | 316 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
| 317 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 318 |
|
---|
| 319 |
|
---|
[4da2512] | 320 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
| 321 |
|
---|
| 322 |
|
---|
| 323 | ###################################
|
---|
| 324 | ### MAIN ###
|
---|
| 325 | ###################################
|
---|
| 326 |
|
---|
| 327 |
|
---|
| 328 | validate_config
|
---|
| 329 | echo "${SD_BORDER}${nl_}"
|
---|
| 330 | echo -n "Are you happy with these settings? yes/no (no): "
|
---|
| 331 | read ANSWER
|
---|
| 332 | if [ x$ANSWER != "xyes" ] ; then
|
---|
[881c96f] | 333 | echo "${nl_}Rerun make to fix the configuration options.${nl_}"
|
---|
[4da2512] | 334 | exit 1
|
---|
| 335 | fi
|
---|
| 336 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
| 337 |
|
---|
| 338 | # Load additional modules or configuration files based on global settings
|
---|
| 339 | # compare module
|
---|
| 340 | if [[ "$COMPARE" = "y" ]]; then
|
---|
| 341 | [[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..."
|
---|
[d517356] | 342 | source $COMMON_DIR/libs/func_compare.sh
|
---|
| 343 | [[ $? > 0 ]] && echo "$COMMON_DIR/libs/func_compare.sh did not load.." && exit
|
---|
[4da2512] | 344 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 345 | fi
|
---|
| 346 | #
|
---|
| 347 | # optimize module
|
---|
| 348 | if [[ "$OPTIMIZE" != "0" ]]; then
|
---|
| 349 | [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization module..."
|
---|
| 350 | source optimize/optimize_functions
|
---|
| 351 | [[ $? > 0 ]] && echo " optimize/optimize_functions did not load.." && exit
|
---|
| 352 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 353 | #
|
---|
| 354 | # optimize configurations
|
---|
| 355 | [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization config..."
|
---|
| 356 | source optimize/opt_config
|
---|
| 357 | [[ $? > 0 ]] && echo " optimize/opt_config did not load.." && exit
|
---|
| 358 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 359 | # Validate optimize settings, if required
|
---|
| 360 | validate_opt_settings
|
---|
| 361 | fi
|
---|
| 362 | #
|
---|
| 363 |
|
---|
[a16f769] | 364 | if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
|
---|
[4da2512] | 365 |
|
---|
[7b6ecc5] | 366 | # If $BUILDDIR has subdirectories like tools/ or bin/, stop the run
|
---|
| 367 | # and notify the user about that.
|
---|
| 368 | if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] && [ -z $CLEAN ] ; then
|
---|
| 369 | eval "$no_empty_builddir"
|
---|
[9a536f7] | 370 | fi
|
---|
[4965fa8] | 371 |
|
---|
[7b6ecc5] | 372 | # If requested, clean the build directory
|
---|
| 373 | clean_builddir
|
---|
[4da2512] | 374 |
|
---|
[7b6ecc5] | 375 | if [[ ! -d $JHALFSDIR ]]; then
|
---|
| 376 | mkdir -p $JHALFSDIR
|
---|
| 377 | fi
|
---|
[3e7ceed] | 378 |
|
---|
[7b6ecc5] | 379 | # Create $BUILDDIR/sources even though it could be created by get_sources()
|
---|
| 380 | if [[ ! -d $BUILDDIR/sources ]]; then
|
---|
| 381 | mkdir -p $BUILDDIR/sources
|
---|
| 382 | fi
|
---|
| 383 | #
|
---|
| 384 | # Create the log directory
|
---|
| 385 | if [[ ! -d $LOGDIR ]]; then
|
---|
| 386 | mkdir $LOGDIR
|
---|
| 387 | fi
|
---|
| 388 | >$LOGDIR/$LOG
|
---|
| 389 | #
|
---|
[3e7ceed] | 390 | # Copy common helper files
|
---|
| 391 | cp $COMMON_DIR/{makefile-functions,progress_bar.sh,packages.xsl} $JHALFSDIR/
|
---|
[7b6ecc5] | 392 | #
|
---|
[3e7ceed] | 393 | # Fix the XSL book parser
|
---|
[92b7cb8] | 394 | case $PROGNAME in
|
---|
| 395 | clfs* ) sed 's,FAKEDIR,'${BOOK}/BOOK',' ${PACKAGE_DIR}/${XSL} > $JHALFSDIR/${XSL} ;;
|
---|
| 396 | lfs | hlfs ) sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL} ;;
|
---|
| 397 | * ) ;;
|
---|
| 398 | esac
|
---|
[3e7ceed] | 399 | export XSL=$JHALFSDIR/${XSL}
|
---|
[7b6ecc5] | 400 | #
|
---|
| 401 |
|
---|
[7072e1f] | 402 | # Copy packageManager.xml, if needed
|
---|
| 403 | [[ "$PKGMNGT" = "y" ]] && [[ "$PROGNAME" = "lfs" ]] &&
|
---|
| 404 | cp $PKGMNGTDIR/packageManager.xml $JHALFSDIR/ &&
|
---|
| 405 | cp $PKGMNGTDIR/packInstall.sh $JHALFSDIR/
|
---|
| 406 | #
|
---|
[3e7ceed] | 407 | # Copy urls.xsl, if needed
|
---|
| 408 | [[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
|
---|
[7b6ecc5] | 409 | #
|
---|
[7072e1f] | 410 | # Copy APR patches, if needed
|
---|
| 411 | [[ "$DEP_SVN" = "y" ]] &&
|
---|
| 412 | cp $COMMON_DIR/blfs-tool-deps/apr*.patch $BUILDDIR/sources
|
---|
| 413 | #
|
---|
[3e7ceed] | 414 | # Create the test-log directory, if needed
|
---|
| 415 | [[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR
|
---|
| 416 | #
|
---|
[93346ee] | 417 | # Create the installed-files directory, if needed
|
---|
| 418 | [[ "$INSTALL_LOG" = "y" ]] && [[ ! -d $FILELOGDIR ]] && install -d -m 1777 $FILELOGDIR
|
---|
| 419 | #
|
---|
[3e7ceed] | 420 | # Prepare report creation, if needed
|
---|
[7b6ecc5] | 421 | if [[ "$REPORT" = "y" ]]; then
|
---|
| 422 | cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/
|
---|
[7072e1f] | 423 | # After making sure that all looks sane, dump the settings to a file
|
---|
[7b6ecc5] | 424 | # This file will be used to create the REPORT header
|
---|
| 425 | validate_config > $JHALFSDIR/jhalfs.config
|
---|
| 426 | fi
|
---|
| 427 | #
|
---|
[3e7ceed] | 428 | # Copy optimize files, if needed
|
---|
| 429 | [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
|
---|
[7b6ecc5] | 430 | #
|
---|
[3e7ceed] | 431 | # Copy compare files, if needed
|
---|
| 432 | if [[ "$COMPARE" = "y" ]]; then
|
---|
| 433 | mkdir -p $JHALFSDIR/extras
|
---|
| 434 | cp extras/* $JHALFSDIR/extras
|
---|
| 435 | fi
|
---|
[7b6ecc5] | 436 | #
|
---|
| 437 |
|
---|
[3e7ceed] | 438 | # Copy custom tools config files, if requested
|
---|
| 439 | if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
|
---|
| 440 | echo "Copying custom tool scripts to $JHALFSDIR"
|
---|
| 441 | mkdir -p $JHALFSDIR/custom-commands
|
---|
| 442 | cp -f custom/config/* $JHALFSDIR/custom-commands
|
---|
| 443 | fi
|
---|
| 444 | #
|
---|
[7b6ecc5] | 445 | # Install blfs-tool, if requested.
|
---|
| 446 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
| 447 | # Install the files
|
---|
| 448 | [[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -p ${BUILDDIR}${BLFS_ROOT}
|
---|
| 449 | cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
|
---|
| 450 | cp -r menu ${BUILDDIR}${BLFS_ROOT}
|
---|
| 451 | cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
|
---|
| 452 | cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
|
---|
| 453 | # Clean-up
|
---|
| 454 | rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
|
---|
| 455 | rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
|
---|
| 456 | rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
|
---|
| 457 | # Set some harcoded envars to their proper values
|
---|
| 458 | sed -i 's,blfs-xml,'$BLFS_XML',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,libs/book.xsl}
|
---|
| 459 | sed -i 's,tracking-dir,'$TRACKING_DIR',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,gen-makefile.sh}
|
---|
| 460 | # Copy the dependencies build scripts
|
---|
| 461 | cp -r $COMMON_DIR/blfs-tool-deps $JHALFSDIR/
|
---|
| 462 | rm -rf $JHALFSDIR/blfs-tool-deps/.svn
|
---|
| 463 | fi
|
---|
[3e7ceed] | 464 | #
|
---|
[7b6ecc5] | 465 |
|
---|
[1cf621b] | 466 | # Download or updates the book source
|
---|
[7b6ecc5] | 467 | get_book
|
---|
[1cf621b] | 468 | extract_commands
|
---|
[4965fa8] | 469 | echo "${SD_BORDER}${nl_}"
|
---|
[7b6ecc5] | 470 |
|
---|
| 471 | # Get the BLFS book, if requested.
|
---|
| 472 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
| 473 | echo -n "Downloading the BLFS document, $BLFS_BRANCH_ID version... "
|
---|
| 474 | if [[ ! -d ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} ]] ; then
|
---|
| 475 | mkdir -p ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML}
|
---|
| 476 | svn co $SVN_2/BLFS/$BLFS_TREE ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} >>$LOGDIR/$LOG 2>&1
|
---|
| 477 | else
|
---|
| 478 | pushd ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} 1> /dev/null
|
---|
| 479 | svn up >>$LOGDIR/$LOG 2>&1
|
---|
| 480 | popd 1> /dev/null
|
---|
| 481 | fi
|
---|
| 482 | echo -ne "done\n"
|
---|
| 483 | echo "${SD_BORDER}${nl_}"
|
---|
| 484 | fi
|
---|
| 485 |
|
---|
[4965fa8] | 486 | fi
|
---|
| 487 |
|
---|
[0873ccc] | 488 | # When regenerating the Makefile, we need to know also the canonical book version
|
---|
[a16f769] | 489 | if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then
|
---|
| 490 | case $PROGNAME in
|
---|
[92b7cb8] | 491 | clfs* )
|
---|
[a16f769] | 492 | VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
| 493 | *)
|
---|
| 494 | VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
| 495 | esac
|
---|
| 496 | fi
|
---|
| 497 |
|
---|
[4da2512] | 498 | build_Makefile
|
---|
[3e7ceed] | 499 |
|
---|
[4da2512] | 500 | echo "${SD_BORDER}${nl_}"
|
---|
| 501 |
|
---|
[1cf621b] | 502 | # Check for build prerequisites.
|
---|
| 503 | echo
|
---|
| 504 | cd $CWD
|
---|
| 505 | check_prerequisites
|
---|
| 506 | echo "${SD_BORDER}${nl_}"
|
---|
| 507 | # All is well, run the build (if requested)
|
---|
[4da2512] | 508 | run_make
|
---|