[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
|
---|
[898f47a] | 238 | # Set the canonical book version
|
---|
| 239 | cd $JHALFSDIR
|
---|
| 240 | VERSION=`grep "ENTITY version" $BOOK/general.ent | sed -e 's@<!ENTITY version "@@' -e 's@">@@'`
|
---|
[1236262] | 241 | }
|
---|
| 242 |
|
---|
| 243 | extract_commands() {
|
---|
| 244 | # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
|
---|
| 245 | test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
|
---|
[557fe91] | 246 | exit 1"
|
---|
[4dafc45] | 247 | cd $JHALFSDIR
|
---|
[1236262] | 248 |
|
---|
| 249 | # Start clean
|
---|
| 250 | if [ -d commands ] ; then rm -rf commands ; fi && mkdir commands
|
---|
| 251 | echo -n "Extracting commands... "
|
---|
| 252 |
|
---|
[dc2fee8] | 253 | # Dump the commands in shell script form from the LFS book.
|
---|
[01e51a1] | 254 | xsltproc --nonet --xinclude --stringparam testsuite $TEST \
|
---|
| 255 | --stringparam toolchaintest $TOOLCHAINTEST -o ./commands/ \
|
---|
| 256 | $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
---|
[1236262] | 257 |
|
---|
[af47a19] | 258 | # Make the scripts executable.
|
---|
[dc44153] | 259 | chmod -R +x $JHALFSDIR/commands
|
---|
| 260 |
|
---|
[1236262] | 261 | # Grab the patches and package names.
|
---|
[4dafc45] | 262 | cd $JHALFSDIR
|
---|
[1236262] | 263 | for i in patches packages ; do rm -f $i ; done
|
---|
[24530379] | 264 | grep "\-version" $BOOK/general.ent | sed -e 's@<!ENTITY @@' -e 's@">@"@' \
|
---|
[557fe91] | 265 | -e '/generic/d' >> packages
|
---|
[0a9117e] | 266 | echo `grep "glibc" packages | sed 's@glibc@glibc-linuxthreads@'` >> packages
|
---|
[24530379] | 267 | grep "ENTITY" $BOOK/patches.ent | sed -e 's/.* "//' -e 's/">//' >> patches
|
---|
[1236262] | 268 |
|
---|
| 269 | # Done. Moving on...
|
---|
| 270 | echo -ne "done\n"
|
---|
| 271 | get_sources
|
---|
| 272 | }
|
---|
| 273 |
|
---|
| 274 | download() {
|
---|
| 275 | cd $BUILDDIR/sources
|
---|
| 276 |
|
---|
[0a9117e] | 277 | # Hackish fix for the bash-doc and glibc-linuxthreads packages that
|
---|
| 278 | # doesn't conform to norms in the URL scheme.
|
---|
| 279 | DIR=`echo $1 | sed -e 's@-doc@@' -e 's@-linuxthreads@@'`
|
---|
[1236262] | 280 |
|
---|
| 281 | # Find the md5 sum for this package.
|
---|
| 282 | if [ $2 != MD5SUMS ] ; then MD5=`grep " $2" MD5SUMS` ; fi
|
---|
| 283 |
|
---|
| 284 | if [ ! -f $2 ] ; then
|
---|
[557fe91] | 285 | case $DL in
|
---|
| 286 | wget )
|
---|
| 287 | wget $HTTP/$DIR/$2
|
---|
| 288 | ;;
|
---|
| 289 | curl )
|
---|
| 290 | `curl -# $HTTP/$DIR/$2 -o $2`
|
---|
| 291 | ;;
|
---|
| 292 | * )
|
---|
| 293 | echo "$DL not supported at this time."
|
---|
| 294 | ;;
|
---|
| 295 | esac
|
---|
[1236262] | 296 | elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then
|
---|
[557fe91] | 297 | case $DL in
|
---|
| 298 | wget )
|
---|
| 299 | wget -c $HTTP/$DIR/$2
|
---|
| 300 | ;;
|
---|
| 301 | curl )
|
---|
| 302 | `curl -# -C - $HTTP/$DIR/$2 -o $2`
|
---|
| 303 | ;;
|
---|
| 304 | * )
|
---|
| 305 | echo "$DL not supported at this time."
|
---|
| 306 | ;;
|
---|
| 307 | esac
|
---|
[1236262] | 308 | fi
|
---|
| 309 | if [ $2 != MD5SUMS ] && ! echo "$MD5" | md5sum -c - ; then
|
---|
| 310 | exit 1
|
---|
| 311 | fi
|
---|
| 312 | }
|
---|
| 313 |
|
---|
| 314 | get_sources() {
|
---|
| 315 |
|
---|
[07f47df] | 316 | # Test if the packages must be downloaded
|
---|
[d310939] | 317 | if [ "$HPKG" = "1" ] ; then
|
---|
[1236262] | 318 |
|
---|
[07f47df] | 319 | # This variable is necessary to make sure the `cat $JHALFSDIR/packages`
|
---|
| 320 | # separates each iteration by lines. It is necessary to have the second
|
---|
| 321 | # ' on the next line.
|
---|
| 322 | IFS='
|
---|
| 323 | '
|
---|
[1236262] | 324 |
|
---|
[07f47df] | 325 | if [ ! -d $BUILDDIR/sources ] ; then mkdir $BUILDDIR/sources ; fi
|
---|
| 326 | cd $BUILDDIR/sources
|
---|
| 327 | if [ -f MD5SUMS ] ; then rm MD5SUMS ; fi
|
---|
| 328 |
|
---|
| 329 | download "" MD5SUMS
|
---|
| 330 |
|
---|
| 331 | # Iterate through each package and grab it, along with any patches it needs.
|
---|
| 332 | for i in `cat $JHALFSDIR/packages` ; do
|
---|
| 333 | PKG=`echo $i | sed 's/-version.*//'`
|
---|
| 334 |
|
---|
| 335 | # Someone used some silly entities right next to the valid package entities.
|
---|
| 336 | if [ "$PKG" = "expect-lib" -o "$PKG" = "linux-dl" ] ; then continue ; fi
|
---|
| 337 |
|
---|
| 338 | VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 339 | if [ "$PKG" = "tcl" ] ; then
|
---|
| 340 | FILE="$PKG$VRS-src.tar.bz2"
|
---|
| 341 | else
|
---|
| 342 | FILE="$PKG-$VRS.tar.bz2"
|
---|
| 343 | fi
|
---|
| 344 | download $PKG $FILE
|
---|
| 345 | for patch in `grep "$PKG-&$PKG" $JHALFSDIR/patches` ; do
|
---|
| 346 | PATCH=`echo $patch | sed 's@&'$PKG'-version;@'$VRS'@'`
|
---|
| 347 | download $PKG $PATCH
|
---|
| 348 | done
|
---|
[fbb6b78] | 349 | done
|
---|
[0a9117e] | 350 | # Hardcoded Udev configuration file until find a better way
|
---|
| 351 | download udev udev-config-3.rules
|
---|
[07f47df] | 352 | fi
|
---|
[1236262] | 353 | }
|
---|
| 354 |
|
---|
[f8de156] | 355 | build_Makefile() {
|
---|
[9e406b5] | 356 | echo -n "Creating Makefile... "
|
---|
[f8de156] | 357 | cd $JHALFSDIR/commands
|
---|
[fbb6b78] | 358 |
|
---|
[f8de156] | 359 | # Start with a clean Makefile.tmp file
|
---|
| 360 | >$MKFILE.tmp
|
---|
| 361 |
|
---|
[0bad6ba] | 362 | for file in chapter05/* ; do
|
---|
[71642ef] | 363 | # Keep the script file name
|
---|
| 364 | i=`basename $file`
|
---|
[63b2859] | 365 |
|
---|
[01e51a1] | 366 | # If no testsuites will be run, then TCL, Expect and DejaGNU isn't needed
|
---|
| 367 | if [ "$TOOLCHAINTEST" = "0" ]; then
|
---|
| 368 | if echo $i | grep -q "tcl" ; then
|
---|
| 369 | continue
|
---|
| 370 | elif echo $i | grep -q "expect" ; then
|
---|
| 371 | continue
|
---|
| 372 | elif echo $i | grep -q "dejagnu" ; then
|
---|
| 373 | continue
|
---|
| 374 | fi
|
---|
| 375 | fi
|
---|
| 376 |
|
---|
[71642ef] | 377 | # First append each name of the script files to a list (this will become
|
---|
| 378 | # the names of the targets in the Makefile
|
---|
| 379 | chapter5="$chapter5 $i"
|
---|
[557fe91] | 380 |
|
---|
[71642ef] | 381 | # Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
|
---|
| 382 | # and binutils in chapter 5)
|
---|
| 383 | name=`echo $i | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'`
|
---|
[557fe91] | 384 |
|
---|
[e909d9d] | 385 | # Set the dependency for the first target.
|
---|
| 386 | if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
|
---|
| 387 |
|
---|
| 388 | # Drop in the name of the target on a new line, and the previous target
|
---|
[0fc4c75] | 389 | # as a dependency. Also call the echo_message function.
|
---|
[3f990d1] | 390 | (
|
---|
| 391 | cat << EOF
|
---|
| 392 |
|
---|
| 393 | $i: $PREV
|
---|
| 394 | @\$(call echo_message, Building)
|
---|
| 395 | EOF
|
---|
| 396 | ) >> $MKFILE.tmp
|
---|
[557fe91] | 397 |
|
---|
[71642ef] | 398 | # Find the version of the command files, if it corresponds with the building of
|
---|
| 399 | # a specific package
|
---|
| 400 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
[557fe91] | 401 |
|
---|
[71642ef] | 402 | # If $vrs isn't empty, we've got a package...
|
---|
| 403 | if [ "$vrs" != "" ] ; then
|
---|
| 404 | if [ "$name" = "tcl" ] ; then
|
---|
| 405 | FILE="$name$vrs-src.tar.bz2"
|
---|
| 406 | else
|
---|
| 407 | FILE="$name-$vrs.tar.bz2"
|
---|
| 408 | fi
|
---|
[557fe91] | 409 |
|
---|
[71642ef] | 410 | # Insert instructions for unpacking the package and to set
|
---|
| 411 | # the PKGDIR variable.
|
---|
[3f990d1] | 412 | (
|
---|
| 413 | cat << EOF
|
---|
| 414 | @\$(call unpack,$FILE)
|
---|
[eaa021a] | 415 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[3f990d1] | 416 | chown -R lfs \$(LFS)\$(SRC)/\$\$ROOT && \\
|
---|
| 417 | echo "PKGDIR=\$(LFS)\$(SRC)/\$\$ROOT" > envars && \\
|
---|
| 418 | echo "export PKGDIR" >> envars && \\
|
---|
| 419 | EOF
|
---|
| 420 | ) >> $MKFILE.tmp
|
---|
| 421 |
|
---|
[71642ef] | 422 | fi
|
---|
[557fe91] | 423 |
|
---|
[4c62c61] | 424 | # Dump the path to the Binutils or TCL sources directory.
|
---|
| 425 | if [ "$i" = "027-binutils-pass1" -o "$i" = "032-tcl" -o "$i" = "036-binutils-pass2" ] ; then
|
---|
[3f990d1] | 426 | (
|
---|
| 427 | cat << EOF
|
---|
| 428 | echo "\$(LFS)\$(SRC)/\$\$ROOT" > sources-dir
|
---|
| 429 | EOF
|
---|
| 430 | ) >> $MKFILE.tmp
|
---|
[88dcce5] | 431 |
|
---|
[71642ef] | 432 | # For the Adjusting phase we must to cd to the binutils-build directory.
|
---|
[0fc4c75] | 433 | elif [ "$i" = "031-adjusting" ] ; then
|
---|
[3f990d1] | 434 | (
|
---|
| 435 | cat << EOF
|
---|
| 436 | @echo "PKGDIR=\$(LFS)\$(SRC)/binutils-build" > envars && \\
|
---|
| 437 | echo "export PKGDIR" >> envars
|
---|
| 438 | EOF
|
---|
| 439 | ) >> $MKFILE.tmp
|
---|
[0209bb7] | 440 |
|
---|
[97a3ffc] | 441 | # For the Expect build we need to set the TCLPATH envar.
|
---|
[0fc4c75] | 442 | elif [ "$i" = "033-expect" ] ; then
|
---|
[3f990d1] | 443 | (
|
---|
| 444 | cat << EOF
|
---|
| 445 | echo "TCLPATH=\`cat sources-dir\`" >> envars && \\
|
---|
| 446 | echo "export TCLPATH" >> envars
|
---|
| 447 | EOF
|
---|
| 448 | ) >> $MKFILE.tmp
|
---|
[0fc4c75] | 449 |
|
---|
| 450 | # Everything else, add a true statment so we don't confuse make
|
---|
| 451 | else
|
---|
[3f990d1] | 452 | (
|
---|
| 453 | cat << EOF
|
---|
| 454 | true
|
---|
| 455 | EOF
|
---|
| 456 | ) >> $MKFILE.tmp
|
---|
[71642ef] | 457 | fi
|
---|
[557fe91] | 458 |
|
---|
[3f990d1] | 459 | # Insert date and disk usage at the top of the log file, the script run
|
---|
| 460 | # and date and disk usage again at the bottom of the log file.
|
---|
| 461 | (
|
---|
| 462 | cat << EOF
|
---|
| 463 | @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
| 464 | su - lfs -c "source /home/lfs/.bashrc && $JHALFSDIR/commands/$file" >>logs/$i 2>&1 && \\
|
---|
| 465 | echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\n" >>logs/$i
|
---|
| 466 | EOF
|
---|
| 467 | ) >> $MKFILE.tmp
|
---|
[71642ef] | 468 |
|
---|
[cf7f294] | 469 | # Remove the build directory(ies) except if the package build fails
|
---|
| 470 | # (to can review config.cache, config.log, and like.)
|
---|
| 471 | # For Binutils and TCL the sources must be retained some time.
|
---|
[71642ef] | 472 | if [ "$vrs" != "" ] ; then
|
---|
[d310939] | 473 | if [ "$i" != "027-binutils-pass1" ] && [ "$i" != "032-tcl" ] && [ "$i" != "036-binutils-pass2" ] ; then
|
---|
[3f990d1] | 474 | (
|
---|
| 475 | cat << EOF
|
---|
[eaa021a] | 476 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[3f990d1] | 477 | rm -r \$(LFS)\$(SRC)/\$\$ROOT && \\
|
---|
| 478 | if [ -e \$(LFS)\$(SRC)/$name-build ]; then \\
|
---|
| 479 | rm -r \$(LFS)\$(SRC)/$name-build; \\
|
---|
| 480 | fi;
|
---|
| 481 | EOF
|
---|
| 482 | ) >> $MKFILE.tmp
|
---|
[71642ef] | 483 | fi
|
---|
| 484 | fi
|
---|
[7bbd436] | 485 |
|
---|
| 486 | # Remove the Binutils pass 1 sources after a successful Adjusting phase.
|
---|
| 487 | if [ "$i" = "031-adjusting" ] ; then
|
---|
[3f990d1] | 488 | (
|
---|
| 489 | cat << EOF
|
---|
| 490 | @rm -r \`cat sources-dir\` && \\
|
---|
| 491 | rm -r \$(LFS)\$(SRC)/binutils-build && \\
|
---|
| 492 | rm sources-dir
|
---|
| 493 | EOF
|
---|
| 494 | ) >> $MKFILE.tmp
|
---|
[7bbd436] | 495 | fi
|
---|
| 496 |
|
---|
| 497 | # Remove the TCL sources after a successful Expect build.
|
---|
| 498 | if [ "$i" = "033-expect" ] ; then
|
---|
[3f990d1] | 499 | (
|
---|
| 500 | cat << EOF
|
---|
| 501 | @rm -r \`cat sources-dir\` && \\
|
---|
| 502 | rm sources-dir
|
---|
| 503 | EOF
|
---|
| 504 | ) >> $MKFILE.tmp
|
---|
[7bbd436] | 505 | fi
|
---|
| 506 |
|
---|
| 507 | # Include a touch of the target name so make can check
|
---|
| 508 | # if it's already been made.
|
---|
[3f990d1] | 509 | (
|
---|
| 510 | cat << EOF
|
---|
| 511 | @touch \$@
|
---|
| 512 | EOF
|
---|
| 513 | ) >> $MKFILE.tmp
|
---|
[7bbd436] | 514 |
|
---|
[e909d9d] | 515 | # Keep the script file name for Makefile dependencies.
|
---|
| 516 | PREV=$i
|
---|
[f8de156] | 517 | done
|
---|
[9e406b5] | 518 |
|
---|
[97a3ffc] | 519 | for file in chapter06/* ; do
|
---|
| 520 | # Keep the script file name
|
---|
| 521 | i=`basename $file`
|
---|
| 522 |
|
---|
[16c67ed] | 523 | # We'll run the chroot commands differently than the others, so skip them in the
|
---|
| 524 | # dependencies and target creation.
|
---|
| 525 | if echo $i | grep -q "chroot" ; then
|
---|
| 526 | continue
|
---|
| 527 | fi
|
---|
| 528 |
|
---|
[97a3ffc] | 529 | # First append each name of the script files to a list (this will become
|
---|
| 530 | # the names of the targets in the Makefile
|
---|
| 531 | chapter6="$chapter6 $i"
|
---|
| 532 |
|
---|
| 533 | # Grab the name of the target
|
---|
| 534 | name=`echo $i | sed -e 's@[0-9]\{3\}-@@'`
|
---|
| 535 |
|
---|
| 536 | # Set the dependency for the first target.
|
---|
| 537 | if [ -z $PREV ] ; then PREV=055-stripping ; fi
|
---|
| 538 |
|
---|
| 539 | # Drop in the name of the target on a new line, and the previous target
|
---|
[4c62c61] | 540 | # as a dependency. Also call the echo_message function.
|
---|
[3f990d1] | 541 | (
|
---|
| 542 | cat << EOF
|
---|
| 543 |
|
---|
| 544 | $i: $PREV
|
---|
| 545 | @\$(call echo_message, Building)
|
---|
| 546 | EOF
|
---|
| 547 | ) >> $MKFILE.tmp
|
---|
[97a3ffc] | 548 |
|
---|
| 549 | # Find the version of the command files, if it corresponds with the building of
|
---|
| 550 | # a specific package
|
---|
| 551 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 552 |
|
---|
| 553 | # If $vrs isn't empty, we've got a package...
|
---|
[3f990d1] | 554 | # Insert instructions for unpacking the package and changing directories
|
---|
[97a3ffc] | 555 | if [ "$vrs" != "" ] ; then
|
---|
| 556 | FILE="$name-$vrs.tar.bz2"
|
---|
[3f990d1] | 557 | (
|
---|
| 558 | cat << EOF
|
---|
| 559 | @\$(call unpack,$FILE)
|
---|
[eaa021a] | 560 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[3f990d1] | 561 | echo "PKGDIR=\$(SRC)/\$\$ROOT" > envars && \\
|
---|
[2e51f44] | 562 | echo "export PKGDIR" >> envars
|
---|
[3f990d1] | 563 | EOF
|
---|
| 564 | ) >> $MKFILE.tmp
|
---|
[97a3ffc] | 565 | fi
|
---|
| 566 |
|
---|
| 567 | # For the Re-Adjusting phase we must to cd to the binutils-build directory.
|
---|
| 568 | if [ "$i" = "067-readjusting" ] ; then
|
---|
[3f990d1] | 569 | (
|
---|
| 570 | cat << EOF
|
---|
| 571 | @echo "PKGDIR=\$(SRC)/binutils-build" > envars && \\
|
---|
| 572 | echo "export PKGDIR" >> envars
|
---|
| 573 | EOF
|
---|
| 574 | ) >> $MKFILE.tmp
|
---|
[4c62c61] | 575 | fi
|
---|
[97a3ffc] | 576 |
|
---|
[a41ce58] | 577 | # For Groff we need to set PAGE envar.
|
---|
| 578 | if [ "$i" = "082-groff" ] ; then
|
---|
| 579 | (
|
---|
| 580 | cat << EOF
|
---|
| 581 | @echo "PAGE=\$(PAGE)" >> envars && \\
|
---|
| 582 | echo "export PAGE" >> envars
|
---|
| 583 | EOF
|
---|
| 584 | ) >> $MKFILE.tmp
|
---|
| 585 | fi
|
---|
| 586 |
|
---|
[b51d2ec] | 587 | # In the mount of kernel filesystems we need to set LFS
|
---|
[80c00fc] | 588 | # and not to use chroot.
|
---|
[4c62c61] | 589 | if [ "$i" = "057-kernfs" ] ; then
|
---|
[3f990d1] | 590 | (
|
---|
| 591 | cat << EOF
|
---|
[7871325] | 592 | @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
[b51d2ec] | 593 | export LFS=\$(LFS) && commands/$file >>logs/$i 2>&1 && \\
|
---|
[3f990d1] | 594 | echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\n" >>logs/$i
|
---|
| 595 | EOF
|
---|
[a7d20b8] | 596 | ) >> $MKFILE.tmp
|
---|
| 597 |
|
---|
| 598 | # The rest of Chapter06
|
---|
[7ecd166] | 599 | else
|
---|
[3f990d1] | 600 | (
|
---|
| 601 | cat << EOF
|
---|
[80c00fc] | 602 | @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=0??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
[2e51f44] | 603 | \$(CHROOT1) 'cd /jhalfs && source envars && /jhalfs/commands/$file >>/jhalfs/logs/$i 2>&1' && \\
|
---|
[3f990d1] | 604 | echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=0??-* \$(LFS)\`\n" >>logs/$i
|
---|
| 605 | EOF
|
---|
| 606 | ) >> $MKFILE.tmp
|
---|
| 607 |
|
---|
[7ecd166] | 608 | fi
|
---|
[97a3ffc] | 609 |
|
---|
[cf7f294] | 610 | # Remove the build directory(ies) except if the package build fails.
|
---|
[97a3ffc] | 611 | if [ "$vrs" != "" ] ; then
|
---|
[3f990d1] | 612 | (
|
---|
| 613 | cat << EOF
|
---|
[eaa021a] | 614 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[3f990d1] | 615 | rm -r \$(LFS)\$(SRC)/\$\$ROOT && \\
|
---|
| 616 | if [ -e \$(LFS)\$(SRC)/$name-build ]; then \\
|
---|
| 617 | rm -r \$(LFS)\$(SRC)/$name-build; \\
|
---|
| 618 | fi;
|
---|
| 619 | EOF
|
---|
| 620 | ) >> $MKFILE.tmp
|
---|
[97a3ffc] | 621 | fi
|
---|
| 622 |
|
---|
[4e4a8d5] | 623 | # Remove the Binutils pass 2 sources after a successful Re-Adjusting phase.
|
---|
[6299c11] | 624 | if [ "$i" = "067-readjusting" ] ; then
|
---|
[3f990d1] | 625 | (
|
---|
| 626 | cat << EOF
|
---|
| 627 | @rm -r \`cat sources-dir\` && \\
|
---|
| 628 | rm -r \$(LFS)\$(SRC)/binutils-build && \\
|
---|
| 629 | rm sources-dir
|
---|
| 630 | EOF
|
---|
| 631 | ) >> $MKFILE.tmp
|
---|
[97a3ffc] | 632 | fi
|
---|
| 633 |
|
---|
[732d1f1] | 634 | # Include a touch of the target name so make can check
|
---|
| 635 | # if it's already been made.
|
---|
[3f990d1] | 636 | (
|
---|
| 637 | cat << EOF
|
---|
| 638 | @touch \$@
|
---|
| 639 | EOF
|
---|
| 640 | ) >> $MKFILE.tmp
|
---|
[732d1f1] | 641 |
|
---|
[97a3ffc] | 642 | # Keep the script file name for Makefile dependencies.
|
---|
| 643 | PREV=$i
|
---|
| 644 | done
|
---|
| 645 |
|
---|
[cf7f294] | 646 | for file in chapter0{7,8,9}/* ; do
|
---|
| 647 | # Keep the script file name
|
---|
| 648 | i=`basename $file`
|
---|
| 649 |
|
---|
| 650 | # Grub must be configured manually
|
---|
| 651 | if echo $i | grep -q "grub" ; then
|
---|
| 652 | continue
|
---|
[83f64dc] | 653 | # The filesystems can't be unmounted yet due that the user must
|
---|
| 654 | # to enter to the chroot environment to create the root password,
|
---|
| 655 | # edit several files and setup Grub,
|
---|
| 656 | elif echo $i | grep -q "reboot" ; then
|
---|
| 657 | continue
|
---|
[cf7f294] | 658 | fi
|
---|
| 659 |
|
---|
| 660 | # If no .config file is supplied, the kernel build is skipped
|
---|
| 661 | if [ -z $CONFIG ] ; then
|
---|
| 662 | if echo $i | grep -q "kernel" ; then
|
---|
| 663 | continue
|
---|
| 664 | fi
|
---|
| 665 | fi
|
---|
| 666 |
|
---|
| 667 | # First append each name of the script files to a list (this will become
|
---|
| 668 | # the names of the targets in the Makefile
|
---|
| 669 | chapter789="$chapter789 $i"
|
---|
| 670 |
|
---|
| 671 | # Set the dependency for the first target.
|
---|
| 672 | if [ -z $PREV ] ; then PREV=116-strippingagain ; fi
|
---|
| 673 |
|
---|
| 674 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 675 | # as a dependency. Also call the echo_message function.
|
---|
| 676 | (
|
---|
| 677 | cat << EOF
|
---|
| 678 |
|
---|
| 679 | $i: $PREV
|
---|
| 680 | @\$(call echo_message, Building)
|
---|
| 681 | EOF
|
---|
| 682 | ) >> $MKFILE.tmp
|
---|
| 683 |
|
---|
| 684 | # Find the the bootscripts and kernel package names
|
---|
| 685 | if [ "$i" = "119-bootscripts" -o "$i" = "132-kernel" ] ; then
|
---|
| 686 | if [ "$i" = "119-bootscripts" ] ; then
|
---|
| 687 | vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 688 | FILE="lfs-bootscripts-$vrs.tar.bz2"
|
---|
| 689 | elif [ "$i" = "132-kernel" ] ; then
|
---|
| 690 | vrs=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 691 | FILE="linux-$vrs.tar.bz2"
|
---|
| 692 | fi
|
---|
| 693 | (
|
---|
| 694 | cat << EOF
|
---|
| 695 | @\$(call unpack,$FILE)
|
---|
| 696 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
| 697 | echo "PKGDIR=\$(SRC)/\$\$ROOT" > envars && \\
|
---|
| 698 | echo "export PKGDIR" >> envars
|
---|
| 699 | EOF
|
---|
| 700 | ) >> $MKFILE.tmp
|
---|
| 701 | fi
|
---|
| 702 |
|
---|
| 703 | # Put in place the kernel .config file
|
---|
[2b73842] | 704 | if [ "$i" = "132-kernel" ] ; then
|
---|
[cf7f294] | 705 | (
|
---|
| 706 | cat << EOF
|
---|
[f0f60d0] | 707 | @cp $CONFIG \$(LFS)/sources/kernel-config
|
---|
[cf7f294] | 708 | EOF
|
---|
| 709 | ) >> $MKFILE.tmp
|
---|
| 710 | fi
|
---|
| 711 |
|
---|
| 712 | # Initialize the log an run the script
|
---|
| 713 | (
|
---|
| 714 | cat << EOF
|
---|
| 715 | @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=0??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
| 716 | \$(CHROOT2) 'cd /jhalfs && source envars && /jhalfs/commands/$file >>/jhalfs/logs/$i 2>&1' && \\
|
---|
| 717 | echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=0??-* \$(LFS)\`\n" >>logs/$i
|
---|
| 718 | EOF
|
---|
| 719 | ) >> $MKFILE.tmp
|
---|
| 720 |
|
---|
| 721 | # Remove the build directory except if the package build fails.
|
---|
| 722 | if [ "$i" = "119-bootscripts" -o "$i" = "132-kernel" ] ; then
|
---|
| 723 | (
|
---|
| 724 | cat << EOF
|
---|
| 725 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
| 726 | rm -r \$(LFS)\$(SRC)/\$\$ROOT
|
---|
| 727 | EOF
|
---|
| 728 | ) >> $MKFILE.tmp
|
---|
| 729 | fi
|
---|
| 730 |
|
---|
| 731 | # Include a touch of the target name so make can check
|
---|
| 732 | # if it's already been made.
|
---|
| 733 | (
|
---|
| 734 | cat << EOF
|
---|
| 735 | @touch \$@
|
---|
| 736 | EOF
|
---|
| 737 | ) >> $MKFILE.tmp
|
---|
| 738 |
|
---|
| 739 | # Keep the script file name for Makefile dependencies.
|
---|
| 740 | PREV=$i
|
---|
| 741 | done
|
---|
| 742 |
|
---|
[3f990d1] | 743 | # Add a header, some variables and include the function file
|
---|
| 744 | # to the top of the real Makefile.
|
---|
| 745 | (
|
---|
| 746 | cat << EOF
|
---|
| 747 | $HEADER
|
---|
| 748 |
|
---|
| 749 | SRC= /sources
|
---|
| 750 | LFS= $BUILDDIR
|
---|
[a41ce58] | 751 | PAGE= $PAGE
|
---|
[3f990d1] | 752 |
|
---|
| 753 | include functions
|
---|
| 754 |
|
---|
| 755 | EOF
|
---|
| 756 | ) > $MKFILE
|
---|
[8bb92e7] | 757 |
|
---|
[c08d23b] | 758 |
|
---|
| 759 | # Add chroot commands
|
---|
| 760 | i=1
|
---|
| 761 | for file in chapter06/*chroot* ; do
|
---|
| 762 | chroot=`cat $file | sed -e '/#!\/bin\/sh/d' -e 's@ \\\@ @g' | tr -d '\n' | sed \
|
---|
[002f8a7] | 763 | -e 's/ */ /g' -e 's|\\$|&&|g' -e 's|&&exit||g' -e 's|$| -c|' -e 's|"$$LFS"|$(LFS)|'`
|
---|
[d7fd195] | 764 | echo -e "CHROOT$i= $chroot\n" >> $MKFILE
|
---|
[c08d23b] | 765 | i=`expr $i + 1`
|
---|
| 766 | done
|
---|
[9e406b5] | 767 |
|
---|
[0bad6ba] | 768 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
| 769 | # as a dependency.
|
---|
[3f990d1] | 770 | (
|
---|
| 771 | cat << EOF
|
---|
[cf7f294] | 772 | all: chapter4 chapter5 chapter6 chapter789
|
---|
[898f47a] | 773 | @\$(call echo_finished,$VERSION)
|
---|
[3f990d1] | 774 |
|
---|
| 775 | chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
|
---|
| 776 |
|
---|
| 777 | chapter5: chapter4 $chapter5
|
---|
| 778 |
|
---|
| 779 | chapter6: chapter5 $chapter6
|
---|
| 780 |
|
---|
[cf7f294] | 781 | chapter789: chapter6 $chapter789
|
---|
| 782 |
|
---|
[3f990d1] | 783 | clean-all: clean
|
---|
| 784 | rm -rf ./*
|
---|
| 785 |
|
---|
| 786 | clean: clean-chapter5 clean-chapter4
|
---|
| 787 |
|
---|
| 788 | clean-chapter4:
|
---|
| 789 | -userdel lfs
|
---|
| 790 | rm -rf /home/lfs
|
---|
| 791 | rm -rf \$(LFS)/tools
|
---|
| 792 | rm -f /tools
|
---|
| 793 | rm -f envars
|
---|
| 794 | rm -f 02* logs/02*.log
|
---|
| 795 |
|
---|
| 796 | clean-chapter5:
|
---|
| 797 | rm -rf \$(LFS)/tools/*
|
---|
| 798 | rm -f $chapter5
|
---|
| 799 | cd logs && rm -f $chapter5 && cd ..
|
---|
| 800 |
|
---|
| 801 | 020-creatingtoolsdir:
|
---|
| 802 | @\$(call echo_message, Building)
|
---|
| 803 | @mkdir -v \$(LFS)/tools && \\
|
---|
| 804 | ln -sv \$(LFS)/tools / && \\
|
---|
| 805 | touch \$@
|
---|
| 806 |
|
---|
| 807 | 021-addinguser: 020-creatingtoolsdir
|
---|
| 808 | @\$(call echo_message, Building)
|
---|
| 809 | @groupadd lfs && \\
|
---|
| 810 | useradd -s /bin/bash -g lfs -m -k /dev/null lfs && \\
|
---|
| 811 | chown lfs \$(LFS)/tools && \\
|
---|
| 812 | chown lfs \$(LFS)/sources && \\
|
---|
| 813 | touch \$@
|
---|
| 814 |
|
---|
| 815 | 022-settingenvironment: 021-addinguser
|
---|
| 816 | @\$(call echo_message, Building)
|
---|
| 817 | @echo "exec env -i HOME=\\\$\$HOME TERM=\\\$\$TERM PS1='\u:\w\$$ ' /bin/bash" > /home/lfs/.bash_profile && \\
|
---|
| 818 | echo "set +h" > /home/lfs/.bashrc && \\
|
---|
| 819 | echo "umask 022" >> /home/lfs/.bashrc && \\
|
---|
| 820 | echo "LFS=/mnt/lfs" >> /home/lfs/.bashrc && \\
|
---|
| 821 | echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
|
---|
| 822 | echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
|
---|
| 823 | echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
|
---|
| 824 | echo ". $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\
|
---|
| 825 | chown lfs:lfs /home/lfs/.bash* && \\
|
---|
| 826 | touch envars && \\
|
---|
| 827 | touch \$@
|
---|
| 828 | EOF
|
---|
| 829 | ) >> $MKFILE
|
---|
[0bad6ba] | 830 |
|
---|
[9e406b5] | 831 | # Bring over the items from the Makefile.tmp
|
---|
| 832 | cat $MKFILE.tmp >> $MKFILE
|
---|
| 833 | rm $MKFILE.tmp
|
---|
| 834 | echo -ne "done\n"
|
---|
[f8de156] | 835 | }
|
---|
| 836 |
|
---|
[88dcce5] | 837 | run_make() {
|
---|
[d310939] | 838 | # Test if make must be run.
|
---|
| 839 | if [ "$RUNMAKE" = "1" ] ; then
|
---|
| 840 | # Build the system
|
---|
| 841 | if [ -e $MKFILE ] ; then
|
---|
[e3e1db0] | 842 | echo -ne "Building the LFS system...\n"
|
---|
[d310939] | 843 | cd $JHALFSDIR && make
|
---|
| 844 | echo -ne "done\n"
|
---|
| 845 | fi
|
---|
[88dcce5] | 846 | fi
|
---|
| 847 | }
|
---|
[1236262] | 848 |
|
---|
[4dafc45] | 849 | if [ ! -d $JHALFSDIR ] ; then
|
---|
[557fe91] | 850 | mkdir -p $JHALFSDIR
|
---|
[1236262] | 851 | fi
|
---|
| 852 |
|
---|
[4c62c61] | 853 | if [ ! -d $LOGDIR ] ; then
|
---|
| 854 | mkdir $LOGDIR
|
---|
[a5e49c6] | 855 | fi
|
---|
| 856 |
|
---|
[4c62c61] | 857 | >$LOGDIR/$LOG
|
---|
[409488e] | 858 |
|
---|
| 859 | if [ "$PWD" != "$JHALFSDIR" ] ; then
|
---|
[0fc4c75] | 860 | cp $0 $XSL $FNC $JHALFSDIR/
|
---|
[409488e] | 861 | fi
|
---|
| 862 |
|
---|
[1236262] | 863 | get_book
|
---|
[f8de156] | 864 | build_Makefile
|
---|
[71642ef] | 865 | run_make
|
---|