2006-11-11 12:39:16 +01:00
|
|
|
#!/bin/bash
|
2006-04-06 21:35:22 +02:00
|
|
|
# $Id$
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
|
|
|
|
orphan_scripts="" # 2 scripts do not fit BOOT_Makefiles LUSER environment
|
|
|
|
|
|
|
|
|
|
|
|
#--------------------------------------#
|
|
|
|
host_prep_Makefiles() { #
|
|
|
|
#--------------------------------------#
|
2006-07-02 11:24:47 +02:00
|
|
|
local CLFS_HOST
|
2006-04-06 21:35:22 +02:00
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files ( SETUP ) ${R_arrow}"
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
# defined here, only for ease of reading
|
2006-07-17 19:42:13 +02:00
|
|
|
CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
|
2006-04-06 21:35:22 +02:00
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
023-creatingtoolsdir:
|
|
|
|
@\$(call echo_message, Building)
|
2006-06-09 22:52:05 +02:00
|
|
|
@mkdir \$(MOUNT_PT)/tools && \\
|
|
|
|
rm -f /tools && \\
|
2007-03-18 11:14:04 +01:00
|
|
|
ln -s \$(MOUNT_PT)/tools /
|
|
|
|
@\$(call housekeeping)
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
024-creatingcrossdir: 023-creatingtoolsdir
|
2006-12-11 14:14:54 +01:00
|
|
|
@\$(call echo_message, Building)
|
2006-04-06 21:35:22 +02:00
|
|
|
@mkdir -v \$(MOUNT_PT)/cross-tools && \\
|
2006-06-09 22:52:05 +02:00
|
|
|
rm -f /cross-tools && \\
|
2007-03-18 11:14:04 +01:00
|
|
|
ln -s \$(MOUNT_PT)/cross-tools /
|
|
|
|
@\$(call housekeeping)
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
025-addinguser: 024-creatingcrossdir
|
|
|
|
@\$(call echo_message, Building)
|
2007-04-13 22:40:38 +02:00
|
|
|
@if [ ! -d \$(LUSER_HOME) ]; then \\
|
2006-08-08 19:26:40 +02:00
|
|
|
groupadd \$(LGROUP); \\
|
|
|
|
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
2006-04-06 21:35:22 +02:00
|
|
|
else \\
|
2006-08-08 19:26:40 +02:00
|
|
|
touch luser-exist; \\
|
2006-04-06 21:35:22 +02:00
|
|
|
fi;
|
2006-12-11 14:14:54 +01:00
|
|
|
@chown \$(LUSER) \$(MOUNT_PT)/tools && \\
|
2006-08-08 19:26:40 +02:00
|
|
|
chown \$(LUSER) \$(MOUNT_PT)/cross-tools && \\
|
2006-12-11 14:14:54 +01:00
|
|
|
chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
|
2007-03-18 11:14:04 +01:00
|
|
|
chmod a+wt \$(SRCSDIR)
|
|
|
|
@\$(call housekeeping)
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
026-settingenvironment: 025-addinguser
|
|
|
|
@\$(call echo_message, Building)
|
2007-04-13 22:40:38 +02:00
|
|
|
@if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
|
|
|
mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
|
2006-04-06 21:35:22 +02:00
|
|
|
fi;
|
2007-04-13 22:40:38 +02:00
|
|
|
@if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
|
|
|
|
mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
|
2006-04-06 21:35:22 +02:00
|
|
|
fi;
|
2007-04-13 22:40:38 +02:00
|
|
|
@echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
|
|
|
|
echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
|
|
|
|
echo "CLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
|
|
|
|
echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
|
|
|
|
echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
|
|
|
|
echo "export CLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
|
|
|
|
echo "" >> \$(LUSER_HOME)/.bashrc && \\
|
|
|
|
echo "unset CFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
|
|
|
|
echo "unset CXXFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
|
|
|
|
echo "" >> \$(LUSER_HOME)/.bashrc && \\
|
|
|
|
echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> \$(LUSER_HOME)/.bashrc && \\
|
|
|
|
echo "export CLFS_TARGET=\"${TARGET}\"" >> \$(LUSER_HOME)/.bashrc && \\
|
|
|
|
echo "export CLFS_TARGET32=\"${TARGET32}\"" >> \$(LUSER_HOME)/.bashrc && \\
|
|
|
|
echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc
|
|
|
|
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
|
2006-04-06 21:35:22 +02:00
|
|
|
touch envars && \\
|
2006-10-02 21:32:06 +02:00
|
|
|
chmod -R a+wt \$(MOUNT_PT) && \\
|
2007-03-18 11:14:04 +01:00
|
|
|
chown -R \$(LUSER) \$(MOUNT_PT)/\$(SCRIPT_ROOT)
|
|
|
|
@\$(call housekeeping)
|
2006-04-06 21:35:22 +02:00
|
|
|
EOF
|
|
|
|
) >> $MKFILE.tmp
|
2006-10-02 21:32:06 +02:00
|
|
|
host_prep=" 023-creatingtoolsdir 024-creatingcrossdir 026-settingenvironment"
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
#--------------------------------------#
|
|
|
|
cross_tools_Makefiles() { #
|
|
|
|
#--------------------------------------#
|
|
|
|
echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools ( LUSER ) ${R_arrow}"
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
for file in cross-tools/* ; do
|
|
|
|
# Keep the script file name
|
|
|
|
this_script=`basename $file`
|
|
|
|
#
|
|
|
|
# Skip this script...
|
|
|
|
case $this_script in
|
|
|
|
*cflags* | *variables* ) # work done in host_prep_Makefiles
|
|
|
|
continue; ;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
#
|
|
|
|
# Set the dependency for the first target.
|
|
|
|
if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi
|
|
|
|
|
|
|
|
# First append each name of the script files to a list (this will become
|
|
|
|
# the names of the targets in the Makefile
|
|
|
|
cross_tools="$cross_tools $this_script"
|
|
|
|
|
|
|
|
# Grab the name of the target (minus the -headers or -cross in the case of gcc
|
|
|
|
# and binutils in chapter 5)
|
|
|
|
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
|
|
|
-e 's@-static@@' \
|
|
|
|
-e 's@-final@@' \
|
2006-12-20 12:12:56 +01:00
|
|
|
-e 's@-64@@' \
|
2006-04-06 21:35:22 +02:00
|
|
|
-e 's@-n32@@'`
|
2006-06-20 23:14:44 +02:00
|
|
|
pkg_tarball=$(get_package_tarball_name $name)
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> 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.
|
2006-10-02 21:32:06 +02:00
|
|
|
LUSER_wrt_target "${this_script}" "$PREV"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2006-06-20 23:14:44 +02:00
|
|
|
# If $pkg_tarball isn't empty, we've got a package...
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2006-10-02 21:32:06 +02:00
|
|
|
[[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
|
2013-09-27 22:47:05 +02:00
|
|
|
[[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = 3 ]] && wrt_makeflags "${name}"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2006-10-02 21:32:06 +02:00
|
|
|
LUSER_wrt_RunAsUser "${file}"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2006-10-02 21:32:06 +02:00
|
|
|
[[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
# Include a touch of the target name so make can check if it's already been made.
|
2006-06-10 17:58:06 +02:00
|
|
|
wrt_touch
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
#
|
|
|
|
# Keep the script file name for Makefile dependencies.
|
|
|
|
PREV=$this_script
|
|
|
|
|
|
|
|
done # for file in ....
|
|
|
|
}
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
#--------------------------------------#
|
|
|
|
temptools_Makefiles() { #
|
|
|
|
#--------------------------------------#
|
|
|
|
echo "${tab_}${GREEN}Processing... ${L_arrow}temp system ( LUSER ) ${R_arrow}"
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
for file in temp-system/* ; do
|
|
|
|
# Keep the script file name
|
|
|
|
this_script=`basename $file`
|
2006-06-24 16:39:17 +02:00
|
|
|
#
|
|
|
|
# Deal with any odd scripts..
|
|
|
|
case $this_script in
|
|
|
|
*choose) # The choose script will fail if you cannot enter the new environment
|
|
|
|
# If the 'boot' build method was chosen don't run the script
|
|
|
|
[[ $METHOD = "boot" ]] && continue; ;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
2006-07-02 11:24:47 +02:00
|
|
|
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
# First append each name of the script files to a list (this will become
|
|
|
|
# the names of the targets in the Makefile
|
|
|
|
temptools="$temptools $this_script"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Grab the name of the target, strip id number, XXX-script
|
|
|
|
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
|
|
|
#
|
2006-06-20 23:14:44 +02:00
|
|
|
pkg_tarball=$(get_package_tarball_name $name)
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> 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.
|
2006-10-02 21:32:06 +02:00
|
|
|
LUSER_wrt_target "${this_script}" "$PREV"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2006-06-20 23:14:44 +02:00
|
|
|
# If $pkg_tarball isn't empty, we've got a package...
|
2006-04-06 21:35:22 +02:00
|
|
|
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
|
|
|
#
|
2006-10-02 21:32:06 +02:00
|
|
|
[[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
|
2013-09-27 22:47:05 +02:00
|
|
|
[[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2006-10-02 21:32:06 +02:00
|
|
|
LUSER_wrt_RunAsUser "${file}"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2006-10-02 21:32:06 +02:00
|
|
|
[[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
# Include a touch of the target name so make can check if it's already been made.
|
2006-06-10 17:58:06 +02:00
|
|
|
wrt_touch
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
#
|
|
|
|
# Keep the script file name for Makefile dependencies.
|
|
|
|
PREV=$this_script
|
|
|
|
done # for file in ....
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
#--------------------------------------#
|
|
|
|
chroot_Makefiles() { #
|
|
|
|
#--------------------------------------#
|
|
|
|
echo "${tab_}${GREEN}Processing... ${L_arrow}tmptools CHROOT ( CHROOT ) ${R_arrow}"
|
2006-04-06 21:35:22 +02:00
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
for file in chroot/* ; do
|
2006-04-06 21:35:22 +02:00
|
|
|
# Keep the script file name
|
|
|
|
this_script=`basename $file`
|
2006-10-02 21:32:06 +02:00
|
|
|
#
|
|
|
|
# Skipping scripts is done now and not included in the build tree.
|
2006-04-06 21:35:22 +02:00
|
|
|
case $this_script in
|
2006-10-02 21:32:06 +02:00
|
|
|
*chroot*) continue ;;
|
2006-04-06 21:35:22 +02:00
|
|
|
esac
|
2006-10-02 21:32:06 +02:00
|
|
|
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
# First append each name of the script files to a list (this will become
|
|
|
|
# the names of the targets in the Makefile
|
2006-10-02 21:32:06 +02:00
|
|
|
case "${this_script}" in
|
|
|
|
*kernfs) orphan_scripts="${orphan_scripts} ${this_script}" ;;
|
|
|
|
*) chroottools="$chroottools $this_script" ;;
|
2006-04-06 21:35:22 +02:00
|
|
|
esac
|
2006-10-02 21:32:06 +02:00
|
|
|
|
|
|
|
# Grab the name of the target, strip id number, XXX-script
|
|
|
|
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
|
|
|
|
2006-06-20 23:14:44 +02:00
|
|
|
pkg_tarball=$(get_package_tarball_name $name)
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
# This is very ugly:: util-linux is in /chroot but must be run under LUSER
|
2012-02-09 23:58:45 +01:00
|
|
|
# Same for e2fsprogs (in CLFS 1.1.0)
|
2006-10-02 21:32:06 +02:00
|
|
|
# .. Customized makefile entry
|
|
|
|
case "${this_script}" in
|
|
|
|
*util-linux)
|
|
|
|
LUSER_wrt_target "${this_script}" "$PREV"
|
|
|
|
LUSER_wrt_unpack "$pkg_tarball"
|
2013-09-27 22:47:05 +02:00
|
|
|
[[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
2006-10-02 21:32:06 +02:00
|
|
|
LUSER_wrt_RunAsUser "${file}"
|
|
|
|
LUSER_RemoveBuildDirs "${name}"
|
|
|
|
wrt_touch
|
2006-12-20 12:12:56 +01:00
|
|
|
temptools="$temptools $this_script"
|
|
|
|
continue ;;
|
2012-02-09 23:58:45 +01:00
|
|
|
*util-linux-ng)
|
|
|
|
LUSER_wrt_target "${this_script}" "$PREV"
|
|
|
|
LUSER_wrt_unpack "$pkg_tarball"
|
2013-09-27 22:47:05 +02:00
|
|
|
[[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
2012-02-09 23:58:45 +01:00
|
|
|
LUSER_wrt_RunAsUser "${file}"
|
|
|
|
LUSER_RemoveBuildDirs "${name}"
|
|
|
|
wrt_touch
|
|
|
|
temptools="$temptools $this_script"
|
|
|
|
continue ;;
|
|
|
|
*util-linux-libs)
|
|
|
|
LUSER_wrt_target "${this_script}" "$PREV"
|
|
|
|
LUSER_wrt_unpack "$pkg_tarball"
|
2013-09-27 22:47:05 +02:00
|
|
|
[[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
2012-02-09 23:58:45 +01:00
|
|
|
LUSER_wrt_RunAsUser "${file}"
|
|
|
|
LUSER_RemoveBuildDirs "${name}"
|
|
|
|
wrt_touch
|
|
|
|
temptools="$temptools $this_script"
|
|
|
|
continue ;;
|
|
|
|
*e2fsprogs)
|
|
|
|
LUSER_wrt_target "${this_script}" "$PREV"
|
|
|
|
LUSER_wrt_unpack "$pkg_tarball"
|
2013-09-27 22:47:05 +02:00
|
|
|
[[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
2012-02-09 23:58:45 +01:00
|
|
|
LUSER_wrt_RunAsUser "${file}"
|
|
|
|
LUSER_RemoveBuildDirs "${name}"
|
|
|
|
wrt_touch
|
|
|
|
temptools="$temptools $this_script"
|
|
|
|
continue ;;
|
|
|
|
*e2fsprogs-libs)
|
|
|
|
LUSER_wrt_target "${this_script}" "$PREV"
|
|
|
|
LUSER_wrt_unpack "$pkg_tarball"
|
2013-09-27 22:47:05 +02:00
|
|
|
[[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
2012-02-09 23:58:45 +01:00
|
|
|
LUSER_wrt_RunAsUser "${file}"
|
|
|
|
LUSER_RemoveBuildDirs "${name}"
|
|
|
|
wrt_touch
|
|
|
|
temptools="$temptools $this_script"
|
|
|
|
continue ;;
|
2006-10-02 21:32:06 +02:00
|
|
|
esac
|
|
|
|
|
|
|
|
|
2006-04-06 21:35:22 +02:00
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> 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.
|
2006-10-02 21:32:06 +02:00
|
|
|
CHROOT_wrt_target "${this_script}" "$PREV"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2006-06-20 23:14:44 +02:00
|
|
|
# If $pkg_tarball isn't empty, we've got a package...
|
2006-04-06 21:35:22 +02:00
|
|
|
# Insert instructions for unpacking the package and changing directories
|
|
|
|
#
|
2006-10-02 21:32:06 +02:00
|
|
|
if [ "$pkg_tarball" != "" ] ; then
|
2006-11-11 22:20:15 +01:00
|
|
|
CHROOT_Unpack "$pkg_tarball"
|
2013-09-27 22:47:05 +02:00
|
|
|
[[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
2006-10-02 21:32:06 +02:00
|
|
|
fi
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
# Select a script execution method
|
|
|
|
case $this_script in
|
2006-11-11 22:20:15 +01:00
|
|
|
*kernfs) wrt_RunAsRoot "${file}" ;;
|
2006-10-02 21:32:06 +02:00
|
|
|
*) CHROOT_wrt_RunAsRoot "${file}" ;;
|
2006-04-06 21:35:22 +02:00
|
|
|
esac
|
|
|
|
#
|
2006-10-02 21:32:06 +02:00
|
|
|
# Housekeeping...remove the build directory(ies), except if the package build fails.
|
|
|
|
[[ "$pkg_tarball" != "" ]] && CHROOT_wrt_RemoveBuildDirs "${name}"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
# Include a touch of the target name so make can check if it's already been made.
|
2006-06-10 17:58:06 +02:00
|
|
|
wrt_touch
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
#
|
|
|
|
# Keep the script file name for Makefile dependencies.
|
|
|
|
PREV=$this_script
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
done # for file in...
|
2006-04-06 21:35:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
#--------------------------------------#
|
|
|
|
boot_Makefiles() { #
|
|
|
|
#--------------------------------------#
|
2006-04-06 21:35:22 +02:00
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
echo "${tab_}${GREEN}Processing... ${L_arrow}tmptools BOOT ( LUSER ) ${R_arrow}"
|
|
|
|
#
|
|
|
|
# Create a target bootable partition containing a compile environment. Later
|
|
|
|
# on we boot into this environment and contine the build.
|
|
|
|
#
|
|
|
|
for file in boot/* ; do
|
2006-04-06 21:35:22 +02:00
|
|
|
# Keep the script file name
|
|
|
|
this_script=`basename $file`
|
2006-10-02 21:32:06 +02:00
|
|
|
|
|
|
|
# A little housekeeping on the scripts
|
2006-04-06 21:35:22 +02:00
|
|
|
case $this_script in
|
2007-07-29 13:57:40 +02:00
|
|
|
*grub | *aboot | *colo | *silo | *arcload | *lilo | *introduction ) continue ;;
|
2006-10-02 21:32:06 +02:00
|
|
|
*whatnext*) continue ;;
|
|
|
|
*fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
|
|
|
|
*kernel) # if there is no kernel config file do not build the kernel
|
|
|
|
[[ -z $CONFIG ]] && continue
|
|
|
|
# Copy the config file to /sources with a standardized name
|
|
|
|
cp $BOOT_CONFIG $BUILDDIR/sources/bootkernel-config
|
|
|
|
;;
|
2006-04-06 21:35:22 +02:00
|
|
|
esac
|
|
|
|
#
|
|
|
|
# First append each name of the script files to a list (this will become
|
|
|
|
# the names of the targets in the Makefile
|
2006-10-02 21:32:06 +02:00
|
|
|
case "${this_script}" in
|
|
|
|
*changingowner) orphan_scripts="${orphan_scripts} ${this_script}" ;;
|
|
|
|
*devices) orphan_scripts="${orphan_scripts} ${this_script}" ;;
|
|
|
|
*) boottools="$boottools $this_script" ;;
|
|
|
|
esac
|
|
|
|
#
|
|
|
|
# Grab the name of the target, strip id number and misc words.
|
|
|
|
case $this_script in
|
|
|
|
*kernel) name=linux ;;
|
|
|
|
*bootscripts) name="bootscripts-cross-lfs" ;;
|
|
|
|
*udev-rules) name="udev-cross-lfs" ;;
|
|
|
|
*grub-build) name=grub ;;
|
|
|
|
*-aboot-build) name=aboot ;;
|
|
|
|
*yaboot-build) name=yaboot ;;
|
|
|
|
*colo-build) name=colo ;;
|
|
|
|
*silo-build) name=silo ;;
|
|
|
|
*arcload-build) name=arcload ;;
|
|
|
|
*lilo-build) name=lilo ;;
|
|
|
|
*) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
|
|
|
|
esac
|
|
|
|
# Identify the unique version naming scheme for the clfs bootscripts..(bad boys)
|
2006-06-20 23:14:44 +02:00
|
|
|
pkg_tarball=$(get_package_tarball_name $name)
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> 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.
|
2006-10-02 21:32:06 +02:00
|
|
|
LUSER_wrt_target "${this_script}" "$PREV"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2006-06-20 23:14:44 +02:00
|
|
|
# If $pkg_tarball isn't empty, we've got a package...
|
2006-04-06 21:35:22 +02:00
|
|
|
# Insert instructions for unpacking the package and changing directories
|
|
|
|
#
|
2006-10-02 21:32:06 +02:00
|
|
|
[[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
|
2013-09-27 22:47:05 +02:00
|
|
|
[[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
# Select a script execution method
|
|
|
|
case $this_script in
|
2006-10-02 21:32:06 +02:00
|
|
|
# The following 2 scripts are defined in the /boot directory but need
|
|
|
|
# to be run as a root user. Set them up here but run them in another phase
|
2006-11-11 22:20:15 +01:00
|
|
|
*changingowner*) wrt_RunAsRoot "${file}" ;;
|
|
|
|
*devices*) wrt_RunAsRoot "${file}" ;;
|
2006-10-02 21:32:06 +02:00
|
|
|
*fstab*) if [[ -n "$FSTAB" ]]; then
|
|
|
|
LUSER_wrt_CopyFstab
|
|
|
|
else
|
|
|
|
LUSER_wrt_RunAsUser "${file}"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*) LUSER_wrt_RunAsUser "${file}" ;;
|
2006-04-06 21:35:22 +02:00
|
|
|
esac
|
|
|
|
#
|
2006-10-02 21:32:06 +02:00
|
|
|
# Housekeeping...remove any build directory(ies) except if the package build fails.
|
|
|
|
[[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
# Include a touch of the target name so make can check if it's already been made.
|
2006-06-10 17:58:06 +02:00
|
|
|
wrt_touch
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
#
|
|
|
|
# Keep the script file name for Makefile dependencies.
|
|
|
|
PREV=$this_script
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
done
|
2006-04-06 21:35:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
#--------------------------------------#
|
2006-11-13 22:01:21 +01:00
|
|
|
testsuite_tools_Makefiles() { #
|
2006-10-02 21:32:06 +02:00
|
|
|
#--------------------------------------#
|
2006-04-06 21:35:22 +02:00
|
|
|
|
2006-11-13 22:01:21 +01:00
|
|
|
if [[ "${METHOD}" = "chroot" ]]; then
|
|
|
|
echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools ( CHROOT ) ${R_arrow}"
|
|
|
|
else
|
|
|
|
echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools ( ROOT ) ${R_arrow}"
|
2006-11-13 22:17:10 +01:00
|
|
|
PREV=""
|
2006-11-13 22:01:21 +01:00
|
|
|
fi
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
for file in testsuite-tools/* ; do
|
|
|
|
# Keep the script file name
|
|
|
|
this_script=`basename $file`
|
|
|
|
|
|
|
|
# First append each name of the script files to a list (this will become
|
|
|
|
# the names of the targets in the Makefile
|
|
|
|
testsuitetools="$testsuitetools $this_script"
|
|
|
|
|
|
|
|
# Grab the name of the target, strip id number, XXX-script
|
|
|
|
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
|
|
|
-e 's@-64bit@@' \
|
|
|
|
-e 's@-64@@' \
|
|
|
|
-e 's@64@@' \
|
|
|
|
-e 's@n32@@'`
|
|
|
|
|
2006-06-20 23:14:44 +02:00
|
|
|
pkg_tarball=$(get_package_tarball_name $name)
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> 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.
|
2006-11-12 10:55:20 +01:00
|
|
|
CHROOT_wrt_target "${this_script}" "$PREV"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2006-11-12 10:55:20 +01:00
|
|
|
CHROOT_Unpack "$pkg_tarball"
|
2013-09-27 22:47:05 +02:00
|
|
|
[[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2006-11-12 10:55:20 +01:00
|
|
|
CHROOT_wrt_RunAsRoot "${file}"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2006-11-12 10:55:20 +01:00
|
|
|
CHROOT_wrt_RemoveBuildDirs "${name}"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
# Include a touch of the target name so make can check if it's already been made.
|
2006-06-10 17:58:06 +02:00
|
|
|
wrt_touch
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
#
|
|
|
|
# Keep the script file name for Makefile dependencies.
|
|
|
|
PREV=$this_script
|
|
|
|
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
#--------------------------------------#
|
2006-11-13 22:01:21 +01:00
|
|
|
final_system_Makefiles() { #
|
2006-10-02 21:32:06 +02:00
|
|
|
#--------------------------------------#
|
2006-04-29 16:44:29 +02:00
|
|
|
# Set envars and scripts for iteration targets
|
|
|
|
if [[ -z "$1" ]] ; then
|
|
|
|
local N=""
|
2006-11-13 22:01:21 +01:00
|
|
|
# In boot method the makesys phase was initiated in testsuite_tools_makefile
|
|
|
|
[[ "${METHOD}" = "boot" ]] && [[ "$TEST" = 0 ]] && PREV=""
|
2006-04-29 16:44:29 +02:00
|
|
|
else
|
|
|
|
local N=-build_$1
|
|
|
|
local basicsystem=""
|
|
|
|
mkdir final-system$N
|
|
|
|
cp final-system/* final-system$N
|
|
|
|
for script in final-system$N/* ; do
|
|
|
|
# Overwrite existing symlinks, files, and dirs
|
|
|
|
sed -e 's/ln -sv/&f/g' \
|
|
|
|
-e 's/mv -v/&f/g' \
|
|
|
|
-e 's/mkdir -v/&p/g' -i ${script}
|
2006-12-05 16:25:00 +01:00
|
|
|
# Rename the scripts
|
|
|
|
mv ${script} ${script}$N
|
2006-04-29 16:44:29 +02:00
|
|
|
done
|
2007-02-24 17:35:58 +01:00
|
|
|
# Remove Bzip2 binaries before make install (CLFS-1.0 compatibility)
|
2006-12-05 16:25:00 +01:00
|
|
|
sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2$N
|
2006-04-29 16:44:29 +02:00
|
|
|
# Delete *old Readline libraries just after make install
|
2006-12-05 16:25:00 +01:00
|
|
|
sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline$N
|
2006-04-29 16:44:29 +02:00
|
|
|
fi
|
|
|
|
|
2006-11-13 22:01:21 +01:00
|
|
|
if [[ "${METHOD}" = "chroot" ]]; then
|
|
|
|
echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system$N ( CHROOT ) ${R_arrow}"
|
|
|
|
else
|
|
|
|
echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N ( ROOT ) ${R_arrow}"
|
|
|
|
fi
|
2006-04-06 21:35:22 +02:00
|
|
|
|
2006-04-29 16:44:29 +02:00
|
|
|
for file in final-system$N/* ; do
|
2006-04-06 21:35:22 +02:00
|
|
|
# Keep the script file name
|
|
|
|
this_script=`basename $file`
|
|
|
|
|
2006-04-29 16:44:29 +02:00
|
|
|
# Test if the stripping phase must be skipped.
|
|
|
|
# Skip alsp temp-perl for iterative runs
|
2006-04-06 21:35:22 +02:00
|
|
|
case $this_script in
|
2006-08-16 19:42:54 +02:00
|
|
|
*stripping*) [[ "$STRIP" = "n" ]] && continue ;;
|
2006-04-29 16:44:29 +02:00
|
|
|
*temp-perl*) [[ -n "$N" ]] && continue ;;
|
2006-04-06 21:35:22 +02:00
|
|
|
esac
|
|
|
|
|
|
|
|
# Grab the name of the target, strip id number, XXX-script
|
|
|
|
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
|
|
|
-e 's@temp-@@' \
|
|
|
|
-e 's@-64bit@@' \
|
|
|
|
-e 's@-64@@' \
|
|
|
|
-e 's@64@@' \
|
2006-12-05 16:25:00 +01:00
|
|
|
-e 's@n32@@' \
|
|
|
|
-e 's,'$N',,'`
|
2006-04-06 21:35:22 +02:00
|
|
|
|
2006-04-29 16:44:29 +02:00
|
|
|
# Find the version of the command files, if it corresponds with the building of
|
|
|
|
# a specific package. We need this here to can skip scripts not needed for
|
|
|
|
# iterations rebuilds
|
2006-06-20 23:14:44 +02:00
|
|
|
pkg_tarball=$(get_package_tarball_name $name)
|
2006-06-17 01:52:18 +02:00
|
|
|
|
2006-06-20 23:14:44 +02:00
|
|
|
if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
|
2006-04-29 16:44:29 +02:00
|
|
|
case "${this_script}" in
|
|
|
|
*stripping*) ;;
|
|
|
|
*) continue ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Append each name of the script files to a list (this will become
|
|
|
|
# the names of the targets in the Makefile
|
2006-12-05 16:25:00 +01:00
|
|
|
basicsystem="$basicsystem ${this_script}"
|
2006-04-29 16:44:29 +02:00
|
|
|
|
2006-04-06 21:35:22 +02:00
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> 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.
|
2006-12-05 16:25:00 +01:00
|
|
|
CHROOT_wrt_target "${this_script}" "$PREV"
|
2006-04-06 21:35:22 +02:00
|
|
|
|
2006-06-20 23:14:44 +02:00
|
|
|
# If $pkg_tarball isn't empty, we've got a package...
|
|
|
|
if [ "$pkg_tarball" != "" ] ; then
|
2007-06-03 11:06:13 +02:00
|
|
|
# Touch timestamp file if installed files logs will be created.
|
|
|
|
# But only for the firt build when running iterative builds.
|
|
|
|
if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
|
|
|
|
CHROOT_wrt_TouchTimestamp
|
|
|
|
fi
|
2006-10-02 21:32:06 +02:00
|
|
|
CHROOT_Unpack "$pkg_tarball"
|
2006-06-04 19:56:01 +02:00
|
|
|
# If the testsuites must be run, initialize the log file
|
|
|
|
case $name in
|
2012-02-09 23:58:45 +01:00
|
|
|
binutils | gcc | glibc | eglibc )
|
2006-12-05 16:25:00 +01:00
|
|
|
[[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}"
|
2006-06-04 19:56:01 +02:00
|
|
|
;;
|
|
|
|
* )
|
2006-12-05 16:25:00 +01:00
|
|
|
[[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && CHROOT_wrt_test_log "${this_script}"
|
2006-06-04 19:56:01 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
# If using optimizations, write the instructions
|
2006-05-11 22:21:14 +02:00
|
|
|
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
2006-04-06 21:35:22 +02:00
|
|
|
fi
|
|
|
|
#
|
2006-10-02 21:32:06 +02:00
|
|
|
CHROOT_wrt_RunAsRoot "${file}"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2007-06-03 11:06:13 +02:00
|
|
|
# Write installed files log and remove the build directory(ies)
|
|
|
|
# except if the package build fails.
|
|
|
|
if [ "$pkg_tarball" != "" ] ; then
|
|
|
|
CHROOT_wrt_RemoveBuildDirs "$name"
|
|
|
|
if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
|
|
|
|
CHROOT_wrt_LogNewFiles "$name"
|
|
|
|
fi
|
|
|
|
fi
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2007-06-03 11:06:13 +02:00
|
|
|
# Include a touch of the target name so make can check
|
|
|
|
# if it's already been made.
|
2006-06-10 17:58:06 +02:00
|
|
|
wrt_touch
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
#
|
|
|
|
# Keep the script file name for Makefile dependencies.
|
2006-12-05 16:25:00 +01:00
|
|
|
PREV=${this_script}
|
2006-04-29 16:44:29 +02:00
|
|
|
# Set system_build envar for iteration targets
|
|
|
|
system_build=$basicsystem
|
2006-04-06 21:35:22 +02:00
|
|
|
done # for file in final-system/* ...
|
|
|
|
}
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
#--------------------------------------#
|
2006-11-13 22:01:21 +01:00
|
|
|
bootscripts_Makefiles() { #
|
2006-10-02 21:32:06 +02:00
|
|
|
#--------------------------------------#
|
2006-11-13 22:01:21 +01:00
|
|
|
|
|
|
|
if [[ "${METHOD}" = "chroot" ]]; then
|
|
|
|
echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) bootscripts ( CHROOT ) ${R_arrow}"
|
2006-04-29 16:44:29 +02:00
|
|
|
else
|
2006-11-13 22:01:21 +01:00
|
|
|
echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) bootscripts ( ROOT ) ${R_arrow}"
|
2006-04-29 16:44:29 +02:00
|
|
|
fi
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
for file in bootscripts/* ; do
|
|
|
|
# Keep the script file name
|
|
|
|
this_script=`basename $file`
|
|
|
|
|
|
|
|
case $this_script in
|
|
|
|
*udev) continue ;; # This is not a script but a commentary, we want udev-rules
|
|
|
|
*console*) continue ;; # Use the files that came with the bootscripts
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# First append each name of the script files to a list (this will become
|
|
|
|
# the names of the targets in the Makefile
|
|
|
|
bootscripttools="$bootscripttools $this_script"
|
|
|
|
|
|
|
|
# Grab the name of the target, strip id number, XXX-script
|
|
|
|
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
|
|
|
-e 's@-64bit@@' \
|
|
|
|
-e 's@-64@@' \
|
|
|
|
-e 's@64@@' \
|
|
|
|
-e 's@n32@@'`
|
|
|
|
case $name in
|
2006-06-19 21:12:37 +02:00
|
|
|
*bootscripts*) name=bootscripts-cross-lfs ;;
|
2006-04-06 21:35:22 +02:00
|
|
|
*udev-rules) name=udev-cross-lfs ;;
|
|
|
|
esac
|
2006-06-19 21:12:37 +02:00
|
|
|
|
2006-06-20 23:14:44 +02:00
|
|
|
pkg_tarball=$(get_package_tarball_name $name)
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> 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.
|
2006-10-02 21:32:06 +02:00
|
|
|
CHROOT_wrt_target "${this_script}" "$PREV"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2006-06-20 23:14:44 +02:00
|
|
|
# If $pkg_tarball isn't empty, we've got a package...
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2007-06-03 11:06:13 +02:00
|
|
|
if [ "$pkg_tarball" != "" ] ; then
|
|
|
|
if [ "${INSTALL_LOG}" = "y" ] ; then
|
|
|
|
CHROOT_wrt_LogNewFiles "$name"
|
|
|
|
fi
|
|
|
|
CHROOT_Unpack "$pkg_tarball"
|
|
|
|
fi
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2006-10-02 21:32:06 +02:00
|
|
|
CHROOT_wrt_RunAsRoot "${file}"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2007-06-03 11:06:13 +02:00
|
|
|
# Write installed files log and remove the build directory(ies)
|
|
|
|
# except if the package build fails.
|
|
|
|
if [ "$pkg_tarball" != "" ] ; then
|
|
|
|
CHROOT_wrt_RemoveBuildDirs "$name"
|
|
|
|
if [ "${INSTALL_LOG}" = "y" ] ; then
|
|
|
|
CHROOT_wrt_LogNewFiles "$name"
|
|
|
|
fi
|
|
|
|
fi
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
# Include a touch of the target name so make can check if it's already been made.
|
2006-06-10 17:58:06 +02:00
|
|
|
wrt_touch
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
#
|
|
|
|
# Keep the script file name for Makefile dependencies.
|
|
|
|
PREV=$this_script
|
|
|
|
|
|
|
|
done # for file in bootscripts/* ...
|
|
|
|
}
|
|
|
|
|
2012-02-09 23:58:45 +01:00
|
|
|
#--------------------------------------#
|
|
|
|
network_Makefiles() { #
|
|
|
|
#--------------------------------------#
|
|
|
|
|
|
|
|
if [[ "${METHOD}" = "chroot" ]]; then
|
|
|
|
echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) network ( CHROOT ) ${R_arrow}"
|
|
|
|
else
|
|
|
|
echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) network ( ROOT ) ${R_arrow}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
for file in network/* ; do
|
|
|
|
# Keep the script file name
|
|
|
|
this_script=`basename $file`
|
|
|
|
|
|
|
|
case $this_script in
|
|
|
|
*choose) continue ;; # This is not a script but a commentary.
|
|
|
|
*dhcp) continue ;; # Assume static networking.
|
|
|
|
*dhcpcd) continue ;; # Assume static networking.
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# First append each name of the script files to a list (this will become
|
|
|
|
# the names of the targets in the Makefile
|
|
|
|
networktools="$networktools $this_script"
|
|
|
|
|
|
|
|
# Grab the name of the target, strip id number, XXX-script
|
|
|
|
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
|
|
|
-e 's@-64bit@@' \
|
|
|
|
-e 's@-64@@' \
|
|
|
|
-e 's@64@@' \
|
|
|
|
-e 's@n32@@'`
|
|
|
|
case $name in
|
|
|
|
*network*) name=network-cross-lfs ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
pkg_tarball=$(get_package_tarball_name $name)
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> 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"
|
|
|
|
#
|
|
|
|
# If $pkg_tarball isn't empty, we've got a package...
|
|
|
|
#
|
|
|
|
if [ "$pkg_tarball" != "" ] ; then
|
|
|
|
if [ "${INSTALL_LOG}" = "y" ] ; then
|
|
|
|
CHROOT_wrt_LogNewFiles "$name"
|
|
|
|
fi
|
|
|
|
CHROOT_Unpack "$pkg_tarball"
|
|
|
|
fi
|
|
|
|
#
|
|
|
|
CHROOT_wrt_RunAsRoot "${file}"
|
|
|
|
#
|
|
|
|
# Write installed files log and remove the build directory(ies)
|
|
|
|
# except if the package build fails.
|
|
|
|
if [ "$pkg_tarball" != "" ] ; then
|
|
|
|
CHROOT_wrt_RemoveBuildDirs "$name"
|
|
|
|
if [ "${INSTALL_LOG}" = "y" ] ; then
|
|
|
|
CHROOT_wrt_LogNewFiles "$name"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
#
|
|
|
|
# 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 # for file in network/* ...
|
|
|
|
}
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
#--------------------------------------#
|
2006-11-13 22:01:21 +01:00
|
|
|
bootable_Makefiles() { #
|
2006-10-02 21:32:06 +02:00
|
|
|
#--------------------------------------#
|
2006-04-06 21:35:22 +02:00
|
|
|
|
2006-11-13 22:01:21 +01:00
|
|
|
if [[ "${METHOD}" = "chroot" ]]; then
|
|
|
|
echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable ( CHROOT ) ${R_arrow}"
|
|
|
|
else
|
|
|
|
echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable ( ROOT ) ${R_arrow}"
|
|
|
|
fi
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
|
2006-12-11 14:59:08 +01:00
|
|
|
for file in bootable/* ; do
|
2006-04-06 21:35:22 +02:00
|
|
|
# Keep the script file name
|
|
|
|
this_script=`basename $file`
|
|
|
|
|
|
|
|
# A little housekeeping on the scripts
|
|
|
|
case $this_script in
|
|
|
|
*grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
|
2006-10-02 21:32:06 +02:00
|
|
|
*fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
|
2006-04-06 21:35:22 +02:00
|
|
|
*kernel) # if there is no kernel config file do not build the kernel
|
|
|
|
[[ -z $CONFIG ]] && continue
|
|
|
|
# Copy the config file to /sources with a standardized name
|
|
|
|
cp $CONFIG $BUILDDIR/sources/kernel-config
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
#
|
|
|
|
# First append each name of the script files to a list (this will become
|
|
|
|
# the names of the targets in the Makefile
|
|
|
|
bootabletools="$bootabletools $this_script"
|
|
|
|
#
|
|
|
|
# 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@@' `
|
|
|
|
case $this_script in
|
|
|
|
*kernel*) name=linux
|
|
|
|
;;
|
|
|
|
esac
|
2006-06-20 23:14:44 +02:00
|
|
|
|
|
|
|
pkg_tarball=$(get_package_tarball_name $name)
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> 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.
|
2006-10-02 21:32:06 +02:00
|
|
|
CHROOT_wrt_target "${this_script}" "$PREV"
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
2006-06-20 23:14:44 +02:00
|
|
|
# If $pkg_tarball isn't empty, we've got a package...
|
2006-04-06 21:35:22 +02:00
|
|
|
# Insert instructions for unpacking the package and changing directories
|
|
|
|
#
|
2007-06-03 11:06:13 +02:00
|
|
|
if [ "$pkg_tarball" != "" ] ; then
|
|
|
|
if [ "${INSTALL_LOG}" = "y" ] ; then
|
|
|
|
CHROOT_wrt_LogNewFiles "$name"
|
|
|
|
fi
|
|
|
|
CHROOT_Unpack "$pkg_tarball"
|
|
|
|
fi
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
# Select a script execution method
|
|
|
|
case $this_script in
|
2006-10-02 21:32:06 +02:00
|
|
|
*fstab*) if [[ -n "$FSTAB" ]]; then
|
|
|
|
CHROOT_wrt_CopyFstab
|
|
|
|
else
|
|
|
|
CHROOT_wrt_RunAsRoot "${file}"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*) CHROOT_wrt_RunAsRoot "${file}"
|
|
|
|
;;
|
2006-04-06 21:35:22 +02:00
|
|
|
esac
|
|
|
|
#
|
2007-06-03 11:06:13 +02:00
|
|
|
# Write installed files log and remove the build directory(ies)
|
|
|
|
# except if the package build fails.
|
|
|
|
if [ "$pkg_tarball" != "" ] ; then
|
|
|
|
CHROOT_wrt_RemoveBuildDirs "$name"
|
|
|
|
if [ "${INSTALL_LOG}" = "y" ] ; then
|
|
|
|
CHROOT_wrt_LogNewFiles "$name"
|
|
|
|
fi
|
|
|
|
fi
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
# Include a touch of the target name so make can check if it's already been made.
|
2006-06-10 17:58:06 +02:00
|
|
|
wrt_touch
|
2006-04-06 21:35:22 +02:00
|
|
|
#
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
#
|
|
|
|
# Keep the script file name for Makefile dependencies.
|
|
|
|
PREV=$this_script
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
#--------------------------------------#
|
|
|
|
build_Makefile() { # Construct a Makefile from the book scripts
|
|
|
|
#--------------------------------------#
|
|
|
|
#
|
|
|
|
# Script crashes if error trapping is on
|
|
|
|
#
|
|
|
|
set +e
|
|
|
|
declare -f method_cmds
|
|
|
|
set -e
|
|
|
|
|
|
|
|
echo "...Creating Makefile... ${BOLD}START${OFF}"
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
cd $JHALFSDIR/${PROGNAME}-commands
|
2006-10-02 21:32:06 +02:00
|
|
|
# Start with a clean files
|
|
|
|
>$MKFILE
|
2006-04-06 21:35:22 +02:00
|
|
|
>$MKFILE.tmp
|
|
|
|
|
2006-11-13 22:01:21 +01:00
|
|
|
method_cmds=${METHOD}_Makefiles
|
2006-10-02 21:32:06 +02:00
|
|
|
|
|
|
|
host_prep_Makefiles # mk_SETUP (SETUP) $host_prep
|
|
|
|
cross_tools_Makefiles # mk_CROSS (LUSER) $cross_tools
|
|
|
|
temptools_Makefiles # mk_TEMP (LUSER) $temptools
|
|
|
|
$method_cmds # mk_SYSTOOLS (CHROOT) $chroottools/$boottools
|
|
|
|
if [[ ! $TEST = "0" ]]; then
|
2006-11-13 22:01:21 +01:00
|
|
|
testsuite_tools_Makefiles # mk_SYSTOOLS (CHROOT) $testsuitetools
|
2006-04-06 21:35:22 +02:00
|
|
|
fi
|
2006-11-13 22:01:21 +01:00
|
|
|
final_system_Makefiles # mk_FINAL (CHROOT) $basicsystem
|
2006-10-02 21:32:06 +02:00
|
|
|
# Add the iterations targets, if needed
|
|
|
|
[[ "$COMPARE" = "y" ]] && wrt_compare_targets
|
2006-11-13 22:01:21 +01:00
|
|
|
bootscripts_Makefiles # mk_BOOTSCRIPT (CHROOT) $bootscripttools
|
2012-02-09 23:58:45 +01:00
|
|
|
if [ -d network ]; then
|
|
|
|
network_Makefiles # If present, process network setup.
|
|
|
|
fi
|
2006-11-13 22:01:21 +01:00
|
|
|
bootable_Makefiles # mk_BOOTABLE (CHROOT) $bootabletools
|
2006-04-06 21:35:22 +02:00
|
|
|
|
2006-12-15 11:53:10 +01:00
|
|
|
# Add the CUSTOM_TOOLS targets, if needed
|
|
|
|
[[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
|
2006-10-05 00:11:32 +02:00
|
|
|
# Add the BLFS_TOOL targets, if needed
|
|
|
|
[[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets
|
|
|
|
|
2006-04-06 21:35:22 +02:00
|
|
|
# Add a header, some variables and include the function file
|
|
|
|
# to the top of the real Makefile.
|
2006-11-11 20:55:13 +01:00
|
|
|
wrt_Makefile_header
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
# Add chroot commands
|
|
|
|
if [ "$METHOD" = "chroot" ] ; then
|
2006-08-08 19:26:40 +02:00
|
|
|
CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
|
2008-10-21 23:24:25 +02:00
|
|
|
chroot=`cat chroot/???-chroot | \
|
2006-08-08 19:26:40 +02:00
|
|
|
sed -e "s@chroot@$CHROOT_LOC@" \
|
2006-12-11 23:13:42 +01:00
|
|
|
-e '/#!\/bin\/bash/d' \
|
2006-08-08 19:26:40 +02:00
|
|
|
-e '/^export/d' \
|
|
|
|
-e '/^logout/d' \
|
|
|
|
-e 's@ \\\@ @g' | \
|
|
|
|
tr -d '\n' | \
|
|
|
|
sed -e 's/ */ /g' \
|
|
|
|
-e 's|\\$|&&|g' \
|
|
|
|
-e 's|exit||g' \
|
|
|
|
-e 's|$| -c|' \
|
2006-11-06 20:41:19 +01:00
|
|
|
-e 's|"$${CLFS}"|$(MOUNT_PT)|'\
|
2006-12-04 12:26:39 +01:00
|
|
|
-e 's|set -e||' \
|
|
|
|
-e 's|set +h||'`
|
2006-04-06 21:35:22 +02:00
|
|
|
echo -e "CHROOT1= $chroot\n" >> $MKFILE
|
|
|
|
fi
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
################## CHROOT ####################
|
|
|
|
|
2006-04-06 21:35:22 +02:00
|
|
|
if [[ "${METHOD}" = "chroot" ]]; then
|
|
|
|
(
|
2006-10-02 21:32:06 +02:00
|
|
|
cat << EOF
|
2006-04-06 21:35:22 +02:00
|
|
|
|
2006-12-15 11:53:10 +01:00
|
|
|
all: ck_UID mk_SETUP mk_CROSS mk_SUDO mk_SYSTOOLS create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL
|
2006-10-02 21:32:06 +02:00
|
|
|
@sudo make do-housekeeping
|
2006-12-11 14:59:08 +01:00
|
|
|
@echo "$VERSION - jhalfs build" > clfs-release && \\
|
|
|
|
sudo mv clfs-release \$(MOUNT_PT)/etc
|
2006-10-02 21:32:06 +02:00
|
|
|
@\$(call echo_finished,$VERSION)
|
2006-06-20 23:14:44 +02:00
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
ck_UID:
|
|
|
|
@if [ \`id -u\` = "0" ]; then \\
|
|
|
|
echo "+--------------------------------------------------+"; \\
|
|
|
|
echo "|You cannot run this makefile from the root account|"; \\
|
|
|
|
echo "+--------------------------------------------------+"; \\
|
|
|
|
exit 1; \\
|
|
|
|
fi
|
|
|
|
|
|
|
|
#---------------AS ROOT
|
|
|
|
mk_SETUP:
|
|
|
|
@\$(call echo_SU_request)
|
2007-04-05 19:55:48 +02:00
|
|
|
@sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
|
2006-10-02 21:32:06 +02:00
|
|
|
@touch \$@
|
|
|
|
|
|
|
|
#---------------AS LUSER
|
|
|
|
mk_CROSS: mk_SETUP
|
|
|
|
@\$(call echo_PHASE,Cross and Temporary Tools)
|
2007-04-05 19:55:48 +02:00
|
|
|
@(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) AS_LUSER" )
|
2006-10-02 21:32:06 +02:00
|
|
|
@sudo make restore-luser-env
|
|
|
|
@touch \$@
|
|
|
|
|
|
|
|
mk_SUDO: mk_CROSS
|
2007-04-05 19:55:48 +02:00
|
|
|
@sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
|
2006-10-02 21:32:06 +02:00
|
|
|
@touch \$@
|
|
|
|
|
|
|
|
#---------------CHROOT JAIL
|
|
|
|
mk_SYSTOOLS: mk_SUDO
|
|
|
|
@\$(call echo_CHROOT_request)
|
|
|
|
@\$(call echo_PHASE, CHROOT JAIL )
|
2007-04-05 20:08:25 +02:00
|
|
|
@( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) PREP_CHROOT_JAIL")
|
2007-04-05 19:55:48 +02:00
|
|
|
@( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT_JAIL")
|
2006-10-02 21:32:06 +02:00
|
|
|
@touch \$@
|
2006-04-06 21:35:22 +02:00
|
|
|
|
2006-12-15 11:53:10 +01:00
|
|
|
mk_CUSTOM_TOOLS: create-sbu_du-report
|
|
|
|
@if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
|
2007-03-02 01:09:55 +01:00
|
|
|
\$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
|
2006-12-15 11:53:10 +01:00
|
|
|
sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
|
2007-04-05 19:55:48 +02:00
|
|
|
(sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
|
2006-12-15 11:53:10 +01:00
|
|
|
fi;
|
|
|
|
@touch \$@
|
|
|
|
|
|
|
|
mk_BLFS_TOOL: mk_CUSTOM_TOOLS
|
2006-10-05 00:11:32 +02:00
|
|
|
@if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
|
2007-03-02 01:09:55 +01:00
|
|
|
\$(call sh_echo_PHASE,Building BLFS_TOOL); \\
|
2006-10-05 00:11:32 +02:00
|
|
|
sudo mkdir -p $BUILDDIR$TRACKING_DIR; \\
|
2007-04-05 19:55:48 +02:00
|
|
|
sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BLFS_TOOL"; \\
|
2006-11-12 14:50:34 +01:00
|
|
|
fi;
|
2006-10-05 00:11:32 +02:00
|
|
|
@touch \$@
|
2006-10-02 21:32:06 +02:00
|
|
|
|
2007-04-05 20:08:25 +02:00
|
|
|
SETUP: $host_prep
|
|
|
|
AS_LUSER: $cross_tools $temptools
|
|
|
|
SUDO: $orphan_scripts
|
|
|
|
PREP_CHROOT_JAIL: SHELL=/tools/bin/bash
|
|
|
|
PREP_CHROOT_JAIL: ${chroottools}
|
|
|
|
CHROOT_JAIL: SHELL=/tools/bin/bash
|
|
|
|
CHROOT_JAIL: $testsuitetools $basicsystem $bootscripttools $bootabletools
|
|
|
|
CUSTOM_TOOLS: $custom_list
|
|
|
|
BLFS_TOOL: $blfs_tool
|
2006-04-06 21:35:22 +02:00
|
|
|
|
2006-11-12 14:50:34 +01:00
|
|
|
|
|
|
|
create-sbu_du-report: mk_SYSTOOLS
|
|
|
|
@\$(call echo_message, Building)
|
|
|
|
@if [ "\$(ADD_REPORT)" = "y" ]; then \\
|
|
|
|
./create-sbu_du-report.sh logs $VERSION; \\
|
|
|
|
\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
|
|
|
|
fi;
|
|
|
|
@touch \$@
|
|
|
|
|
2006-05-13 17:32:39 +02:00
|
|
|
do-housekeeping:
|
2006-06-10 18:11:58 +02:00
|
|
|
@-umount \$(MOUNT_PT)/dev/pts
|
|
|
|
@-umount \$(MOUNT_PT)/dev/shm
|
|
|
|
@-umount \$(MOUNT_PT)/dev
|
|
|
|
@-umount \$(MOUNT_PT)/sys
|
|
|
|
@-umount \$(MOUNT_PT)/proc
|
2006-10-02 21:32:06 +02:00
|
|
|
@-rm /tools /cross-tools
|
2006-08-08 19:26:40 +02:00
|
|
|
@-if [ ! -f luser-exist ]; then \\
|
|
|
|
userdel \$(LUSER); \\
|
2007-04-13 22:40:38 +02:00
|
|
|
rm -rf \$(LUSER_HOME); \\
|
2006-05-13 17:32:39 +02:00
|
|
|
fi;
|
|
|
|
|
2006-04-06 21:35:22 +02:00
|
|
|
EOF
|
|
|
|
) >> $MKFILE
|
2006-10-02 21:32:06 +02:00
|
|
|
|
2006-04-06 21:35:22 +02:00
|
|
|
fi
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
################### BOOT #####################
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
if [[ "${METHOD}" = "boot" ]]; then
|
|
|
|
(
|
2006-10-02 21:32:06 +02:00
|
|
|
cat << EOF
|
2006-04-06 21:35:22 +02:00
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
all: ck_UID mk_SETUP mk_CROSS mk_SUDO
|
|
|
|
@sudo make restore-luser-env
|
|
|
|
@sudo make do-housekeeping
|
2006-04-06 21:35:22 +02:00
|
|
|
@\$(call echo_boot_finished,$VERSION)
|
|
|
|
|
2006-12-15 11:53:10 +01:00
|
|
|
makesys: mk_FINAL mk_CUSTOM_TOOLS mk_BLFS_TOOL
|
2006-12-11 14:59:08 +01:00
|
|
|
@echo "$VERSION - jhalfs build" > /etc/clfs-release
|
2006-04-06 21:35:22 +02:00
|
|
|
@\$(call echo_finished,$VERSION)
|
|
|
|
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
ck_UID:
|
|
|
|
@if [ \`id -u\` = "0" ]; then \\
|
|
|
|
echo "+--------------------------------------------------+"; \\
|
|
|
|
echo "|You cannot run this makefile from the root account|"; \\
|
|
|
|
echo "|However, if this is the boot environment |"; \\
|
|
|
|
echo "| the command you are looking for is |"; \\
|
|
|
|
echo "| make makesys |"; \\
|
|
|
|
echo "| to finish off the build |"; \\
|
|
|
|
echo "+--------------------------------------------------+"; \\
|
|
|
|
exit 1; \\
|
|
|
|
fi
|
2006-04-06 21:35:22 +02:00
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
#---------------AS ROOT
|
2006-04-06 21:35:22 +02:00
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
mk_SETUP:
|
|
|
|
@\$(call echo_SU_request)
|
2007-04-05 19:55:48 +02:00
|
|
|
@sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
|
2006-10-02 21:32:06 +02:00
|
|
|
@touch \$@
|
|
|
|
|
|
|
|
#---------------AS LUSER
|
2006-06-20 23:14:44 +02:00
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
mk_CROSS: mk_SETUP
|
|
|
|
@\$(call echo_PHASE,Cross Tool)
|
2007-04-05 19:55:48 +02:00
|
|
|
@(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) AS_LUSER" )
|
2006-10-02 21:32:06 +02:00
|
|
|
@touch \$@
|
|
|
|
|
2006-10-05 00:11:32 +02:00
|
|
|
mk_SUDO: mk_CROSS
|
2007-04-05 19:55:48 +02:00
|
|
|
@sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
|
2006-10-02 21:32:06 +02:00
|
|
|
@touch \$@
|
|
|
|
|
|
|
|
#---------------AS ROOT
|
|
|
|
|
|
|
|
mk_FINAL:
|
|
|
|
@\$(call echo_PHASE,Final System)
|
2007-04-05 19:55:48 +02:00
|
|
|
@( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) AS_ROOT )
|
2006-10-02 21:32:06 +02:00
|
|
|
@touch \$@
|
|
|
|
|
2006-12-15 11:53:10 +01:00
|
|
|
mk_CUSTOM_TOOLS: mk_FINAL
|
|
|
|
@if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
|
2007-03-02 01:09:55 +01:00
|
|
|
\$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
|
2007-03-03 13:18:07 +01:00
|
|
|
mkdir -p ${TRACKING_DIR}; \\
|
2007-04-05 19:55:48 +02:00
|
|
|
( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS ); \\
|
2006-12-15 11:53:10 +01:00
|
|
|
fi;
|
|
|
|
@touch \$@
|
|
|
|
|
|
|
|
mk_BLFS_TOOL: mk_CUSTOM_TOOLS
|
2006-10-05 00:11:32 +02:00
|
|
|
@if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
|
2007-03-02 01:09:55 +01:00
|
|
|
\$(call sh_echo_PHASE,Building BLFS_TOOL); \\
|
2007-03-03 13:18:07 +01:00
|
|
|
mkdir -p $TRACKING_DIR; \\
|
2007-04-05 19:55:48 +02:00
|
|
|
( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) BLFS_TOOL ); \\
|
2006-10-05 00:11:32 +02:00
|
|
|
fi
|
|
|
|
@touch \$@
|
|
|
|
|
2006-12-15 11:53:10 +01:00
|
|
|
SETUP: $host_prep
|
|
|
|
AS_LUSER: $cross_tools $temptools ${boottools}
|
|
|
|
SUDO: $orphan_scripts
|
2007-02-26 21:18:52 +01:00
|
|
|
AS_ROOT: SHELL=/tools/bin/bash
|
2006-12-15 11:53:10 +01:00
|
|
|
AS_ROOT: $testsuitetools $basicsystem $bootscripttools $bootabletools
|
|
|
|
CUSTOM_TOOLS: $custom_list
|
|
|
|
BLFS_TOOL: $blfs_tool
|
2006-10-02 21:32:06 +02:00
|
|
|
|
|
|
|
do-housekeeping:
|
|
|
|
@-rm /tools /cross-tools
|
|
|
|
@-if [ ! -f luser-exist ]; then \\
|
2006-08-08 19:26:40 +02:00
|
|
|
userdel \$(LUSER); \\
|
2007-04-13 22:40:38 +02:00
|
|
|
rm -rf \$(LUSER_HOME); \\
|
2006-04-06 21:35:22 +02:00
|
|
|
fi;
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
EOF
|
|
|
|
) >> $MKFILE
|
|
|
|
fi
|
|
|
|
|
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
|
2006-08-08 19:26:40 +02:00
|
|
|
restore-luser-env:
|
2006-04-06 21:35:22 +02:00
|
|
|
@\$(call echo_message, Building)
|
2007-04-13 22:40:38 +02:00
|
|
|
@if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
|
|
|
mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
|
2006-04-06 21:35:22 +02:00
|
|
|
fi;
|
2007-04-13 22:40:38 +02:00
|
|
|
@if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
|
|
|
|
mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
|
2006-04-06 21:35:22 +02:00
|
|
|
fi;
|
2007-04-13 22:40:38 +02:00
|
|
|
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
|
2006-06-10 17:58:06 +02:00
|
|
|
touch \$@ && \\
|
|
|
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
|
|
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
2006-04-06 21:35:22 +02:00
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
########################################################
|
|
|
|
|
2006-05-13 17:32:39 +02:00
|
|
|
|
2006-04-06 21:35:22 +02:00
|
|
|
EOF
|
|
|
|
) >> $MKFILE
|
|
|
|
|
|
|
|
# Bring over the items from the Makefile.tmp
|
|
|
|
cat $MKFILE.tmp >> $MKFILE
|
|
|
|
rm $MKFILE.tmp
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
2006-04-06 21:35:22 +02:00
|
|
|
}
|