Merged r3043:3145 from experimental:
New Makefile code and other improvements.
This commit is contained in:
parent
6f75d64303
commit
045b2dc1ce
24 changed files with 1551 additions and 867 deletions
844
CLFS/master.sh
844
CLFS/master.sh
File diff suppressed because it is too large
Load diff
121
CLFS2/master.sh
121
CLFS2/master.sh
|
@ -11,7 +11,7 @@ host_prep_Makefiles() { # Initialization of the system
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
local CLFS_HOST
|
local CLFS_HOST
|
||||||
|
|
||||||
echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}"
|
echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files ( SETUP ) ${R_arrow}"
|
||||||
|
|
||||||
# defined here, only for ease of reading
|
# defined here, only for ease of reading
|
||||||
CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
|
CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
|
||||||
|
@ -35,7 +35,7 @@ cat << EOF
|
||||||
else \\
|
else \\
|
||||||
touch luser-exist; \\
|
touch luser-exist; \\
|
||||||
fi;
|
fi;
|
||||||
@chown \$(LUSER) \$(MOUNT_PT) && \\
|
@chown -R \$(LUSER) \$(MOUNT_PT) && \\
|
||||||
chown \$(LUSER) \$(MOUNT_PT)/sources
|
chown \$(LUSER) \$(MOUNT_PT)/sources
|
||||||
@touch \$@ && \\
|
@touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
|
@ -64,7 +64,9 @@ cat << EOF
|
||||||
echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/\$(LUSER)/.bashrc && \\
|
echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
|
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
|
||||||
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
||||||
touch envars
|
touch envars && \\
|
||||||
|
chown \$(LUSER):\$(LGROUP) envars && \\
|
||||||
|
chmod -R a+wt \$(MOUNT_PT)
|
||||||
@touch \$@ && \\
|
@touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
@ -122,13 +124,15 @@ cat << EOF
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
|
|
||||||
|
host_prep=" 023-creatingtoolsdir 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#-----------------------------#
|
#-----------------------------#
|
||||||
cross_tools_Makefiles() { #
|
cross_tools_Makefiles() { #
|
||||||
#-----------------------------#
|
#-----------------------------#
|
||||||
echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools${R_arrow}"
|
echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools ( LUSER ) ${R_arrow}"
|
||||||
|
|
||||||
for file in cross-tools/* ; do
|
for file in cross-tools/* ; do
|
||||||
# Keep the script file name
|
# Keep the script file name
|
||||||
|
@ -175,18 +179,18 @@ cross_tools_Makefiles() { #
|
||||||
#
|
#
|
||||||
# Drop in the name of the target on a new line, and the previous target
|
# 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}" "$PREV"
|
LUSER_wrt_target "${this_script}" "$PREV"
|
||||||
#
|
#
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
wrt_unpack "$pkg_tarball"
|
LUSER_wrt_unpack "$pkg_tarball"
|
||||||
# If using optimizations, write the instructions
|
# If using optimizations, write the instructions
|
||||||
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
wrt_RunAsUser "${this_script}" "${file}"
|
LUSER_wrt_RunAsUser "${file}"
|
||||||
#
|
#
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
[[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
|
||||||
#
|
#
|
||||||
# Include a touch of the target name so make can check if it's already been made.
|
# Include a touch of the target name so make can check if it's already been made.
|
||||||
wrt_touch
|
wrt_touch
|
||||||
|
@ -206,7 +210,7 @@ cross_tools_Makefiles() { #
|
||||||
#-----------------------------#
|
#-----------------------------#
|
||||||
final_system_Makefiles() { #
|
final_system_Makefiles() { #
|
||||||
#-----------------------------#
|
#-----------------------------#
|
||||||
echo "${tab_}${GREEN}Processing... ${L_arrow}final system${R_arrow}"
|
echo "${tab_}${GREEN}Processing... ${L_arrow}final system ( LUSER ) ${R_arrow}"
|
||||||
|
|
||||||
for file in final-system/* ; do
|
for file in final-system/* ; do
|
||||||
# Keep the script file name
|
# Keep the script file name
|
||||||
|
@ -240,18 +244,18 @@ final_system_Makefiles() { #
|
||||||
#
|
#
|
||||||
# Drop in the name of the target on a new line, and the previous target
|
# 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}" "$PREV"
|
LUSER_wrt_target "${this_script}" "$PREV"
|
||||||
#
|
#
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
wrt_unpack "$pkg_tarball"
|
LUSER_wrt_unpack "$pkg_tarball"
|
||||||
# If using optimizations, write the instructions
|
# If using optimizations, write the instructions
|
||||||
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
wrt_RunAsUser "${this_script}" "${file}"
|
LUSER_wrt_RunAsUser "${file}"
|
||||||
#
|
#
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
[[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
|
||||||
#
|
#
|
||||||
# Include a touch of the target name so make can check if it's already been made.
|
# Include a touch of the target name so make can check if it's already been made.
|
||||||
wrt_touch
|
wrt_touch
|
||||||
|
@ -270,7 +274,7 @@ final_system_Makefiles() { #
|
||||||
#-----------------------------#
|
#-----------------------------#
|
||||||
bootscripts_Makefiles() { #
|
bootscripts_Makefiles() { #
|
||||||
#-----------------------------#
|
#-----------------------------#
|
||||||
echo "${tab_}${GREEN}Processing... ${L_arrow}bootscripts${R_arrow}"
|
echo "${tab_}${GREEN}Processing... ${L_arrow}bootscripts ( LUSER ) ${R_arrow}"
|
||||||
|
|
||||||
for file in bootscripts/* ; do
|
for file in bootscripts/* ; do
|
||||||
# Keep the script file name
|
# Keep the script file name
|
||||||
|
@ -306,14 +310,14 @@ bootscripts_Makefiles() { #
|
||||||
#
|
#
|
||||||
# Drop in the name of the target on a new line, and the previous target
|
# 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}" "$PREV"
|
LUSER_wrt_target "${this_script}" "$PREV"
|
||||||
#
|
#
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
|
[[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
|
||||||
#
|
#
|
||||||
wrt_RunAsUser "${this_script}" "${file}"
|
LUSER_wrt_RunAsUser "${file}"
|
||||||
#
|
#
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
[[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
|
||||||
#
|
#
|
||||||
# Include a touch of the target name so make can check if it's already been made.
|
# Include a touch of the target name so make can check if it's already been made.
|
||||||
wrt_touch
|
wrt_touch
|
||||||
|
@ -333,7 +337,7 @@ bootscripts_Makefiles() { #
|
||||||
#-----------------------------#
|
#-----------------------------#
|
||||||
bootable_Makefiles() { #
|
bootable_Makefiles() { #
|
||||||
#-----------------------------#
|
#-----------------------------#
|
||||||
echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable${R_arrow}"
|
echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable ( LUSER ) ${R_arrow}"
|
||||||
|
|
||||||
for file in bootable/* ; do
|
for file in bootable/* ; do
|
||||||
# Keep the script file name
|
# Keep the script file name
|
||||||
|
@ -342,6 +346,7 @@ bootable_Makefiles() { #
|
||||||
# A little housekeeping on the scripts
|
# A little housekeeping on the scripts
|
||||||
case $this_script in
|
case $this_script in
|
||||||
*grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
|
*grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
|
||||||
|
*fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
|
||||||
*kernel) # if there is no kernel config file do not build the kernel
|
*kernel) # if there is no kernel config file do not build the kernel
|
||||||
[[ -z $CONFIG ]] && continue
|
[[ -z $CONFIG ]] && continue
|
||||||
# Copy the config file to /sources with a standardized name
|
# Copy the config file to /sources with a standardized name
|
||||||
|
@ -351,7 +356,12 @@ bootable_Makefiles() { #
|
||||||
#
|
#
|
||||||
# First append each name of the script files to a list (this will become
|
# First append each name of the script files to a list (this will become
|
||||||
# the names of the targets in the Makefile
|
# the names of the targets in the Makefile
|
||||||
bootable="$bootable $this_script"
|
# NOTE: new makfile format forces the last script, *chowning, into a separate
|
||||||
|
# phase.
|
||||||
|
case ${this_script} in
|
||||||
|
*chowning) chowning=${this_script} ;;
|
||||||
|
*) bootable="$bootable $this_script" ;;
|
||||||
|
esac
|
||||||
#
|
#
|
||||||
# Grab the name of the target, strip id number and misc words.
|
# Grab the name of the target, strip id number and misc words.
|
||||||
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
|
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
|
||||||
|
@ -368,27 +378,27 @@ bootable_Makefiles() { #
|
||||||
#
|
#
|
||||||
# Drop in the name of the target on a new line, and the previous target
|
# 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}" "$PREV"
|
LUSER_wrt_target "${this_script}" "$PREV"
|
||||||
#
|
#
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
|
[[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
|
||||||
#
|
#
|
||||||
# Select a script execution method
|
# Select a script execution method
|
||||||
case $this_script in
|
case $this_script in
|
||||||
*fstab*) if [[ -n "$FSTAB" ]]; then
|
*fstab*) if [[ -n "$FSTAB" ]]; then
|
||||||
wrt_copy_fstab "${this_script}"
|
LUSER_wrt_CopyFstab
|
||||||
else
|
else
|
||||||
wrt_RunAsUser "${this_script}" "${file}"
|
LUSER_wrt_RunAsUser "${file}"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*chowning) wrt_RunAsRoot "${this_script}" "${file}"
|
*chowning) wrt_RunAsRoot "${this_script}" "${file}"
|
||||||
;;
|
;;
|
||||||
*) wrt_RunAsUser "${this_script}" "${file}"
|
*) LUSER_wrt_RunAsUser "${file}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
#
|
#
|
||||||
# Housekeeping...remove any build directory(ies) except if the package build fails.
|
# Housekeeping...remove any build directory(ies) except if the package build fails.
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
[[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
|
||||||
#
|
#
|
||||||
# Include a touch of the target name so make can check if it's already been made.
|
# Include a touch of the target name so make can check if it's already been made.
|
||||||
wrt_touch
|
wrt_touch
|
||||||
|
@ -402,9 +412,6 @@ bootable_Makefiles() { #
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Add SBU-disk_usage report target if required
|
|
||||||
if [[ "$REPORT" = "y" ]] ; then wrt_report ; fi
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -446,6 +453,8 @@ SU_LUSER = su - \$(LUSER) -c
|
||||||
PRT_DU = echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n"
|
PRT_DU = echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n"
|
||||||
LUSER_HOME = /home/\$(LUSER)
|
LUSER_HOME = /home/\$(LUSER)
|
||||||
|
|
||||||
|
export PATH := \${PATH}:/usr/sbin
|
||||||
|
|
||||||
include makefile-functions
|
include makefile-functions
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
@ -454,27 +463,44 @@ EOF
|
||||||
# Drop in the main target 'all:' and the chapter targets with each sub-target
|
# Drop in the main target 'all:' and the chapter targets with each sub-target
|
||||||
# as a dependency.
|
# as a dependency.
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
all: chapter2 chapter3 chapter4 chapter5 chapter6 restore-luser-env do-housekeeping
|
|
||||||
|
all: ck_UID mk_SETUP mk_LUSER mk_ROOT create-sbu_du-report
|
||||||
|
@sudo make do-housekeeping
|
||||||
@\$(call echo_finished,$VERSION)
|
@\$(call echo_finished,$VERSION)
|
||||||
|
|
||||||
chapter2: 023-creatingtoolsdir 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile
|
ck_UID:
|
||||||
|
@if [ \`id -u\` = "0" ]; then \\
|
||||||
|
echo "--------------------------------------------------"; \\
|
||||||
|
echo "You cannot run this makefile from the root account"; \\
|
||||||
|
echo "--------------------------------------------------"; \\
|
||||||
|
exit 1; \\
|
||||||
|
fi
|
||||||
|
|
||||||
chapter3: chapter2 $cross_tools
|
mk_SETUP:
|
||||||
|
@\$(call echo_SU_request)
|
||||||
|
@sudo make SETUP
|
||||||
|
@touch \$@
|
||||||
|
|
||||||
chapter4: chapter3 $basicsystem
|
mk_LUSER: mk_SETUP
|
||||||
|
@\$(call echo_SULUSER_request)
|
||||||
|
@(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" )
|
||||||
|
@sudo make restore-luser-env
|
||||||
|
@touch \$@
|
||||||
|
|
||||||
chapter5: chapter4 $bootscripttools
|
mk_ROOT:
|
||||||
|
@sudo make ROOT
|
||||||
|
@touch \$@
|
||||||
|
|
||||||
chapter6: chapter5 $bootable
|
SETUP: $host_prep
|
||||||
|
|
||||||
clean-all: clean
|
LUSER: $cross_tools $basicsystem $bootscripttools $bootable
|
||||||
rm -rf ./{clfs2-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
|
|
||||||
|
ROOT: $chowning
|
||||||
|
|
||||||
clean:
|
|
||||||
|
|
||||||
restart:
|
restart:
|
||||||
@echo "This feature does not exist for the CLFS makefile. (yet)"
|
@echo "This feature does not exist for the CLFS-2 makefile. (yet)"
|
||||||
|
|
||||||
restore-luser-env:
|
restore-luser-env:
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
|
@ -498,6 +524,21 @@ do-housekeeping:
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE
|
) >> $MKFILE
|
||||||
|
|
||||||
|
# Add SBU-disk_usage report target
|
||||||
|
echo "create-sbu_du-report:" >> $MKFILE
|
||||||
|
if [[ "$REPORT" = "y" ]] ; then
|
||||||
|
(
|
||||||
|
cat << EOF
|
||||||
|
@\$(call echo_message, Building)
|
||||||
|
@./create-sbu_du-report.sh logs $VERSION
|
||||||
|
@\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report)
|
||||||
|
@touch \$@
|
||||||
|
|
||||||
|
|
||||||
|
EOF
|
||||||
|
) >> $MKFILE
|
||||||
|
else echo -e "\t@true\n\n" >> $MKFILE; fi
|
||||||
|
|
||||||
# Bring over the items from the Makefile.tmp
|
# Bring over the items from the Makefile.tmp
|
||||||
cat $MKFILE.tmp >> $MKFILE
|
cat $MKFILE.tmp >> $MKFILE
|
||||||
rm $MKFILE.tmp
|
rm $MKFILE.tmp
|
||||||
|
|
15
Config.in
15
Config.in
|
@ -325,6 +325,19 @@ menu "--- BOOK Settings"
|
||||||
bool "libxslt (required)"
|
bool "libxslt (required)"
|
||||||
default y
|
default y
|
||||||
|
|
||||||
|
config DEP_TIDY
|
||||||
|
bool "tidy (required)"
|
||||||
|
default y
|
||||||
|
|
||||||
|
config DEP_DBXML
|
||||||
|
bool "DocBook XML DTD (required)"
|
||||||
|
default y
|
||||||
|
|
||||||
|
config DEP_UNZIP
|
||||||
|
bool "UnZip (required to install DocBook XML DTD)"
|
||||||
|
default y
|
||||||
|
depends on DEP_DBXML
|
||||||
|
|
||||||
config DEP_DBXSL
|
config DEP_DBXSL
|
||||||
bool "DocBook XSL (required)"
|
bool "DocBook XSL (required)"
|
||||||
default y
|
default y
|
||||||
|
@ -707,6 +720,7 @@ menu "--- Advanced Features"
|
||||||
#--- End ICA/farce
|
#--- End ICA/farce
|
||||||
|
|
||||||
#--- Optimizations
|
#--- Optimizations
|
||||||
|
if !BOOK_CLFS2
|
||||||
config CONFIG_OPTIMIZE
|
config CONFIG_OPTIMIZE
|
||||||
bool "Use optimization (see help)"
|
bool "Use optimization (see help)"
|
||||||
default n
|
default n
|
||||||
|
@ -740,6 +754,7 @@ menu "--- Advanced Features"
|
||||||
default "0" if !CONFIG_OPTIMIZE
|
default "0" if !CONFIG_OPTIMIZE
|
||||||
default "1" if OPT_1
|
default "1" if OPT_1
|
||||||
default "2" if OPT_2
|
default "2" if OPT_2
|
||||||
|
endif
|
||||||
#--- End Optimizations
|
#--- End Optimizations
|
||||||
|
|
||||||
#-- Internal Settings
|
#-- Internal Settings
|
||||||
|
|
232
HLFS/master.sh
232
HLFS/master.sh
|
@ -7,16 +7,30 @@ set -e # Enable error trapping
|
||||||
### FUNCTIONS ###
|
### FUNCTIONS ###
|
||||||
###################################
|
###################################
|
||||||
|
|
||||||
|
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
process_toolchain() { # embryo,cocoon and butterfly need special handling
|
process_toolchain() { # embryo,cocoon and butterfly need special handling
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
local toolchain=$1
|
local toolchain=$1
|
||||||
local this_script=$2
|
local this_file=$2
|
||||||
local tc_phase
|
local tc_phase
|
||||||
local binutil_tarball
|
local binutil_tarball
|
||||||
local gcc_core_tarball
|
local gcc_core_tarball
|
||||||
|
local TC_MountPT
|
||||||
|
local remove_existing
|
||||||
|
|
||||||
echo "${tab_}${tab_}${GREEN}toolchain ${L_arrow}${toolchain}${R_arrow}"
|
tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'`
|
||||||
|
case $tc_phase in
|
||||||
|
embryo | \
|
||||||
|
cocoon) # Vars for LUSER phase
|
||||||
|
remove_existing="remove_existing_dirs"
|
||||||
|
TC_MountPT="\$(MOUNT_PT)\$(SRC)"
|
||||||
|
;;
|
||||||
|
butterfly) # Vars for CHROOT phase
|
||||||
|
remove_existing="remove_existing_dirs2"
|
||||||
|
TC_MountPT="\$(SRC)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
#
|
#
|
||||||
# Safe method to remove existing toolchain dirs
|
# Safe method to remove existing toolchain dirs
|
||||||
|
@ -24,56 +38,49 @@ process_toolchain() { # embryo,cocoon and butterfly need special handling
|
||||||
gcc_core_tarball=$(get_package_tarball_name "gcc-core")
|
gcc_core_tarball=$(get_package_tarball_name "gcc-core")
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@\$(call remove_existing_dirs,$binutil_tarball)
|
@\$(call ${remove_existing},$binutil_tarball)
|
||||||
@\$(call remove_existing_dirs,$gcc_core_tarball)
|
@\$(call ${remove_existing},$gcc_core_tarball)
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
|
|
||||||
#
|
#
|
||||||
# Manually remove the toolchain directories..
|
# Manually remove the toolchain directories..
|
||||||
tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'`
|
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@rm -rf \$(MOUNT_PT)\$(SRC)/${tc_phase}-toolchain && \\
|
@rm -rf ${TC_MountPT}/${tc_phase}-toolchain && \\
|
||||||
rm -rf \$(MOUNT_PT)\$(SRC)/${tc_phase}-build
|
rm -rf ${TC_MountPT}/${tc_phase}-build
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
|
|
||||||
case ${toolchain} in
|
|
||||||
*butterfly*)
|
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@echo "export PKGDIR=\$(SRC)" > envars
|
@echo "export PKGDIR=${TC_MountPT}" > envars
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
[[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
|
|
||||||
wrt_run_as_chroot1 "$toolchain" "$this_script"
|
case ${tc_phase} in
|
||||||
|
butterfly)
|
||||||
|
[[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${toolchain}"
|
||||||
|
CHROOT_wrt_RunAsRoot "$this_file"
|
||||||
;;
|
;;
|
||||||
|
*) LUSER_wrt_RunAsUser "$this_file"
|
||||||
*)
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)" > envars
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
wrt_RunAsUser "$toolchain" "$this_script"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
#
|
#
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@\$(call remove_existing_dirs,$binutil_tarball)
|
@\$(call ${remove_existing},$binutil_tarball)
|
||||||
@\$(call remove_existing_dirs,$gcc_core_tarball)
|
@\$(call ${remove_existing},$gcc_core_tarball)
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
|
|
||||||
#
|
#
|
||||||
# Manually remove the toolchain directories..
|
# Manually remove the toolchain directories..
|
||||||
tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'`
|
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@rm -r \$(MOUNT_PT)\$(SRC)/${tc_phase}-toolchain && \\
|
@rm -rf ${TC_MountPT}/${tc_phase}-toolchain && \\
|
||||||
rm -r \$(MOUNT_PT)\$(SRC)/${tc_phase}-build
|
rm -rf ${TC_MountPT}/${tc_phase}-build
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
|
|
||||||
|
@ -84,13 +91,13 @@ EOF
|
||||||
chapter3_Makefiles() { # Initialization of the system
|
chapter3_Makefiles() { # Initialization of the system
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
|
|
||||||
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter3${R_arrow}"
|
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter3 ( SETUP ) ${R_arrow}"
|
||||||
|
|
||||||
# Define a few model dependant variables
|
# Define a few model dependant variables
|
||||||
if [[ ${MODEL} = "uclibc" ]]; then
|
if [[ ${MODEL} = "uclibc" ]]; then
|
||||||
TARGET="pc-linux-gnu"; LOADER="ld-uClibc.so.0"
|
TARGET="pc-linux-gnu"; LOADER="ld-uClibc.so.0"
|
||||||
else
|
else
|
||||||
TARGET="pc-linux-gnu"; LOADER="ld-linux.so.2"
|
TARGET="pc-linux-gnu"; LOADER="ld-linux.so.2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If /home/$LUSER is already present in the host, we asume that the
|
# If /home/$LUSER is already present in the host, we asume that the
|
||||||
|
@ -120,6 +127,7 @@ cat << EOF
|
||||||
touch luser-exist; \\
|
touch luser-exist; \\
|
||||||
fi;
|
fi;
|
||||||
@chown \$(LUSER) \$(MOUNT_PT)/tools && \\
|
@chown \$(LUSER) \$(MOUNT_PT)/tools && \\
|
||||||
|
chown -R \$(LUSER) \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
|
||||||
chown \$(LUSER) \$(MOUNT_PT)/sources && \\
|
chown \$(LUSER) \$(MOUNT_PT)/sources && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
|
@ -145,13 +153,15 @@ cat << EOF
|
||||||
echo "export target ldso" >> /home/\$(LUSER)/.bashrc && \\
|
echo "export target ldso" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\
|
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
||||||
|
chmod -R a+wt \$(MOUNT_PT) && \\
|
||||||
touch envars && \\
|
touch envars && \\
|
||||||
|
chown \$(LUSER) envars && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
|
chapter3=" 020-creatingtoolsdir 021-addinguser 022-settingenvironment"
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
|
@ -160,7 +170,7 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
|
||||||
local file
|
local file
|
||||||
local this_script
|
local this_script
|
||||||
|
|
||||||
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5${R_arrow}"
|
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5 ( LUSER ) ${R_arrow}"
|
||||||
|
|
||||||
for file in chapter05/* ; do
|
for file in chapter05/* ; do
|
||||||
# Keep the script file name
|
# Keep the script file name
|
||||||
|
@ -205,32 +215,32 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
|
||||||
# NO Optimization allowed
|
# NO Optimization allowed
|
||||||
if [[ ${name} = "embryo-toolchain" ]] || \
|
if [[ ${name} = "embryo-toolchain" ]] || \
|
||||||
[[ ${name} = "cocoon-toolchain" ]]; then
|
[[ ${name} = "cocoon-toolchain" ]]; then
|
||||||
wrt_target "$this_script" "$PREV"
|
LUSER_wrt_target "$this_script" "$PREV"
|
||||||
process_toolchain "${this_script}" "${file}"
|
process_toolchain "${this_script}" "${file}"
|
||||||
wrt_touch
|
wrt_touch
|
||||||
PREV=$this_script
|
PREV=$this_script
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
wrt_target "$this_script" "$PREV"
|
LUSER_wrt_target "$this_script" "$PREV"
|
||||||
# Find the version of the command files, if it corresponds with the building of
|
# Find the version of the command files, if it corresponds with the building of
|
||||||
# a specific package
|
# a specific package
|
||||||
pkg_tarball=$(get_package_tarball_name $name)
|
pkg_tarball=$(get_package_tarball_name $name)
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
||||||
wrt_unpack "$pkg_tarball"
|
LUSER_wrt_unpack "$pkg_tarball"
|
||||||
# If using optimizations, write the instructions
|
# If using optimizations, write the instructions
|
||||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||||
fi
|
fi
|
||||||
# Insert date and disk usage at the top of the log file, the script run
|
# Insert date and disk usage at the top of the log file, the script run
|
||||||
# and date and disk usage again at the bottom of the log file.
|
# and date and disk usage again at the bottom of the log file.
|
||||||
wrt_RunAsUser "$this_script" "${file}"
|
LUSER_wrt_RunAsUser "${file}"
|
||||||
|
|
||||||
# Remove the build directory(ies) except if the package build fails
|
# Remove the build directory(ies) except if the package build fails
|
||||||
# (so we can review config.cache, config.log, etc.)
|
# (so we can review config.cache, config.log, etc.)
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
wrt_remove_build_dirs "$name"
|
LUSER_RemoveBuildDirs "$name"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Include a touch of the target name so make can check if it's already been made.
|
# Include a touch of the target name so make can check if it's already been made.
|
||||||
|
@ -275,7 +285,7 @@ chapter6_Makefiles() { # sysroot or chroot build phase
|
||||||
sed -e '/groupadd/d' -i chapter06$N/*-udev
|
sed -e '/groupadd/d' -i chapter06$N/*-udev
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N${R_arrow}"
|
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}"
|
||||||
|
|
||||||
for file in chapter06$N/* ; do
|
for file in chapter06$N/* ; do
|
||||||
# Keep the script file name
|
# Keep the script file name
|
||||||
|
@ -324,25 +334,25 @@ chapter6_Makefiles() { # sysroot or chroot build phase
|
||||||
# Drop in the name of the target on a new line, and the previous target
|
# 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.
|
||||||
if [[ ${name} = "butterfly-toolchain" ]]; then
|
if [[ ${name} = "butterfly-toolchain" ]]; then
|
||||||
wrt_target "${this_script}${N}" "$PREV"
|
CHROOT_wrt_target "${this_script}${N}" "$PREV"
|
||||||
process_toolchain "${this_script}" "${file}"
|
process_toolchain "${this_script}" "${file}"
|
||||||
wrt_touch
|
wrt_touch
|
||||||
PREV=$this_script
|
PREV=$this_script
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
wrt_target "${this_script}${N}" "$PREV"
|
CHROOT_wrt_target "${this_script}${N}" "$PREV"
|
||||||
|
|
||||||
# If $pkg_tarball 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
|
# Insert instructions for unpacking the package and changing directories
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
wrt_unpack2 "$pkg_tarball"
|
CHROOT_Unpack "$pkg_tarball"
|
||||||
# If the testsuites must be run, initialize the log file
|
# If the testsuites must be run, initialize the log file
|
||||||
# butterfly-toolchain tests are enabled in 'process_tookchain' function
|
# butterfly-toolchain tests are enabled in 'process_tookchain' function
|
||||||
case $name in
|
case $name in
|
||||||
glibc ) [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
|
glibc ) [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}"
|
||||||
;;
|
;;
|
||||||
* ) [[ "$TEST" > "1" ]] && wrt_test_log2 "${this_script}"
|
* ) [[ "$TEST" > "1" ]] && CHROOT_wrt_test_log "${this_script}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
# If using optimizations, write the instructions
|
# If using optimizations, write the instructions
|
||||||
|
@ -351,17 +361,17 @@ chapter6_Makefiles() { # sysroot or chroot build phase
|
||||||
|
|
||||||
# In the mount of kernel filesystems we need to set HLFS and not to use chroot.
|
# In the mount of kernel filesystems we need to set HLFS and not to use chroot.
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*kernfs*)
|
*kernfs* | *changingowner*)
|
||||||
wrt_RunAsRoot "${this_script}" "${file}"
|
wrt_RunAsRoot "${this_script}" "${file}"
|
||||||
;;
|
;;
|
||||||
*) # The rest of Chapter06
|
*) # The rest of Chapter06
|
||||||
wrt_run_as_chroot1 "${this_script}" "${file}"
|
CHROOT_wrt_RunAsRoot "${file}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
#
|
#
|
||||||
# Remove the build directory(ies) except if the package build fails.
|
# Remove the build directory(ies) except if the package build fails.
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
wrt_remove_build_dirs "$name"
|
CHROOT_wrt_RemoveBuildDirs "$name"
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
# Include a touch of the target name so make can check if it's already been made.
|
# Include a touch of the target name so make can check if it's already been made.
|
||||||
|
@ -385,7 +395,7 @@ chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..e
|
||||||
local file
|
local file
|
||||||
local this_script
|
local this_script
|
||||||
|
|
||||||
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7${R_arrow}"
|
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7 ( BOOT ) ${R_arrow}"
|
||||||
for file in chapter07/*; do
|
for file in chapter07/*; do
|
||||||
# Keep the script file name
|
# Keep the script file name
|
||||||
this_script=`basename $file`
|
this_script=`basename $file`
|
||||||
|
@ -398,12 +408,12 @@ chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..e
|
||||||
*usage) continue ;; # Contains example commands
|
*usage) continue ;; # Contains example commands
|
||||||
*grub) continue ;;
|
*grub) continue ;;
|
||||||
*console) continue ;; # Use the file generated by lfs-bootscripts
|
*console) continue ;; # Use the file generated by lfs-bootscripts
|
||||||
|
*fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab
|
||||||
*kernel)
|
;;
|
||||||
# If no .config file is supplied, the kernel build is skipped
|
*kernel) # If no .config file is supplied, the kernel build is skipped
|
||||||
[[ -z $CONFIG ]] && continue
|
[[ -z $CONFIG ]] && continue
|
||||||
cp $CONFIG $BUILDDIR/sources/kernel-config
|
cp $CONFIG $BUILDDIR/sources/kernel-config
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# First append then name of the script file to a list (this will become
|
# First append then name of the script file to a list (this will become
|
||||||
|
@ -416,11 +426,11 @@ chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..e
|
||||||
#
|
#
|
||||||
# Drop in the name of the target on a new line, and the previous target
|
# 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" "$PREV"
|
CHROOT_wrt_target "$this_script" "$PREV"
|
||||||
|
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*bootscripts*)
|
*bootscripts*)
|
||||||
wrt_unpack2 $(get_package_tarball_name "lfs-bootscripts")
|
CHROOT_Unpack $(get_package_tarball_name "lfs-bootscripts")
|
||||||
blfs_bootscripts=$(get_package_tarball_name "blfs-bootscripts" | sed -e 's/.tar.*//' )
|
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
|
echo -e "\t@echo \"\$(MOUNT_PT)\$(SRC)/$blfs_bootscripts\" >> sources-dir" >> $MKFILE.tmp
|
||||||
;;
|
;;
|
||||||
|
@ -429,13 +439,13 @@ chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..e
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*fstab*) # Check if we have a real /etc/fstab file
|
*fstab*) # Check if we have a real /etc/fstab file
|
||||||
if [[ -n "$FSTAB" ]] ; then
|
if [[ -n "$FSTAB" ]] ; then
|
||||||
wrt_copy_fstab "$this_script"
|
CHROOT_wrt_CopyFstab
|
||||||
else # Initialize the log and run the script
|
else
|
||||||
wrt_run_as_chroot2 "${this_script}" "${file}"
|
CHROOT_wrt_RunAsRoot "$file"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*) # All other scripts
|
*) # All other scripts
|
||||||
wrt_run_as_chroot2 "${this_script}" "${file}"
|
CHROOT_wrt_RunAsRoot "${file}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -444,8 +454,8 @@ chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..e
|
||||||
*bootscripts*)
|
*bootscripts*)
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
@ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
||||||
rm -r \$(MOUNT_PT)\$(SRC)/\$\$ROOT
|
rm -r \$(SRC)/\$\$ROOT
|
||||||
@rm -r \`cat sources-dir\` && \\
|
@rm -r \`cat sources-dir\` && \\
|
||||||
rm sources-dir
|
rm sources-dir
|
||||||
EOF
|
EOF
|
||||||
|
@ -512,7 +522,9 @@ crTESTLOGDIR = /\$(SCRIPT_ROOT)/test-logs
|
||||||
SU_LUSER = su - \$(LUSER) -c
|
SU_LUSER = su - \$(LUSER) -c
|
||||||
LUSER_HOME = /home/\$(LUSER)
|
LUSER_HOME = /home/\$(LUSER)
|
||||||
PRT_DU = echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n"
|
PRT_DU = echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n"
|
||||||
PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) \$(MOUNT_PT)\`\n"
|
PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) / \`\n"
|
||||||
|
|
||||||
|
export PATH := \${PATH}:/usr/sbin
|
||||||
|
|
||||||
include makefile-functions
|
include makefile-functions
|
||||||
|
|
||||||
|
@ -545,52 +557,64 @@ EOF
|
||||||
# as a dependency.
|
# as a dependency.
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
all: chapter3 chapter5 chapter6 chapter7 do-housekeeping
|
|
||||||
|
all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report
|
||||||
|
@sudo make do-housekeeping
|
||||||
@\$(call echo_finished,$VERSION)
|
@\$(call echo_finished,$VERSION)
|
||||||
|
|
||||||
chapter3: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
|
ck_UID:
|
||||||
|
@if [ \`id -u\` = "0" ]; then \\
|
||||||
|
echo "--------------------------------------------------"; \\
|
||||||
|
echo "You cannot run this makefile from the root account"; \\
|
||||||
|
echo "--------------------------------------------------"; \\
|
||||||
|
exit 1; \\
|
||||||
|
fi
|
||||||
|
|
||||||
chapter5: chapter3 $chapter5 restore-luser-env
|
mk_SETUP:
|
||||||
|
@\$(call echo_SU_request)
|
||||||
|
@sudo make SETUP
|
||||||
|
@touch \$@
|
||||||
|
|
||||||
chapter6: chapter5 $chapter6
|
mk_LUSER: mk_SETUP
|
||||||
|
@\$(call echo_SULUSER_request)
|
||||||
|
@(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" )
|
||||||
|
@sudo make restore-luser-env
|
||||||
|
@touch \$@
|
||||||
|
|
||||||
chapter7: chapter6 $chapter7
|
mk_SUDO: mk_LUSER
|
||||||
|
@sudo make SUDO
|
||||||
|
@touch \$@
|
||||||
|
|
||||||
clean-all: clean
|
mk_CHROOT: mk_SUDO
|
||||||
rm -rf ./{hlfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
|
@if [ ! -e \$(MOUNT_PT)/bin ]; then \\
|
||||||
|
mkdir \$(MOUNT_PT)/bin; \\
|
||||||
clean: clean-chapter7 clean-chapter6 clean-chapter5 clean-chapter3
|
cd \$(MOUNT_PT)/bin && \\
|
||||||
|
ln -sf /tools/bin/bash bash; ln -sf bash sh; \\
|
||||||
restart: restart_code all
|
sudo chown -R 0:0 \$(MOUNT_PT)/bin; \\
|
||||||
|
|
||||||
clean-chapter3:
|
|
||||||
-if [ ! -f luser-exist ]; then \\
|
|
||||||
userdel \$(LUSER); \\
|
|
||||||
rm -rf /home/\$(LUSER); \\
|
|
||||||
fi;
|
fi;
|
||||||
rm -rf \$(MOUNT_PT)/tools
|
@sudo sed -e 's|^ln -sv |ln -svf |' -i \$(CMDSDIR)/chapter06/064-createfiles
|
||||||
rm -f /tools
|
@\$(call echo_CHROOT_request)
|
||||||
rm -f envars luser-exist
|
@( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make CHROOT")
|
||||||
rm -f 02* logs/02*.log
|
@touch \$@
|
||||||
|
|
||||||
clean-chapter5:
|
mk_BOOT: mk_CHROOT
|
||||||
rm -rf \$(MOUNT_PT)/tools/*
|
@\$(call echo_CHROOT_request)
|
||||||
rm -f $chapter5 restore-luser-env sources-dir
|
@( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BOOT")
|
||||||
cd logs && rm -f $chapter5 && cd ..
|
@touch \$@
|
||||||
|
|
||||||
clean-chapter6:
|
|
||||||
-umount \$(MOUNT_PT)/sys
|
|
||||||
-umount \$(MOUNT_PT)/proc
|
|
||||||
-umount \$(MOUNT_PT)/dev/shm
|
|
||||||
-umount \$(MOUNT_PT)/dev/pts
|
|
||||||
-umount \$(MOUNT_PT)/dev
|
|
||||||
rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
|
|
||||||
rm -f $chapter6
|
|
||||||
cd logs && rm -f $chapter6 && cd ..
|
|
||||||
|
|
||||||
clean-chapter7:
|
SETUP: $chapter3
|
||||||
rm -f $chapter7
|
|
||||||
cd logs && rm -f $chapter7 && cd ..
|
LUSER: $chapter5
|
||||||
|
|
||||||
|
SUDO: 060-kernfs 062-changingowner
|
||||||
|
|
||||||
|
CHROOT: $chapter6
|
||||||
|
|
||||||
|
BOOT: $chapter7
|
||||||
|
|
||||||
|
|
||||||
|
#restart: restart_code all
|
||||||
|
|
||||||
restore-luser-env:
|
restore-luser-env:
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
|
@ -611,6 +635,7 @@ do-housekeeping:
|
||||||
@-umount \$(MOUNT_PT)/dev
|
@-umount \$(MOUNT_PT)/dev
|
||||||
@-umount \$(MOUNT_PT)/sys
|
@-umount \$(MOUNT_PT)/sys
|
||||||
@-umount \$(MOUNT_PT)/proc
|
@-umount \$(MOUNT_PT)/proc
|
||||||
|
@-rm /tools
|
||||||
@-if [ ! -f luser-exist ]; then \\
|
@-if [ ! -f luser-exist ]; then \\
|
||||||
userdel \$(LUSER); \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/\$(LUSER); \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
|
@ -660,6 +685,21 @@ restart_code:
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE
|
) >> $MKFILE
|
||||||
|
|
||||||
|
# Add SBU-disk_usage report target
|
||||||
|
echo "create-sbu_du-report:" >> $MKFILE
|
||||||
|
if [[ "$REPORT" = "y" ]] ; then
|
||||||
|
(
|
||||||
|
cat << EOF
|
||||||
|
@\$(call echo_message, Building)
|
||||||
|
@./create-sbu_du-report.sh logs $VERSION
|
||||||
|
@\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report)
|
||||||
|
@touch \$@
|
||||||
|
|
||||||
|
|
||||||
|
EOF
|
||||||
|
) >> $MKFILE
|
||||||
|
else echo -e "\t@true\n\n" >> $MKFILE; fi
|
||||||
|
|
||||||
# Bring over the items from the Makefile.tmp
|
# Bring over the items from the Makefile.tmp
|
||||||
cat $MKFILE.tmp >> $MKFILE
|
cat $MKFILE.tmp >> $MKFILE
|
||||||
rm $MKFILE.tmp
|
rm $MKFILE.tmp
|
||||||
|
|
218
LFS/master.sh
218
LFS/master.sh
|
@ -7,10 +7,13 @@
|
||||||
###################################
|
###################################
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################
|
||||||
|
|
||||||
|
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
chapter4_Makefiles() {
|
chapter4_Makefiles() { #
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4${R_arrow}"
|
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4 ( SETUP ) ${R_arrow}"
|
||||||
|
|
||||||
# If /home/$LUSER is already present in the host, we asume that the
|
# If /home/$LUSER is already present in the host, we asume that the
|
||||||
# lfs user and group are also presents in the host, and a backup
|
# lfs user and group are also presents in the host, and a backup
|
||||||
|
@ -35,7 +38,8 @@ chapter4_Makefiles() {
|
||||||
touch luser-exist; \\
|
touch luser-exist; \\
|
||||||
fi;
|
fi;
|
||||||
@chown \$(LUSER) \$(MOUNT_PT)/tools && \\
|
@chown \$(LUSER) \$(MOUNT_PT)/tools && \\
|
||||||
chmod a+wt \$(MOUNT_PT)/sources && \\
|
chown -R \$(LUSER) \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
|
||||||
|
chmod -R a+wt \$(MOUNT_PT) && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
@ -57,17 +61,22 @@ chapter4_Makefiles() {
|
||||||
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\
|
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
||||||
touch envars && \\
|
touch envars && \\
|
||||||
|
chown \$(LUSER) envars && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) > $MKFILE.tmp
|
||||||
|
|
||||||
|
chapter4=" 020-creatingtoolsdir 021-addinguser 022-settingenvironment"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
chapter5_Makefiles() {
|
chapter5_Makefiles() {
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5${R_arrow}"
|
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5 ( LUSER ) ${R_arrow}"
|
||||||
|
|
||||||
for file in chapter05/* ; do
|
for file in chapter05/* ; do
|
||||||
# Keep the script file name
|
# Keep the script file name
|
||||||
|
@ -86,7 +95,13 @@ chapter5_Makefiles() {
|
||||||
|
|
||||||
# First append each name of the script files to a list (this will become
|
# First append each name of the script files to a list (this will become
|
||||||
# the names of the targets in the Makefile
|
# the names of the targets in the Makefile
|
||||||
chapter5="$chapter5 ${this_script}"
|
# DO NOT append the changingowner script.
|
||||||
|
# A hack is necessary: create script in chap5 BUT run as a dependency for
|
||||||
|
# chap6 CHROOT
|
||||||
|
case "${this_script}" in
|
||||||
|
*changingowner) : ;;
|
||||||
|
*) chapter5="$chapter5 ${this_script}" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
|
# Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
|
||||||
# and binutils in chapter 5)
|
# and binutils in chapter 5)
|
||||||
|
@ -101,7 +116,7 @@ chapter5_Makefiles() {
|
||||||
#
|
#
|
||||||
# Drop in the name of the target on a new line, and the previous target
|
# 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}" "$PREV"
|
LUSER_wrt_target "${this_script}" "$PREV"
|
||||||
|
|
||||||
# Find the version of the command files, if it corresponds with the building of
|
# Find the version of the command files, if it corresponds with the building of
|
||||||
# a specific package
|
# a specific package
|
||||||
|
@ -110,9 +125,9 @@ chapter5_Makefiles() {
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
||||||
wrt_unpack "$pkg_tarball"
|
LUSER_wrt_unpack "$pkg_tarball"
|
||||||
# If the testsuites must be run, initialize the log file
|
# If the testsuites must be run, initialize the log file
|
||||||
[[ "$TEST" = "3" ]] && wrt_test_log "${this_script}"
|
[[ "$TEST" = "3" ]] && LUSER_wrt_test_log "${this_script}"
|
||||||
# If using optimizations, write the instructions
|
# If using optimizations, write the instructions
|
||||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||||
fi
|
fi
|
||||||
|
@ -122,13 +137,13 @@ chapter5_Makefiles() {
|
||||||
# The changingowner script must be run as root.
|
# The changingowner script must be run as root.
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*changingowner) wrt_RunAsRoot "${this_script}" "$file" ;;
|
*changingowner) wrt_RunAsRoot "${this_script}" "$file" ;;
|
||||||
*) wrt_RunAsUser "${this_script}" "$file" ;;
|
*) LUSER_wrt_RunAsUser "$file" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Remove the build directory(ies) except if the package build fails
|
# Remove the build directory(ies) except if the package build fails
|
||||||
# (so we can review config.cache, config.log, etc.)
|
# (so we can review config.cache, config.log, etc.)
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
wrt_remove_build_dirs "$name"
|
LUSER_RemoveBuildDirs "$name"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Include a touch of the target name so make can check
|
# Include a touch of the target name so make can check
|
||||||
|
@ -144,9 +159,11 @@ chapter5_Makefiles() {
|
||||||
done # end for file in chapter05/*
|
done # end for file in chapter05/*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
chapter6_Makefiles() {
|
chapter6_Makefiles() {
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
|
|
||||||
# Set envars and scripts for iteration targets
|
# Set envars and scripts for iteration targets
|
||||||
LOGS="" # Start with an empty global LOGS envar
|
LOGS="" # Start with an empty global LOGS envar
|
||||||
if [[ -z "$1" ]] ; then
|
if [[ -z "$1" ]] ; then
|
||||||
|
@ -166,7 +183,7 @@ chapter6_Makefiles() {
|
||||||
sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2
|
sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N${R_arrow}"
|
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}"
|
||||||
|
|
||||||
for file in chapter06$N/* ; do
|
for file in chapter06$N/* ; do
|
||||||
# Keep the script file name
|
# Keep the script file name
|
||||||
|
@ -208,19 +225,19 @@ chapter6_Makefiles() {
|
||||||
#
|
#
|
||||||
# Drop in the name of the target on a new line, and the previous target
|
# 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"
|
CHROOT_wrt_target "${this_script}${N}" "$PREV"
|
||||||
|
|
||||||
# If $pkg_tarball 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
|
# Insert instructions for unpacking the package and changing directories
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
wrt_unpack2 "$pkg_tarball"
|
CHROOT_Unpack "$pkg_tarball"
|
||||||
# If the testsuites must be run, initialize the log file
|
# If the testsuites must be run, initialize the log file
|
||||||
case $name in
|
case $name in
|
||||||
binutils | gcc | glibc )
|
binutils | gcc | glibc )
|
||||||
[[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
|
[[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}"
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
[[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && wrt_test_log2 "${this_script}"
|
[[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && CHROOT_wrt_test_log "${this_script}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
# If using optimizations, write the instructions
|
# If using optimizations, write the instructions
|
||||||
|
@ -231,12 +248,12 @@ chapter6_Makefiles() {
|
||||||
# and not to use chroot.
|
# and not to use chroot.
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*kernfs) wrt_RunAsRoot "${this_script}" "$file" ;;
|
*kernfs) wrt_RunAsRoot "${this_script}" "$file" ;;
|
||||||
*) wrt_run_as_chroot1 "${this_script}" "$file" ;;
|
*) CHROOT_wrt_RunAsRoot "$file" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Remove the build directory(ies) except if the package build fails.
|
# Remove the build directory(ies) except if the package build fails.
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
wrt_remove_build_dirs "$name"
|
CHROOT_wrt_RemoveBuildDirs "$name"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Include a touch of the target name so make can check
|
# Include a touch of the target name so make can check
|
||||||
|
@ -257,7 +274,7 @@ chapter6_Makefiles() {
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
chapter789_Makefiles() {
|
chapter789_Makefiles() {
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8/9${R_arrow}"
|
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8/9 ( BOOT ) ${R_arrow}"
|
||||||
|
|
||||||
for file in chapter0{7,8,9}/* ; do
|
for file in chapter0{7,8,9}/* ; do
|
||||||
# Keep the script file name
|
# Keep the script file name
|
||||||
|
@ -274,6 +291,7 @@ chapter789_Makefiles() {
|
||||||
*grub) continue ;;
|
*grub) continue ;;
|
||||||
*reboot) continue ;;
|
*reboot) continue ;;
|
||||||
*console) continue ;; # Use the file generated by lfs-bootscripts
|
*console) continue ;; # Use the file generated by lfs-bootscripts
|
||||||
|
*fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
|
||||||
*kernel) [[ -z ${CONFIG} ]] && continue
|
*kernel) [[ -z ${CONFIG} ]] && continue
|
||||||
cp ${CONFIG} $BUILDDIR/sources/kernel-config ;;
|
cp ${CONFIG} $BUILDDIR/sources/kernel-config ;;
|
||||||
esac
|
esac
|
||||||
|
@ -288,37 +306,37 @@ chapter789_Makefiles() {
|
||||||
#
|
#
|
||||||
# Drop in the name of the target on a new line, and the previous target
|
# 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}" "$PREV"
|
CHROOT_wrt_target "${this_script}" "$PREV"
|
||||||
|
|
||||||
# Find the bootscripts and kernel package names
|
# Find the bootscripts and kernel package names
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*bootscripts)
|
*bootscripts)
|
||||||
name="lfs-bootscripts"
|
name="lfs-bootscripts"
|
||||||
pkg_tarball=$(get_package_tarball_name $name)
|
pkg_tarball=$(get_package_tarball_name $name)
|
||||||
wrt_unpack2 "$pkg_tarball"
|
CHROOT_Unpack "$pkg_tarball"
|
||||||
;;
|
;;
|
||||||
*kernel)
|
*kernel)
|
||||||
name="linux"
|
name="linux"
|
||||||
pkg_tarball=$(get_package_tarball_name $name)
|
pkg_tarball=$(get_package_tarball_name $name)
|
||||||
wrt_unpack2 "$pkg_tarball"
|
CHROOT_Unpack "$pkg_tarball"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Check if we have a real /etc/fstab file
|
# Check if we have a real /etc/fstab file
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*fstab) if [[ -n $FSTAB ]]; then
|
*fstab) if [[ -n $FSTAB ]]; then
|
||||||
wrt_copy_fstab "${this_script}"
|
CHROOT_wrt_CopyFstab
|
||||||
else
|
else
|
||||||
wrt_run_as_chroot2 "$this_script" "$file"
|
CHROOT_wrt_RunAsRoot "$file"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*) wrt_run_as_chroot2 "$this_script" "$file"
|
*) CHROOT_wrt_RunAsRoot "$file"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*bootscripts) wrt_remove_build_dirs "dummy" ;;
|
*bootscripts) CHROOT_wrt_RemoveBuildDirs "dummy" ;;
|
||||||
*kernel) wrt_remove_build_dirs "dummy" ;;
|
*kernel) CHROOT_wrt_RemoveBuildDirs "dummy" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Include a touch of the target name so make can check
|
# Include a touch of the target name so make can check
|
||||||
|
@ -333,19 +351,20 @@ chapter789_Makefiles() {
|
||||||
PREV=${this_script}
|
PREV=${this_script}
|
||||||
done # for file in chapter0{7,8,9}/*
|
done # for file in chapter0{7,8,9}/*
|
||||||
|
|
||||||
# Add SBU-disk_usage report target if required
|
|
||||||
if [[ "$REPORT" = "y" ]] ; then wrt_report ; fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
build_Makefile() {
|
build_Makefile() { #
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
|
|
||||||
echo "Creating Makefile... ${BOLD}START${OFF}"
|
echo "Creating Makefile... ${BOLD}START${OFF}"
|
||||||
|
|
||||||
cd $JHALFSDIR/${PROGNAME}-commands
|
cd $JHALFSDIR/${PROGNAME}-commands
|
||||||
|
|
||||||
# Start with a clean Makefile.tmp file
|
# Start with a clean Makefile.tmp file
|
||||||
>$MKFILE.tmp
|
>$MKFILE
|
||||||
|
|
||||||
chapter4_Makefiles
|
chapter4_Makefiles
|
||||||
chapter5_Makefiles
|
chapter5_Makefiles
|
||||||
|
@ -353,7 +372,8 @@ build_Makefile() {
|
||||||
# Add the iterations targets, if needed
|
# Add the iterations targets, if needed
|
||||||
[[ "$COMPARE" = "y" ]] && wrt_compare_targets
|
[[ "$COMPARE" = "y" ]] && wrt_compare_targets
|
||||||
chapter789_Makefiles
|
chapter789_Makefiles
|
||||||
|
# Add the BLFS_TOOL targets, if needed
|
||||||
|
[[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets
|
||||||
|
|
||||||
# Add a header, some variables and include the function file
|
# Add a header, some variables and include the function file
|
||||||
# to the top of the real Makefile.
|
# to the top of the real Makefile.
|
||||||
|
@ -361,6 +381,7 @@ build_Makefile() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
$HEADER
|
$HEADER
|
||||||
|
|
||||||
|
|
||||||
SRC = /sources
|
SRC = /sources
|
||||||
MOUNT_PT = $BUILDDIR
|
MOUNT_PT = $BUILDDIR
|
||||||
PKG_LST = $PKG_LST
|
PKG_LST = $PKG_LST
|
||||||
|
@ -381,16 +402,16 @@ crTESTLOGDIR = /\$(SCRIPT_ROOT)/test-logs
|
||||||
|
|
||||||
SU_LUSER = su - \$(LUSER) -c
|
SU_LUSER = su - \$(LUSER) -c
|
||||||
LUSER_HOME = /home/\$(LUSER)
|
LUSER_HOME = /home/\$(LUSER)
|
||||||
PRT_DU = echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n"
|
PRT_DU = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) \$(MOUNT_PT) \`\n"
|
||||||
PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) \$(MOUNT_PT)\`\n"
|
PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) / \`\n"
|
||||||
|
|
||||||
|
export PATH := \${PATH}:/usr/sbin
|
||||||
|
|
||||||
include makefile-functions
|
include makefile-functions
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
) > $MKFILE
|
) > $MKFILE
|
||||||
|
|
||||||
|
|
||||||
# Add chroot commands
|
# Add chroot commands
|
||||||
CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
|
CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
|
||||||
i=1
|
i=1
|
||||||
|
@ -414,53 +435,71 @@ EOF
|
||||||
# as a dependency.
|
# as a dependency.
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
all: chapter4 chapter5 chapter6 chapter789 do_housekeeping
|
|
||||||
|
all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL
|
||||||
|
@sudo make do_housekeeping
|
||||||
@\$(call echo_finished,$VERSION)
|
@\$(call echo_finished,$VERSION)
|
||||||
|
|
||||||
chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
|
ck_UID:
|
||||||
|
@if [ \`id -u\` = "0" ]; then \\
|
||||||
|
echo "--------------------------------------------------"; \\
|
||||||
|
echo "You cannot run this makefile from the root account"; \\
|
||||||
|
echo "--------------------------------------------------"; \\
|
||||||
|
exit 1; \\
|
||||||
|
fi
|
||||||
|
|
||||||
chapter5: chapter4 $chapter5 restore-luser-env
|
mk_SETUP:
|
||||||
|
@\$(call echo_SU_request)
|
||||||
|
@sudo make SETUP
|
||||||
|
@touch \$@
|
||||||
|
|
||||||
chapter6: chapter5 $chapter6
|
mk_LUSER: mk_SETUP
|
||||||
|
@\$(call echo_SULUSER_request)
|
||||||
|
@( sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" )
|
||||||
|
@sudo make restore-luser-env
|
||||||
|
@touch \$@
|
||||||
|
|
||||||
chapter789: chapter6 $chapter789
|
mk_SUDO: mk_LUSER
|
||||||
|
@sudo make SUDO
|
||||||
|
touch \$@
|
||||||
|
#
|
||||||
|
# The convoluted piece of code below is necessary to provide 'make' with a valid shell in the
|
||||||
|
# chroot environment. (Unless someone knows a different way)
|
||||||
|
# Manually create the /bin directory and provide link to the /tools dir.
|
||||||
|
# Also change the original symlink creation to include (f)orce to prevent failure due to
|
||||||
|
# pre-existing links.
|
||||||
|
#
|
||||||
|
mk_CHROOT: mk_SUDO
|
||||||
|
@if [ ! -e \$(MOUNT_PT)/bin ]; then \\
|
||||||
|
mkdir \$(MOUNT_PT)/bin; \\
|
||||||
|
cd \$(MOUNT_PT)/bin && \\
|
||||||
|
ln -sf /tools/bin/bash bash; ln -sf bash sh; \\
|
||||||
|
sudo chown -R 0:0 \$(MOUNT_PT)/bin; \\
|
||||||
|
fi;
|
||||||
|
@sudo sed -e 's|^ln -sv |ln -svf |' -i \$(CMDSDIR)/chapter06/063-createfiles
|
||||||
|
@\$(call echo_CHROOT_request)
|
||||||
|
@( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make CHROOT")
|
||||||
|
@touch \$@
|
||||||
|
|
||||||
clean-all: clean
|
mk_BOOT: mk_CHROOT
|
||||||
rm -rf ./{lfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
|
@\$(call echo_CHROOT_request)
|
||||||
|
@( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BOOT")
|
||||||
|
@touch \$@
|
||||||
|
|
||||||
|
|
||||||
|
SETUP: $chapter4
|
||||||
|
|
||||||
|
LUSER: $chapter5
|
||||||
|
|
||||||
|
SUDO: 057-changingowner 059-kernfs
|
||||||
|
|
||||||
|
CHROOT: $chapter6
|
||||||
|
|
||||||
|
BOOT: $chapter789
|
||||||
|
|
||||||
clean: clean-chapter789 clean-chapter6 clean-chapter5 clean-chapter4
|
|
||||||
|
|
||||||
restart: restart_code all
|
restart: restart_code all
|
||||||
|
|
||||||
clean-chapter4:
|
|
||||||
-if [ ! -f luser-exist ]; then \\
|
|
||||||
userdel \$(LUSER); \\
|
|
||||||
rm -rf /home/\$(LUSER); \\
|
|
||||||
fi;
|
|
||||||
rm -rf \$(MOUNT_PT)/tools
|
|
||||||
rm -f /tools
|
|
||||||
rm -f envars luser-exist
|
|
||||||
rm -f 02* logs/02*.log
|
|
||||||
|
|
||||||
clean-chapter5:
|
|
||||||
rm -rf \$(MOUNT_PT)/tools/*
|
|
||||||
rm -f $chapter5 restore-luser-env sources-dir
|
|
||||||
cd logs && rm -f $chapter5 && cd ..
|
|
||||||
|
|
||||||
clean-chapter6:
|
|
||||||
-umount \$(MOUNT_PT)/sys
|
|
||||||
-umount \$(MOUNT_PT)/proc
|
|
||||||
-umount \$(MOUNT_PT)/dev/shm
|
|
||||||
-umount \$(MOUNT_PT)/dev/pts
|
|
||||||
-umount \$(MOUNT_PT)/dev
|
|
||||||
rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
|
|
||||||
rm -f $chapter6
|
|
||||||
cd logs && rm -f $chapter6 && cd ..
|
|
||||||
|
|
||||||
clean-chapter789:
|
|
||||||
rm -f $chapter789
|
|
||||||
cd logs && rm -f $chapter789 && cd ..
|
|
||||||
|
|
||||||
restore-luser-env:
|
restore-luser-env:
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
|
@ -480,6 +519,7 @@ do_housekeeping:
|
||||||
@-umount \$(MOUNT_PT)/dev/shm
|
@-umount \$(MOUNT_PT)/dev/shm
|
||||||
@-umount \$(MOUNT_PT)/dev/pts
|
@-umount \$(MOUNT_PT)/dev/pts
|
||||||
@-umount \$(MOUNT_PT)/dev
|
@-umount \$(MOUNT_PT)/dev
|
||||||
|
@-rm /tools
|
||||||
@-if [ ! -f luser-exist ]; then \\
|
@-if [ ! -f luser-exist ]; then \\
|
||||||
userdel \$(LUSER); \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/\$(LUSER); \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
|
@ -528,10 +568,40 @@ restart_code:
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE
|
) >> $MKFILE
|
||||||
|
|
||||||
|
# Add SBU-disk_usage report target
|
||||||
|
echo "create-sbu_du-report:" >> $MKFILE
|
||||||
|
if [[ "$REPORT" = "y" ]] ; then
|
||||||
|
(
|
||||||
|
cat << EOF
|
||||||
|
@\$(call echo_message, Building)
|
||||||
|
@./create-sbu_du-report.sh logs $VERSION
|
||||||
|
@\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report)
|
||||||
|
@touch \$@
|
||||||
|
|
||||||
|
|
||||||
|
EOF
|
||||||
|
) >> $MKFILE
|
||||||
|
else echo -e "\t@true\n\n" >> $MKFILE; fi
|
||||||
|
|
||||||
|
# Add BLFS_TOOL targets
|
||||||
|
echo "mk_BLFS_TOOL:" >> $MKFILE
|
||||||
|
if [[ "$BLFS_TOOL" = "y" ]] ; then
|
||||||
|
(
|
||||||
|
cat << EOF
|
||||||
|
@\$(call echo_CHROOT_request)
|
||||||
|
@ sudo mkdir $BUILDDIR$TRACKING_DIR
|
||||||
|
@( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BLFS_TOOL")
|
||||||
|
@touch \$@
|
||||||
|
|
||||||
|
BLFS_TOOL: $blfs_tool
|
||||||
|
|
||||||
|
|
||||||
|
EOF
|
||||||
|
) >> $MKFILE
|
||||||
|
else echo -e "\t@true\n\n" >> $MKFILE; fi
|
||||||
|
|
||||||
# Bring over the items from the Makefile.tmp
|
# Bring over the items from the Makefile.tmp
|
||||||
cat $MKFILE.tmp >> $MKFILE
|
cat $MKFILE.tmp >> $MKFILE
|
||||||
rm $MKFILE.tmp
|
rm $MKFILE.tmp
|
||||||
echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
18
README.HLFS
Normal file
18
README.HLFS
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
$Id$
|
||||||
|
|
||||||
|
|
||||||
|
::::NOTICE::::
|
||||||
|
|
||||||
|
Hardened Linux From Scratch is a highly volatile project. Extreme design
|
||||||
|
changes can occur and the build could be broken for extended periods of
|
||||||
|
time.
|
||||||
|
|
||||||
|
As of Sept.15.2006 jhalfs cannot build the svn book. This is a book
|
||||||
|
problem and not jhalfs.
|
||||||
|
|
||||||
|
|
||||||
|
Automation failures:
|
||||||
|
1.Directory /dev and devices nodes /dev/null, /dev/console needed to be
|
||||||
|
created in kernfs
|
||||||
|
2.Linux-headers does not contain /net.
|
||||||
|
3.Remove the creation of /null and /console node from the devices script.
|
44
blfs-tool
44
blfs-tool
|
@ -72,6 +72,11 @@ source configuration
|
||||||
[[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1
|
[[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1
|
||||||
[[ $VERBOSITY > 0 ]] && echo "OK"
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
||||||
|
|
||||||
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
||||||
|
source $COMMON_DIR/func_check_version.sh
|
||||||
|
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
||||||
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
||||||
|
|
||||||
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
||||||
source $COMMON_DIR/func_validate_configs.sh
|
source $COMMON_DIR/func_validate_configs.sh
|
||||||
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
||||||
|
@ -94,6 +99,45 @@ case $BRANCH_ID in
|
||||||
* ) TREE=tags/${BRANCH_ID}/BOOK ;;
|
* ) TREE=tags/${BRANCH_ID}/BOOK ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Check for minimun dependencies versions
|
||||||
|
xsltprocVer=`xsltproc -V | head -n1 `
|
||||||
|
libxmlVer=$(echo $xsltprocVer | cut -d " " -f3)
|
||||||
|
libxsltVer=$(echo $xsltprocVer | cut -d " " -f5)
|
||||||
|
tidyVer=`tidy -V | cut -d " " -f9`
|
||||||
|
|
||||||
|
# Version numbers are packed strings not xx.yy.zz format.
|
||||||
|
check_version "2.06.20" "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}" "LIBXML2"
|
||||||
|
check_version "1.01.14" "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}" "LIBXSLT"
|
||||||
|
check_version "2004" "${tidyVer}" "TIDY"
|
||||||
|
|
||||||
|
XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?>
|
||||||
|
<?xml-stylesheet type='text/xsl' href='http://docbook.sourceforge.net/release/xsl/1.69.1/xhtml/docbook.xsl'?>
|
||||||
|
<!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'
|
||||||
|
'http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd'>
|
||||||
|
<article>
|
||||||
|
<title>Test file</title>
|
||||||
|
<sect1>
|
||||||
|
<title>Some title</title>
|
||||||
|
<para>Some text</para>
|
||||||
|
</sect1>
|
||||||
|
</article>"
|
||||||
|
|
||||||
|
if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then
|
||||||
|
check_version "4.4" "4.4" "DocBook XML DTD"
|
||||||
|
else
|
||||||
|
echo "Warning: not found a working DocBook XML DTD 4.4 installation"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then
|
||||||
|
check_version "1.69.1" "1.69.1" "DocBook XSL"
|
||||||
|
else
|
||||||
|
echo "Warning: not found a working DocBook XSL 1.69.1 installation"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${SD_BORDER}${nl_}"
|
||||||
|
|
||||||
# For consistency with other books
|
# For consistency with other books
|
||||||
validate_config
|
validate_config
|
||||||
echo "${SD_BORDER}${nl_}"
|
echo "${SD_BORDER}${nl_}"
|
||||||
|
|
22
common/blfs-tool-deps/903-tidy
Normal file
22
common/blfs-tool-deps/903-tidy
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
patch -Np1 -i ../tidy-051026-prevent_PRE_newlines-1.patch
|
||||||
|
sh build/gnuauto/setup.sh
|
||||||
|
./configure --prefix=/usr
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
cd htmldoc
|
||||||
|
tidy -xml-help > tidy-help.xml
|
||||||
|
tidy -xml-config > tidy-config.xml
|
||||||
|
xsltproc -o tidy.1 tidy1.xsl tidy-help.xml
|
||||||
|
xsltproc -o quickref.html quickref-html.xsl tidy-config.xml
|
||||||
|
cd ..
|
||||||
|
install -v -m644 htmldoc/tidy.1 /usr/share/man/man1
|
||||||
|
install -v -m755 -d /usr/share/doc/tidy-051026
|
||||||
|
install -v -m644 htmldoc/quickref.html /usr/share/doc/tidy-051026
|
||||||
|
|
||||||
|
exit
|
10
common/blfs-tool-deps/904-unzip
Normal file
10
common/blfs-tool-deps/904-unzip
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
make -f unix/Makefile LOCAL_UNZIP=-D_FILE_OFFSET_BITS=64 linux
|
||||||
|
make prefix=/usr install
|
||||||
|
|
||||||
|
exit
|
108
common/blfs-tool-deps/905-docbook-xml
Normal file
108
common/blfs-tool-deps/905-docbook-xml
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd /sources
|
||||||
|
mkdir docbook-xml
|
||||||
|
cd docbook-xml
|
||||||
|
unzip ../docbook-xml-4.4.zip
|
||||||
|
install -v -d -m755 /usr/share/xml/docbook/xml-dtd-4.4
|
||||||
|
install -v -d -m755 /etc/xml
|
||||||
|
chown -R root:root .
|
||||||
|
cp -v -af docbook.cat *.dtd ent/ *.mod \
|
||||||
|
/usr/share/xml/docbook/xml-dtd-4.4
|
||||||
|
if [ ! -e /etc/xml/docbook ]; then
|
||||||
|
xmlcatalog --noout --create /etc/xml/docbook
|
||||||
|
fi
|
||||||
|
xmlcatalog --noout --add "public" \
|
||||||
|
"-//OASIS//DTD DocBook XML V4.4//EN" \
|
||||||
|
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" \
|
||||||
|
/etc/xml/docbook
|
||||||
|
xmlcatalog --noout --add "public" \
|
||||||
|
"-//OASIS//DTD DocBook XML CALS Table Model V4.4//EN" \
|
||||||
|
"file:///usr/share/xml/docbook/xml-dtd-4.4/calstblx.dtd" \
|
||||||
|
/etc/xml/docbook
|
||||||
|
xmlcatalog --noout --add "public" \
|
||||||
|
"-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
|
||||||
|
"file:///usr/share/xml/docbook/xml-dtd-4.4/soextblx.dtd" \
|
||||||
|
/etc/xml/docbook
|
||||||
|
xmlcatalog --noout --add "public" \
|
||||||
|
"-//OASIS//ELEMENTS DocBook XML Information Pool V4.4//EN" \
|
||||||
|
"file:///usr/share/xml/docbook/xml-dtd-4.4/dbpoolx.mod" \
|
||||||
|
/etc/xml/docbook
|
||||||
|
xmlcatalog --noout --add "public" \
|
||||||
|
"-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.4//EN" \
|
||||||
|
"file:///usr/share/xml/docbook/xml-dtd-4.4/dbhierx.mod" \
|
||||||
|
/etc/xml/docbook
|
||||||
|
xmlcatalog --noout --add "public" \
|
||||||
|
"-//OASIS//ELEMENTS DocBook XML HTML Tables V4.4//EN" \
|
||||||
|
"file:///usr/share/xml/docbook/xml-dtd-4.4/htmltblx.mod" \
|
||||||
|
/etc/xml/docbook
|
||||||
|
xmlcatalog --noout --add "public" \
|
||||||
|
"-//OASIS//ENTITIES DocBook XML Notations V4.4//EN" \
|
||||||
|
"file:///usr/share/xml/docbook/xml-dtd-4.4/dbnotnx.mod" \
|
||||||
|
/etc/xml/docbook
|
||||||
|
xmlcatalog --noout --add "public" \
|
||||||
|
"-//OASIS//ENTITIES DocBook XML Character Entities V4.4//EN" \
|
||||||
|
"file:///usr/share/xml/docbook/xml-dtd-4.4/dbcentx.mod" \
|
||||||
|
/etc/xml/docbook
|
||||||
|
xmlcatalog --noout --add "public" \
|
||||||
|
"-//OASIS//ENTITIES DocBook XML Additional General Entities V4.4//EN" \
|
||||||
|
"file:///usr/share/xml/docbook/xml-dtd-4.4/dbgenent.mod" \
|
||||||
|
/etc/xml/docbook
|
||||||
|
xmlcatalog --noout --add "rewriteSystem" \
|
||||||
|
"http://www.oasis-open.org/docbook/xml/4.4" \
|
||||||
|
"file:///usr/share/xml/docbook/xml-dtd-4.4" \
|
||||||
|
/etc/xml/docbook
|
||||||
|
xmlcatalog --noout --add "rewriteURI" \
|
||||||
|
"http://www.oasis-open.org/docbook/xml/4.4" \
|
||||||
|
"file:///usr/share/xml/docbook/xml-dtd-4.4" \
|
||||||
|
/etc/xml/docbook
|
||||||
|
if [ ! -e /etc/xml/catalog ]; then
|
||||||
|
xmlcatalog --noout --create /etc/xml/catalog
|
||||||
|
fi
|
||||||
|
xmlcatalog --noout --add "delegatePublic" \
|
||||||
|
"-//OASIS//ENTITIES DocBook XML" \
|
||||||
|
"file:///etc/xml/docbook" \
|
||||||
|
/etc/xml/catalog
|
||||||
|
xmlcatalog --noout --add "delegatePublic" \
|
||||||
|
"-//OASIS//DTD DocBook XML" \
|
||||||
|
"file:///etc/xml/docbook" \
|
||||||
|
/etc/xml/catalog
|
||||||
|
xmlcatalog --noout --add "delegateSystem" \
|
||||||
|
"http://www.oasis-open.org/docbook/" \
|
||||||
|
"file:///etc/xml/docbook" \
|
||||||
|
/etc/xml/catalog
|
||||||
|
xmlcatalog --noout --add "delegateURI" \
|
||||||
|
"http://www.oasis-open.org/docbook/" \
|
||||||
|
"file:///etc/xml/docbook" \
|
||||||
|
/etc/xml/catalog
|
||||||
|
for DTDVERSION in 4.1.2 4.2 4.3
|
||||||
|
do
|
||||||
|
xmlcatalog --noout --add "public" \
|
||||||
|
"-//OASIS//DTD DocBook XML V$DTDVERSION//EN" \
|
||||||
|
"http://www.oasis-open.org/docbook/xml/$DTDVERSION/docbookx.dtd" \
|
||||||
|
/etc/xml/docbook
|
||||||
|
xmlcatalog --noout --add "rewriteSystem" \
|
||||||
|
"http://www.oasis-open.org/docbook/xml/$DTDVERSION" \
|
||||||
|
"file:///usr/share/xml/docbook/xml-dtd-4.4" \
|
||||||
|
/etc/xml/docbook
|
||||||
|
xmlcatalog --noout --add "rewriteURI" \
|
||||||
|
"http://www.oasis-open.org/docbook/xml/$DTDVERSION" \
|
||||||
|
"file:///usr/share/xml/docbook/xml-dtd-4.4" \
|
||||||
|
/etc/xml/docbook
|
||||||
|
xmlcatalog --noout --add "delegateSystem" \
|
||||||
|
"http://www.oasis-open.org/docbook/xml/$DTDVERSION/" \
|
||||||
|
"file:///etc/xml/docbook" \
|
||||||
|
/etc/xml/catalog
|
||||||
|
xmlcatalog --noout --add "delegateURI" \
|
||||||
|
"http://www.oasis-open.org/docbook/xml/$DTDVERSION/" \
|
||||||
|
"file:///etc/xml/docbook" \
|
||||||
|
/etc/xml/catalog
|
||||||
|
done
|
||||||
|
cd ..
|
||||||
|
rm -rf docbook-xml
|
||||||
|
|
||||||
|
exit
|
|
@ -29,51 +29,15 @@ HEADER="# This file is automatically generated by jhalfs
|
||||||
# Generated on `date \"+%F %X %Z\"`"
|
# Generated on `date \"+%F %X %Z\"`"
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------#
|
||||||
|
# NEW Makefile scripting functions #
|
||||||
|
#------------------------------------------------------#
|
||||||
|
|
||||||
|
|
||||||
|
unset get_package_tarball_name
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
wrt_target() { # Create target and initialize log file
|
get_package_tarball_name() { #
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
local i=$1
|
|
||||||
local PREV=$2
|
|
||||||
case $i in
|
|
||||||
iteration* ) local LOGFILE=$this_script.log ;;
|
|
||||||
* ) local LOGFILE=$this_script ;;
|
|
||||||
esac
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
|
|
||||||
$i: $PREV
|
|
||||||
@\$(call echo_message, Building)
|
|
||||||
@./progress_bar.sh \$@ \$\$PPID &
|
|
||||||
@echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >logs/$LOGFILE
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_target_boot() { # Create target and initialize log file
|
|
||||||
#----------------------------------#
|
|
||||||
local i=$1
|
|
||||||
local PREV=$2
|
|
||||||
case $i in
|
|
||||||
iteration* ) local LOGFILE=$this_script.log ;;
|
|
||||||
* ) local LOGFILE=$this_script ;;
|
|
||||||
esac
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
|
|
||||||
$i: $PREV
|
|
||||||
@\$(call echo_message, Building)
|
|
||||||
@./progress_bar.sh \$@ \$\$PPID &
|
|
||||||
@echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT}\`\n" >logs/$LOGFILE
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
#----------------------------#
|
|
||||||
get_package_tarball_name() { #
|
|
||||||
#----------------------------#
|
|
||||||
local script_name=$1
|
local script_name=$1
|
||||||
|
|
||||||
# The use of 'head' is necessary to limit the return value to the FIRST match..
|
# The use of 'head' is necessary to limit the return value to the FIRST match..
|
||||||
|
@ -88,87 +52,49 @@ get_package_tarball_name() { #
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unset wrt_RunaAsRoot
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
wrt_test_log() { # Initialize testsuite log file
|
wrt_RunAsRoot() { # Some scripts must be run as root..
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
local TESTLOGFILE=$1
|
local ENV_MOUNT
|
||||||
(
|
local this_script=$1
|
||||||
cat << EOF
|
local file=$2
|
||||||
@echo "export TEST_LOG=$TESTLOGDIR/$TESTLOGFILE" >> envars && \\
|
|
||||||
su - \$(LUSER) -c "echo -e '\n\`date\`\n' >$TESTLOGDIR/$TESTLOGFILE"
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
#----------------------------------#
|
case ${PROGNAME} in
|
||||||
wrt_test_log2() { #
|
lfs ) MOUNT_ENV="LFS" ;;
|
||||||
#----------------------------------#
|
blfs ) MOUNT_ENV="BLFS" ;;
|
||||||
local TESTLOGFILE=$1
|
clfs ) MOUNT_ENV="CLFS" ;;
|
||||||
(
|
clfs2 ) MOUNT_ENV="CLFS" ;;
|
||||||
cat << EOF
|
hlfs ) MOUNT_ENV="HLFS" ;;
|
||||||
@echo "export TEST_LOG=/$SCRIPT_ROOT/test-logs/$TESTLOGFILE" >> envars && \\
|
*) echo "undefined progname $PROGNAME"; exit 1 ;;
|
||||||
echo -e "\n\`date\`\n" >test-logs/$TESTLOGFILE
|
esac
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_target_vars() { # Target vars for hlfs (cross-build method)
|
|
||||||
#----------------------------------#
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@echo "export target=$(uname -m)-${TARGET}" >> envars && \\
|
|
||||||
echo "export ldso=/lib/${LOADER}" >> envars
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_copy_fstab() { #
|
|
||||||
#----------------------------------#
|
|
||||||
local i=$1
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@cp -v $FSTAB \$(MOUNT_PT)/etc/fstab >>logs/$i 2>&1
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_copy_fstab2() { #
|
|
||||||
#----------------------------------#
|
|
||||||
local i=$1
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@cp -v /sources/fstab /etc/fstab >>logs/$i 2>&1
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_report() { #
|
|
||||||
#----------------------------------#
|
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
@( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ && \\
|
||||||
create-sbu_du-report: $PREV
|
\$(PRT_DU_CR) >>logs/\$@
|
||||||
@\$(call echo_message, Building)
|
|
||||||
@./create-sbu_du-report.sh logs $VERSION
|
|
||||||
@\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report)
|
|
||||||
@touch \$@
|
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
|
|
||||||
chapter789="$chapter789 create-sbu_du-report"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unset wrt_unpack
|
|
||||||
|
#------------------------------------------------------#
|
||||||
|
#------------------------------------------------------#
|
||||||
|
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
wrt_unpack() { # Unpack and set 'ROOT' var
|
ROOT_RunAsRoot() { #
|
||||||
|
#----------------------------------#
|
||||||
|
local file=$1
|
||||||
|
(
|
||||||
|
cat << EOF
|
||||||
|
@( time { source envars && \$(CMDSDIR)/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
|
||||||
|
\$(PRT_DU_CR) >>logs/$this_script
|
||||||
|
EOF
|
||||||
|
) >> $MKFILE.tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
#----------------------------------#
|
||||||
|
ROOT_Unpack() { # An alias, for clairity
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
local FILE=$1
|
local FILE=$1
|
||||||
local optSAVE_PREVIOUS=$2
|
local optSAVE_PREVIOUS=$2
|
||||||
|
@ -184,36 +110,130 @@ EOF
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@\$(call unpack,$FILE)
|
@\$(call unpack,$FILE)
|
||||||
@\$(call get_pkg_root)
|
@\$(call get_pkg_root_LUSER)
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unset wrt_unpack2
|
#------------------------------------------------------#
|
||||||
|
#------------------------------------------------------#
|
||||||
|
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
wrt_unpack2() { #
|
LUSER_wrt_target() { # Create target and initialize log file
|
||||||
|
#----------------------------------#
|
||||||
|
local i=$1
|
||||||
|
local PREV=$2
|
||||||
|
(
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
$i: $PREV
|
||||||
|
@\$(call echo_message, Building)
|
||||||
|
@./progress_bar.sh \$@ \$\$PPID &
|
||||||
|
@echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) \$(MOUNT_PT)\`\n" >logs/\$@
|
||||||
|
EOF
|
||||||
|
) >> $MKFILE.tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------#
|
||||||
|
LUSER_wrt_RunAsUser() { # Execute script inside time { }, footer to log file
|
||||||
|
#----------------------------------#
|
||||||
|
local file=$1
|
||||||
|
|
||||||
|
(
|
||||||
|
cat << EOF
|
||||||
|
@( time { source ~/.bashrc && \$(CMDSDIR)/`dirname $file`/\$@ >> logs/\$@ 2>&1; } ) 2>> logs/\$@ && \\
|
||||||
|
\$(PRT_DU) >> logs/\$@
|
||||||
|
EOF
|
||||||
|
) >> $MKFILE.tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------#
|
||||||
|
LUSER_wrt_unpack() { # Unpack and set 'ROOT' var
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
local FILE=$1
|
local FILE=$1
|
||||||
local optSAVE_PREVIOUS=$2
|
local optSAVE_PREVIOUS=$2
|
||||||
|
|
||||||
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
|
if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@\$(call remove_existing_dirs,$FILE)
|
@\$(call remove_existing_dirs,$FILE)
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@\$(call unpack2,$FILE)
|
@\$(call unpack,$FILE)
|
||||||
@\$(call get_pkg_root,nouser)
|
@\$(call get_pkg_root_LUSER)
|
||||||
|
EOF
|
||||||
|
) >> $MKFILE.tmp
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------#
|
||||||
|
LUSER_wrt_CopyFstab() { #
|
||||||
|
#----------------------------------#
|
||||||
|
(
|
||||||
|
cat << EOF
|
||||||
|
@( time { cp -v \$(MOUNT_PT)/sources/fstab \$(MOUNT_PT)/etc/fstab >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
wrt_unpack3() { #
|
LUSER_wrt_test_log() { # Initialize testsuite log file
|
||||||
|
#----------------------------------#
|
||||||
|
local TESTLOGFILE=$1
|
||||||
|
(
|
||||||
|
cat << EOF
|
||||||
|
@echo "export TEST_LOG=$TESTLOGDIR/$TESTLOGFILE" >> envars && \\
|
||||||
|
echo -e '\n\`date\`\n' >$TESTLOGDIR/$TESTLOGFILE
|
||||||
|
EOF
|
||||||
|
) >> $MKFILE.tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------#
|
||||||
|
LUSER_RemoveBuildDirs() { #
|
||||||
|
#----------------------------------#
|
||||||
|
local name=$1
|
||||||
|
(
|
||||||
|
cat << EOF
|
||||||
|
@\$(call remove_build_dirs,$name)
|
||||||
|
EOF
|
||||||
|
) >> $MKFILE.tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------#
|
||||||
|
#-----------------------------------------------------------------#
|
||||||
|
|
||||||
|
#----------------------------------#
|
||||||
|
CHROOT_wrt_target() { # Create target and initialize log file
|
||||||
|
#----------------------------------#
|
||||||
|
local i=$1
|
||||||
|
local PREV=$2
|
||||||
|
case $i in
|
||||||
|
iteration* ) local LOGFILE="${this_script}.log" ;;
|
||||||
|
* ) local LOGFILE="${this_script}" ;;
|
||||||
|
esac
|
||||||
|
(
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
$i: $PREV
|
||||||
|
@\$(call echo_message, Building)
|
||||||
|
@./progress_bar.sh \$@ \$\$PPID &
|
||||||
|
@echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) / \`\n" >logs/$LOGFILE
|
||||||
|
EOF
|
||||||
|
) >> $MKFILE.tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------#
|
||||||
|
CHROOT_Unpack() { #
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
local FILE=$1
|
local FILE=$1
|
||||||
local optSAVE_PREVIOUS=$2
|
local optSAVE_PREVIOUS=$2
|
||||||
|
@ -234,20 +254,46 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unset wrt_remove_build_dirs
|
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
wrt_remove_build_dirs() { #
|
CHROOT_wrt_test_log() { #
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
local name=$1
|
local TESTLOGFILE=$1
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@\$(call remove_build_dirs,$name)
|
@echo "export TEST_LOG=/\$(SCRIPT_ROOT)/test-logs/$TESTLOGFILE" >> envars && \\
|
||||||
|
echo -e "\n\`date\`\n" >test-logs/$TESTLOGFILE
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
wrt_remove_build_dirs2() { #
|
CHROOT_wrt_RunAsRoot() { #
|
||||||
|
#----------------------------------#
|
||||||
|
local file=$1
|
||||||
|
(
|
||||||
|
cat << EOF
|
||||||
|
@( time { source envars && \$(crCMDSDIR)/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
|
||||||
|
\$(PRT_DU_CR) >>logs/$this_script
|
||||||
|
EOF
|
||||||
|
) >> $MKFILE.tmp
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------#
|
||||||
|
CHROOT_wrt_CopyFstab() { #
|
||||||
|
#----------------------------------#
|
||||||
|
(
|
||||||
|
cat << EOF
|
||||||
|
@( time { cp -v /sources/fstab /etc/fstab >>logs/${this_script} 2>&1 ; } ) 2>>logs/${this_script}
|
||||||
|
EOF
|
||||||
|
) >> $MKFILE.tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------#
|
||||||
|
CHROOT_wrt_RemoveBuildDirs() { #
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
local name=$1
|
local name=$1
|
||||||
(
|
(
|
||||||
|
@ -258,7 +304,6 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unset wrt_touch
|
unset wrt_touch
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
wrt_touch() { #
|
wrt_touch() { #
|
||||||
|
@ -270,128 +315,73 @@ EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
unset wrt_RunAsUser
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_RunAsUser() { # Execute script inside time { }, footer to log file
|
|
||||||
#----------------------------------#
|
|
||||||
local this_script=$1
|
|
||||||
local file=$2
|
|
||||||
|
|
||||||
(
|
#----------------------------------#
|
||||||
cat << EOF
|
wrt_blfs_tool_targets() { #
|
||||||
@( time { \$(SU_LUSER) "source \$(LUSER_HOME)/.bashrc && \$(CMDSDIR)/`dirname $file`/\$@" >> logs/\$@ 2>&1; } ) 2>> logs/\$@ && \\
|
#----------------------------------#
|
||||||
\$(PRT_DU) >> logs/\$@
|
|
||||||
EOF
|
echo "${tab_}${GREEN}Processing... ${L_arrow}BLFS_TOOL ${R_arrow}"
|
||||||
) >> $MKFILE.tmp
|
|
||||||
|
for file in blfs-tool-deps/* ; do
|
||||||
|
# Keep the script file name
|
||||||
|
this_script=`basename $file`
|
||||||
|
|
||||||
|
# Grab the name of the target
|
||||||
|
name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@'`
|
||||||
|
|
||||||
|
# Find the package.
|
||||||
|
case $name in
|
||||||
|
tidy ) pkg_tarball=${TIDY_PKG} ;;
|
||||||
|
unzip ) pkg_tarball=${UNZIP_PKG} ;;
|
||||||
|
* ) pkg_tarball=$(get_package_tarball_name $name) ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Append each name of the script files to a list (this will become
|
||||||
|
# the names of the targets in the Makefile)
|
||||||
|
blfs_tool="$blfs_tool ${this_script}"
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------#
|
||||||
|
# >>>>>>>> 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.
|
||||||
|
CHROOT_wrt_target "${this_script}" "$PREV"
|
||||||
|
|
||||||
|
# Insert instructions for unpacking the package and changing directories
|
||||||
|
# DocBook-XML is a zip, the build script will handle that.
|
||||||
|
[[ ! "$name" = "docbook-xml" ]] && CHROOT_Unpack "$pkg_tarball"
|
||||||
|
|
||||||
|
# Run the script.
|
||||||
|
CHROOT_wrt_RunAsRoot "$file"
|
||||||
|
|
||||||
|
# Remove the build directory(ies) except if the package build fails.
|
||||||
|
[[ ! "$name" = "docbook-xml" ]] && CHROOT_wrt_RemoveBuildDirs "$name"
|
||||||
|
|
||||||
|
# Touch the tracking file.
|
||||||
|
case $name in
|
||||||
|
tidy ) pkg_ver=tidy-051026 ;;
|
||||||
|
unzip ) pkg_ver=unzip-5.52 ;;
|
||||||
|
* ) pkg_ver=$(echo $pkg_tarball | sed -e 's/.tar.*//;s/.tgz//;s/.zip//') ;;
|
||||||
|
esac
|
||||||
|
echo -e "\t@touch $TRACKING_DIR/$pkg_ver" >> $MKFILE.tmp
|
||||||
|
|
||||||
|
# Include a touch of the target name so make can check
|
||||||
|
# if it's already been made.
|
||||||
|
wrt_touch
|
||||||
|
#
|
||||||
|
#--------------------------------------------------------------------#
|
||||||
|
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
||||||
|
#--------------------------------------------------------------------#
|
||||||
|
|
||||||
|
# Keep the script file name for Makefile dependencies.
|
||||||
|
PREV=${this_script}
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------------------------------------#
|
||||||
#----------------------------------#
|
# END Makefile scripting functions #
|
||||||
wrt_RunAsRoot() { # Some scripts must be run as root..
|
#------------------------------------------------------#
|
||||||
#----------------------------------#
|
|
||||||
local ENV_MOUNT
|
|
||||||
local this_script=$1
|
|
||||||
local file=$2
|
|
||||||
|
|
||||||
case ${PROGNAME} in
|
|
||||||
lfs ) MOUNT_ENV="LFS" ;;
|
|
||||||
blfs ) MOUNT_ENV="BLFS" ;;
|
|
||||||
clfs ) MOUNT_ENV="CLFS" ;;
|
|
||||||
clfs2 ) MOUNT_ENV="CLFS" ;;
|
|
||||||
hlfs ) MOUNT_ENV="HLFS" ;;
|
|
||||||
*) echo "undefined progname $PROGNAME"; exit 1
|
|
||||||
esac
|
|
||||||
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ && \\
|
|
||||||
\$(PRT_DU_CR) >>logs/\$@
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_run_as_root2() { #
|
|
||||||
#----------------------------------#
|
|
||||||
local this_script=$1
|
|
||||||
local file=$2
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@( time { source envars && ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ && \\
|
|
||||||
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \`\n" >>logs/\$@
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
unset wrt_run_as_chroot1
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_run_as_chroot1() { #
|
|
||||||
#----------------------------------#
|
|
||||||
local this_script=$1
|
|
||||||
local file=$2
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@( time { \$(CHROOT1) 'cd \$(SCRIPT_ROOT) && source envars && \$(crCMDSDIR)/$file >>logs/${this_script} 2>&1' ; } ) 2>>logs/${this_script} && \\
|
|
||||||
\$(PRT_DU_CR) >> logs/${this_script}
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
unset wrt_run_as_chroot2
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_run_as_chroot2() { #
|
|
||||||
#----------------------------------#
|
|
||||||
local this_script=$1
|
|
||||||
local file=$2
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@( time { \$(CHROOT2) 'cd \$(SCRIPT_ROOT) && source envars && \$(crCMDSDIR)/`dirname $file`/\$@ >>logs/\$@ 2>&1' ; } ) 2>>logs/\$@ && \\
|
|
||||||
\$(PRT_DU_CR) >> logs/\$@
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
unset wrt_target
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_target() { # Create target and initialize log file
|
|
||||||
#----------------------------------#
|
|
||||||
local i=$1
|
|
||||||
local PREV=$2
|
|
||||||
case $i in
|
|
||||||
iteration* ) local LOGFILE="\$@.log" ;;
|
|
||||||
* ) local LOGFILE="\$@" ;;
|
|
||||||
esac
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
|
|
||||||
$i: $PREV
|
|
||||||
@\$(call echo_message, Building)
|
|
||||||
@./progress_bar.sh \$@ \$\$PPID &
|
|
||||||
@echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >logs/$LOGFILE
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_target_boot() { # Create target and initialize log file
|
|
||||||
#----------------------------------#
|
|
||||||
local i=$1
|
|
||||||
local PREV=$2
|
|
||||||
case $i in
|
|
||||||
iteration* ) local LOGFILE="\$@.log" ;;
|
|
||||||
* ) local LOGFILE="\$@" ;;
|
|
||||||
esac
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
|
|
||||||
$i: $PREV
|
|
||||||
@\$(call echo_message, Building)
|
|
||||||
@./progress_bar.sh \$@ \$\$PPID &
|
|
||||||
@echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT}\`\n" >logs/$LOGFILE
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -401,8 +391,8 @@ run_make() { #
|
||||||
# Test if make must be run.
|
# Test if make must be run.
|
||||||
if [ "$RUNMAKE" = "y" ] ; then
|
if [ "$RUNMAKE" = "y" ] ; then
|
||||||
# Test to make sure we're running the build as root
|
# Test to make sure we're running the build as root
|
||||||
if [ "$UID" != "0" ] ; then
|
if [ "$UID" = "0" ] ; then
|
||||||
echo "You must be logged in as root to successfully build the system."
|
echo "You must not be logged in as root to build the system."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# Build the system
|
# Build the system
|
||||||
|
@ -427,7 +417,7 @@ clean_builddir() { #
|
||||||
fi
|
fi
|
||||||
# Test to make sure that the build directory was populated by jhalfs
|
# Test to make sure that the build directory was populated by jhalfs
|
||||||
if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
|
if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
|
||||||
echo "Looks like $BUILDDIR was not populated by a previous jhalfs run."
|
echo "Looks like $BUILDDIR was not populated by a previous jhalfs-X run."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
# Clean the build directory
|
# Clean the build directory
|
||||||
|
@ -586,6 +576,7 @@ extract_commands() { #
|
||||||
|
|
||||||
# Done. Moving on...
|
# Done. Moving on...
|
||||||
get_sources
|
get_sources
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
|
@ -615,6 +606,9 @@ create_package_list() { #
|
||||||
cat << EOF
|
cat << EOF
|
||||||
$LIBXML_PKG
|
$LIBXML_PKG
|
||||||
$LIBXSLT_PKG
|
$LIBXSLT_PKG
|
||||||
|
$TIDY_PKG
|
||||||
|
$UNZIP_PKG
|
||||||
|
$DBXML_PKG
|
||||||
$DBXSL_PKG
|
$DBXSL_PKG
|
||||||
$LINKS_PKG
|
$LINKS_PKG
|
||||||
$SUDO_PKG
|
$SUDO_PKG
|
||||||
|
@ -799,6 +793,7 @@ create_urls() { #
|
||||||
if [[ "${BLFS_TOOL}" = "y" ]]; then
|
if [[ "${BLFS_TOOL}" = "y" ]]; then
|
||||||
add_blfs_deps_urls
|
add_blfs_deps_urls
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------# Hardcoded URLs and MD5.
|
#----------------------------# Hardcoded URLs and MD5.
|
||||||
|
@ -815,6 +810,19 @@ add_blfs_deps_urls() { # No easy way to extract it.
|
||||||
echo "${LIBXSLT_URL} ${BLFS_SERVER}libxslt/${LIBXSLT_PKG} ${LIBXSLT_MD5}" >> urls.lst
|
echo "${LIBXSLT_URL} ${BLFS_SERVER}libxslt/${LIBXSLT_PKG} ${LIBXSLT_MD5}" >> urls.lst
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "${DEP_TIDY}" = "y" ]] ; then
|
||||||
|
echo "${TIDY_URL} ${BLFS_SERVER}tidy/${TIDY_PKG} ${TIDY_MD5}" >> urls.lst
|
||||||
|
echo "${TIDY_PATCH_URL} ${BLFS_SERVER}tidy/${TIDY_PATCH} ${TIDY_PATCH_MD5}" >> urls.lst
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${DEP_UNZIP}" = "y" ]] ; then
|
||||||
|
echo "${UNZIP_URL} ${BLFS_SERVER}unzip/${UNZIP_PKG} ${UNZIP_MD5}" >> urls.lst
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${DEP_DBXML}" = "y" ]] ; then
|
||||||
|
echo "${DBXML_URL} ${BLFS_SERVER}docbook-xml/${DBXML_PKG} ${DBXML_MD5}" >> urls.lst
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "${DEP_DBXSL}" = "y" ]] ; then
|
if [[ "${DEP_DBXSL}" = "y" ]] ; then
|
||||||
echo "${DBXSL_URL} ${BLFS_SERVER}docbook-xsl/${DBXSL_PKG} ${DBXSL_MD5}" >> urls.lst
|
echo "${DBXSL_URL} ${BLFS_SERVER}docbook-xsl/${DBXSL_PKG} ${DBXSL_MD5}" >> urls.lst
|
||||||
fi
|
fi
|
||||||
|
@ -858,28 +866,40 @@ copy_blfs_deps_scripts() { # method avoid to place the test on all
|
||||||
mv blfs-tool-deps/902-libxslt ${PROGNAME}-commands/blfs-tool-deps
|
mv blfs-tool-deps/902-libxslt ${PROGNAME}-commands/blfs-tool-deps
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "${DEP_TIDY}" = "y" ]] ; then
|
||||||
|
mv blfs-tool-deps/903-tidy ${PROGNAME}-commands/blfs-tool-deps
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${DEP_UNZIP}" = "y" ]] ; then
|
||||||
|
mv blfs-tool-deps/904-unzip ${PROGNAME}-commands/blfs-tool-deps
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${DEP_DBXML}" = "y" ]] ; then
|
||||||
|
mv blfs-tool-deps/905-docbook-xml ${PROGNAME}-commands/blfs-tool-deps
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "${DEP_DBXSL}" = "y" ]] ; then
|
if [[ "${DEP_DBXSL}" = "y" ]] ; then
|
||||||
mv blfs-tool-deps/903-docbook-xsl ${PROGNAME}-commands/blfs-tool-deps
|
mv blfs-tool-deps/906-docbook-xsl ${PROGNAME}-commands/blfs-tool-deps
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${DEP_LINKS}" = "y" ]] ; then
|
if [[ "${DEP_LINKS}" = "y" ]] ; then
|
||||||
mv blfs-tool-deps/905-links ${PROGNAME}-commands/blfs-tool-deps
|
mv blfs-tool-deps/908-links ${PROGNAME}-commands/blfs-tool-deps
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${DEP_SUDO}" = "y" ]] ; then
|
if [[ "${DEP_SUDO}" = "y" ]] ; then
|
||||||
mv blfs-tool-deps/906-sudo ${PROGNAME}-commands/blfs-tool-deps
|
mv blfs-tool-deps/909-sudo ${PROGNAME}-commands/blfs-tool-deps
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${DEP_WGET}" = "y" ]] ; then
|
if [[ "${DEP_WGET}" = "y" ]] ; then
|
||||||
mv blfs-tool-deps/907-wget ${PROGNAME}-commands/blfs-tool-deps
|
mv blfs-tool-deps/910-wget ${PROGNAME}-commands/blfs-tool-deps
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${DEP_SVN}" = "y" ]] ; then
|
if [[ "${DEP_SVN}" = "y" ]] ; then
|
||||||
mv blfs-tool-deps/908-subversion ${PROGNAME}-commands/blfs-tool-deps
|
mv blfs-tool-deps/911-subversion ${PROGNAME}-commands/blfs-tool-deps
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${DEP_GPM}" = "y" ]] ; then
|
if [[ "${DEP_GPM}" = "y" ]] ; then
|
||||||
mv blfs-tool-deps/904-gpm ${PROGNAME}-commands/blfs-tool-deps
|
mv blfs-tool-deps/907-gpm ${PROGNAME}-commands/blfs-tool-deps
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf blfs-tool-deps
|
rm -rf blfs-tool-deps
|
||||||
|
|
|
@ -108,7 +108,7 @@ for log in $BUILDLOGS ; do
|
||||||
echo -e "Approximate SBU time is:\t$SBU" >> "$REPORT"
|
echo -e "Approximate SBU time is:\t$SBU" >> "$REPORT"
|
||||||
|
|
||||||
# Dump disk usage values
|
# Dump disk usage values
|
||||||
echo -e "\nDisk usage before unpacking the package:\t\t\t$DU1 KB or $DU1MB MB" >> "$REPORT"
|
echo -e "\nDisk usage before unpacking the package:\t\t$DU1 KB or $DU1MB MB" >> "$REPORT"
|
||||||
echo -e "Disk usage before deleting the source and build dirs:\t$DU2 KB or $DU2MB MB" >> "$REPORT"
|
echo -e "Disk usage before deleting the source and build dirs:\t$DU2 KB or $DU2MB MB" >> "$REPORT"
|
||||||
echo -e "Required space to build the package:\t\t\t$REQUIRED1 KB or $REQUIRED2 MB\n" >> "$REPORT"
|
echo -e "Required space to build the package:\t\t\t$REQUIRED1 KB or $REQUIRED2 MB\n" >> "$REPORT"
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ inline_doc
|
||||||
|
|
||||||
declare -i major minor revision change
|
declare -i major minor revision change
|
||||||
declare -i ref_major ref_minor ref_revision ref_change
|
declare -i ref_major ref_minor ref_revision ref_change
|
||||||
|
declare -r spaceSTR=" "
|
||||||
|
|
||||||
ref_version=$1
|
ref_version=$1
|
||||||
tst_version=$2
|
tst_version=$2
|
||||||
|
@ -30,20 +31,16 @@ inline_doc
|
||||||
# This saves us the save/restore hassle of the system IFS value
|
# This saves us the save/restore hassle of the system IFS value
|
||||||
local IFS
|
local IFS
|
||||||
|
|
||||||
# if echo $ref_version | grep [[:alpha:]] 2>&1 >/dev/null ||
|
|
||||||
# echo $tst_version | grep [[:alpha:]] 2>&1 >/dev/null ;then
|
|
||||||
# echo "Cannot test for text, 0.0.0a, version types, assuming 'success' "
|
|
||||||
# return
|
|
||||||
# fi
|
|
||||||
|
|
||||||
write_error_and_die() {
|
write_error_and_die() {
|
||||||
echo -e "\n\t\t$TXT version -->${tst_version}<-- is too old.
|
echo -e "\n\t\t$TXT version -->${tst_version}<-- is too old.
|
||||||
This script requires ${ref_version} or greater\n"
|
This script requires ${ref_version} or greater\n"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
echo -ne "$TXT:\t${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}"
|
echo -ne "${TXT}${dotSTR:${#TXT}} ${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}"
|
||||||
IFS=".-(" # Split up w.x.y.z as well as w.x.y-rc (catch release candidates)
|
|
||||||
|
# echo -ne "$TXT:\t${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}"
|
||||||
|
IFS=".-(p" # Split up w.x.y.z as well as w.x.y-rc (catch release candidates)
|
||||||
set -- $ref_version # set postional parameters to minimum ver values
|
set -- $ref_version # set postional parameters to minimum ver values
|
||||||
ref_major=$1; ref_minor=$2; ref_revision=$3
|
ref_major=$1; ref_minor=$2; ref_revision=$3
|
||||||
#
|
#
|
||||||
|
@ -51,15 +48,111 @@ inline_doc
|
||||||
major=$1; minor=$2; revision=$3
|
major=$1; minor=$2; revision=$3
|
||||||
#
|
#
|
||||||
# Compare against minimum acceptable version..
|
# Compare against minimum acceptable version..
|
||||||
(( major > ref_major )) && echo " ..OK" && return
|
(( major > ref_major )) && echo " ${spaceSTR:${#tst_version}}${GREEN}OK${OFF}" && return
|
||||||
(( major < ref_major )) && write_error_and_die
|
(( major < ref_major )) && write_error_and_die
|
||||||
# major=ref_major
|
# major=ref_major
|
||||||
(( minor < ref_minor )) && write_error_and_die
|
(( minor < ref_minor )) && write_error_and_die
|
||||||
(( minor > ref_minor )) && echo " ..OK" && return
|
(( minor > ref_minor )) && echo " ${spaceSTR:${#tst_version}}${GREEN}OK${OFF}" && return
|
||||||
# minor=ref_minor
|
# minor=ref_minor
|
||||||
(( revision >= ref_revision )) && echo " ..OK" && return
|
(( revision >= ref_revision )) && echo " ${spaceSTR:${#tst_version}}${GREEN}OK${OFF}" && return
|
||||||
|
|
||||||
# oops.. write error msg and die
|
# oops.. write error msg and die
|
||||||
write_error_and_die
|
write_error_and_die
|
||||||
}
|
}
|
||||||
|
# local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
|
||||||
|
|
||||||
|
#----------------------------#
|
||||||
|
check_prerequisites() { #
|
||||||
|
#----------------------------#
|
||||||
|
|
||||||
|
# LFS/HLFS/CLFS prerequisites
|
||||||
|
if [ ! "${PROGNAME}" = "hlfs" ]; then
|
||||||
|
check_version "2.6.2" "`uname -r`" "KERNEL"
|
||||||
|
check_version "2.0.5" "$BASH_VERSION" "BASH"
|
||||||
|
check_version "3.0.0" "`gcc -dumpversion`" "GCC"
|
||||||
|
libcVer="`/lib/libc.so.6 | head -n1`"
|
||||||
|
libcVer="${libcVer##*version }"
|
||||||
|
check_version "2.2.5" ${libcVer%%,*} "GLIBC"
|
||||||
|
check_version "2.12" "$(ld --version | head -n1 | cut -d" " -f4)" "BINUTILS"
|
||||||
|
check_version "1.14" "$(tar --version | head -n1 | cut -d" " -f4)" "TAR"
|
||||||
|
bzip2Ver="$(bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f8)"
|
||||||
|
check_version "1.0.2" "${bzip2Ver%%,*}" "BZIP2"
|
||||||
|
check_version "5.0" "$(chown --version | head -n1 | cut -d")" -f2)" "COREUTILS"
|
||||||
|
check_version "2.8" "$(diff --version | head -n1 | cut -d" " -f4)" "DIFF"
|
||||||
|
check_version "4.1.20" "$(find --version | head -n1 | cut -d" " -f4)" "FIND"
|
||||||
|
check_version "3.0" "$(gawk --version | head -n1 | cut -d" " -f3)" "GAWK"
|
||||||
|
check_version "2.5" "$(grep --version | head -n1 | cut -d" " -f4)" "GREP"
|
||||||
|
check_version "1.2.4" "$(gzip --version 2>&1 | head -n1 | cut -d" " -f2)" "GZIP"
|
||||||
|
check_version "3.79.1" "$(make --version | head -n1 | cut -d " " -f3)" "MAKE"
|
||||||
|
check_version "2.5.4" "$(patch --version | head -n1 | cut -d" " -f2)" "PATCH"
|
||||||
|
check_version "3.0.2" "$(sed --version | head -n1 | cut -d" " -f4)" "SED"
|
||||||
|
else
|
||||||
|
# HLFS prerequisites
|
||||||
|
check_version "2.6.2" "$(uname -r)" "KERNEL"
|
||||||
|
check_version "3.0" "$BASH_VERSION" "BASH"
|
||||||
|
check_version "3.0" "$(gcc -dumpversion)" "GCC"
|
||||||
|
check_version "1.14" "$(tar --version | head -n1 | cut -d" " -f4)" "TAR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for minimum sudo version
|
||||||
|
SUDO_LOC="$(whereis -b sudo | cut -d" " -f2)"
|
||||||
|
if [ -x $SUDO_LOC ]; then
|
||||||
|
sudoVer="$(sudo -V | head -n1 | cut -d" " -f3)"
|
||||||
|
check_version "1.6.8" "${sudoVer}" "SUDO"
|
||||||
|
else
|
||||||
|
echo "${nl_}\"${RED}sudo${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for minimum libxml2 and libxslt versions
|
||||||
|
xsltprocVer=$(xsltproc -V | head -n1 )
|
||||||
|
libxmlVer=$(echo $xsltprocVer | cut -d " " -f3)
|
||||||
|
libxsltVer=$(echo $xsltprocVer | cut -d " " -f5)
|
||||||
|
|
||||||
|
# Version numbers are packed strings not xx.yy.zz format.
|
||||||
|
check_version "2.06.20" "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}" "LIBXML2"
|
||||||
|
check_version "1.01.14" "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}" "LIBXSLT"
|
||||||
|
|
||||||
|
# The next versions checks are required only when BLFS_TOOL is set and
|
||||||
|
# this dependencies has not be selected for installation
|
||||||
|
if [[ "$BLFS_TOOL" = "y" ]] ; then
|
||||||
|
|
||||||
|
if [[ -z "$DEP_TIDY" ]] ; then
|
||||||
|
tidyVer=$(tidy -V | cut -d " " -f9)
|
||||||
|
check_version "2004" "${tidyVer}" "TIDY"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the proper DocBook-XML-DTD and DocBook-XSL are correctly installed
|
||||||
|
XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?>
|
||||||
|
<?xml-stylesheet type='text/xsl' href='http://docbook.sourceforge.net/release/xsl/1.69.1/xhtml/docbook.xsl'?>
|
||||||
|
<!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'
|
||||||
|
'http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd'>
|
||||||
|
<article>
|
||||||
|
<title>Test file</title>
|
||||||
|
<sect1>
|
||||||
|
<title>Some title</title>
|
||||||
|
<para>Some text</para>
|
||||||
|
</sect1>
|
||||||
|
</article>"
|
||||||
|
|
||||||
|
if [[ -z "$DEP_DBXML" ]] ; then
|
||||||
|
if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then
|
||||||
|
check_version "4.4" "4.4" "DocBook XML DTD"
|
||||||
|
else
|
||||||
|
echo "Warning: not found a working DocBook XML DTD 4.4 installation"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$DEP_DBXSL" ]] ; then
|
||||||
|
if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then
|
||||||
|
check_version "1.69.1" "1.69.1" "DocBook XSL"
|
||||||
|
else
|
||||||
|
echo "Warning: not found a working DocBook XSL 1.69.1 installation"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi # end BLFS_TOOL=Y
|
||||||
|
|
||||||
|
}
|
|
@ -11,7 +11,7 @@ wrt_compare_targets() { #
|
||||||
wrt_system_build "$N" "$PREV_IT"
|
wrt_system_build "$N" "$PREV_IT"
|
||||||
fi
|
fi
|
||||||
this_script=$ITERATION
|
this_script=$ITERATION
|
||||||
wrt_target "$ITERATION" "$PREV"
|
CHROOT_wrt_target "$ITERATION" "$PREV"
|
||||||
wrt_compare_work "$ITERATION" "$PREV_IT"
|
wrt_compare_work "$ITERATION" "$PREV_IT"
|
||||||
wrt_logs "$N"
|
wrt_logs "$N"
|
||||||
PREV_IT=$ITERATION
|
PREV_IT=$ITERATION
|
||||||
|
@ -26,13 +26,27 @@ wrt_system_build() { #
|
||||||
local PREV_IT=$2
|
local PREV_IT=$2
|
||||||
|
|
||||||
if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "chroot" ]] ; then
|
if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "chroot" ]] ; then
|
||||||
final_system_Makefiles $RUN
|
chroot_final_system_Makefiles $RUN
|
||||||
elif [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
|
elif [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
|
||||||
bm_final_system_Makefiles $RUN
|
boot_final_system_Makefiles $RUN
|
||||||
else
|
else
|
||||||
chapter6_Makefiles $RUN
|
chapter6_Makefiles $RUN
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$PROGNAME" = "clfs" ]] ; then
|
||||||
|
basicsystem="$basicsystem $PREV_IT $system_build"
|
||||||
|
else
|
||||||
|
chapter6="$chapter6 $PREV_IT $system_build"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$RUN" = "$ITERATIONS" ]] ; then
|
||||||
|
if [[ "$PROGNAME" = "clfs" ]] ; then
|
||||||
|
basicsystem="$basicsystem iteration-$RUN"
|
||||||
|
else
|
||||||
|
chapter6="$chapter6 iteration-$RUN"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "\nsystem_build_$RUN: $PREV_IT $system_build" >> $MKFILE.tmp
|
echo -e "\nsystem_build_$RUN: $PREV_IT $system_build" >> $MKFILE.tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,15 +58,10 @@ wrt_compare_work() { #
|
||||||
local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /lost+found /media /mnt /opt /proc \
|
local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /lost+found /media /mnt /opt /proc \
|
||||||
/sources /root /srv /sys /tmp /tools /usr/local /usr/src /var/log/paco"
|
/sources /root /srv /sys /tmp /tools /usr/local /usr/src /var/log/paco"
|
||||||
|
|
||||||
if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
|
local ROOT_DIR=/
|
||||||
local ROOT_DIR=/
|
local DEST_TOPDIR=/${SCRIPT_ROOT}
|
||||||
local DEST_TOPDIR=/${SCRIPT_ROOT}
|
local ICALOGDIR=/${SCRIPT_ROOT}/logs/ICA
|
||||||
local ICALOGDIR=/${SCRIPT_ROOT}/logs/ICA
|
local FARCELOGDIR=/${SCRIPT_ROOT}/logs/farce
|
||||||
local FARCELOGDIR=/${SCRIPT_ROOT}/logs/farce
|
|
||||||
else
|
|
||||||
local ROOT_DIR=$BUILDDIR
|
|
||||||
local DEST_TOPDIR=$BUILDDIR/${SCRIPT_ROOT}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$RUN_ICA" = "y" ]] ; then
|
if [[ "$RUN_ICA" = "y" ]] ; then
|
||||||
local DEST_ICA=$DEST_TOPDIR/ICA && \
|
local DEST_ICA=$DEST_TOPDIR/ICA && \
|
||||||
|
|
|
@ -26,7 +26,7 @@ inline_doc
|
||||||
local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL"
|
local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL"
|
||||||
local -r blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR"
|
local -r blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR"
|
||||||
|
|
||||||
local -r blfs_tool_PARAM_LIST="BLFS_BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR DEP_LIBXML DEP_LIBXSLT DEP_DBXSL DEP_LINKS DEP_SUDO DEP_WGET DEP_SVN DEP_GPM"
|
local -r blfs_tool_PARAM_LIST="BLFS_BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR DEP_LIBXML DEP_LIBXSLT DEP_TIDY DEP_UNZIP DEP_DBXML DEP_DBXSL DEP_LINKS DEP_SUDO DEP_WGET DEP_SVN DEP_GPM"
|
||||||
|
|
||||||
local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,'
|
local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,'
|
||||||
local -r ERROR_MSG_pt2='rerun make and fix your configuration settings${OFF}'
|
local -r ERROR_MSG_pt2='rerun make and fix your configuration settings${OFF}'
|
||||||
|
|
|
@ -1,18 +1,53 @@
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
BOLD= "[0;1m"
|
BOLD = "[0;1m"
|
||||||
RED= "[1;31m"
|
RED = "[1;31m"
|
||||||
GREEN= "[0;32m"
|
GREEN = "[0;32m"
|
||||||
ORANGE= "[0;33m"
|
ORANGE = "[0;33m"
|
||||||
BLUE= "[1;34m"
|
BLUE = "[1;34m"
|
||||||
WHITE= "[00m"
|
WHITE = "[00m"
|
||||||
|
YELLOW = "[1;33m"
|
||||||
|
|
||||||
|
OFF = "[0m"
|
||||||
|
BOLD = "[1m"
|
||||||
|
REVERSE = "[7m"
|
||||||
|
|
||||||
|
|
||||||
|
define echo_PHASE
|
||||||
|
@clear
|
||||||
|
@echo $(BOLD)--------------------------------------------------------------------------------
|
||||||
|
@echo Executing $(BLUE)$(1)$(WHITE) scripts
|
||||||
|
@echo $(BOLD)--------------------------------------------------------------------------------
|
||||||
|
#echo $(WHITE)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define echo_SU_request
|
||||||
|
@echo $(BOLD)--------------------------------------------------------------------------------
|
||||||
|
@echo $(BLUE)$@
|
||||||
|
@echo $(WHITE)ROOT privilege is required to perform a number commands
|
||||||
|
@echo sudo will request a password to all high privilege cmds to execute correctly
|
||||||
|
endef
|
||||||
|
|
||||||
|
define echo_SULUSER_request
|
||||||
|
@clear
|
||||||
|
@echo $(BOLD)--------------------------------------------------------------------------------
|
||||||
|
@echo $(BOLD)$(BLUE)$@
|
||||||
|
@echo $(WHITE)You are going to log into the user account $(BOLD)$(YELLOW)$(LUSER)$(OFF)
|
||||||
|
@echo su requires a password
|
||||||
|
endef
|
||||||
|
|
||||||
|
define echo_CHROOT_request
|
||||||
|
@clear
|
||||||
|
@echo $(BOLD)--------------------------------------------------------------------------------
|
||||||
|
@echo $(BOLD)$(BLUE)$@
|
||||||
|
@echo $(WHITE)You are going to CHROOT into $(MOUNT_PT) $(BOLD)$(YELLOW)$(LUSER)$(OFF)
|
||||||
|
@echo a password is required
|
||||||
|
endef
|
||||||
|
|
||||||
define echo_message
|
define echo_message
|
||||||
@echo $(BOLD)
|
@echo $(BOLD)--------------------------------------------------------------------------------
|
||||||
@echo --------------------------------------------------------------------------------
|
@echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)$(WHITE)
|
||||||
@echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)
|
|
||||||
@echo $(WHITE)
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define remove_existing_dirs
|
define remove_existing_dirs
|
||||||
|
@ -23,7 +58,7 @@ define remove_existing_dirs
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define remove_existing_dirs2
|
define remove_existing_dirs2
|
||||||
@PKG_PATH=\`ls -t $(SRC)/$(1) | head -n1\` && \
|
@PKG_PATH=`ls -t $(SRC)/$(1) | head -n1` && \
|
||||||
ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
|
ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
|
||||||
rm -rf $(SRC)/$$ROOT && \
|
rm -rf $(SRC)/$$ROOT && \
|
||||||
rm -rf $(SRC)/$${ROOT%-*}-build
|
rm -rf $(SRC)/$${ROOT%-*}-build
|
||||||
|
@ -44,7 +79,7 @@ endef
|
||||||
define housekeeping
|
define housekeeping
|
||||||
@touch $@ && \
|
@touch $@ && \
|
||||||
sleep .25 && \
|
sleep .25 && \
|
||||||
echo -e "\n\n "$(BOLD)Target $(BLUE)$@ $(BOLD)OK && \
|
echo -e "\n" $(BOLD)Target $(BLUE)$@ $(WHITE)$(BOLD)OK && \
|
||||||
echo --------------------------------------------------------------------------------$(WHITE)
|
echo --------------------------------------------------------------------------------$(WHITE)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
@ -64,6 +99,11 @@ define get_pkg_root2
|
||||||
echo "export PKGDIR=$(SRC)/$$ROOT" > envars
|
echo "export PKGDIR=$(SRC)/$$ROOT" > envars
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define get_pkg_root_LUSER
|
||||||
|
@ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
||||||
|
echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars
|
||||||
|
endef
|
||||||
|
|
||||||
define unpack
|
define unpack
|
||||||
@cd $(SRCSDIR) && \
|
@cd $(SRCSDIR) && \
|
||||||
tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
|
tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
|
||||||
|
|
|
@ -36,7 +36,7 @@ write_or_exit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# initialize screen
|
# initialize screen
|
||||||
write_or_exit "${RESET_LINE}${TS_POSITION}0 min. 0 sec. "
|
write_or_exit "${RESET_LINE}${TS_POSITION}0 min. 0 sec"
|
||||||
|
|
||||||
# loop forever..
|
# loop forever..
|
||||||
while true ; do
|
while true ; do
|
||||||
|
|
30
jhalfs
30
jhalfs
|
@ -159,7 +159,8 @@ if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
||||||
branch-* ) BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-}/BOOK ;;
|
branch-* ) BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-}/BOOK ;;
|
||||||
* ) BLFS_TREE=tags/${BLFS_BRANCH_ID}/BOOK ;;
|
* ) BLFS_TREE=tags/${BLFS_BRANCH_ID}/BOOK ;;
|
||||||
esac
|
esac
|
||||||
# dependencies envars, to can update it more easy.
|
# Dependencies envars, to can update it more easy.
|
||||||
|
# Tidy and Unzip version are harcoded also in wrt_blfs_tool_targets()
|
||||||
# libxml2
|
# libxml2
|
||||||
LIBXML_PKG="libxml2-2.6.26.tar.gz"
|
LIBXML_PKG="libxml2-2.6.26.tar.gz"
|
||||||
LIBXML_URL="ftp://xmlsoft.org/libxml2/${LIBXML_PKG}"
|
LIBXML_URL="ftp://xmlsoft.org/libxml2/${LIBXML_PKG}"
|
||||||
|
@ -168,6 +169,22 @@ if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
||||||
LIBXSLT_PKG="libxslt-1.1.17.tar.gz"
|
LIBXSLT_PKG="libxslt-1.1.17.tar.gz"
|
||||||
LIBXSLT_URL="ftp://xmlsoft.org/libxslt/${LIBXSLT_PKG}"
|
LIBXSLT_URL="ftp://xmlsoft.org/libxslt/${LIBXSLT_PKG}"
|
||||||
LIBXSLT_MD5="fde6a7a93c0eb14cba628692fa3a1000"
|
LIBXSLT_MD5="fde6a7a93c0eb14cba628692fa3a1000"
|
||||||
|
# tidy
|
||||||
|
TIDY_PKG="tidy_src_051026.tgz"
|
||||||
|
TIDY_URL="http://tidy.sourceforge.net/src/${TIDY_PKG}"
|
||||||
|
TIDY_MD5="1e39fafd6808978871346658c8da1454"
|
||||||
|
# tidy patch
|
||||||
|
TIDY_PATCH="tidy-051026-prevent_PRE_newlines-1.patch"
|
||||||
|
TIDY_PATCH_URL="http://www.linuxfromscratch.org/patches/blfs/svn/${TIDY_PATCH}"
|
||||||
|
TIDY_PATCH_MD5="82f67f7af58fc2c945b3410ae655cc1a"
|
||||||
|
# unzip
|
||||||
|
UNZIP_PKG="unzip552.tar.gz"
|
||||||
|
UNZIP_URL="ftp://ftp.info-zip.org/pub/infozip/src/${UNZIP_PKG}"
|
||||||
|
UNZIP_MD5="9d23919999d6eac9217d1f41472034a9"
|
||||||
|
# DocBook XML DTD
|
||||||
|
DBXML_PKG="docbook-xml-4.4.zip"
|
||||||
|
DBXML_URL="http://www.docbook.org/xml/4.4/${DBXML_PKG}"
|
||||||
|
DBXML_MD5="cbb04e9a700955d88c50962ef22c1634"
|
||||||
# DocBook XSL
|
# DocBook XSL
|
||||||
DBXSL_PKG="docbook-xsl-1.69.1.tar.bz2"
|
DBXSL_PKG="docbook-xsl-1.69.1.tar.bz2"
|
||||||
DBXSL_URL="http://prdownloads.sourceforge.net/docbook/${DBXSL_PKG}"
|
DBXSL_URL="http://prdownloads.sourceforge.net/docbook/${DBXSL_PKG}"
|
||||||
|
@ -241,13 +258,9 @@ source $COMMON_DIR/func_validate_configs.sh
|
||||||
### MAIN ###
|
### MAIN ###
|
||||||
###################################
|
###################################
|
||||||
|
|
||||||
# Check for minimum bash,tar,gcc and kernel versions
|
# Check for build prereequisites.
|
||||||
echo
|
echo
|
||||||
check_version "2.6.2" "`uname -r`" "KERNEL"
|
check_prerequisites
|
||||||
check_version "3.0" "$BASH_VERSION" "BASH"
|
|
||||||
check_version "3.0" "`gcc -dumpversion`" "GCC"
|
|
||||||
tarVer=`tar --version | head -n1 | cut -d " " -f4`
|
|
||||||
check_version "1.15.0" "${tarVer}" "TAR"
|
|
||||||
echo "${SD_BORDER}${nl_}"
|
echo "${SD_BORDER}${nl_}"
|
||||||
|
|
||||||
validate_config
|
validate_config
|
||||||
|
@ -359,6 +372,7 @@ if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
||||||
sed -i 's,tracking-dir,'$TRACKING_DIR',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,gen-makefile.sh}
|
sed -i 's,tracking-dir,'$TRACKING_DIR',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,gen-makefile.sh}
|
||||||
# Copy the dependencies build scripts
|
# Copy the dependencies build scripts
|
||||||
cp -r $COMMON_DIR/blfs-tool-deps $JHALFSDIR/
|
cp -r $COMMON_DIR/blfs-tool-deps $JHALFSDIR/
|
||||||
|
rm -rf $JHALFSDIR/blfs-tool-deps/.svn
|
||||||
fi
|
fi
|
||||||
|
|
||||||
get_book
|
get_book
|
||||||
|
@ -369,7 +383,7 @@ if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
||||||
echo -n "Downloading the BLFS document, $BLFS_BRANCH_ID version... "
|
echo -n "Downloading the BLFS document, $BLFS_BRANCH_ID version... "
|
||||||
if [[ ! -d ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} ]] ; then
|
if [[ ! -d ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} ]] ; then
|
||||||
mkdir -p ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML}
|
mkdir -p ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML}
|
||||||
svn co $SVN/BLFS/$TREE ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} >>$LOGDIR/$LOG 2>&1
|
svn co $SVN/BLFS/$BLFS_TREE ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} >>$LOGDIR/$LOG 2>&1
|
||||||
else
|
else
|
||||||
pushd ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} 1> /dev/null
|
pushd ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} 1> /dev/null
|
||||||
svn up >>$LOGDIR/$LOG 2>&1
|
svn up >>$LOGDIR/$LOG 2>&1
|
||||||
|
|
Reference in a new issue