[0170229] | 1 | #!/bin/sh
|
---|
[1ce084e] | 2 | # $Id$
|
---|
[0170229] | 3 |
|
---|
| 4 | ###################################
|
---|
| 5 | ### FUNCTIONS ###
|
---|
| 6 | ###################################
|
---|
| 7 |
|
---|
| 8 | unset extract_commands
|
---|
| 9 | #----------------------------#
|
---|
| 10 | extract_commands() { #
|
---|
| 11 | #----------------------------#
|
---|
| 12 |
|
---|
| 13 | #Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
|
---|
| 14 | test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
|
---|
| 15 | exit 1"
|
---|
| 16 |
|
---|
| 17 | cd $JHALFSDIR
|
---|
| 18 | VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
|
---|
| 19 |
|
---|
| 20 | # Start clean
|
---|
| 21 | if [ -d ${PROGNAME}-commands ]; then
|
---|
| 22 | rm -rf ${PROGNAME}-commands
|
---|
| 23 | else
|
---|
| 24 | mkdir -v ${PROGNAME}-commands
|
---|
| 25 | fi
|
---|
| 26 | echo "Extracting commands... ${BOLD}START${OFF}"
|
---|
| 27 |
|
---|
| 28 | echo "${tab_}Extracting commands for ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
|
---|
| 29 | xsltproc --xinclude \
|
---|
| 30 | --nonet \
|
---|
| 31 | --output ./${PROGNAME}-commands/ \
|
---|
| 32 | $BOOK/stylesheets/dump-commands.xsl $BOOK/$ARCH-index.xml
|
---|
| 33 |
|
---|
| 34 | # Grab the patches and package names.
|
---|
| 35 | cd $JHALFSDIR
|
---|
| 36 |
|
---|
| 37 | echo "${tab_}Creating the packages and patches files" ;
|
---|
| 38 | for i in patches packages ; do rm -f $i ; done
|
---|
| 39 |
|
---|
| 40 | grep "\-version " $BOOK/packages.ent | sed -e 's@<!ENTITY @@' \
|
---|
| 41 | -e 's@">@"@' \
|
---|
| 42 | -e '/generic/d' >> packages
|
---|
| 43 |
|
---|
| 44 | # Download the vim-lang package if it must be installed
|
---|
| 45 | if [ "$VIMLANG" = "1" ] ; then
|
---|
| 46 | echo `grep "vim" packages | sed 's@vim@&-lang@'` >> packages
|
---|
| 47 | fi
|
---|
| 48 |
|
---|
| 49 | grep "^<\!ENTITY" $BOOK/patches.ent | sed -e 's/.* "//' -e 's/">//' >> patches
|
---|
| 50 | # Needed for Groff patchlevel patch
|
---|
| 51 | GROFFLEVEL=`grep "groff-patchlevel" $BOOK/general.ent | sed -e 's/groff-patchlevel //' \
|
---|
| 52 | -e 's/"//g' \
|
---|
| 53 | -e 's@<!ENTITY @@' \
|
---|
| 54 | -e 's|>||'`
|
---|
| 55 | sed -i 's|&groff-patchlevel;|'$GROFFLEVEL'|' patches
|
---|
| 56 |
|
---|
| 57 |
|
---|
| 58 | # Preprocess the cmd scripts..
|
---|
| 59 | echo "${tab_}Preprocessing the cmd scripts"
|
---|
| 60 | #
|
---|
| 61 | local file this_script package vrs URLs
|
---|
| 62 | #
|
---|
| 63 | # Create a list of URLs..
|
---|
| 64 | echo "${tab_}${tab_}Writing a list of URLs to filelist_.wget "
|
---|
| 65 | xsltproc --nonet \
|
---|
| 66 | --xinclude \
|
---|
| 67 | -o filelist_.wget \
|
---|
| 68 | $BOOK/stylesheets/wget.xsl \
|
---|
| 69 | $BOOK/$ARCH-index.xml > /dev/null 2>&1
|
---|
| 70 | #
|
---|
| 71 | # Loop through all the command scripts
|
---|
| 72 | echo "${tab_}${tab_}Modifying the cmd scripts"
|
---|
| 73 | for file in `ls ${PROGNAME}-commands/*/*`;do
|
---|
| 74 | #
|
---|
| 75 | # 1. Compress the script file (remove blank lines)
|
---|
| 76 | # 2. Add a variable header and a footer to selected scripts
|
---|
| 77 | this_script=`basename $file`
|
---|
| 78 | #
|
---|
| 79 | # DO NOT play with the chroot scripts.. they are used as is later
|
---|
| 80 | [[ `_IS_ $this_script "chroot"` ]] && continue
|
---|
| 81 | #
|
---|
| 82 | # Strip leading index number and misc test.. This is a miserable method
|
---|
| 83 | package=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
| 84 | -e 's@-static@@' \
|
---|
| 85 | -e 's@-final@@' \
|
---|
| 86 | -e 's@temp-@@' \
|
---|
| 87 | -e 's@-64bit@@' \
|
---|
| 88 | -e 's@-64@@' \
|
---|
| 89 | -e 's@64@@' \
|
---|
| 90 | -e 's@-n32@@' \
|
---|
| 91 | -e 's@-build@@' \
|
---|
| 92 | -e 's@glibc-headers@glibc@'`
|
---|
| 93 | #
|
---|
| 94 | # Find the package version of the command files
|
---|
| 95 | #
|
---|
| 96 | # A little package name manipulation
|
---|
| 97 | case $package in
|
---|
| 98 | bootscripts) package="lfs-bootscripts" ;;
|
---|
| 99 | kernel) package="linux" ;;
|
---|
| 100 | esac
|
---|
| 101 | vrs=`grep "^$package-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 102 | #
|
---|
| 103 | # If $vrs isn't empty, we've got a package...
|
---|
| 104 | # NOTE: The included \n causes the separator to be written
|
---|
| 105 | # on the next line. This is for cosmetic purposes only...
|
---|
| 106 | #
|
---|
| 107 | # Set the appropriate 'sha-bang'.. depending of the phase..
|
---|
| 108 | case $package in
|
---|
| 109 | *introduction* | \
|
---|
| 110 | *changingowner* | \
|
---|
| 111 | *creatingdirs* | \
|
---|
| 112 | *createfiles* ) sha_bang=''
|
---|
| 113 | ;;
|
---|
| 114 | *) sha_bang='#!/bin/bash'
|
---|
| 115 | ;;
|
---|
| 116 | esac
|
---|
| 117 | #
|
---|
| 118 | #
|
---|
| 119 | if [ "$vrs" != "" ] ; then
|
---|
| 120 | HEADER_STR="cd \$PKGDIR${nl_}#------------------"
|
---|
| 121 | FOOTER_STR="#------------------${nl_}exit"
|
---|
| 122 | else
|
---|
| 123 | HEADER_STR="#------------------"
|
---|
| 124 | FOOTER_STR="#------------------${nl_}exit"
|
---|
| 125 | fi
|
---|
| 126 | PKG_URL=`grep -e "$package-$vrs.*tar." $JHALFSDIR/filelist_.wget` && true
|
---|
| 127 | PATCHES=`grep "$package-$vrs.*patch" $JHALFSDIR/filelist_.wget` && true
|
---|
| 128 | #
|
---|
| 129 | # There would be no URL for a cmd only script, reset package name
|
---|
| 130 | if [[ $PKG_URL = "" ]]; then
|
---|
| 131 | package=""
|
---|
| 132 | fi
|
---|
| 133 | (
|
---|
| 134 | cat << EOF
|
---|
| 135 | ${sha_bang}
|
---|
| 136 | set -e
|
---|
| 137 |
|
---|
| 138 | #####################################
|
---|
| 139 | NAME=${this_script}
|
---|
| 140 | PACKAGE=${package}
|
---|
| 141 | VERSION=${vrs}
|
---|
| 142 | PKG_URL=( ${PKG_URL} )
|
---|
| 143 | PATCHES=( ${PATCHES} )
|
---|
| 144 | #####################################
|
---|
| 145 |
|
---|
| 146 | ${HEADER_STR}
|
---|
| 147 | `grep '.' ${file}`
|
---|
| 148 | ${FOOTER_STR}
|
---|
| 149 | EOF
|
---|
| 150 | ) > tmp.script
|
---|
| 151 | mv tmp.script ${file}
|
---|
| 152 |
|
---|
| 153 | done # for file in `ls $PROGNAME-commands/*/*`
|
---|
| 154 | #
|
---|
| 155 | # Make the scripts executable.
|
---|
| 156 | chmod -R +x $JHALFSDIR/${PROGNAME}-commands
|
---|
| 157 |
|
---|
| 158 | # Done. Moving on...
|
---|
| 159 | echo "Extracting commands... ${BOLD}DONE${OFF}"
|
---|
| 160 | get_sources
|
---|
| 161 |
|
---|
| 162 | }
|
---|
| 163 |
|
---|
| 164 |
|
---|
| 165 |
|
---|
| 166 | #----------------------------#
|
---|
| 167 | host_prep_Makefiles() { # Initialization of the system
|
---|
| 168 | #----------------------------#
|
---|
| 169 | local LFS_HOST
|
---|
| 170 |
|
---|
| 171 | echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}"
|
---|
| 172 |
|
---|
| 173 | # defined here, only for ease of reading
|
---|
| 174 | LFS_HOST="`echo ${MACHTYPE} | sed -e 's/unknown/cross/g' -e 's/-pc-/-cross-/g'`"
|
---|
| 175 | (
|
---|
| 176 | cat << EOF
|
---|
| 177 | 023-creatingtoolsdir:
|
---|
| 178 | @\$(call echo_message, Building)
|
---|
| 179 | @mkdir -v \$(MOUNT_PT)/tools && \\
|
---|
| 180 | rm -fv /tools && \\
|
---|
| 181 | ln -sv \$(MOUNT_PT)/tools /
|
---|
| 182 | @if [ ! -d \$(MOUNT_PT)/sources ]; then \\
|
---|
| 183 | mkdir \$(MOUNT_PT)/sources; \\
|
---|
| 184 | fi;
|
---|
| 185 | @chmod a+wt \$(MOUNT_PT)/sources && \\
|
---|
| 186 | touch \$@
|
---|
| 187 |
|
---|
| 188 | 024-creatingcrossdir: 023-creatingtoolsdir
|
---|
| 189 | @mkdir -v \$(MOUNT_PT)/cross-tools && \\
|
---|
| 190 | rm -fv /cross-tools && \\
|
---|
| 191 | ln -sv \$(MOUNT_PT)/cross-tools /
|
---|
| 192 | @touch \$@
|
---|
| 193 |
|
---|
| 194 | 025-addinguser: 024-creatingcrossdir
|
---|
| 195 | @\$(call echo_message, Building)
|
---|
| 196 | @if [ ! -d /home/lfs ]; then \\
|
---|
| 197 | groupadd lfs; \\
|
---|
| 198 | useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
|
---|
| 199 | else \\
|
---|
| 200 | touch user-lfs-exist; \\
|
---|
| 201 | fi;
|
---|
| 202 | @chown lfs \$(MOUNT_PT) && \\
|
---|
| 203 | chown lfs \$(MOUNT_PT)/tools && \\
|
---|
| 204 | chown lfs \$(MOUNT_PT)/cross-tools && \\
|
---|
| 205 | chown lfs \$(MOUNT_PT)/sources && \\
|
---|
| 206 | touch \$@
|
---|
| 207 |
|
---|
| 208 | 026-settingenvironment: 025-addinguser
|
---|
| 209 | @\$(call echo_message, Building)
|
---|
| 210 | @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
| 211 | mv -v /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\
|
---|
| 212 | fi;
|
---|
| 213 | @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
| 214 | mv -v /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\
|
---|
| 215 | fi;
|
---|
| 216 | @echo "set +h" > /home/lfs/.bashrc && \\
|
---|
| 217 | echo "umask 022" >> /home/lfs/.bashrc && \\
|
---|
| 218 | echo "LFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\
|
---|
| 219 | echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
|
---|
| 220 | echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
|
---|
| 221 | echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
|
---|
| 222 | echo "" >> /home/lfs/.bashrc && \\
|
---|
| 223 | echo "unset CFLAGS" >> /home/lfs/.bashrc && \\
|
---|
| 224 | echo "unset CXXFLAGS" >> /home/lfs/.bashrc && \\
|
---|
| 225 | echo "" >> /home/lfs/.bashrc && \\
|
---|
| 226 | echo "export LFS_HOST=\"${LFS_HOST}\"" >> /home/lfs/.bashrc && \\
|
---|
| 227 | echo "export LFS_TARGET=\"${TARGET}\"" >> /home/lfs/.bashrc && \\
|
---|
| 228 | echo "export LFS_TARGET32=\"${TARGET32}\"" >> /home/lfs/.bashrc && \\
|
---|
| 229 | echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc
|
---|
| 230 | @chown lfs:lfs /home/lfs/.bashrc && \\
|
---|
| 231 | touch envars && \\
|
---|
| 232 | touch \$@
|
---|
| 233 | EOF
|
---|
| 234 | ) >> $MKFILE.tmp
|
---|
| 235 |
|
---|
| 236 | }
|
---|
| 237 |
|
---|
| 238 |
|
---|
| 239 |
|
---|
| 240 | #-----------------------------#
|
---|
| 241 | cross_tools_Makefiles() { #
|
---|
| 242 | #-----------------------------#
|
---|
| 243 | echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools${R_arrow}"
|
---|
| 244 |
|
---|
| 245 | for file in cross-tools/* ; do
|
---|
| 246 | # Keep the script file name
|
---|
| 247 | this_script=`basename $file`
|
---|
| 248 | #
|
---|
| 249 | # Skip this script...
|
---|
| 250 | case $this_script in
|
---|
| 251 | *cflags* | *variables* ) # work done in host_prep_Makefiles
|
---|
| 252 | continue; ;;
|
---|
| 253 | *) ;;
|
---|
| 254 | esac
|
---|
| 255 | #
|
---|
| 256 | # Set the dependency for the first target.
|
---|
| 257 | if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi
|
---|
| 258 |
|
---|
| 259 | # First append each name of the script files to a list (this will become
|
---|
| 260 | # the names of the targets in the Makefile
|
---|
| 261 | cross_tools="$cross_tools $this_script"
|
---|
| 262 |
|
---|
| 263 | # Grab the name of the target (minus the -headers or -cross in the case of gcc
|
---|
| 264 | # and binutils in chapter 5)
|
---|
| 265 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
| 266 | -e 's@-static@@' \
|
---|
| 267 | -e 's@-final@@' \
|
---|
| 268 | -e 's@-headers@@' \
|
---|
| 269 | -e 's@-64@@' \
|
---|
| 270 | -e 's@-n32@@'`
|
---|
| 271 | # Adjust 'name' and patch a few scripts on the fly..
|
---|
| 272 | case $name in
|
---|
| 273 | linux-libc) name=linux-libc-headers ;;
|
---|
| 274 | esac
|
---|
| 275 | #
|
---|
| 276 | # Find the version of the command files, if it corresponds with the building of a specific package
|
---|
| 277 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 278 |
|
---|
| 279 |
|
---|
| 280 | #--------------------------------------------------------------------#
|
---|
| 281 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 282 | #--------------------------------------------------------------------#
|
---|
| 283 | #
|
---|
| 284 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 285 | # as a dependency. Also call the echo_message function.
|
---|
| 286 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 287 | #
|
---|
| 288 | # If $vrs isn't empty, we've got a package...
|
---|
| 289 | #
|
---|
[c3c4e1d] | 290 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" && echo -e '\ttrue' >> $MKFILE.tmp
|
---|
[0170229] | 291 | #
|
---|
| 292 | wrt_run_as_lfs "${this_script}" "${file}"
|
---|
| 293 | #
|
---|
| 294 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 295 | #
|
---|
| 296 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 297 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 298 | #
|
---|
| 299 | #--------------------------------------------------------------------#
|
---|
| 300 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 301 | #--------------------------------------------------------------------#
|
---|
| 302 | #
|
---|
| 303 | # Keep the script file name for Makefile dependencies.
|
---|
| 304 | PREV=$this_script
|
---|
| 305 |
|
---|
| 306 | done # for file in ....
|
---|
| 307 | }
|
---|
| 308 |
|
---|
| 309 |
|
---|
| 310 | #-----------------------------#
|
---|
| 311 | temptools_Makefiles() { #
|
---|
| 312 | #-----------------------------#
|
---|
| 313 | echo "${tab_}${GREEN}Processing... ${L_arrow}temp system${R_arrow}"
|
---|
| 314 |
|
---|
| 315 | for file in temp-system/* ; do
|
---|
| 316 | # Keep the script file name
|
---|
| 317 | this_script=`basename $file`
|
---|
| 318 | #
|
---|
| 319 | # First append each name of the script files to a list (this will become
|
---|
| 320 | # the names of the targets in the Makefile
|
---|
| 321 | temptools="$temptools $this_script"
|
---|
| 322 |
|
---|
| 323 | #
|
---|
| 324 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 325 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
---|
| 326 | #
|
---|
| 327 | # Find the version of the command files, if it corresponds with the building of a specific package
|
---|
| 328 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 329 |
|
---|
| 330 |
|
---|
| 331 | #--------------------------------------------------------------------#
|
---|
| 332 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 333 | #--------------------------------------------------------------------#
|
---|
| 334 | #
|
---|
| 335 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 336 | # as a dependency. Also call the echo_message function.
|
---|
| 337 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 338 | #
|
---|
| 339 | # If $vrs isn't empty, we've got a package...
|
---|
| 340 | # Insert instructions for unpacking the package and to set the PKGDIR variable.
|
---|
| 341 | #
|
---|
[c3c4e1d] | 342 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" && echo -e '\ttrue' >> $MKFILE.tmp
|
---|
[0170229] | 343 | #
|
---|
| 344 | wrt_run_as_lfs "${this_script}" "${file}"
|
---|
| 345 | #
|
---|
| 346 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 347 | #
|
---|
| 348 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 349 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 350 | #
|
---|
| 351 | #--------------------------------------------------------------------#
|
---|
| 352 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 353 | #--------------------------------------------------------------------#
|
---|
| 354 | #
|
---|
| 355 | # Keep the script file name for Makefile dependencies.
|
---|
| 356 | PREV=$this_script
|
---|
| 357 | done # for file in ....
|
---|
| 358 | }
|
---|
| 359 |
|
---|
| 360 |
|
---|
| 361 | #-----------------------------#
|
---|
| 362 | boot_Makefiles() { #
|
---|
| 363 | #-----------------------------#
|
---|
| 364 | echo "${tab_}${GREEN}Processing... ${L_arrow}boot${R_arrow}"
|
---|
| 365 |
|
---|
| 366 | for file in boot/* ; do
|
---|
| 367 | # Keep the script file name
|
---|
| 368 | this_script=`basename $file`
|
---|
| 369 |
|
---|
| 370 | # A little housekeeping on the scripts
|
---|
| 371 | case $this_script in
|
---|
| 372 | *grub*) continue ;;
|
---|
| 373 | *whatnext*) continue ;;
|
---|
| 374 | *settingenvironment*) sed 's@PS1=@set +h\nPS1=@' -i $file ;;
|
---|
[4845f38] | 375 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
| 376 | [[ -z $CONFIG ]] && continue
|
---|
| 377 | sed "s|make mrproper|make mrproper\ncp $CONFIG .config|" -i $file
|
---|
| 378 | # You cannot run menuconfig from within the makefile
|
---|
| 379 | sed 's|menuconfig|oldconfig|' -i $file
|
---|
| 380 | #If defined include the keymap in the kernel
|
---|
| 381 | if [[ -n "$KEYMAP" ]]; then
|
---|
| 382 | sed "s|^loadkeys -m.*>|loadkeys -m $KEYMAP >|" -i $file
|
---|
| 383 | else
|
---|
| 384 | sed '/loadkeys -m/d' -i $file
|
---|
| 385 | sed '/drivers\/char/d' -i $file
|
---|
| 386 | fi
|
---|
[0170229] | 387 | ;;
|
---|
| 388 | esac
|
---|
| 389 | #
|
---|
| 390 | # First append each name of the script files to a list (this will become
|
---|
| 391 | # the names of the targets in the Makefile
|
---|
| 392 | boottools="$boottools $this_script"
|
---|
| 393 | #
|
---|
| 394 | # Grab the name of the target, strip id number and misc words.
|
---|
| 395 | case $this_script in
|
---|
| 396 | *kernel) name=linux ;;
|
---|
| 397 | *bootscripts) name=lfs-bootscripts ;;
|
---|
| 398 | *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
|
---|
| 399 | esac
|
---|
| 400 |
|
---|
| 401 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 402 |
|
---|
| 403 | #--------------------------------------------------------------------#
|
---|
| 404 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 405 | #--------------------------------------------------------------------#
|
---|
| 406 | #
|
---|
| 407 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 408 | # as a dependency. Also call the echo_message function.
|
---|
| 409 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 410 | #
|
---|
| 411 | # If $vrs isn't empty, we've got a package...
|
---|
| 412 | # Insert instructions for unpacking the package and changing directories
|
---|
| 413 | #
|
---|
[c3c4e1d] | 414 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
|
---|
[0170229] | 415 | #
|
---|
| 416 | # Select a script execution method
|
---|
| 417 | case $this_script in
|
---|
| 418 | *changingowner*) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
| 419 | *devices*) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
| 420 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
| 421 | wrt_copy_fstab "${this_script}"
|
---|
| 422 | else
|
---|
| 423 | wrt_run_as_lfs "${this_script}" "${file}"
|
---|
| 424 | fi
|
---|
| 425 | ;;
|
---|
| 426 | *) wrt_run_as_lfs "${this_script}" "${file}" ;;
|
---|
| 427 | esac
|
---|
| 428 | #
|
---|
| 429 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
| 430 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 431 | #
|
---|
| 432 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 433 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 434 | #
|
---|
| 435 | #--------------------------------------------------------------------#
|
---|
| 436 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 437 | #--------------------------------------------------------------------#
|
---|
| 438 | #
|
---|
| 439 | # Keep the script file name for Makefile dependencies.
|
---|
| 440 | PREV=$this_script
|
---|
| 441 |
|
---|
| 442 | done
|
---|
| 443 | # This will force the Makefile to exit and not allow it to be restarted with
|
---|
| 444 | # the command <make>, The user will have to issue the cmd <make chapterXX>
|
---|
| 445 | echo -e "\t@\$(call echo_boot_finished,$VERSION) && \\" >> $MKFILE.tmp
|
---|
| 446 | echo -e "\tfalse" >> $MKFILE.tmp
|
---|
| 447 | }
|
---|
| 448 |
|
---|
| 449 |
|
---|
| 450 | #-----------------------------#
|
---|
| 451 | chroot_Makefiles() { #
|
---|
| 452 | #-----------------------------#
|
---|
| 453 | echo "${tab_}${GREEN}Processing... ${L_arrow}chroot${R_arrow}"
|
---|
| 454 |
|
---|
| 455 | for file in chroot/* ; do
|
---|
| 456 | # Keep the script file name
|
---|
| 457 | this_script=`basename $file`
|
---|
| 458 | #
|
---|
| 459 | # Skipping scripts is done now and not included in the build tree.
|
---|
| 460 | [[ `_IS_ $this_script chroot` ]] && continue
|
---|
| 461 |
|
---|
| 462 | #
|
---|
| 463 | # First append each name of the script files to a list (this will become
|
---|
| 464 | # the names of the targets in the Makefile
|
---|
| 465 | chroottools="$chroottools $this_script"
|
---|
| 466 |
|
---|
| 467 | #
|
---|
| 468 | # A little housekeeping on the script contents
|
---|
| 469 | case $this_script in
|
---|
| 470 | *kernfs*) sed '/exit/d' -i $file ;;
|
---|
| 471 | *pwdgroup*) sed '/exec/d' -i $file ;;
|
---|
| 472 | esac
|
---|
| 473 | #
|
---|
| 474 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 475 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
---|
| 476 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 477 |
|
---|
| 478 | #--------------------------------------------------------------------#
|
---|
| 479 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 480 | #--------------------------------------------------------------------#
|
---|
| 481 | #
|
---|
| 482 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 483 | # as a dependency. Also call the echo_message function.
|
---|
| 484 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 485 | #
|
---|
| 486 | # If $vrs isn't empty, we've got a package...
|
---|
| 487 | # Insert instructions for unpacking the package and changing directories
|
---|
| 488 | #
|
---|
| 489 | if [ "$vrs" != "" ] ; then
|
---|
| 490 | case $this_script in
|
---|
[c3c4e1d] | 491 | *util-linux) wrt_unpack "$name-$vrs.tar.*"
|
---|
[7d018d1] | 492 | echo -e '\ttrue' >> $MKFILE.tmp
|
---|
| 493 | ;;
|
---|
| 494 | *) wrt_unpack2 "$name-$vrs.tar.*"
|
---|
| 495 | ;;
|
---|
[0170229] | 496 | esac
|
---|
| 497 | fi
|
---|
| 498 | #
|
---|
| 499 | # Select a script execution method
|
---|
| 500 | case $this_script in
|
---|
| 501 | *kernfs) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
| 502 | *util-linux) wrt_run_as_lfs "${this_script}" "${file}" ;;
|
---|
| 503 | *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
|
---|
| 504 | esac
|
---|
| 505 | #
|
---|
| 506 | # Housekeeping...remove the build directory(ies), except if the package build fails.
|
---|
| 507 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 508 | #
|
---|
| 509 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 510 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 511 | #
|
---|
| 512 | #--------------------------------------------------------------------#
|
---|
| 513 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 514 | #--------------------------------------------------------------------#
|
---|
| 515 | #
|
---|
| 516 | # Keep the script file name for Makefile dependencies.
|
---|
| 517 | PREV=$this_script
|
---|
| 518 |
|
---|
| 519 | done # for file in...
|
---|
| 520 | }
|
---|
| 521 |
|
---|
| 522 |
|
---|
| 523 | #-----------------------------#
|
---|
| 524 | testsuite_tools_Makefiles() { #
|
---|
| 525 | #-----------------------------#
|
---|
| 526 | echo "${tab_}${GREEN}Processing... ${L_arrow}testsuite tools${R_arrow}"
|
---|
| 527 |
|
---|
| 528 | for file in testsuite-tools/* ; do
|
---|
| 529 | # Keep the script file name
|
---|
| 530 | this_script=`basename $file`
|
---|
| 531 |
|
---|
| 532 | # First append each name of the script files to a list (this will become
|
---|
| 533 | # the names of the targets in the Makefile
|
---|
| 534 | testsuitetools="$testsuitetools $this_script"
|
---|
| 535 |
|
---|
| 536 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 537 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
| 538 | -e 's@-64bit@@' \
|
---|
| 539 | -e 's@-64@@' \
|
---|
| 540 | -e 's@64@@' \
|
---|
| 541 | -e 's@n32@@'`
|
---|
| 542 |
|
---|
| 543 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 544 |
|
---|
| 545 | #--------------------------------------------------------------------#
|
---|
| 546 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 547 | #--------------------------------------------------------------------#
|
---|
| 548 | #
|
---|
| 549 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 550 | # as a dependency. Also call the echo_message function.
|
---|
| 551 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 552 | #
|
---|
| 553 | case $name in
|
---|
[c3c4e1d] | 554 | tcl) wrt_unpack2 "$name$vrs-src.tar.*" ;;
|
---|
| 555 | *) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
---|
[0170229] | 556 | esac
|
---|
| 557 | #
|
---|
| 558 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
| 559 | #
|
---|
| 560 | wrt_remove_build_dirs "${name}"
|
---|
| 561 | #
|
---|
| 562 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 563 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 564 | #
|
---|
| 565 | #--------------------------------------------------------------------#
|
---|
| 566 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 567 | #--------------------------------------------------------------------#
|
---|
| 568 | #
|
---|
| 569 | # Keep the script file name for Makefile dependencies.
|
---|
| 570 | PREV=$this_script
|
---|
| 571 |
|
---|
| 572 | done
|
---|
| 573 | }
|
---|
| 574 |
|
---|
| 575 |
|
---|
| 576 | #--------------------------------#
|
---|
| 577 | bm_testsuite_tools_Makefiles() { #
|
---|
| 578 | #--------------------------------#
|
---|
| 579 | echo "${tab_}${GREEN}Processing... ${L_arrow}(minimal boot) testsuite tools${R_arrow}"
|
---|
| 580 |
|
---|
| 581 | for file in testsuite-tools/* ; do
|
---|
| 582 | # Keep the script file name
|
---|
| 583 | this_script=`basename $file`
|
---|
| 584 |
|
---|
| 585 | # First append each name of the script files to a list (this will become
|
---|
| 586 | # the names of the targets in the Makefile
|
---|
| 587 | testsuitetools="$testsuitetools $this_script"
|
---|
| 588 |
|
---|
| 589 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 590 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
| 591 | -e 's@-64bit@@' \
|
---|
| 592 | -e 's@-64@@' \
|
---|
| 593 | -e 's@64@@' \
|
---|
| 594 | -e 's@n32@@'`
|
---|
| 595 |
|
---|
| 596 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 597 |
|
---|
| 598 | #--------------------------------------------------------------------#
|
---|
| 599 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 600 | #--------------------------------------------------------------------#
|
---|
| 601 | #
|
---|
| 602 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 603 | # as a dependency. Also call the echo_message function.
|
---|
| 604 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 605 | #
|
---|
| 606 | case $name in
|
---|
[c3c4e1d] | 607 | tcl) wrt_unpack3 "$name$vrs-src.tar.*" ;;
|
---|
| 608 | *) wrt_unpack3 "$name-$vrs.tar.*" ;;
|
---|
[0170229] | 609 | esac
|
---|
| 610 | #
|
---|
| 611 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
| 612 | #
|
---|
| 613 | wrt_remove_build_dirs2 "${name}"
|
---|
| 614 | #
|
---|
| 615 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 616 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 617 | #
|
---|
| 618 | #--------------------------------------------------------------------#
|
---|
| 619 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 620 | #--------------------------------------------------------------------#
|
---|
| 621 | #
|
---|
| 622 | # Keep the script file name for Makefile dependencies.
|
---|
| 623 | PREV=$this_script
|
---|
| 624 |
|
---|
| 625 | done
|
---|
| 626 | }
|
---|
| 627 |
|
---|
| 628 |
|
---|
| 629 | #-----------------------------#
|
---|
| 630 | final_system_Makefiles() { #
|
---|
| 631 | #-----------------------------#
|
---|
| 632 | echo "${tab_}${GREEN}Processing... ${L_arrow}final system${R_arrow}"
|
---|
| 633 |
|
---|
| 634 | for file in final-system/* ; do
|
---|
| 635 | # Keep the script file name
|
---|
| 636 | this_script=`basename $file`
|
---|
| 637 |
|
---|
| 638 | # Skipping scripts is done now so they are not included in the Makefile.
|
---|
| 639 | case $this_script in
|
---|
| 640 | *stripping*) continue ;;
|
---|
| 641 | *grub*) continue ;;
|
---|
| 642 | esac
|
---|
| 643 | #
|
---|
| 644 | # First append each name of the script files to a list (this will become
|
---|
| 645 | # the names of the targets in the Makefile
|
---|
| 646 | basicsystem="$basicsystem $this_script"
|
---|
| 647 | #
|
---|
| 648 | # A little customizing via sed scripts first..
|
---|
| 649 | if [[ $TEST = "0" ]]; then
|
---|
| 650 | # Drop any package checks..
|
---|
| 651 | sed -e '/make check/d' -e '/make test/d' -i $file
|
---|
| 652 | fi
|
---|
| 653 | case $this_script in
|
---|
| 654 | *coreutils*) sed 's@set -e@set -e; set +h@' -i $file ;;
|
---|
| 655 | *groff*) sed "s@\*\*EDITME.*EDITME\*\*@$PAGE@" -i $file ;;
|
---|
| 656 | *vim*) sed '/vim -c/d' -i $file ;;
|
---|
| 657 | *bash*) sed '/exec /d' -i $file ;;
|
---|
| 658 | *shadow*) sed -e '/grpconv/d' -e '/pwconv/d' -e '/passwd root/d' -i $file
|
---|
| 659 | sed '/sed -i libtool/d' -i $file
|
---|
| 660 | sed '/search_path/d' -i $file
|
---|
| 661 | ;;
|
---|
| 662 | *glibc*) sed '/tzselect/d' -i $file
|
---|
| 663 | sed "s@\*\*EDITME.*EDITME\*\*@$TIMEZONE@" -i $file
|
---|
| 664 | # Manipulate glibc's test to work with Makefile
|
---|
| 665 | sed -e 's/glibc-check-log.*//' \
|
---|
| 666 | -e 's@make -k check >@make -k check >glibc-check-log 2>\&1 || true\ngrep Error glibc-check-log || true@' -i $file
|
---|
| 667 | ;;
|
---|
| 668 | *binutils*) sed '/expect /d' -i $file
|
---|
| 669 | if [[ $TOOLCHAINTEST = "0" ]]; then
|
---|
| 670 | sed '/make check/d' -i $file
|
---|
| 671 | fi
|
---|
| 672 | ;;
|
---|
| 673 | *gcc*) # Ignore all gcc testing for now..
|
---|
| 674 | sed -e '/make -k check/d' -i $file
|
---|
| 675 | sed -e '/test_summary/d' -i $file
|
---|
| 676 | ;;
|
---|
| 677 | *texinfo*) # This sucks as a way to trim a script
|
---|
| 678 | sed -e '/cd \/usr/d' \
|
---|
| 679 | -e '/rm dir/d' \
|
---|
| 680 | -e '/for f in/d' \
|
---|
| 681 | -e '/do inst/d' \
|
---|
| 682 | -e '/done/d' -i $file
|
---|
| 683 | ;;
|
---|
| 684 | esac
|
---|
| 685 |
|
---|
| 686 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 687 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
| 688 | -e 's@temp-@@' \
|
---|
| 689 | -e 's@-64bit@@' \
|
---|
| 690 | -e 's@-64@@' \
|
---|
| 691 | -e 's@64@@' \
|
---|
| 692 | -e 's@n32@@'`
|
---|
| 693 |
|
---|
| 694 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 695 |
|
---|
| 696 | #--------------------------------------------------------------------#
|
---|
| 697 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 698 | #--------------------------------------------------------------------#
|
---|
| 699 | #
|
---|
| 700 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 701 | # as a dependency. Also call the echo_message function.
|
---|
| 702 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 703 |
|
---|
| 704 | # If $vrs isn't empty, we've got a package...
|
---|
| 705 | if [ "$vrs" != "" ] ; then
|
---|
| 706 | case $name in
|
---|
| 707 | temp-perl) wrt_unpack2 "perl-$vrs.tar.*" ;;
|
---|
| 708 | *) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
---|
| 709 | esac
|
---|
| 710 | #
|
---|
| 711 | # Export a few 'config' vars..
|
---|
| 712 | case $this_script in
|
---|
| 713 | *glibc*) # For glibc we can set then TIMEZONE envar.
|
---|
| 714 | wrt_export_timezone ;;
|
---|
| 715 | *groff*) # For Groff we need to set PAGE envar.
|
---|
| 716 | wrt_export_pagesize ;;
|
---|
| 717 | esac
|
---|
| 718 | fi
|
---|
| 719 | #
|
---|
| 720 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
| 721 | #
|
---|
| 722 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 723 | #
|
---|
| 724 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 725 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 726 | #
|
---|
| 727 | #--------------------------------------------------------------------#
|
---|
| 728 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 729 | #--------------------------------------------------------------------#
|
---|
| 730 | #
|
---|
| 731 | # Keep the script file name for Makefile dependencies.
|
---|
| 732 | PREV=$this_script
|
---|
| 733 |
|
---|
| 734 | done # for file in final-system/* ...
|
---|
| 735 | }
|
---|
| 736 |
|
---|
| 737 |
|
---|
| 738 | #-----------------------------#
|
---|
| 739 | bm_final_system_Makefiles() { #
|
---|
| 740 | #-----------------------------#
|
---|
| 741 | echo "${tab_}${GREEN}Processing... ${L_arrow}(minimal boot) final system${R_arrow}"
|
---|
| 742 |
|
---|
| 743 | for file in final-system/* ; do
|
---|
| 744 | # Keep the script file name
|
---|
| 745 | this_script=`basename $file`
|
---|
| 746 |
|
---|
| 747 | # Skipping scripts is done now so they are not included in the Makefile.
|
---|
| 748 | case $this_script in
|
---|
| 749 | *stripping*) continue ;;
|
---|
| 750 | *grub*) continue ;;
|
---|
| 751 | esac
|
---|
| 752 |
|
---|
| 753 | # First append each name of the script files to a list (this will become
|
---|
| 754 | # the names of the targets in the Makefile
|
---|
| 755 | basicsystem="$basicsystem $this_script"
|
---|
| 756 |
|
---|
| 757 | #
|
---|
| 758 | # A little customizing via sed scripts first..
|
---|
| 759 | if [[ $TEST = "0" ]]; then
|
---|
| 760 | # Drop any package checks..
|
---|
| 761 | sed -e '/make check/d' -e '/make test/d' -i $file
|
---|
| 762 | fi
|
---|
| 763 | case $this_script in
|
---|
| 764 | *coreutils*) sed 's@set -e@set -e; set +h@' -i $file ;;
|
---|
| 765 | *groff*) sed "s@\*\*EDITME.*EDITME\*\*@$PAGE@" -i $file ;;
|
---|
| 766 | *vim*) sed '/vim -c/d' -i $file ;;
|
---|
| 767 | *bash*) sed '/exec /d' -i $file ;;
|
---|
| 768 | *shadow*) sed -e '/grpconv/d' \
|
---|
| 769 | -e '/pwconv/d' \
|
---|
| 770 | -e '/passwd root/d' -i $file
|
---|
| 771 | sed '/sed -i libtool/d' -i $file
|
---|
| 772 | sed '/search_path/d' -i $file
|
---|
| 773 | ;;
|
---|
| 774 | *psmisc*) # Build fails on creation of this link. <pidof> installed in sysvinit
|
---|
| 775 | sed -e 's/^ln -s/#ln -s/' -i $file
|
---|
| 776 | ;;
|
---|
| 777 | *glibc*) sed '/tzselect/d' -i $file
|
---|
| 778 | sed "s@\*\*EDITME.*EDITME\*\*@$TIMEZONE@" -i $file
|
---|
| 779 | # Manipulate glibc's test to work with Makefile
|
---|
| 780 | sed -e 's/glibc-check-log.*//' -e 's@make -k check >@make -k check >glibc-check-log 2>\&1 || true\ngrep Error glibc-check-log || true@' -i $file
|
---|
| 781 | ;;
|
---|
| 782 | *binutils*) sed '/expect /d' -i $file
|
---|
| 783 | if [[ $TOOLCHAINTEST = "0" ]]; then
|
---|
| 784 | sed '/make check/d' -i $file
|
---|
| 785 | fi
|
---|
| 786 | ;;
|
---|
| 787 | *gcc*) # Ignore all gcc testing for now..
|
---|
| 788 | sed -e '/make -k check/d' -i $file
|
---|
| 789 | sed -e '/test_summary/d' -i $file
|
---|
| 790 | ;;
|
---|
| 791 | *texinfo*) # This sucks as a way to trim a script
|
---|
| 792 | sed -e '/cd \/usr/d' \
|
---|
| 793 | -e '/rm dir/d' \
|
---|
| 794 | -e '/for f in/d' \
|
---|
| 795 | -e '/do inst/d' \
|
---|
| 796 | -e '/done/d' -i $file
|
---|
| 797 | ;;
|
---|
| 798 | esac
|
---|
| 799 |
|
---|
| 800 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 801 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
| 802 | -e 's@temp-@@' \
|
---|
| 803 | -e 's@-64bit@@' \
|
---|
| 804 | -e 's@-64@@' \
|
---|
| 805 | -e 's@64@@' \
|
---|
| 806 | -e 's@n32@@'`
|
---|
| 807 |
|
---|
| 808 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 809 |
|
---|
| 810 | #--------------------------------------------------------------------#
|
---|
| 811 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 812 | #--------------------------------------------------------------------#
|
---|
| 813 | #
|
---|
| 814 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 815 | # as a dependency. Also call the echo_message function.
|
---|
| 816 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 817 |
|
---|
| 818 | # If $vrs isn't empty, we've got a package...
|
---|
| 819 | if [ "$vrs" != "" ] ; then
|
---|
| 820 | case $name in
|
---|
[c3c4e1d] | 821 | temp-perl) wrt_unpack3 "perl-$vrs.tar.*" ;;
|
---|
| 822 | *) wrt_unpack3 "$name-$vrs.tar.*" ;;
|
---|
[0170229] | 823 | esac
|
---|
| 824 | #
|
---|
| 825 | # Export a few 'config' vars..
|
---|
| 826 | case $this_script in
|
---|
| 827 | *glibc*) # For glibc we can set then TIMEZONE envar.
|
---|
| 828 | echo -e '\t@echo "export TIMEZONE=$(TIMEZONE)" >> envars' >> $MKFILE.tmp ;;
|
---|
| 829 | *groff*) # For Groff we need to set PAGE envar.
|
---|
| 830 | echo -e '\t@echo "export PAGE=$(PAGE)" >> envars' >> $MKFILE.tmp ;;
|
---|
| 831 | esac
|
---|
| 832 | fi
|
---|
| 833 | #
|
---|
| 834 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
| 835 | #
|
---|
| 836 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
| 837 | #
|
---|
| 838 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 839 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 840 | #
|
---|
| 841 | #--------------------------------------------------------------------#
|
---|
| 842 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 843 | #--------------------------------------------------------------------#
|
---|
| 844 | #
|
---|
| 845 | # Keep the script file name for Makefile dependencies.
|
---|
| 846 | PREV=$this_script
|
---|
| 847 |
|
---|
| 848 | done # for file in final-system/* ...
|
---|
| 849 | }
|
---|
| 850 |
|
---|
| 851 |
|
---|
| 852 | #-----------------------------#
|
---|
| 853 | bootscripts_Makefiles() { #
|
---|
| 854 | #-----------------------------#
|
---|
| 855 | echo "${tab_}${GREEN}Processing... ${L_arrow}bootscripts${R_arrow}"
|
---|
| 856 |
|
---|
| 857 | for file in bootscripts/* ; do
|
---|
| 858 | # Keep the script file name
|
---|
| 859 | this_script=`basename $file`
|
---|
| 860 |
|
---|
| 861 | case $this_script in
|
---|
| 862 | *udev*) continue ;; # This is not a script but a commentary
|
---|
| 863 | *console*) continue ;; # Use the files that came with the bootscripts
|
---|
| 864 | *) ;;
|
---|
| 865 | esac
|
---|
| 866 |
|
---|
| 867 | # First append each name of the script files to a list (this will become
|
---|
| 868 | # the names of the targets in the Makefile
|
---|
| 869 | bootscripttools="$bootscripttools $this_script"
|
---|
| 870 |
|
---|
| 871 | # A little bit of script modification
|
---|
| 872 | case $this_script in
|
---|
| 873 | *profile*) # Over-ride the book cmds, write our own simple one.
|
---|
| 874 | (
|
---|
| 875 | cat <<- EOF
|
---|
| 876 | cat > /etc/profile << "_EOF_"
|
---|
| 877 | # Begin /etc/profile
|
---|
| 878 |
|
---|
| 879 | export LC_ALL=${LC_ALL}
|
---|
| 880 | export LANG=${LANG}
|
---|
| 881 | export INPUTRC=/etc/inputrc
|
---|
| 882 |
|
---|
| 883 | # End /etc/profile
|
---|
| 884 | _EOF_
|
---|
| 885 | EOF
|
---|
| 886 | ) > $file
|
---|
| 887 | ;;
|
---|
| 888 | esac
|
---|
| 889 |
|
---|
| 890 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 891 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
| 892 | -e 's@-64bit@@' \
|
---|
| 893 | -e 's@-64@@' \
|
---|
| 894 | -e 's@64@@' \
|
---|
| 895 | -e 's@n32@@'`
|
---|
| 896 | if [[ `_IS_ $name bootscripts` ]]; then name=lfs-bootscripts; fi
|
---|
| 897 |
|
---|
| 898 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 899 |
|
---|
| 900 | #--------------------------------------------------------------------#
|
---|
| 901 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 902 | #--------------------------------------------------------------------#
|
---|
| 903 | #
|
---|
| 904 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 905 | # as a dependency. Also call the echo_message function.
|
---|
| 906 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 907 | #
|
---|
| 908 | # If $vrs isn't empty, we've got a package...
|
---|
| 909 | #
|
---|
| 910 | [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
|
---|
| 911 | #
|
---|
| 912 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
| 913 | #
|
---|
| 914 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 915 | #
|
---|
| 916 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 917 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 918 | #
|
---|
| 919 | #--------------------------------------------------------------------#
|
---|
| 920 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 921 | #--------------------------------------------------------------------#
|
---|
| 922 | #
|
---|
| 923 | # Keep the script file name for Makefile dependencies.
|
---|
| 924 | PREV=$this_script
|
---|
| 925 |
|
---|
| 926 | done # for file in bootscripts/* ...
|
---|
| 927 |
|
---|
| 928 | }
|
---|
| 929 |
|
---|
| 930 | #-----------------------------#
|
---|
| 931 | bm_bootscripts_Makefiles() { #
|
---|
| 932 | #-----------------------------#
|
---|
| 933 | echo "${tab_}${GREEN}Processing... ${L_arrow}(minimal boot) bootscripts${R_arrow}"
|
---|
| 934 |
|
---|
| 935 | for file in bootscripts/* ; do
|
---|
| 936 | # Keep the script file name
|
---|
| 937 | this_script=`basename $file`
|
---|
| 938 |
|
---|
| 939 | case $this_script in
|
---|
| 940 | *udev*) continue ;; # This is not a script but a commentary
|
---|
| 941 | *console*) continue ;; # Use the files that came with the bootscripts
|
---|
| 942 | *) ;;
|
---|
| 943 | esac
|
---|
| 944 |
|
---|
| 945 | # First append each name of the script files to a list (this will become
|
---|
| 946 | # the names of the targets in the Makefile
|
---|
| 947 | bootscripttools="$bootscripttools $this_script"
|
---|
| 948 |
|
---|
| 949 | # A little bit of script modification
|
---|
| 950 | case $this_script in
|
---|
| 951 | *profile*) # Over-ride the book cmds, write our own simple one.
|
---|
| 952 | (
|
---|
| 953 | cat <<- EOF
|
---|
| 954 | cat > /etc/profile << "_EOF_"
|
---|
| 955 | # Begin /etc/profile
|
---|
| 956 |
|
---|
| 957 | export LC_ALL=${LC_ALL}
|
---|
| 958 | export LANG=${LANG}
|
---|
| 959 | export INPUTRC=/etc/inputrc
|
---|
| 960 |
|
---|
| 961 | # End /etc/profile
|
---|
| 962 | _EOF_
|
---|
| 963 | EOF
|
---|
| 964 | ) > $file
|
---|
| 965 | ;;
|
---|
| 966 | esac
|
---|
| 967 |
|
---|
| 968 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 969 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
| 970 | -e 's@-64bit@@' \
|
---|
| 971 | -e 's@-64@@' \
|
---|
| 972 | -e 's@64@@' \
|
---|
| 973 | -e 's@n32@@'`
|
---|
| 974 | if [[ `_IS_ $name bootscripts` ]]; then name=lfs-bootscripts; fi
|
---|
| 975 |
|
---|
| 976 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 977 |
|
---|
| 978 | #--------------------------------------------------------------------#
|
---|
| 979 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 980 | #--------------------------------------------------------------------#
|
---|
| 981 | #
|
---|
| 982 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 983 | # as a dependency. Also call the echo_message function.
|
---|
| 984 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 985 | #
|
---|
| 986 | # If $vrs isn't empty, we've got a package...
|
---|
| 987 | #
|
---|
[c3c4e1d] | 988 | [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
---|
[0170229] | 989 | #
|
---|
| 990 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
| 991 | #
|
---|
| 992 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
| 993 | #
|
---|
| 994 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 995 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 996 | #
|
---|
| 997 | #--------------------------------------------------------------------#
|
---|
| 998 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 999 | #--------------------------------------------------------------------#
|
---|
| 1000 | #
|
---|
| 1001 | # Keep the script file name for Makefile dependencies.
|
---|
| 1002 | PREV=$this_script
|
---|
| 1003 |
|
---|
| 1004 | done # for file in bootscripts/* ...
|
---|
| 1005 |
|
---|
| 1006 | }
|
---|
| 1007 |
|
---|
| 1008 |
|
---|
| 1009 |
|
---|
| 1010 | #-----------------------------#
|
---|
| 1011 | bootable_Makefiles() { #
|
---|
| 1012 | #-----------------------------#
|
---|
| 1013 | echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable${R_arrow}"
|
---|
| 1014 |
|
---|
| 1015 | for file in bootable/* ; do
|
---|
| 1016 | # Keep the script file name
|
---|
| 1017 | this_script=`basename $file`
|
---|
| 1018 |
|
---|
| 1019 | # A little housekeeping on the scripts
|
---|
| 1020 | case $this_script in
|
---|
| 1021 | *grub*) continue ;;
|
---|
| 1022 | *kernel)
|
---|
[4845f38] | 1023 | # if there is no kernel config file do not build the kernel
|
---|
| 1024 | [[ -z $CONFIG ]] && continue
|
---|
[0170229] | 1025 | sed "s|make mrproper|make mrproper\ncp $CONFIG .config|" -i $file
|
---|
| 1026 | # You cannot run menuconfig from within the makefile
|
---|
| 1027 | sed 's|menuconfig|oldconfig|' -i $file
|
---|
| 1028 | # If defined include the keymap in the kernel
|
---|
| 1029 | if [[ -n "$KEYMAP" ]]; then
|
---|
| 1030 | sed "s|^loadkeys -m.*>|loadkeys -m $KEYMAP >|" -i $file
|
---|
| 1031 | else
|
---|
| 1032 | sed '/loadkeys -m/d' -i $file
|
---|
| 1033 | sed '/drivers\/char/d' -i $file
|
---|
| 1034 | fi
|
---|
| 1035 | ;;
|
---|
| 1036 | esac
|
---|
| 1037 | #
|
---|
| 1038 | # First append each name of the script files to a list (this will become
|
---|
| 1039 | # the names of the targets in the Makefile
|
---|
| 1040 | bootabletools="$bootabletools $this_script"
|
---|
| 1041 | #
|
---|
| 1042 | # Grab the name of the target, strip id number and misc words.
|
---|
| 1043 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
|
---|
| 1044 | [[ `_IS_ $this_script "kernel"` ]] && name=linux
|
---|
| 1045 |
|
---|
| 1046 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 1047 |
|
---|
| 1048 | #--------------------------------------------------------------------#
|
---|
| 1049 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 1050 | #--------------------------------------------------------------------#
|
---|
| 1051 | #
|
---|
| 1052 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 1053 | # as a dependency. Also call the echo_message function.
|
---|
| 1054 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 1055 | #
|
---|
| 1056 | # If $vrs isn't empty, we've got a package...
|
---|
| 1057 | # Insert instructions for unpacking the package and changing directories
|
---|
| 1058 | #
|
---|
[c3c4e1d] | 1059 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
|
---|
[0170229] | 1060 | #
|
---|
| 1061 | # Select a script execution method
|
---|
| 1062 | case $this_script in
|
---|
| 1063 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
| 1064 | wrt_copy_fstab "${this_script}"
|
---|
| 1065 | else
|
---|
| 1066 | wrt_run_as_lfs "${this_script}" "${file}"
|
---|
| 1067 | fi
|
---|
| 1068 | ;;
|
---|
| 1069 | *) wrt_run_as_lfs "${this_script}" "${file}" ;;
|
---|
| 1070 | esac
|
---|
| 1071 | #
|
---|
| 1072 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
| 1073 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 1074 | #
|
---|
| 1075 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 1076 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 1077 | #
|
---|
| 1078 | #--------------------------------------------------------------------#
|
---|
| 1079 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 1080 | #--------------------------------------------------------------------#
|
---|
| 1081 | #
|
---|
| 1082 | # Keep the script file name for Makefile dependencies.
|
---|
| 1083 | PREV=$this_script
|
---|
| 1084 |
|
---|
| 1085 | done
|
---|
| 1086 |
|
---|
| 1087 | }
|
---|
| 1088 |
|
---|
| 1089 |
|
---|
| 1090 |
|
---|
| 1091 | #-----------------------------#
|
---|
| 1092 | bm_bootable_Makefiles() { #
|
---|
| 1093 | #-----------------------------#
|
---|
| 1094 | echo "${tab_}${GREEN}Processing... ${L_arrow}(minimal boot) make bootable${R_arrow}"
|
---|
| 1095 |
|
---|
| 1096 | for file in bootable/* ; do
|
---|
| 1097 | # Keep the script file name
|
---|
| 1098 | this_script=`basename $file`
|
---|
| 1099 |
|
---|
| 1100 | # A little housekeeping on the scripts
|
---|
| 1101 | case $this_script in
|
---|
| 1102 | *grub*) continue ;;
|
---|
[c3c4e1d] | 1103 | *kernel)
|
---|
[4845f38] | 1104 | # if there is no kernel config file do not build the kernel
|
---|
| 1105 | [[ -z $CONFIG ]] && continue
|
---|
| 1106 | cfg_file="/sources/`basename $CONFIG`"
|
---|
[0170229] | 1107 | sed "s|make mrproper|make mrproper\ncp $cfg_file .config|" -i $file
|
---|
| 1108 | # You cannot run menuconfig from within the makefile
|
---|
| 1109 | sed 's|menuconfig|oldconfig|' -i $file
|
---|
| 1110 | # If defined include the keymap in the kernel
|
---|
| 1111 | if [[ -n "$KEYMAP" ]]; then
|
---|
| 1112 | sed "s|^loadkeys -m.*>|loadkeys -m $KEYMAP >|" -i $file
|
---|
| 1113 | else
|
---|
| 1114 | sed '/loadkeys -m/d' -i $file
|
---|
| 1115 | sed '/drivers\/char/d' -i $file
|
---|
| 1116 | fi
|
---|
| 1117 | ;;
|
---|
| 1118 | esac
|
---|
| 1119 | #
|
---|
| 1120 | # First append each name of the script files to a list (this will become
|
---|
| 1121 | # the names of the targets in the Makefile
|
---|
| 1122 | bootabletools="$bootabletools $this_script"
|
---|
| 1123 | #
|
---|
| 1124 | # Grab the name of the target, strip id number and misc words.
|
---|
| 1125 | case $this_script in
|
---|
| 1126 | *kernel) name=linux
|
---|
| 1127 | ;;
|
---|
| 1128 | *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
|
---|
| 1129 | esac
|
---|
| 1130 |
|
---|
| 1131 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 1132 |
|
---|
| 1133 | #--------------------------------------------------------------------#
|
---|
| 1134 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 1135 | #--------------------------------------------------------------------#
|
---|
| 1136 | #
|
---|
| 1137 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 1138 | # as a dependency. Also call the echo_message function.
|
---|
| 1139 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 1140 | #
|
---|
| 1141 | # If $vrs isn't empty, we've got a package...
|
---|
| 1142 | # Insert instructions for unpacking the package and changing directories
|
---|
| 1143 | #
|
---|
[c3c4e1d] | 1144 | [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
---|
[0170229] | 1145 | #
|
---|
| 1146 | # Select a script execution method
|
---|
| 1147 | case $this_script in
|
---|
| 1148 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
| 1149 | wrt_copy_fstab2 "${this_script}"
|
---|
| 1150 | else
|
---|
| 1151 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
| 1152 | fi
|
---|
| 1153 | ;;
|
---|
| 1154 | *) wrt_run_as_root2 "${this_script}" "${file}" ;;
|
---|
| 1155 | esac
|
---|
| 1156 | #
|
---|
| 1157 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
| 1158 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
| 1159 | #
|
---|
| 1160 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 1161 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 1162 | #
|
---|
| 1163 | #--------------------------------------------------------------------#
|
---|
| 1164 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 1165 | #--------------------------------------------------------------------#
|
---|
| 1166 | #
|
---|
| 1167 | # Keep the script file name for Makefile dependencies.
|
---|
| 1168 | PREV=$this_script
|
---|
| 1169 |
|
---|
| 1170 | done
|
---|
| 1171 |
|
---|
| 1172 | }
|
---|
| 1173 |
|
---|
| 1174 |
|
---|
| 1175 |
|
---|
| 1176 | #-----------------------------#
|
---|
| 1177 | the_end_Makefiles() { #
|
---|
| 1178 | #-----------------------------#
|
---|
| 1179 | echo "${tab_}${GREEN}Processing... ${L_arrow}THE END${R_arrow}"
|
---|
| 1180 | }
|
---|
| 1181 |
|
---|
| 1182 |
|
---|
| 1183 | #-----------------------------#
|
---|
| 1184 | build_Makefile() { # Construct a Makefile from the book scripts
|
---|
| 1185 | #-----------------------------#
|
---|
| 1186 | echo "Creating Makefile... ${BOLD}START${OFF}"
|
---|
| 1187 |
|
---|
| 1188 | cd $JHALFSDIR/${PROGNAME}-commands
|
---|
| 1189 | # Start with a clean Makefile.tmp file
|
---|
| 1190 | >$MKFILE.tmp
|
---|
| 1191 |
|
---|
| 1192 | host_prep_Makefiles
|
---|
| 1193 | cross_tools_Makefiles
|
---|
| 1194 | temptools_Makefiles
|
---|
| 1195 | if [[ $BOOTMINIMAL = "0" ]]; then
|
---|
| 1196 | chroot_Makefiles
|
---|
| 1197 | if [[ $TOOLCHAINTEST = "1" ]]; then
|
---|
| 1198 | testsuite_tools_Makefiles
|
---|
| 1199 | fi
|
---|
| 1200 | final_system_Makefiles
|
---|
| 1201 | bootscripts_Makefiles
|
---|
| 1202 | bootable_Makefiles
|
---|
| 1203 | else
|
---|
| 1204 | boot_Makefiles # This phase must die at the end of its run..
|
---|
| 1205 | if [[ $TOOLCHAINTEST = "1" ]]; then
|
---|
| 1206 | bm_testsuite_tools_Makefiles
|
---|
| 1207 | fi
|
---|
| 1208 | bm_final_system_Makefiles
|
---|
| 1209 | bm_bootscripts_Makefiles
|
---|
| 1210 | bm_bootable_Makefiles
|
---|
| 1211 | fi
|
---|
| 1212 | # the_end_Makefiles
|
---|
| 1213 |
|
---|
| 1214 |
|
---|
| 1215 | # Add a header, some variables and include the function file
|
---|
| 1216 | # to the top of the real Makefile.
|
---|
| 1217 | (
|
---|
| 1218 | cat << EOF
|
---|
| 1219 | $HEADER
|
---|
| 1220 |
|
---|
| 1221 | SRC= /sources
|
---|
| 1222 | MOUNT_PT= $BUILDDIR
|
---|
| 1223 | PAGE= $PAGE
|
---|
| 1224 | TIMEZONE= $TIMEZONE
|
---|
| 1225 |
|
---|
| 1226 | include makefile-functions
|
---|
| 1227 |
|
---|
| 1228 | EOF
|
---|
| 1229 | ) > $MKFILE
|
---|
| 1230 |
|
---|
| 1231 | # Add chroot commands
|
---|
| 1232 | i=1
|
---|
| 1233 | for file in chroot/*chroot* ; do
|
---|
| 1234 | chroot=`cat $file | sed -e '/#!\/bin\/sh/d' \
|
---|
| 1235 | -e '/^export/d' \
|
---|
| 1236 | -e '/^logout/d' \
|
---|
| 1237 | -e 's@ \\\@ @g' | tr -d '\n' | sed -e 's/ */ /g' \
|
---|
| 1238 | -e 's|\\$|&&|g' \
|
---|
| 1239 | -e 's|exit||g' \
|
---|
| 1240 | -e 's|$| -c|' \
|
---|
| 1241 | -e 's|"$$LFS"|$(MOUNT_PT)|'\
|
---|
| 1242 | -e 's|set -e||'`
|
---|
| 1243 | echo -e "CHROOT$i= $chroot\n" >> $MKFILE
|
---|
| 1244 | i=`expr $i + 1`
|
---|
| 1245 | done
|
---|
| 1246 |
|
---|
| 1247 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
| 1248 | # as a dependency.
|
---|
| 1249 | (
|
---|
| 1250 | cat << EOF
|
---|
| 1251 | all: chapter2 chapter3 chapter4 chapter5 chapter6 chapter7 chapter8
|
---|
| 1252 | @\$(call echo_finished,$VERSION)
|
---|
| 1253 |
|
---|
| 1254 | chapter2: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment
|
---|
| 1255 |
|
---|
| 1256 | chapter3: chapter2 $cross_tools
|
---|
| 1257 |
|
---|
| 1258 | chapter4: chapter3 $temptools
|
---|
| 1259 |
|
---|
| 1260 | chapter5: chapter4 $chroottools $boottools
|
---|
| 1261 |
|
---|
| 1262 | chapter6: chapter5 $basicsystem
|
---|
| 1263 |
|
---|
| 1264 | chapter7: chapter6 $bootscripttools
|
---|
| 1265 |
|
---|
| 1266 | chapter8: chapter7 $bootabletools
|
---|
| 1267 |
|
---|
| 1268 | clean-all: clean
|
---|
| 1269 | rm -rf ./{${PROGNAME}-commands,logs,Makefile,dump-clfs-scripts.xsl,functions,packages,patches}
|
---|
| 1270 |
|
---|
| 1271 | clean: clean-chapter4 clean-chapter3 clean-chapter2
|
---|
| 1272 |
|
---|
| 1273 | clean-chapter2:
|
---|
| 1274 | -if [ ! -f user-lfs-exist ]; then \\
|
---|
| 1275 | userdel lfs; \\
|
---|
| 1276 | rm -rf /home/lfs; \\
|
---|
| 1277 | fi;
|
---|
| 1278 | rm -rf \$(MOUNT_PT)/tools
|
---|
| 1279 | rm -f /tools
|
---|
| 1280 | rm -rf \$(MOUNT_PT)/cross-tools
|
---|
| 1281 | rm -f /cross-tools
|
---|
| 1282 | rm -f envars user-lfs-exist
|
---|
| 1283 | rm -f 02* logs/02*.log
|
---|
| 1284 |
|
---|
| 1285 | clean-chapter3:
|
---|
| 1286 | rm -rf \$(MOUNT_PT)/tools/*
|
---|
| 1287 | rm -f $cross_tools restore-lfs-env sources-dir
|
---|
| 1288 | cd logs && rm -f $cross_tools && cd ..
|
---|
| 1289 |
|
---|
| 1290 | clean-chapter4:
|
---|
| 1291 | -umount \$(MOUNT_PT)/sys
|
---|
| 1292 | -umount \$(MOUNT_PT)/proc
|
---|
| 1293 | -umount \$(MOUNT_PT)/dev/shm
|
---|
| 1294 | -umount \$(MOUNT_PT)/dev/pts
|
---|
| 1295 | -umount \$(MOUNT_PT)/dev
|
---|
| 1296 | rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
|
---|
| 1297 | rm -f $temptools
|
---|
| 1298 | cd logs && rm -f $temptools && cd ..
|
---|
| 1299 |
|
---|
| 1300 |
|
---|
| 1301 | restore-lfs-env:
|
---|
| 1302 | @\$(call echo_message, Building)
|
---|
| 1303 | @if [ -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
| 1304 | mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
|
---|
| 1305 | fi;
|
---|
| 1306 | @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
| 1307 | mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
|
---|
| 1308 | fi;
|
---|
| 1309 | @chown lfs:lfs /home/lfs/.bash* && \\
|
---|
| 1310 | touch \$@
|
---|
| 1311 |
|
---|
| 1312 | EOF
|
---|
| 1313 | ) >> $MKFILE
|
---|
| 1314 |
|
---|
| 1315 |
|
---|
| 1316 | # Bring over the items from the Makefile.tmp
|
---|
| 1317 | cat $MKFILE.tmp >> $MKFILE
|
---|
| 1318 | rm $MKFILE.tmp
|
---|
| 1319 | echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
---|
| 1320 |
|
---|
| 1321 | }
|
---|
| 1322 |
|
---|