[fbb6b78] | 1 | #!/bin/sh
|
---|
[1236262] | 2 |
|
---|
| 3 | version="
|
---|
[63b2859] | 4 | jhalfs development
|
---|
| 5 |
|
---|
[db9cec6] | 6 | Originally written by Jeremy Huntwork.
|
---|
[557fe91] | 7 | Maintained by Manuel Canales Esparcia.
|
---|
[1236262] | 8 |
|
---|
| 9 | This program is published under the \
|
---|
[557fe91] | 10 | Gnu General Public License, Version 2.
|
---|
| 11 | "
|
---|
[1236262] | 12 |
|
---|
| 13 | usage="\
|
---|
| 14 | Usage: $0 [OPTION]
|
---|
| 15 |
|
---|
| 16 | Options:
|
---|
[557fe91] | 17 | -h, --help print this help, then exit
|
---|
[24530379] | 18 |
|
---|
[557fe91] | 19 | -V, --version print version number, then exit
|
---|
[24530379] | 20 |
|
---|
[a41ce58] | 21 | -d --directory DIR use DIR directory for building LFS; all files
|
---|
[557fe91] | 22 | jhalfs produces will be in the directory
|
---|
[af47a19] | 23 | DIR/jhalfs. Default is \"/mnt/lfs\".
|
---|
[24530379] | 24 |
|
---|
| 25 | -P, --get-packages download the packages and patches
|
---|
| 26 |
|
---|
[a41ce58] | 27 | -D, --download-client CLIENT use CLIENT as the program for retrieving
|
---|
[24530379] | 28 | packages (for use in conjunction with -P)
|
---|
| 29 |
|
---|
[a41ce58] | 30 | -W, --working-copy DIR use the local working copy placed in DIR
|
---|
[24530379] | 31 | as the LFS book
|
---|
| 32 |
|
---|
[a41ce58] | 33 | -L, --LFS-version VER ckeckout VER version of the LFS book
|
---|
[24530379] | 34 |
|
---|
| 35 | -T, --testsuites add support to run the optional testsuites
|
---|
| 36 |
|
---|
[01e51a1] | 37 | --no-toolchain-test don't run the toolchain testsuites. This
|
---|
| 38 | disables also the build of TCL, Expect
|
---|
| 39 | and DejaGNU
|
---|
| 40 |
|
---|
[a41ce58] | 41 | --page_size PAGE set PAGE as the default page size (letter,
|
---|
| 42 | A4, or others). This setting is required to
|
---|
[af47a19] | 43 | build Groff. If not specified, \"letter\"
|
---|
| 44 | will be used.
|
---|
[cf7f294] | 45 |
|
---|
| 46 | -C, --kernel-config FILE use the kernel configuration file specified
|
---|
| 47 | in FILE to build the kernel. If not found,
|
---|
| 48 | the kernel build is skipped.
|
---|
| 49 |
|
---|
| 50 | -M, --run-make run make on the generated Makefile
|
---|
| 51 |
|
---|
[1236262] | 52 | "
|
---|
| 53 |
|
---|
| 54 | help="\
|
---|
| 55 | Try '$0 --help' for more information."
|
---|
| 56 |
|
---|
| 57 | exit_missing_arg="\
|
---|
| 58 | echo \"Option '\$1' requires an argument\" >&2
|
---|
| 59 | echo \"\$help\" >&2
|
---|
| 60 | exit 1"
|
---|
| 61 |
|
---|
| 62 | no_dl_client="\
|
---|
| 63 | echo \"Could not find a way to download the LFS sources.\" >&2
|
---|
| 64 | echo \"Attempting to continue.\" >&2"
|
---|
| 65 |
|
---|
| 66 | while test $# -gt 0 ; do
|
---|
[557fe91] | 67 | case $1 in
|
---|
| 68 | --version | -V )
|
---|
| 69 | echo "$version"
|
---|
| 70 | exit 0
|
---|
| 71 | ;;
|
---|
| 72 |
|
---|
| 73 | --help | -h )
|
---|
| 74 | echo "$usage"
|
---|
| 75 | exit 0
|
---|
| 76 | ;;
|
---|
| 77 |
|
---|
| 78 | --LFS-version | -L )
|
---|
| 79 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 80 | shift
|
---|
| 81 | case $1 in
|
---|
| 82 | dev* | SVN | trunk )
|
---|
| 83 | LFSVRS=development
|
---|
| 84 | ;;
|
---|
| 85 | * )
|
---|
| 86 | echo "$1 is an unsupported version at this time."
|
---|
| 87 | exit 1
|
---|
| 88 | ;;
|
---|
| 89 | esac
|
---|
| 90 | shift
|
---|
| 91 | ;;
|
---|
| 92 |
|
---|
| 93 | --directory | -d )
|
---|
| 94 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 95 | shift
|
---|
| 96 | BUILDDIR=$1
|
---|
| 97 | shift
|
---|
| 98 | ;;
|
---|
| 99 |
|
---|
| 100 | --download-client | -D )
|
---|
| 101 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 102 | shift
|
---|
| 103 | DL=$1
|
---|
| 104 | shift
|
---|
| 105 | ;;
|
---|
| 106 |
|
---|
[24530379] | 107 | --working-copy | -W )
|
---|
| 108 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 109 | shift
|
---|
| 110 | WC=1
|
---|
| 111 | BOOK=$1
|
---|
| 112 | shift
|
---|
| 113 | ;;
|
---|
| 114 |
|
---|
[d310939] | 115 | --testsuites | -T )
|
---|
[db9cec6] | 116 | TEST=1
|
---|
| 117 | shift
|
---|
| 118 | ;;
|
---|
| 119 |
|
---|
[d310939] | 120 | --get-packages | -P )
|
---|
[07f47df] | 121 | HPKG=1
|
---|
| 122 | shift
|
---|
| 123 | ;;
|
---|
| 124 |
|
---|
[d310939] | 125 | --run-make | -M )
|
---|
| 126 | RUNMAKE=1
|
---|
| 127 | shift
|
---|
| 128 | ;;
|
---|
| 129 |
|
---|
[a41ce58] | 130 | --page_size )
|
---|
| 131 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 132 | shift
|
---|
| 133 | PAGE=$1
|
---|
| 134 | shift
|
---|
| 135 | ;;
|
---|
| 136 |
|
---|
[01e51a1] | 137 | --no-toolchain-test )
|
---|
| 138 | TOOLCHAINTEST=0
|
---|
| 139 | shift
|
---|
| 140 | ;;
|
---|
| 141 |
|
---|
[cf7f294] | 142 | --kernel-config | -C )
|
---|
| 143 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 144 | shift
|
---|
| 145 | if [ -f $1 ] ; then
|
---|
| 146 | CONFIG=$1
|
---|
| 147 | else
|
---|
| 148 | echo -e "\nFile $1 not found, Skipping kernel build.\n"
|
---|
| 149 | fi
|
---|
| 150 | shift
|
---|
| 151 | ;;
|
---|
| 152 |
|
---|
[557fe91] | 153 | * )
|
---|
| 154 | echo "$usage"
|
---|
| 155 | exit 1
|
---|
| 156 | ;;
|
---|
| 157 | esac
|
---|
[1236262] | 158 | done
|
---|
| 159 |
|
---|
| 160 | # Test to make sure we're running the build as root
|
---|
| 161 |
|
---|
| 162 | if [ "$UID" != "0" ] ; then
|
---|
[557fe91] | 163 | echo "You must be logged in as root to successfully build LFS."
|
---|
| 164 | exit 1
|
---|
[1236262] | 165 | fi
|
---|
| 166 |
|
---|
| 167 | # Find the download client to use, if not already specified.
|
---|
| 168 |
|
---|
| 169 | if [ -z $DL ] ; then
|
---|
| 170 | if [ `type -p wget` ] ; then
|
---|
[557fe91] | 171 | DL=wget
|
---|
[1236262] | 172 | elif [ `type -p curl` ] ; then
|
---|
[557fe91] | 173 | DL=curl
|
---|
[1236262] | 174 | else
|
---|
[557fe91] | 175 | eval "$no_dl_client"
|
---|
[1236262] | 176 | fi
|
---|
| 177 | fi
|
---|
| 178 |
|
---|
| 179 | SVN="svn://svn.linuxfromscratch.org"
|
---|
| 180 | HTTP=http://ftp.lfs-matrix.net/pub/lfs/lfs-packages/conglomeration
|
---|
[48d7968] | 181 | if [ -z $BUILDDIR ] ; then BUILDDIR=/mnt/lfs ; fi
|
---|
[4dafc45] | 182 | JHALFSDIR=$BUILDDIR/jhalfs
|
---|
[4c62c61] | 183 | LOGDIR=$JHALFSDIR/logs
|
---|
[a5e49c6] | 184 | LOG=000-jhalfs.log
|
---|
[f8de156] | 185 | MKFILE=$JHALFSDIR/Makefile
|
---|
[3cfe871] | 186 | XSL=dump-lfs-scripts.xsl
|
---|
[0fc4c75] | 187 | FNC=functions
|
---|
[db9cec6] | 188 | if [ -z $TEST ] ; then TEST=0 ; fi
|
---|
[01e51a1] | 189 | if [ -z $TOOLCHAINTEST ] ; then TOOLCHAINTEST=1 ; fi
|
---|
[a41ce58] | 190 | if [ -z $PAGE ] ; then PAGE=letter ; fi
|
---|
[1236262] | 191 |
|
---|
[8bb92e7] | 192 | HEADER="# This file is automatically generated by jhalfs
|
---|
| 193 | # DO NOT EDIT THIS FILE MANUALLY
|
---|
| 194 | #
|
---|
| 195 | # Generated on `date \"+%F %X %Z\"`"
|
---|
| 196 |
|
---|
[1236262] | 197 | get_book() {
|
---|
| 198 | # Check for Subversion instead of just letting the script hit 'svn' and fail.
|
---|
| 199 | test `type -p svn` || eval "echo \"This feature requires Subversion.\"
|
---|
[557fe91] | 200 | exit 1"
|
---|
[4dafc45] | 201 | cd $JHALFSDIR
|
---|
[fbb6b78] | 202 |
|
---|
[1236262] | 203 | # Test to make sure the LFS version is set
|
---|
| 204 | if [ -z $LFSVRS ] ; then LFSVRS=development ; fi
|
---|
[24530379] | 205 |
|
---|
[56dd1e2] | 206 | # Set the book's sources directory
|
---|
[24530379] | 207 | if [ -z $BOOK ] ; then BOOK=lfs-$LFSVRS ; fi
|
---|
| 208 |
|
---|
| 209 | if [ -z $WC ] ; then
|
---|
| 210 | echo -n "Downloading the LFS Book, version $LFSVRS... "
|
---|
| 211 |
|
---|
| 212 | # Grab the LFS book fresh if it's missing, otherwise, update it from the
|
---|
| 213 | # repo. If we've already extracted the commands, move on to getting the
|
---|
| 214 | # sources.
|
---|
| 215 | if [ -d lfs-$LFSVRS ] ; then
|
---|
| 216 | cd lfs-$LFSVRS
|
---|
| 217 | if svn up | grep -q At && test -d $JHALFSDIR/commands && \
|
---|
| 218 | test -f $JHALFSDIR/packages && test -f $JHALFSDIR/patches ; then
|
---|
| 219 | echo -ne "done\n"
|
---|
| 220 | get_sources
|
---|
| 221 | else
|
---|
| 222 | echo -ne "done\n"
|
---|
| 223 | extract_commands
|
---|
| 224 | fi
|
---|
[557fe91] | 225 | else
|
---|
[24530379] | 226 | if [ $LFSVRS = development ] ; then
|
---|
[4c62c61] | 227 | svn co $SVN/LFS/trunk/BOOK lfs-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
---|
[24530379] | 228 | else
|
---|
[4c62c61] | 229 | svn co $SVN/LFS/branches/$LFSVRS/BOOK lfs-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
---|
[24530379] | 230 | fi
|
---|
[557fe91] | 231 | echo -ne "done\n"
|
---|
| 232 | extract_commands
|
---|
| 233 | fi
|
---|
[1236262] | 234 | else
|
---|
[24530379] | 235 | echo -ne "Using $BOOK as book's sources ...\n"
|
---|
[557fe91] | 236 | extract_commands
|
---|
[1236262] | 237 | fi
|
---|
| 238 | }
|
---|
| 239 |
|
---|
| 240 | extract_commands() {
|
---|
| 241 | # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
|
---|
| 242 | test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
|
---|
[557fe91] | 243 | exit 1"
|
---|
[4dafc45] | 244 | cd $JHALFSDIR
|
---|
[1236262] | 245 |
|
---|
| 246 | # Start clean
|
---|
| 247 | if [ -d commands ] ; then rm -rf commands ; fi && mkdir commands
|
---|
| 248 | echo -n "Extracting commands... "
|
---|
| 249 |
|
---|
[dc2fee8] | 250 | # Dump the commands in shell script form from the LFS book.
|
---|
[01e51a1] | 251 | xsltproc --nonet --xinclude --stringparam testsuite $TEST \
|
---|
| 252 | --stringparam toolchaintest $TOOLCHAINTEST -o ./commands/ \
|
---|
| 253 | $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
---|
[1236262] | 254 |
|
---|
[af47a19] | 255 | # Make the scripts executable.
|
---|
[dc44153] | 256 | chmod -R +x $JHALFSDIR/commands
|
---|
| 257 |
|
---|
[1236262] | 258 | # Grab the patches and package names.
|
---|
[4dafc45] | 259 | cd $JHALFSDIR
|
---|
[1236262] | 260 | for i in patches packages ; do rm -f $i ; done
|
---|
[24530379] | 261 | grep "\-version" $BOOK/general.ent | sed -e 's@<!ENTITY @@' -e 's@">@"@' \
|
---|
[557fe91] | 262 | -e '/generic/d' >> packages
|
---|
[0a9117e] | 263 | echo `grep "glibc" packages | sed 's@glibc@glibc-linuxthreads@'` >> packages
|
---|
[24530379] | 264 | grep "ENTITY" $BOOK/patches.ent | sed -e 's/.* "//' -e 's/">//' >> patches
|
---|
[1236262] | 265 |
|
---|
| 266 | # Done. Moving on...
|
---|
| 267 | echo -ne "done\n"
|
---|
| 268 | get_sources
|
---|
| 269 | }
|
---|
| 270 |
|
---|
| 271 | download() {
|
---|
| 272 | cd $BUILDDIR/sources
|
---|
| 273 |
|
---|
[0a9117e] | 274 | # Hackish fix for the bash-doc and glibc-linuxthreads packages that
|
---|
| 275 | # doesn't conform to norms in the URL scheme.
|
---|
| 276 | DIR=`echo $1 | sed -e 's@-doc@@' -e 's@-linuxthreads@@'`
|
---|
[1236262] | 277 |
|
---|
| 278 | # Find the md5 sum for this package.
|
---|
| 279 | if [ $2 != MD5SUMS ] ; then MD5=`grep " $2" MD5SUMS` ; fi
|
---|
| 280 |
|
---|
| 281 | if [ ! -f $2 ] ; then
|
---|
[557fe91] | 282 | case $DL in
|
---|
| 283 | wget )
|
---|
| 284 | wget $HTTP/$DIR/$2
|
---|
| 285 | ;;
|
---|
| 286 | curl )
|
---|
| 287 | `curl -# $HTTP/$DIR/$2 -o $2`
|
---|
| 288 | ;;
|
---|
| 289 | * )
|
---|
| 290 | echo "$DL not supported at this time."
|
---|
| 291 | ;;
|
---|
| 292 | esac
|
---|
[1236262] | 293 | elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then
|
---|
[557fe91] | 294 | case $DL in
|
---|
| 295 | wget )
|
---|
| 296 | wget -c $HTTP/$DIR/$2
|
---|
| 297 | ;;
|
---|
| 298 | curl )
|
---|
| 299 | `curl -# -C - $HTTP/$DIR/$2 -o $2`
|
---|
| 300 | ;;
|
---|
| 301 | * )
|
---|
| 302 | echo "$DL not supported at this time."
|
---|
| 303 | ;;
|
---|
| 304 | esac
|
---|
[1236262] | 305 | fi
|
---|
| 306 | if [ $2 != MD5SUMS ] && ! echo "$MD5" | md5sum -c - ; then
|
---|
| 307 | exit 1
|
---|
| 308 | fi
|
---|
| 309 | }
|
---|
| 310 |
|
---|
| 311 | get_sources() {
|
---|
| 312 |
|
---|
[07f47df] | 313 | # Test if the packages must be downloaded
|
---|
[d310939] | 314 | if [ "$HPKG" = "1" ] ; then
|
---|
[1236262] | 315 |
|
---|
[07f47df] | 316 | # This variable is necessary to make sure the `cat $JHALFSDIR/packages`
|
---|
| 317 | # separates each iteration by lines. It is necessary to have the second
|
---|
| 318 | # ' on the next line.
|
---|
| 319 | IFS='
|
---|
| 320 | '
|
---|
[1236262] | 321 |
|
---|
[07f47df] | 322 | if [ ! -d $BUILDDIR/sources ] ; then mkdir $BUILDDIR/sources ; fi
|
---|
| 323 | cd $BUILDDIR/sources
|
---|
| 324 | if [ -f MD5SUMS ] ; then rm MD5SUMS ; fi
|
---|
| 325 |
|
---|
| 326 | download "" MD5SUMS
|
---|
| 327 |
|
---|
| 328 | # Iterate through each package and grab it, along with any patches it needs.
|
---|
| 329 | for i in `cat $JHALFSDIR/packages` ; do
|
---|
| 330 | PKG=`echo $i | sed 's/-version.*//'`
|
---|
| 331 |
|
---|
| 332 | # Someone used some silly entities right next to the valid package entities.
|
---|
| 333 | if [ "$PKG" = "expect-lib" -o "$PKG" = "linux-dl" ] ; then continue ; fi
|
---|
| 334 |
|
---|
| 335 | VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 336 | if [ "$PKG" = "tcl" ] ; then
|
---|
| 337 | FILE="$PKG$VRS-src.tar.bz2"
|
---|
| 338 | else
|
---|
| 339 | FILE="$PKG-$VRS.tar.bz2"
|
---|
| 340 | fi
|
---|
| 341 | download $PKG $FILE
|
---|
| 342 | for patch in `grep "$PKG-&$PKG" $JHALFSDIR/patches` ; do
|
---|
| 343 | PATCH=`echo $patch | sed 's@&'$PKG'-version;@'$VRS'@'`
|
---|
| 344 | download $PKG $PATCH
|
---|
| 345 | done
|
---|
[fbb6b78] | 346 | done
|
---|
[0a9117e] | 347 | # Hardcoded Udev configuration file until find a better way
|
---|
| 348 | download udev udev-config-3.rules
|
---|
[07f47df] | 349 | fi
|
---|
[1236262] | 350 | }
|
---|
| 351 |
|
---|
[f8de156] | 352 | build_Makefile() {
|
---|
[9e406b5] | 353 | echo -n "Creating Makefile... "
|
---|
[f8de156] | 354 | cd $JHALFSDIR/commands
|
---|
[fbb6b78] | 355 |
|
---|
[f8de156] | 356 | # Start with a clean Makefile.tmp file
|
---|
| 357 | >$MKFILE.tmp
|
---|
| 358 |
|
---|
[0bad6ba] | 359 | for file in chapter05/* ; do
|
---|
[71642ef] | 360 | # Keep the script file name
|
---|
| 361 | i=`basename $file`
|
---|
[63b2859] | 362 |
|
---|
[01e51a1] | 363 | # If no testsuites will be run, then TCL, Expect and DejaGNU isn't needed
|
---|
| 364 | if [ "$TOOLCHAINTEST" = "0" ]; then
|
---|
| 365 | if echo $i | grep -q "tcl" ; then
|
---|
| 366 | continue
|
---|
| 367 | elif echo $i | grep -q "expect" ; then
|
---|
| 368 | continue
|
---|
| 369 | elif echo $i | grep -q "dejagnu" ; then
|
---|
| 370 | continue
|
---|
| 371 | fi
|
---|
| 372 | fi
|
---|
| 373 |
|
---|
[71642ef] | 374 | # First append each name of the script files to a list (this will become
|
---|
| 375 | # the names of the targets in the Makefile
|
---|
| 376 | chapter5="$chapter5 $i"
|
---|
[557fe91] | 377 |
|
---|
[71642ef] | 378 | # Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
|
---|
| 379 | # and binutils in chapter 5)
|
---|
| 380 | name=`echo $i | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'`
|
---|
[557fe91] | 381 |
|
---|
[e909d9d] | 382 | # Set the dependency for the first target.
|
---|
| 383 | if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
|
---|
| 384 |
|
---|
| 385 | # Drop in the name of the target on a new line, and the previous target
|
---|
[0fc4c75] | 386 | # as a dependency. Also call the echo_message function.
|
---|
[3f990d1] | 387 | (
|
---|
| 388 | cat << EOF
|
---|
| 389 |
|
---|
| 390 | $i: $PREV
|
---|
| 391 | @\$(call echo_message, Building)
|
---|
| 392 | EOF
|
---|
| 393 | ) >> $MKFILE.tmp
|
---|
[557fe91] | 394 |
|
---|
[71642ef] | 395 | # Find the version of the command files, if it corresponds with the building of
|
---|
| 396 | # a specific package
|
---|
| 397 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
[557fe91] | 398 |
|
---|
[71642ef] | 399 | # If $vrs isn't empty, we've got a package...
|
---|
| 400 | if [ "$vrs" != "" ] ; then
|
---|
| 401 | if [ "$name" = "tcl" ] ; then
|
---|
| 402 | FILE="$name$vrs-src.tar.bz2"
|
---|
| 403 | else
|
---|
| 404 | FILE="$name-$vrs.tar.bz2"
|
---|
| 405 | fi
|
---|
[557fe91] | 406 |
|
---|
[71642ef] | 407 | # Insert instructions for unpacking the package and to set
|
---|
| 408 | # the PKGDIR variable.
|
---|
[3f990d1] | 409 | (
|
---|
| 410 | cat << EOF
|
---|
| 411 | @\$(call unpack,$FILE)
|
---|
[eaa021a] | 412 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[3f990d1] | 413 | chown -R lfs \$(LFS)\$(SRC)/\$\$ROOT && \\
|
---|
| 414 | echo "PKGDIR=\$(LFS)\$(SRC)/\$\$ROOT" > envars && \\
|
---|
| 415 | echo "export PKGDIR" >> envars && \\
|
---|
| 416 | EOF
|
---|
| 417 | ) >> $MKFILE.tmp
|
---|
| 418 |
|
---|
[71642ef] | 419 | fi
|
---|
[557fe91] | 420 |
|
---|
[4c62c61] | 421 | # Dump the path to the Binutils or TCL sources directory.
|
---|
| 422 | if [ "$i" = "027-binutils-pass1" -o "$i" = "032-tcl" -o "$i" = "036-binutils-pass2" ] ; then
|
---|
[3f990d1] | 423 | (
|
---|
| 424 | cat << EOF
|
---|
| 425 | echo "\$(LFS)\$(SRC)/\$\$ROOT" > sources-dir
|
---|
| 426 | EOF
|
---|
| 427 | ) >> $MKFILE.tmp
|
---|
[88dcce5] | 428 |
|
---|
[71642ef] | 429 | # For the Adjusting phase we must to cd to the binutils-build directory.
|
---|
[0fc4c75] | 430 | elif [ "$i" = "031-adjusting" ] ; then
|
---|
[3f990d1] | 431 | (
|
---|
| 432 | cat << EOF
|
---|
| 433 | @echo "PKGDIR=\$(LFS)\$(SRC)/binutils-build" > envars && \\
|
---|
| 434 | echo "export PKGDIR" >> envars
|
---|
| 435 | EOF
|
---|
| 436 | ) >> $MKFILE.tmp
|
---|
[0209bb7] | 437 |
|
---|
[97a3ffc] | 438 | # For the Expect build we need to set the TCLPATH envar.
|
---|
[0fc4c75] | 439 | elif [ "$i" = "033-expect" ] ; then
|
---|
[3f990d1] | 440 | (
|
---|
| 441 | cat << EOF
|
---|
| 442 | echo "TCLPATH=\`cat sources-dir\`" >> envars && \\
|
---|
| 443 | echo "export TCLPATH" >> envars
|
---|
| 444 | EOF
|
---|
| 445 | ) >> $MKFILE.tmp
|
---|
[0fc4c75] | 446 |
|
---|
| 447 | # Everything else, add a true statment so we don't confuse make
|
---|
| 448 | else
|
---|
[3f990d1] | 449 | (
|
---|
| 450 | cat << EOF
|
---|
| 451 | true
|
---|
| 452 | EOF
|
---|
| 453 | ) >> $MKFILE.tmp
|
---|
[71642ef] | 454 | fi
|
---|
[557fe91] | 455 |
|
---|
[3f990d1] | 456 | # Insert date and disk usage at the top of the log file, the script run
|
---|
| 457 | # and date and disk usage again at the bottom of the log file.
|
---|
| 458 | (
|
---|
| 459 | cat << EOF
|
---|
| 460 | @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
| 461 | su - lfs -c "source /home/lfs/.bashrc && $JHALFSDIR/commands/$file" >>logs/$i 2>&1 && \\
|
---|
| 462 | echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\n" >>logs/$i
|
---|
| 463 | EOF
|
---|
| 464 | ) >> $MKFILE.tmp
|
---|
[71642ef] | 465 |
|
---|
[cf7f294] | 466 | # Remove the build directory(ies) except if the package build fails
|
---|
| 467 | # (to can review config.cache, config.log, and like.)
|
---|
| 468 | # For Binutils and TCL the sources must be retained some time.
|
---|
[71642ef] | 469 | if [ "$vrs" != "" ] ; then
|
---|
[d310939] | 470 | if [ "$i" != "027-binutils-pass1" ] && [ "$i" != "032-tcl" ] && [ "$i" != "036-binutils-pass2" ] ; then
|
---|
[3f990d1] | 471 | (
|
---|
| 472 | cat << EOF
|
---|
[eaa021a] | 473 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[3f990d1] | 474 | rm -r \$(LFS)\$(SRC)/\$\$ROOT && \\
|
---|
| 475 | if [ -e \$(LFS)\$(SRC)/$name-build ]; then \\
|
---|
| 476 | rm -r \$(LFS)\$(SRC)/$name-build; \\
|
---|
| 477 | fi;
|
---|
| 478 | EOF
|
---|
| 479 | ) >> $MKFILE.tmp
|
---|
[71642ef] | 480 | fi
|
---|
| 481 | fi
|
---|
[7bbd436] | 482 |
|
---|
| 483 | # Remove the Binutils pass 1 sources after a successful Adjusting phase.
|
---|
| 484 | if [ "$i" = "031-adjusting" ] ; then
|
---|
[3f990d1] | 485 | (
|
---|
| 486 | cat << EOF
|
---|
| 487 | @rm -r \`cat sources-dir\` && \\
|
---|
| 488 | rm -r \$(LFS)\$(SRC)/binutils-build && \\
|
---|
| 489 | rm sources-dir
|
---|
| 490 | EOF
|
---|
| 491 | ) >> $MKFILE.tmp
|
---|
[7bbd436] | 492 | fi
|
---|
| 493 |
|
---|
| 494 | # Remove the TCL sources after a successful Expect build.
|
---|
| 495 | if [ "$i" = "033-expect" ] ; then
|
---|
[3f990d1] | 496 | (
|
---|
| 497 | cat << EOF
|
---|
| 498 | @rm -r \`cat sources-dir\` && \\
|
---|
| 499 | rm sources-dir
|
---|
| 500 | EOF
|
---|
| 501 | ) >> $MKFILE.tmp
|
---|
[7bbd436] | 502 | fi
|
---|
| 503 |
|
---|
| 504 | # Include a touch of the target name so make can check
|
---|
| 505 | # if it's already been made.
|
---|
[3f990d1] | 506 | (
|
---|
| 507 | cat << EOF
|
---|
| 508 | @touch \$@
|
---|
| 509 | EOF
|
---|
| 510 | ) >> $MKFILE.tmp
|
---|
[7bbd436] | 511 |
|
---|
[e909d9d] | 512 | # Keep the script file name for Makefile dependencies.
|
---|
| 513 | PREV=$i
|
---|
[f8de156] | 514 | done
|
---|
[9e406b5] | 515 |
|
---|
[97a3ffc] | 516 | for file in chapter06/* ; do
|
---|
| 517 | # Keep the script file name
|
---|
| 518 | i=`basename $file`
|
---|
| 519 |
|
---|
[16c67ed] | 520 | # We'll run the chroot commands differently than the others, so skip them in the
|
---|
| 521 | # dependencies and target creation.
|
---|
| 522 | if echo $i | grep -q "chroot" ; then
|
---|
| 523 | continue
|
---|
| 524 | fi
|
---|
| 525 |
|
---|
[97a3ffc] | 526 | # First append each name of the script files to a list (this will become
|
---|
| 527 | # the names of the targets in the Makefile
|
---|
| 528 | chapter6="$chapter6 $i"
|
---|
| 529 |
|
---|
| 530 | # Grab the name of the target
|
---|
| 531 | name=`echo $i | sed -e 's@[0-9]\{3\}-@@'`
|
---|
| 532 |
|
---|
| 533 | # Set the dependency for the first target.
|
---|
| 534 | if [ -z $PREV ] ; then PREV=055-stripping ; fi
|
---|
| 535 |
|
---|
| 536 | # Drop in the name of the target on a new line, and the previous target
|
---|
[4c62c61] | 537 | # as a dependency. Also call the echo_message function.
|
---|
[3f990d1] | 538 | (
|
---|
| 539 | cat << EOF
|
---|
| 540 |
|
---|
| 541 | $i: $PREV
|
---|
| 542 | @\$(call echo_message, Building)
|
---|
| 543 | EOF
|
---|
| 544 | ) >> $MKFILE.tmp
|
---|
[97a3ffc] | 545 |
|
---|
| 546 | # Find the version of the command files, if it corresponds with the building of
|
---|
| 547 | # a specific package
|
---|
| 548 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 549 |
|
---|
| 550 | # If $vrs isn't empty, we've got a package...
|
---|
[3f990d1] | 551 | # Insert instructions for unpacking the package and changing directories
|
---|
[97a3ffc] | 552 | if [ "$vrs" != "" ] ; then
|
---|
| 553 | FILE="$name-$vrs.tar.bz2"
|
---|
[3f990d1] | 554 | (
|
---|
| 555 | cat << EOF
|
---|
| 556 | @\$(call unpack,$FILE)
|
---|
[eaa021a] | 557 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[3f990d1] | 558 | echo "PKGDIR=\$(SRC)/\$\$ROOT" > envars && \\
|
---|
[2e51f44] | 559 | echo "export PKGDIR" >> envars
|
---|
[3f990d1] | 560 | EOF
|
---|
| 561 | ) >> $MKFILE.tmp
|
---|
[97a3ffc] | 562 | fi
|
---|
| 563 |
|
---|
| 564 | # For the Re-Adjusting phase we must to cd to the binutils-build directory.
|
---|
| 565 | if [ "$i" = "067-readjusting" ] ; then
|
---|
[3f990d1] | 566 | (
|
---|
| 567 | cat << EOF
|
---|
| 568 | @echo "PKGDIR=\$(SRC)/binutils-build" > envars && \\
|
---|
| 569 | echo "export PKGDIR" >> envars
|
---|
| 570 | EOF
|
---|
| 571 | ) >> $MKFILE.tmp
|
---|
[4c62c61] | 572 | fi
|
---|
[97a3ffc] | 573 |
|
---|
[a41ce58] | 574 | # For Groff we need to set PAGE envar.
|
---|
| 575 | if [ "$i" = "082-groff" ] ; then
|
---|
| 576 | (
|
---|
| 577 | cat << EOF
|
---|
| 578 | @echo "PAGE=\$(PAGE)" >> envars && \\
|
---|
| 579 | echo "export PAGE" >> envars
|
---|
| 580 | EOF
|
---|
| 581 | ) >> $MKFILE.tmp
|
---|
| 582 | fi
|
---|
| 583 |
|
---|
[b51d2ec] | 584 | # In the mount of kernel filesystems we need to set LFS
|
---|
[80c00fc] | 585 | # and not to use chroot.
|
---|
[4c62c61] | 586 | if [ "$i" = "057-kernfs" ] ; then
|
---|
[3f990d1] | 587 | (
|
---|
| 588 | cat << EOF
|
---|
[7871325] | 589 | @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
[b51d2ec] | 590 | export LFS=\$(LFS) && commands/$file >>logs/$i 2>&1 && \\
|
---|
[3f990d1] | 591 | echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\n" >>logs/$i
|
---|
| 592 | EOF
|
---|
[a7d20b8] | 593 | ) >> $MKFILE.tmp
|
---|
| 594 |
|
---|
| 595 | # The rest of Chapter06
|
---|
[7ecd166] | 596 | else
|
---|
[3f990d1] | 597 | (
|
---|
| 598 | cat << EOF
|
---|
[80c00fc] | 599 | @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=0??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
[2e51f44] | 600 | \$(CHROOT1) 'cd /jhalfs && source envars && /jhalfs/commands/$file >>/jhalfs/logs/$i 2>&1' && \\
|
---|
[3f990d1] | 601 | echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=0??-* \$(LFS)\`\n" >>logs/$i
|
---|
| 602 | EOF
|
---|
| 603 | ) >> $MKFILE.tmp
|
---|
| 604 |
|
---|
[7ecd166] | 605 | fi
|
---|
[97a3ffc] | 606 |
|
---|
[cf7f294] | 607 | # Remove the build directory(ies) except if the package build fails.
|
---|
[97a3ffc] | 608 | if [ "$vrs" != "" ] ; then
|
---|
[3f990d1] | 609 | (
|
---|
| 610 | cat << EOF
|
---|
[eaa021a] | 611 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[3f990d1] | 612 | rm -r \$(LFS)\$(SRC)/\$\$ROOT && \\
|
---|
| 613 | if [ -e \$(LFS)\$(SRC)/$name-build ]; then \\
|
---|
| 614 | rm -r \$(LFS)\$(SRC)/$name-build; \\
|
---|
| 615 | fi;
|
---|
| 616 | EOF
|
---|
| 617 | ) >> $MKFILE.tmp
|
---|
[97a3ffc] | 618 | fi
|
---|
| 619 |
|
---|
[4e4a8d5] | 620 | # Remove the Binutils pass 2 sources after a successful Re-Adjusting phase.
|
---|
[6299c11] | 621 | if [ "$i" = "067-readjusting" ] ; then
|
---|
[3f990d1] | 622 | (
|
---|
| 623 | cat << EOF
|
---|
| 624 | @rm -r \`cat sources-dir\` && \\
|
---|
| 625 | rm -r \$(LFS)\$(SRC)/binutils-build && \\
|
---|
| 626 | rm sources-dir
|
---|
| 627 | EOF
|
---|
| 628 | ) >> $MKFILE.tmp
|
---|
[97a3ffc] | 629 | fi
|
---|
| 630 |
|
---|
[732d1f1] | 631 | # Include a touch of the target name so make can check
|
---|
| 632 | # if it's already been made.
|
---|
[3f990d1] | 633 | (
|
---|
| 634 | cat << EOF
|
---|
| 635 | @touch \$@
|
---|
| 636 | EOF
|
---|
| 637 | ) >> $MKFILE.tmp
|
---|
[732d1f1] | 638 |
|
---|
[97a3ffc] | 639 | # Keep the script file name for Makefile dependencies.
|
---|
| 640 | PREV=$i
|
---|
| 641 | done
|
---|
| 642 |
|
---|
[cf7f294] | 643 | for file in chapter0{7,8,9}/* ; do
|
---|
| 644 | # Keep the script file name
|
---|
| 645 | i=`basename $file`
|
---|
| 646 |
|
---|
| 647 | # Grub must be configured manually
|
---|
| 648 | if echo $i | grep -q "grub" ; then
|
---|
| 649 | continue
|
---|
[83f64dc] | 650 | # The filesystems can't be unmounted yet due that the user must
|
---|
| 651 | # to enter to the chroot environment to create the root password,
|
---|
| 652 | # edit several files and setup Grub,
|
---|
| 653 | elif echo $i | grep -q "reboot" ; then
|
---|
| 654 | continue
|
---|
[cf7f294] | 655 | fi
|
---|
| 656 |
|
---|
| 657 | # If no .config file is supplied, the kernel build is skipped
|
---|
| 658 | if [ -z $CONFIG ] ; then
|
---|
| 659 | if echo $i | grep -q "kernel" ; then
|
---|
| 660 | continue
|
---|
| 661 | fi
|
---|
| 662 | fi
|
---|
| 663 |
|
---|
| 664 | # First append each name of the script files to a list (this will become
|
---|
| 665 | # the names of the targets in the Makefile
|
---|
| 666 | chapter789="$chapter789 $i"
|
---|
| 667 |
|
---|
| 668 | # Set the dependency for the first target.
|
---|
| 669 | if [ -z $PREV ] ; then PREV=116-strippingagain ; fi
|
---|
| 670 |
|
---|
| 671 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 672 | # as a dependency. Also call the echo_message function.
|
---|
| 673 | (
|
---|
| 674 | cat << EOF
|
---|
| 675 |
|
---|
| 676 | $i: $PREV
|
---|
| 677 | @\$(call echo_message, Building)
|
---|
| 678 | EOF
|
---|
| 679 | ) >> $MKFILE.tmp
|
---|
| 680 |
|
---|
| 681 | # Find the the bootscripts and kernel package names
|
---|
| 682 | if [ "$i" = "119-bootscripts" -o "$i" = "132-kernel" ] ; then
|
---|
| 683 | if [ "$i" = "119-bootscripts" ] ; then
|
---|
| 684 | vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 685 | FILE="lfs-bootscripts-$vrs.tar.bz2"
|
---|
| 686 | elif [ "$i" = "132-kernel" ] ; then
|
---|
| 687 | vrs=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 688 | FILE="linux-$vrs.tar.bz2"
|
---|
| 689 | fi
|
---|
| 690 | (
|
---|
| 691 | cat << EOF
|
---|
| 692 | @\$(call unpack,$FILE)
|
---|
| 693 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
| 694 | echo "PKGDIR=\$(SRC)/\$\$ROOT" > envars && \\
|
---|
| 695 | echo "export PKGDIR" >> envars
|
---|
| 696 | EOF
|
---|
| 697 | ) >> $MKFILE.tmp
|
---|
| 698 | fi
|
---|
| 699 |
|
---|
| 700 | # Put in place the kernel .config file
|
---|
[2b73842] | 701 | if [ "$i" = "132-kernel" ] ; then
|
---|
[cf7f294] | 702 | (
|
---|
| 703 | cat << EOF
|
---|
[83f64dc] | 704 | @source envars && cp $CONFIG \$(LFS)\$(PKGDIR)/.config
|
---|
[cf7f294] | 705 | EOF
|
---|
| 706 | ) >> $MKFILE.tmp
|
---|
| 707 | fi
|
---|
| 708 |
|
---|
| 709 | # Initialize the log an run the script
|
---|
| 710 | (
|
---|
| 711 | cat << EOF
|
---|
| 712 | @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=0??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
| 713 | \$(CHROOT2) 'cd /jhalfs && source envars && /jhalfs/commands/$file >>/jhalfs/logs/$i 2>&1' && \\
|
---|
| 714 | echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=0??-* \$(LFS)\`\n" >>logs/$i
|
---|
| 715 | EOF
|
---|
| 716 | ) >> $MKFILE.tmp
|
---|
| 717 |
|
---|
| 718 | # Remove the build directory except if the package build fails.
|
---|
| 719 | if [ "$i" = "119-bootscripts" -o "$i" = "132-kernel" ] ; then
|
---|
| 720 | (
|
---|
| 721 | cat << EOF
|
---|
| 722 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
| 723 | rm -r \$(LFS)\$(SRC)/\$\$ROOT
|
---|
| 724 | EOF
|
---|
| 725 | ) >> $MKFILE.tmp
|
---|
| 726 | fi
|
---|
| 727 |
|
---|
| 728 | # Include a touch of the target name so make can check
|
---|
| 729 | # if it's already been made.
|
---|
| 730 | (
|
---|
| 731 | cat << EOF
|
---|
| 732 | @touch \$@
|
---|
| 733 | EOF
|
---|
| 734 | ) >> $MKFILE.tmp
|
---|
| 735 |
|
---|
| 736 | # Keep the script file name for Makefile dependencies.
|
---|
| 737 | PREV=$i
|
---|
| 738 | done
|
---|
| 739 |
|
---|
[3f990d1] | 740 | # Add a header, some variables and include the function file
|
---|
| 741 | # to the top of the real Makefile.
|
---|
| 742 | (
|
---|
| 743 | cat << EOF
|
---|
| 744 | $HEADER
|
---|
| 745 |
|
---|
| 746 | SRC= /sources
|
---|
| 747 | LFS= $BUILDDIR
|
---|
[a41ce58] | 748 | PAGE= $PAGE
|
---|
[3f990d1] | 749 |
|
---|
| 750 | include functions
|
---|
| 751 |
|
---|
| 752 | EOF
|
---|
| 753 | ) > $MKFILE
|
---|
[8bb92e7] | 754 |
|
---|
[c08d23b] | 755 |
|
---|
| 756 | # Add chroot commands
|
---|
| 757 | i=1
|
---|
| 758 | for file in chapter06/*chroot* ; do
|
---|
| 759 | chroot=`cat $file | sed -e '/#!\/bin\/sh/d' -e 's@ \\\@ @g' | tr -d '\n' | sed \
|
---|
[002f8a7] | 760 | -e 's/ */ /g' -e 's|\\$|&&|g' -e 's|&&exit||g' -e 's|$| -c|' -e 's|"$$LFS"|$(LFS)|'`
|
---|
[d7fd195] | 761 | echo -e "CHROOT$i= $chroot\n" >> $MKFILE
|
---|
[c08d23b] | 762 | i=`expr $i + 1`
|
---|
| 763 | done
|
---|
[9e406b5] | 764 |
|
---|
[0bad6ba] | 765 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
| 766 | # as a dependency.
|
---|
[3f990d1] | 767 | (
|
---|
| 768 | cat << EOF
|
---|
[cf7f294] | 769 | all: chapter4 chapter5 chapter6 chapter789
|
---|
[3f990d1] | 770 | @echo -e "\n\tYour new LFS system has been successfully built"
|
---|
| 771 |
|
---|
| 772 | chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
|
---|
| 773 |
|
---|
| 774 | chapter5: chapter4 $chapter5
|
---|
| 775 |
|
---|
| 776 | chapter6: chapter5 $chapter6
|
---|
| 777 |
|
---|
[cf7f294] | 778 | chapter789: chapter6 $chapter789
|
---|
| 779 |
|
---|
[3f990d1] | 780 | clean-all: clean
|
---|
| 781 | rm -rf ./*
|
---|
| 782 |
|
---|
| 783 | clean: clean-chapter5 clean-chapter4
|
---|
| 784 |
|
---|
| 785 | clean-chapter4:
|
---|
| 786 | -userdel lfs
|
---|
| 787 | rm -rf /home/lfs
|
---|
| 788 | rm -rf \$(LFS)/tools
|
---|
| 789 | rm -f /tools
|
---|
| 790 | rm -f envars
|
---|
| 791 | rm -f 02* logs/02*.log
|
---|
| 792 |
|
---|
| 793 | clean-chapter5:
|
---|
| 794 | rm -rf \$(LFS)/tools/*
|
---|
| 795 | rm -f $chapter5
|
---|
| 796 | cd logs && rm -f $chapter5 && cd ..
|
---|
| 797 |
|
---|
| 798 | 020-creatingtoolsdir:
|
---|
| 799 | @\$(call echo_message, Building)
|
---|
| 800 | @mkdir -v \$(LFS)/tools && \\
|
---|
| 801 | ln -sv \$(LFS)/tools / && \\
|
---|
| 802 | touch \$@
|
---|
| 803 |
|
---|
| 804 | 021-addinguser: 020-creatingtoolsdir
|
---|
| 805 | @\$(call echo_message, Building)
|
---|
| 806 | @groupadd lfs && \\
|
---|
| 807 | useradd -s /bin/bash -g lfs -m -k /dev/null lfs && \\
|
---|
| 808 | chown lfs \$(LFS)/tools && \\
|
---|
| 809 | chown lfs \$(LFS)/sources && \\
|
---|
| 810 | touch \$@
|
---|
| 811 |
|
---|
| 812 | 022-settingenvironment: 021-addinguser
|
---|
| 813 | @\$(call echo_message, Building)
|
---|
| 814 | @echo "exec env -i HOME=\\\$\$HOME TERM=\\\$\$TERM PS1='\u:\w\$$ ' /bin/bash" > /home/lfs/.bash_profile && \\
|
---|
| 815 | echo "set +h" > /home/lfs/.bashrc && \\
|
---|
| 816 | echo "umask 022" >> /home/lfs/.bashrc && \\
|
---|
| 817 | echo "LFS=/mnt/lfs" >> /home/lfs/.bashrc && \\
|
---|
| 818 | echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
|
---|
| 819 | echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
|
---|
| 820 | echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
|
---|
| 821 | echo ". $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\
|
---|
| 822 | chown lfs:lfs /home/lfs/.bash* && \\
|
---|
| 823 | touch envars && \\
|
---|
| 824 | touch \$@
|
---|
| 825 | EOF
|
---|
| 826 | ) >> $MKFILE
|
---|
[0bad6ba] | 827 |
|
---|
[9e406b5] | 828 | # Bring over the items from the Makefile.tmp
|
---|
| 829 | cat $MKFILE.tmp >> $MKFILE
|
---|
| 830 | rm $MKFILE.tmp
|
---|
| 831 | echo -ne "done\n"
|
---|
[f8de156] | 832 | }
|
---|
| 833 |
|
---|
[88dcce5] | 834 | run_make() {
|
---|
[d310939] | 835 | # Test if make must be run.
|
---|
| 836 | if [ "$RUNMAKE" = "1" ] ; then
|
---|
| 837 | # Build the system
|
---|
| 838 | if [ -e $MKFILE ] ; then
|
---|
[e3e1db0] | 839 | echo -ne "Building the LFS system...\n"
|
---|
[d310939] | 840 | cd $JHALFSDIR && make
|
---|
| 841 | echo -ne "done\n"
|
---|
| 842 | fi
|
---|
[88dcce5] | 843 | fi
|
---|
| 844 | }
|
---|
[1236262] | 845 |
|
---|
[4dafc45] | 846 | if [ ! -d $JHALFSDIR ] ; then
|
---|
[557fe91] | 847 | mkdir -p $JHALFSDIR
|
---|
[1236262] | 848 | fi
|
---|
| 849 |
|
---|
[4c62c61] | 850 | if [ ! -d $LOGDIR ] ; then
|
---|
| 851 | mkdir $LOGDIR
|
---|
[a5e49c6] | 852 | fi
|
---|
| 853 |
|
---|
[4c62c61] | 854 | >$LOGDIR/$LOG
|
---|
[409488e] | 855 |
|
---|
| 856 | if [ "$PWD" != "$JHALFSDIR" ] ; then
|
---|
[0fc4c75] | 857 | cp $0 $XSL $FNC $JHALFSDIR/
|
---|
[409488e] | 858 | fi
|
---|
| 859 |
|
---|
[1236262] | 860 | get_book
|
---|
[f8de156] | 861 | build_Makefile
|
---|
[71642ef] | 862 | run_make
|
---|