Extensive code changes. A different method for finding the tarball name.

This commit is contained in:
George Boudreau 2006-06-20 21:14:44 +00:00
parent c044e3cdc2
commit a160d86d6d
6 changed files with 254 additions and 175 deletions

View file

@ -117,25 +117,10 @@ cross_tools_Makefiles() { #
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
-e 's@-static@@' \
-e 's@-final@@' \
-e 's@-headers@@' \
-e 's@-64@@' \
-e 's@-64@@' \
-e 's@-n32@@'`
# Adjust 'name' and patch a few scripts on the fly..
case $name in
linux-libc) name=linux-libc-headers ;;
linux) name=linux-headers ;;
esac
#
# Find the version of the command files, if it corresponds with the building of a specific package
pkg_tarball=$(get_package_tarball_name $name)
# oh-oh.. This small ugly is necessary to handle the LFS headers naming scheme
if [ "${name}" = "linux-headers" ]; then
linux_vrs=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
vrs=${linux_vrs}-${vrs##*-}
else
vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
fi
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
@ -144,13 +129,13 @@ cross_tools_Makefiles() { #
# as a dependency. Also call the echo_message function.
wrt_target "${this_script}" "$PREV"
#
# If $vrs isn't empty, we've got a package...
# If $pkg_tarball isn't empty, we've got a package...
#
[[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
[[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
#
wrt_run_as_su "${this_script}" "${file}"
#
[[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
@ -183,9 +168,7 @@ temptools_Makefiles() { #
# Grab the name of the target, strip id number, XXX-script
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
#
# Find the version of the command files, if it corresponds with the building of a specific package
vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
pkg_tarball=$(get_package_tarball_name $name)
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
@ -195,15 +178,15 @@ temptools_Makefiles() { #
# as a dependency. Also call the echo_message function.
wrt_target "${this_script}" "$PREV"
#
# If $vrs isn't empty, we've got a package...
# If $pkg_tarball isn't empty, we've got a package...
# Insert instructions for unpacking the package and to set the PKGDIR variable.
#
[[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
[[ "$vrs" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
[[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
#
wrt_run_as_su "${this_script}" "${file}"
#
[[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
@ -257,13 +240,8 @@ boot_Makefiles() { #
*) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
esac
# Identify the unique version naming scheme for the clfs bootscripts..(bad boys)
case $name in
bootscripts-cross-lfs)
vrs=`grep "^clfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
;;
*) vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
;;
esac
pkg_tarball=$(get_package_tarball_name $name)
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
@ -272,11 +250,11 @@ boot_Makefiles() { #
# as a dependency. Also call the echo_message function.
wrt_target "${this_script}" "$PREV"
#
# If $vrs isn't empty, we've got a package...
# If $pkg_tarball isn't empty, we've got a package...
# Insert instructions for unpacking the package and changing directories
#
[[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
[[ "$vrs" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
[[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
#
# Select a script execution method
case $this_script in
@ -292,7 +270,7 @@ boot_Makefiles() { #
esac
#
# Housekeeping...remove any build directory(ies) except if the package build fails.
[[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
@ -329,7 +307,8 @@ chroot_Makefiles() { #
# Grab the name of the target, strip id number, XXX-script
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
pkg_tarball=$(get_package_tarball_name $name)
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
@ -339,13 +318,13 @@ chroot_Makefiles() { #
# as a dependency. Also call the echo_message function.
wrt_target "${this_script}" "$PREV"
#
# If $vrs isn't empty, we've got a package...
# If $pkg_tarball isn't empty, we've got a package...
# Insert instructions for unpacking the package and changing directories
#
if [ "$vrs" != "" ] ; then
if [ "$pkg_tarball" != "" ] ; then
case $this_script in
*util-linux) wrt_unpack "$name-$vrs.tar.*" ;;
*) wrt_unpack2 "$name-$vrs.tar.*" ;;
*util-linux) wrt_unpack "$pkg_tarball" ;;
*) wrt_unpack2 "$pkg_tarball" ;;
esac
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
fi
@ -353,12 +332,12 @@ chroot_Makefiles() { #
# Select a script execution method
case $this_script in
*kernfs) wrt_run_as_root "${this_script}" "${file}" ;;
*util-linux) wrt_run_as_su "${this_script}" "${file}" ;;
*util-linux) wrt_run_as_su "${this_script}" "${file}" ;;
*) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
esac
#
# Housekeeping...remove the build directory(ies), except if the package build fails.
[[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
@ -394,7 +373,7 @@ testsuite_tools_Makefiles() { #
-e 's@64@@' \
-e 's@n32@@'`
vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
pkg_tarball=$(get_package_tarball_name $name)
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
@ -405,8 +384,8 @@ testsuite_tools_Makefiles() { #
wrt_target "${this_script}" "$PREV"
#
case $name in
tcl) wrt_unpack2 "$name$vrs-src.tar.*" ;;
*) wrt_unpack2 "$name-$vrs.tar.*" ;;
tcl) wrt_unpack2 `grep "^tcl" $JHALFSDIR/my_packages` ;;
*) wrt_unpack2 "$pkg_tarball" ;;
esac
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
#
@ -449,7 +428,7 @@ bm_testsuite_tools_Makefiles() { #
-e 's@64@@' \
-e 's@n32@@'`
vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
pkg_tarball=$(get_package_tarball_name $name)
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
@ -460,8 +439,8 @@ bm_testsuite_tools_Makefiles() { #
wrt_target "${this_script}" "$PREV"
#
case $name in
tcl) wrt_unpack3 "$name$vrs-src.tar.*" ;;
*) wrt_unpack3 "$name-$vrs.tar.*" ;;
tcl) wrt_unpack3 `grep "^tcl" $JHALFSDIR/my_packages` ;;
*) wrt_unpack3 "$pkg_tarball" ;;
esac
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
#
@ -531,17 +510,9 @@ final_system_Makefiles() { #
# Find the version of the command files, if it corresponds with the building of
# a specific package. We need this here to can skip scripts not needed for
# iterations rebuilds
pkg_tarball=$(get_package_tarball_name $name)
# oh-oh.. This small ugly is necessary to handle the LFS headers naming scheme
if [ "${name}" = "linux-headers" ]; then
linux_vrs=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
vrs=${linux_vrs}-${vrs##*-}
else
vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
fi
if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
case "${this_script}" in
*stripping*) ;;
*) continue ;;
@ -564,10 +535,9 @@ final_system_Makefiles() { #
# as a dependency. Also call the echo_message function.
wrt_target "${this_script}${N}" "$PREV"
# If $vrs isn't empty, we've got a package...
if [ "$vrs" != "" ] ; then
FILE="$name-$vrs.tar.*"
wrt_unpack2 "$FILE"
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
wrt_unpack2 "$pkg_tarball"
# If the testsuites must be run, initialize the log file
case $name in
binutils | gcc | glibc )
@ -583,7 +553,7 @@ final_system_Makefiles() { #
#
wrt_run_as_chroot1 "${this_script}" "${file}"
#
[[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
@ -650,9 +620,10 @@ bm_final_system_Makefiles() { #
# Find the version of the command files, if it corresponds with the building of
# a specific package. We need this here to can skip scripts not needed for
# iterations rebuilds
vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
pkg_tarball=$(get_package_tarball_name $name)
if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
case "${this_script}" in
*stripping*) ;;
*) continue ;;
@ -675,9 +646,9 @@ bm_final_system_Makefiles() { #
# as a dependency. Also call the echo_message function.
wrt_target "${this_script}${N}" "$PREV"
# If $vrs isn't empty, we've got a package...
if [ "$vrs" != "" ] ; then
FILE="$name-$vrs.tar.*"
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
FILE="$pkg_tarball"
wrt_unpack3 "$FILE"
# If the testsuites must be run, initialize the log file
case $name in
@ -694,7 +665,7 @@ bm_final_system_Makefiles() { #
#
wrt_run_as_root2 "${this_script}" "${file}"
#
[[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
@ -741,14 +712,7 @@ bootscripts_Makefiles() { #
*udev-rules) name=udev-cross-lfs ;;
esac
# Identify the unique version naming scheme for the clfs bootscripts..(bad boys)
case $name in
bootscripts-cross-lfs)
vrs=`grep "^clfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
;;
*) vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
;;
esac
pkg_tarball=$(get_package_tarball_name $name)
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
@ -758,13 +722,13 @@ bootscripts_Makefiles() { #
# as a dependency. Also call the echo_message function.
wrt_target "${this_script}" "$PREV"
#
# If $vrs isn't empty, we've got a package...
# If $pkg_tarball isn't empty, we've got a package...
#
[[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
[[ "$pkg_tarball" != "" ]] && wrt_unpack2 "$pkg_tarball"
#
wrt_run_as_chroot1 "${this_script}" "${file}"
#
[[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
@ -809,7 +773,8 @@ bm_bootscripts_Makefiles() { #
*bootscripts*) name=bootscripts-cross-lfs
;;
esac
vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
pkg_tarball=$(get_package_tarball_name $name)
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
@ -819,13 +784,13 @@ bm_bootscripts_Makefiles() { #
# as a dependency. Also call the echo_message function.
wrt_target "${this_script}" "$PREV"
#
# If $vrs isn't empty, we've got a package...
# If $pkg_tarball isn't empty, we've got a package...
#
[[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
[[ "$pkg_tarball" != "" ]] && wrt_unpack3 "$pkg_tarball"
#
wrt_run_as_root2 "${this_script}" "${file}"
#
[[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
@ -872,7 +837,8 @@ bootable_Makefiles() { #
*kernel*) name=linux
;;
esac
vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
pkg_tarball=$(get_package_tarball_name $name)
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
@ -882,10 +848,10 @@ bootable_Makefiles() { #
# as a dependency. Also call the echo_message function.
wrt_target "${this_script}" "$PREV"
#
# If $vrs isn't empty, we've got a package...
# If $pkg_tarball isn't empty, we've got a package...
# Insert instructions for unpacking the package and changing directories
#
[[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
[[ "$pkg_tarball" != "" ]] && wrt_unpack2 "$pkg_tarball"
#
# Select a script execution method
case $this_script in
@ -899,7 +865,7 @@ bootable_Makefiles() { #
esac
#
# Housekeeping...remove any build directory(ies) except if the package build fails.
[[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
@ -945,12 +911,11 @@ bm_bootable_Makefiles() { #
#
# Grab the name of the target, strip id number and misc words.
case $this_script in
*kernel) name=linux
;;
*kernel) name=linux ;;
*) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
esac
vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
pkg_tarball=$(get_package_tarball_name $name)
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
@ -960,10 +925,10 @@ bm_bootable_Makefiles() { #
# as a dependency. Also call the echo_message function.
wrt_target "${this_script}" "$PREV"
#
# If $vrs isn't empty, we've got a package...
# If $pkg_tarball isn't empty, we've got a package...
# Insert instructions for unpacking the package and changing directories
#
[[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
[[ "$pkg_tarball" != "" ]] && wrt_unpack3 "$pkg_tarball"
#
# Select a script execution method
case $this_script in
@ -979,7 +944,7 @@ bm_bootable_Makefiles() { #
esac
#
# Housekeeping...remove any build directory(ies) except if the package build fails.
[[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
@ -1091,6 +1056,9 @@ clean-all: clean
clean: clean-chapter4 clean-chapter3 clean-chapter2
restart:
@echo "This feature does not exist for the CLFS makefile. (yet)"
clean-chapter2:
-if [ ! -f user-lfs-exist ]; then \\
userdel lfs; \\
@ -1170,6 +1138,9 @@ clean-all: clean
clean: clean-makesys clean-makeboot clean-jhalfs
restart:
@echo "This feature does not exist for the CLFS makefile. (yet)"
clean-jhalfs:
-if [ ! -f user-lfs-exist ]; then \\
userdel lfs; \\

View file

@ -119,13 +119,14 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
# Adjust 'name'
case $name in
linux-libc) name=linux-libc-headers ;;
linux-libc) name="linux-libc-headers" ;;
gcc) name="gcc-core" ;;
uclibc) name="uClibc" ;;
esac
# Set the dependency for the first target.
if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
@ -136,22 +137,13 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
# Find the version of the command files, if it corresponds with the building of
# a specific package
vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
# If $vrs isn't empty, we've got a package...
if [ "$vrs" != "" ] ; then
# Deal with non-standard names
case $name in
tcl) FILE="$name$vrs-src.tar.*" ;;
uclibc) FILE="uClibc-$vrs.tar.*" ;;
gcc) FILE="gcc-core-$vrs.tar.*" ;;
*) FILE="$name-$vrs.tar.*" ;;
esac
pkg_tarball=$(get_package_tarball_name $name)
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
# Insert instructions for unpacking the package and to set the PKGDIR variable.
case $this_script in
*binutils* )
wrt_unpack "$FILE" 1 ;; # Do not delete an existing package directories
*)
wrt_unpack "$FILE" ;;
*binutils* ) wrt_unpack "$pkg_tarball" 1 ;; # Do not delete an existing package directories
*) wrt_unpack "$pkg_tarball" ;;
esac
# If the testsuites must be run, initialize the log file
[[ "$TEST" = "3" ]] && wrt_test_log "${this_script}"
@ -180,12 +172,11 @@ EOF
# Remove the build directory(ies) except if the package build fails
# (so we can review config.cache, config.log, etc.)
# For Binutils the sources must be retained for some time.
if [ "$vrs" != "" ] ; then
if [ "$pkg_tarball" != "" ] ; then
case "${this_script}" in
*binutils*) : # do NOTHING
;;
*) wrt_remove_build_dirs "$name"
;;
*binutils*) : ;; # do NOTHING
*gcc*) wrt_remove_build_dirs "gcc" ;;
*) wrt_remove_build_dirs "$name" ;;
esac
fi
@ -271,11 +262,25 @@ chapter6_Makefiles() { # sysroot or chroot build phase
# Grab the name of the target
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
#
# Sed replacement to fix some rm command that could fail.
# That should be fixed in the book sources.
#
case $name in
glibc) sed 's/rm /rm -f /' -i chapter06$N/$this_script ;;
gcc) sed 's/rm /rm -f /' -i chapter06$N/$this_script ;;
esac
case $name in
gcc) name="gcc-core" ;;
uclibc) name="uClibc" ;;
esac
# Find the version of the command files, if it corresponds with the building of
# a specific package
vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
pkg_tarball=$(get_package_tarball_name $name)
if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
case "${this_script}" in
*stripping*) ;;
*) continue ;;
@ -290,42 +295,23 @@ chapter6_Makefiles() { # sysroot or chroot build phase
# the names of the logs to be moved for each iteration)
LOGS="$LOGS ${this_script}"
#
# Sed replacement to fix some rm command that could fail.
# That should be fixed in the book sources.
#
case $name in
glibc)
sed 's/rm /rm -f /' -i chapter06$N/$this_script
;;
gcc)
sed 's/rm /rm -f /' -i chapter06$N/$this_script
;;
esac
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function.
# as a dependency. Also call the echo_message function.
wrt_target "${this_script}${N}" "$PREV"
# If $vrs isn't empty, we've got a package...
# If $pkg_tarball isn't empty, we've got a package...
# Insert instructions for unpacking the package and changing directories
if [ "$vrs" != "" ] ; then
# Deal with non-standard names
case $name in
tcl) FILE="$name$vrs-src.tar.*" ;;
uclibc) FILE="uClibc-$vrs.tar.*" ;;
gcc) FILE="gcc-core-$vrs.tar.*" ;;
*) FILE="$name-$vrs.tar.*" ;;
esac
wrt_unpack2 "$FILE"
if [ "$pkg_tarball" != "" ] ; then
wrt_unpack2 "$pkg_tarball"
wrt_target_vars
# If the testsuites must be run, initialize the log file
case $name in
binutils | gcc | glibc )
binutils | gcc-core | glibc )
[[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
;;
* )
@ -353,7 +339,7 @@ chapter6_Makefiles() { # sysroot or chroot build phase
esac
#
# Remove the build directory(ies) except if the package build fails.
if [ "$vrs" != "" ] ; then
if [ "$pkg_tarball" != "" ] ; then
wrt_remove_build_dirs "$name"
fi
#
@ -427,11 +413,9 @@ chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..e
case "${this_script}" in
*bootscripts*)
vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
FILE="lfs-bootscripts-$vrs.tar.*"
wrt_unpack2 "$FILE"
vrs=`grep "^blfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
echo -e "\t@echo \"\$(MOUNT_PT)\$(SRC)/blfs-bootscripts-$vrs\" >> sources-dir" >> $MKFILE.tmp
wrt_unpack2 $(get_package_tarball_name "lfs-bootscripts")
blfs_bootscripts=$(get_package_tarball_name "blfs-bootscripts" | sed -e 's/.tar.*//' )
echo -e "\t@echo \"\$(MOUNT_PT)\$(SRC)/$blfs_bootscripts\" >> sources-dir" >> $MKFILE.tmp
;;
esac
@ -546,6 +530,8 @@ clean-all: clean
clean: clean-chapter7 clean-chapter6 clean-chapter5 clean-chapter3
restart: restart_code all
clean-chapter3:
-if [ ! -f user-lfs-exist ]; then \\
userdel lfs; \\
@ -599,6 +585,47 @@ do-housekeeping:
rm -rf /home/lfs; \\
fi;
restart_code:
@echo ">>> This feature is experimental, BUGS may exist"
@if [ ! -L /tools ]; then \\
echo -e "\\nERROR::\\n /tools is NOT a symlink.. /tools must point to \$(MOUNT_PT)/tools\\n" && false;\\
fi;
@if [ ! -e /tools ]; then \\
echo -e "\\nERROR::\\nThe target /tools points to does not exist.\\nVerify the target.. \$(MOUNT_PT)/tools\\n" && false;\\
fi;
@if ! stat -c %N /tools | grep "\$(MOUNT_PT)/tools" >/dev/null ; then \\
echo -e "\\nERROR::\\nThe symlink \\"/tools\\" does not point to \\"\$(MOUNT_PT)/tools\\".\\nCorrect the problem and rerun\\n" && false;\\
fi;
@if [ -f ???-kernfs ]; then \\
mkdir -pv \$(MOUNT_PT)/{proc,sys};\\
if ! mount -l | "\$(MOUNT_PT)/dev" >/dev/null ; then \\
mount -vt ramfs ramfs \$(MOUNT_PT)/dev;\\
fi;\\
if [ ! -e \$(MOUNT_PT)/dev/console ]; then \\
mknod -m 600 \$(MOUNT_PT)/dev/console c 5 1;\\
fi;\\
if [ ! -e \$(MOUNT_PT)/dev/null ]; then \\
mknod -m 666 \$(MOUNT_PT)/dev/null c 1 3;\\
fi;\\
if ! mount -l | grep "\$(MOUNT_PT)/dev/pts" >/dev/null ; then \\
mount -vt devpts -o gid=4,mode=620 devpts \$(MOUNT_PT)/dev/pts;\\
fi;\\
if ! mount -l | grep "\$(MOUNT_PT)/dev/shm" >/dev/null ; then \\
mount -vt tmpfs shm \$(MOUNT_PT)/dev/shm;\\
fi;\\
if ! mount -l | grep "\$(MOUNT_PT)/proc" >/dev/null ; then \\
mount -vt proc proc \$(MOUNT_PT)/proc;\\
fi;\\
if ! mount -l | grep "\$(MOUNT_PT)/sys" >/dev/null ; then \\
mount -vt sysfs sysfs \$(MOUNT_PT)/sys;\\
fi;\\
fi;
EOF
) >> $MKFILE

View file

@ -106,18 +106,12 @@ chapter5_Makefiles() {
# Find the version of the command files, if it corresponds with the building of
# a specific package
vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
# If $vrs isn't empty, we've got a package...
if [ "$vrs" != "" ] ; then
if [ "$name" = "tcl" ] ; then
FILE="$name$vrs-src.tar.*"
else
FILE="$name-$vrs.tar.*"
fi
pkg_tarball=$(get_package_tarball_name $name)
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
# Insert instructions for unpacking the package and to set the PKGDIR variable.
wrt_unpack "$FILE"
wrt_unpack "$pkg_tarball"
# If the testsuites must be run, initialize the log file
[[ "$TEST" = "3" ]] && wrt_test_log "${this_script}"
# If using optimizations, write the instructions
@ -134,7 +128,7 @@ chapter5_Makefiles() {
# Remove the build directory(ies) except if the package build fails
# (so we can review config.cache, config.log, etc.)
if [ "$vrs" != "" ] ; then
if [ "$pkg_tarball" != "" ] ; then
wrt_remove_build_dirs "$name"
fi
@ -195,9 +189,9 @@ chapter6_Makefiles() {
# Find the version of the command files, if it corresponds with the building of
# a specific package. We need this here to can skip scripts not needed for
# iterations rebuilds
vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
pkg_tarball=$(get_package_tarball_name $name)
if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
case "${this_script}" in
*stripping*) ;;
*) continue ;;
@ -220,11 +214,10 @@ chapter6_Makefiles() {
# as a dependency. Also call the echo_message function.
wrt_target "${this_script}${N}" "$PREV"
# If $vrs isn't empty, we've got a package...
# If $pkg_tarball isn't empty, we've got a package...
# Insert instructions for unpacking the package and changing directories
if [ "$vrs" != "" ] ; then
FILE="$name-$vrs.tar.*"
wrt_unpack2 "$FILE"
if [ "$pkg_tarball" != "" ] ; then
wrt_unpack2 "$pkg_tarball"
# If the testsuites must be run, initialize the log file
case $name in
binutils | gcc | glibc )
@ -246,7 +239,7 @@ chapter6_Makefiles() {
esac
# Remove the build directory(ies) except if the package build fails.
if [ "$vrs" != "" ] ; then
if [ "$pkg_tarball" != "" ] ; then
wrt_remove_build_dirs "$name"
fi
@ -304,14 +297,14 @@ chapter789_Makefiles() {
# Find the bootscripts and kernel package names
case "${this_script}" in
*bootscripts)
vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
FILE="lfs-bootscripts-$vrs.tar.*"
wrt_unpack2 "$FILE"
name="lfs-bootscripts"
pkg_tarball=$(get_package_tarball_name $name)
wrt_unpack2 "$pkg_tarball"
;;
*kernel)
vrs=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
FILE="linux-$vrs.tar.*"
wrt_unpack2 "$FILE"
name="linux"
pkg_tarball=$(get_package_tarball_name $name)
wrt_unpack2 "$pkg_tarball"
;;
esac
@ -502,7 +495,7 @@ restart_code:
if ! mount -l | grep "\$(MOUNT_PT)/proc" >/dev/null ; then \\
mount -vt proc proc \$(MOUNT_PT)/proc;\\
fi;\\
if ! mount -l | grep "$\(MOUNT_PT)/sys" >/dev/null ; then \\
if ! mount -l | grep "\$(MOUNT_PT)/sys" >/dev/null ; then \\
mount -vt sysfs sysfs \$(MOUNT_PT)/sys;\\
fi;\\
fi;

View file

@ -683,6 +683,9 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
local saveIFS=$IFS
local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE
# ALWAYS create a list of the full filenames
create_package_list
# Test if the packages must be downloaded
[ ! "$GETPKG" = "1" ] && return
@ -800,6 +803,28 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
fi
}
#----------------------------#
create_package_list() { #
#----------------------------#
# Create the packages file. We need it for proper Makefile creation
echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK $ARCH"
case ${PROGNAME} in
clfs)
xsltproc --nonet \
--xinclude \
-o pkg_tarball_list packages.xsl $BOOK/${ARCH}-index.xml
;;
hlfs | lfs )
xsltproc --nonet \
--xinclude \
-o pkg_tarball_list packages.xsl $BOOK/index.xml
;;
esac
echo " ...OK"
}
#----------------------------#
create_urls() { #
@ -836,3 +861,19 @@ create_urls() { #
cd $BUILDDIR/sources
}
#----------------------------#
get_package_tarball_name() { #
#----------------------------#
local script_name=$1
# The use of 'head' is necessary to limit the return value to the FIRST match..
# hopefully this will not cause problems.
#
case $script_name in
tcl) echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
*) echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
esac
}

46
common/packages.xsl Normal file
View file

@ -0,0 +1,46 @@
<?xml version='1.0' encoding='ISO-8859-1'?>
<!-- $Id$ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:apply-templates select="//para"/>
</xsl:template>
<xsl:template match="para">
<xsl:if test="contains(string(),'Download:')">
<xsl:call-template name="package_name">
<xsl:with-param name="url" select="ulink/@url"/>
</xsl:call-template>
<xsl:text>&#xA;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="package_name">
<xsl:param name="url" select="foo"/>
<xsl:param name="sub-url" select="substring-after($url,'/')"/>
<xsl:choose>
<xsl:when test="contains($sub-url,'/')">
<xsl:call-template name="package_name">
<xsl:with-param name="url" select="$sub-url"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="contains($sub-url,'.patch')"/>
<xsl:when test="contains($sub-url,'?')">
<xsl:value-of select="substring-before($sub-url,'?')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$sub-url"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View file

@ -507,6 +507,7 @@ if [[ "$PWD" != "$JHALFSDIR" ]]; then
fi
#
[[ "$GETPKG" = "1" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
cp $COMMON_DIR/packages.xsl $JHALFSDIR/
#
sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
export XSL=$JHALFSDIR/${XSL}