Updated experimental branch to current trunk code.

This commit is contained in:
Manuel Canales Esparcia 2007-09-19 16:50:48 +00:00
parent 0510381d65
commit 9c9775f7c4
77 changed files with 5063 additions and 2976 deletions

View file

@ -4,6 +4,8 @@
# $Id$ # $Id$
LANG=C
LC_ALL=C
TOPDIR=$(shell pwd) TOPDIR=$(shell pwd)
CONFIG_CONFIG_IN = Config.in CONFIG_CONFIG_IN = Config.in
CONFIG = menu CONFIG = menu
@ -11,10 +13,10 @@ CONFIG = menu
all: menuconfig all: menuconfig
$(CONFIG)/conf: $(CONFIG)/conf:
$(MAKE) -C $(CONFIG) conf $(MAKE) -B -C $(CONFIG) conf
$(CONFIG)/mconf: $(CONFIG)/mconf:
$(MAKE) -C $(CONFIG) ncurses conf mconf $(MAKE) -B -C $(CONFIG) ncurses conf mconf
menuconfig: $(CONFIG)/mconf menuconfig: $(CONFIG)/mconf
@./update_book.sh none @./update_book.sh none
@ -35,4 +37,4 @@ clean-target:
rm -f error rm -f error
- $(MAKE) -C $(CONFIG) clean - $(MAKE) -C $(CONFIG) clean
.PHONY: all menuconfig config clean clean-target .PHONY: all menuconfig config clean clean-target $(CONFIG)/conf $(CONFIG)/mconf

View file

@ -16,3 +16,5 @@
the BLFS book should be revised and validated, but our time is limited. the BLFS book should be revised and validated, but our time is limited.
-- Bugs hunting. -- Bugs hunting.
-- Find a better way to define circular dependencies.

View file

@ -10,6 +10,9 @@
#======== Common envars ========== #======== Common envars ==========
#--- Set a well-known working locale when building software
export LC_ALL=C
#--- The local repository for packages/file #--- The local repository for packages/file
# Any missing file will be downloaded and archived here, # Any missing file will be downloaded and archived here,
# if the user has the right priviledges. # if the user has the right priviledges.
@ -35,7 +38,7 @@ export SRC_DIR=$HOME/sources
export XORG_PREFIX=/usr export XORG_PREFIX=/usr
#--- Configure switches #--- Configure switches
export XORG_CONFIG="--prefix=$XORG_PREFIX --sysconfdir=/etc --localstatedir=/var --datadir=$XORG_PREFIX/lib" export XORG_CONFIG="--prefix=$XORG_PREFIX --sysconfdir=/etc --mandir=$XORG_PREFIX/share/man --localstatedir=/var"
#======== GNOME envars =========== #======== GNOME envars ===========
@ -76,13 +79,13 @@ export KDE_PREFIX=/usr
# expected, please rebuild without optimizations before # expected, please rebuild without optimizations before
# asking for support. # asking for support.
#MAKEFLAGS="-j3" #export MAKEFLAGS="-j3"
#CFLAGS="-O3 -pipe" #export CFLAGS="-O3 -pipe"
#CXXFLAGS=$CFLAGS #export CXXFLAGS=$CFLAGS
#LDFLAGS="-s" #export LDFLAGS="-s"
#OTHER_CFLAGS=$CFLAGS #export OTHER_CFLAGS=$CFLAGS
#OTHER_CXXFLAGS=$CXXFLAGS #export OTHER_CXXFLAGS=$CXXFLAGS
#OTHER_LDFLAGS=$LDFLAGS #export OTHER_LDFLAGS=$LDFLAGS

View file

@ -26,7 +26,7 @@ cat << EOF
$i: $PREV $i: $PREV
@\$(call echo_message, Building) @\$(call echo_message, Building)
@./progress_bar.sh \$@ \$\$PPID & @/bin/bash progress_bar.sh \$@ \$\$PPID &
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }

View file

@ -47,7 +47,11 @@ do
if [ $PKG_DIR = "." ]; then if [ $PKG_DIR = "." ]; then
SET_COMMENT=y SET_COMMENT=y
# Do not include previously installed packages # Do not include previously installed packages
if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" = "x${INST_VER}" ]]; then
continue
fi
# Do not include installed packages newer than the book ones
if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" < "x${INST_VER}" ]]; then
continue continue
fi fi
# Set installed version for updated meta-packages # Set installed version for updated meta-packages
@ -75,7 +79,11 @@ EOF
PKG_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f3) PKG_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f3)
INST_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f4) INST_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f4)
# Skip installed meta-package components # Skip installed meta-package components
if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" = "x${INST_VER}" ]]; then
continue
fi
# Do not include installed packages newer than the book ones
if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" < "x${INST_VER}" ]]; then
continue continue
fi fi
# Set installed version for updated meta-packages components # Set installed version for updated meta-packages components
@ -95,15 +103,30 @@ EOF
fi fi
[[ "${SET_COMMENT}" = "y" ]] && echo "comment \"\"" >>$outFile; unset SET_COMMENT [[ "${SET_COMMENT}" = "y" ]] && echo "comment \"\"" >>$outFile; unset SET_COMMENT
# Deal with a few unusable (at target level) package names # Deal with targets that are part of a meta-package but that are in the same
# directory that non meta-package targets
case ${PKG_NAME} in case ${PKG_NAME} in
xorg7-* ) continue ;; alsa-* | \
alsa-* ) continue ;; xorg7-* | \
x-config | x-setup ) continue ;; x-config | \
x-setup | \
libXau | \
libxcb | \
libXdmcp | \
luit | \
xbitmaps | \
xcb-proto | \
xkeyboard-config | \
mesalib | \
libdrm ) continue ;;
esac esac
# Skip installed packages # Skip installed packages
if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" = "x${INST_VER}" ]]; then
continue
fi
# Do not include installed packages newer than the book ones
if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" < "x${INST_VER}" ]]; then
continue continue
fi fi
# Set installed version for updated packages # Set installed version for updated packages
@ -222,15 +245,12 @@ choice
prompt "Window package" prompt "Window package"
config WIN_xorg7 config WIN_xorg7
bool "Xorg7" bool "Xorg7"
config WIN_xorg
bool "Xorg"
config WIN_xfree86 config WIN_xfree86
bool "xfree86" bool "xfree86"
endchoice endchoice
config X11 config X11
string string
default xorg7 if WIN_xorg7 default xorg7 if WIN_xorg7
default xorg if WIN_xorg
default xfree86 if WIN_xfree86 default xfree86 if WIN_xfree86
endmenu endmenu

View file

@ -56,7 +56,7 @@ parse_configuration() { #
continue ;; continue ;;
esac esac
if [[ "${REPLY}" =~ "^CONFIG_" ]]; then if [[ "${REPLY}" =~ ^CONFIG_ ]]; then
echo -n "$REPLY" echo -n "$REPLY"
if [[ $((++cntr)) > 1 ]]; then if [[ $((++cntr)) > 1 ]]; then
echo " <<-- ERROR SELECT ONLY 1 PACKAGE AT A TIME, WILL NOT BUILD" echo " <<-- ERROR SELECT ONLY 1 PACKAGE AT A TIME, WILL NOT BUILD"
@ -107,7 +107,7 @@ regenerate_deps() { #
# Drop the "=y" # Drop the "=y"
REPLY=${REPLY%=*} REPLY=${REPLY%=*}
if [[ "${REPLY}" =~ "^DEP_" ]]; then if [[ "${REPLY}" =~ ^DEP_ ]]; then
META_PACKAGE=$(echo $REPLY | cut -d "_" -f2 | tr [A-Z] [a-z]) META_PACKAGE=$(echo $REPLY | cut -d "_" -f2 | tr [A-Z] [a-z])
DEP_FNAME=$(echo $REPLY | cut -d "_" -f3) DEP_FNAME=$(echo $REPLY | cut -d "_" -f3)
echo "${DEP_FNAME}" >>libs/${META_PACKAGE}.dep-MOD echo "${DEP_FNAME}" >>libs/${META_PACKAGE}.dep-MOD
@ -131,7 +131,7 @@ regenerate_deps() { #
clean_configuration() { # clean_configuration() { #
#--------------------------# #--------------------------#
tail -n 30 configuration > configuration.tmp tail -n 29 configuration > configuration.tmp
mv configuration.tmp configuration mv configuration.tmp configuration
} }

View file

@ -186,6 +186,9 @@ inline_doc
# Don't have their own XML file # Don't have their own XML file
hal-requirements | hal-runtime-dependencies ) continue ;; hal-requirements | hal-runtime-dependencies ) continue ;;
perl-* | tk-perl ) DEP=perl-modules ;; perl-* | tk-perl ) DEP=perl-modules ;;
dbus-* ) DEP=dbus-bindings ;;
pyxml | pycairo | pygobject | pygtk | pyorbit | \
gnome-python | gnome-python-desktop ) DEP=python-modules ;;
# Orphan links (proper link must be created when generating the book) # Orphan links (proper link must be created when generating the book)
arts ) DEP=aRts ;; arts ) DEP=aRts ;;
@ -202,7 +205,8 @@ inline_doc
* ) * )
pkg_ver=$(grep "^${X11}[[:space:]]" ../packages | cut -f3) pkg_ver=$(grep "^${X11}[[:space:]]" ../packages | cut -f3)
inst_ver=$(grep "^${X11}[[:space:]]" ../packages | cut -f4) inst_ver=$(grep "^${X11}[[:space:]]" ../packages | cut -f4)
[ -n "${pkg_ver}" ] && [ "x${pkg_ver}" = "x${inst_ver}" ] && continue [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" = "x${inst_ver}" ]] && continue
[ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" < "x${inst_ver}" ]] && continue
;; ;;
esac esac
;; ;;
@ -211,7 +215,8 @@ inline_doc
# If DEP has been previouly installed, skip it # If DEP has been previouly installed, skip it
pkg_ver=$(grep "^${DEP}[[:space:]]" ../packages | cut -f3) pkg_ver=$(grep "^${DEP}[[:space:]]" ../packages | cut -f3)
inst_ver=$(grep "^${DEP}[[:space:]]" ../packages | cut -f4) inst_ver=$(grep "^${DEP}[[:space:]]" ../packages | cut -f4)
[ -n "${pkg_ver}" ] && [ "x${pkg_ver}" = "x${inst_ver}" ] && continue [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" = "x${inst_ver}" ]] && continue
[ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" < "x${inst_ver}" ]] && continue
#------------------ #------------------
# Prevent circular dependencies # Prevent circular dependencies
@ -219,37 +224,114 @@ inline_doc
# must be skipped, not placed here, to avoid that the script will bomb # must be skipped, not placed here, to avoid that the script will bomb
# due empty *.xinc files # due empty *.xinc files
case $DEP in case $DEP in
jadetex | perl-* | lynx | Links | w3m ) akode )
# Optional dependencies are runtime only # Both are in the same page
[[ "$PKG" = "docbook-utils" ]] && continue [[ "$PKG" = "kdemultimedia" ]] && continue
;;
libxslt )
# libxml2-->libxslt-->libxml2
[[ "$PKG" = "libxml2" ]] && continue
;;
openldap | postgresql | $KBR5 )
# cyrus-sasl-->several-->cyrus-sasl
[[ "$PKG" = "cyrus-sasl" ]] && continue
;;
espgs )
# sendmail-->espgs-->cups-->php-->sendmail
[[ "$PKG" = "$MAIL_SERVER" ]] && continue
;; ;;
aRts ) aRts )
# esound-->aRts-->esound # esound-->aRts-->esound
[[ "$PKG" = "esound" ]] && continue [[ "$PKG" = "esound" ]] && continue
;; ;;
gimp | sane ) dbus-bindings )
# imagemagick-->{sane}-->gimp-->imagemagick # True circular dependecy
[[ "$PKG" = "imagemagick" ]] && continue [[ "$PKG" = "dbus-bindings" ]] && continue
;;
DocBook )
# Used to rebuild the documentation
[[ "$PKG" = "linux-pam" ]] && continue
;;
docbook-xsl )
# Used to rebuild the documentation
[[ "$PKG" = "linux-pam" ]] && continue
;;
doxygen )
# Used to rebuild the documentation
[[ "$PKG" = "dbus" ]] && continue
[[ "$PKG" = "libdvdcss" ]] && continue
[[ "$PKG" = "libusb" ]] && continue
[[ "$PKG" = "libxcb" ]] && continue
;;
espgs )
# Used to rebuild the documentation
[[ "$PKG" = "$MAIL_SERVER" ]] && continue
;; ;;
ffmpeg ) ffmpeg )
# alsa-plugins-->ffmpeg-->several-->alsa-plugins # alsa-plugins-->ffmpeg-->several-->alsa-plugins
[[ "$PKG" = "alsa-plugins" ]] && continue [[ "$PKG" = "alsa-plugins" ]] && continue
;; ;;
akode ) fop )
# Both are in the same page # Used to rebuild the documentation
[[ "$PKG" = "kdemultimedia" ]] && continue [[ "$PKG" = "linux-pam" ]] && continue
;;
graphviz )
# Used to build the API documentation
[[ "$PKG" = "libusb" ]] && continue
;;
GTK )
# deprecated GTK version
[[ "$PKG" = "alsa-tools" ]] && continue
;;
gtk2 )
# Testsuite only
[[ "$PKG" = "cairo" ]] && continue
;;
jadetex )
# Runtime only
[[ "$PKG" = "docbook-utils" ]] && continue
;;
$KBR5 )
# cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl
[[ "$PKG" = "cyrus-sasl" ]] && continue
;;
librsvg )
# Testsuite only
[[ "$PKG" = "cairo" ]] && continue
;;
libxslt )
# libxml2-->libxslt-->libxml2
[[ "$PKG" = "libxml2" ]] && continue
;;
Links )
# Runtime only
[[ "$PKG" = "docbook-utils" ]] && continue
;;
lynx )
# Runtime only
[[ "$PKG" = "docbook-utils" ]] && continue
;;
openldap )
# cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl
[[ "$PKG" = "cyrus-sasl" ]] && continue
;;
poppler )
# Testsuite only
[[ "$PKG" = "cairo" ]] && continue
;;
postgresql )
# cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl
[[ "$PKG" = "cyrus-sasl" ]] && continue
;;
python-modules )
# True circular dependecy
[[ "$PKG" = "python-modules" ]] && continue
# libgsf-->python-modules-->several combinations-->libgsf
[[ "$PKG" = "libgsf" ]] && continue
# gimp-->python-modules-->several combinations-->gimp
[[ "$PKG" = "gimp" ]] && continue
# Used to rebuild the documentation
[[ "$PKG" = "gstreamer" ]] && continue
[[ "$PKG" = "gst-plugins-base" ]] && continue
[[ "$PKG" = "gst-plugins-good" ]] && continue
;;
tk )
# python-->tk-->xorg7-->several combinations-->libxslt-->python
[[ "$PKG" = "python" ]] && continue
;;
w3m )
# Runtime only
[[ "$PKG" = "docbook-utils" ]] && continue
# Used to rebuild the documentation
[[ "$PKG" = "linux-pam" ]] && continue
;; ;;
esac esac

View file

@ -27,13 +27,12 @@ get_pkg_ver() { # Find package version for a given package ID
wireless_tools ) pkg_id=wireless-tools ;; wireless_tools ) pkg_id=wireless-tools ;;
bind-utils ) pkg_id=bind ;; bind-utils ) pkg_id=bind ;;
html-tidy ) pkg_id=tidy ;; html-tidy ) pkg_id=tidy ;;
jdk ) pkg_id=jdk-src ;;
reiserfs ) pkg_id=reiser ;; reiserfs ) pkg_id=reiser ;;
xfs ) pkg_id=xfsprogs ;; xfs ) pkg_id=xfsprogs ;;
esac esac
xmllint --noent ./${BLFS_XML}/book/bookinfo.xml 2>/dev/null | \ xmllint --noent ./${BLFS_XML}/book/bookinfo.xml 2>/dev/null | \
grep -i " ${pkg_id}-version " | cut -d "\"" -f2 grep -i " ${pkg_id}-version " | cut -d "\"" -f2 | sed "s/ /_/g"
} }
@ -42,7 +41,24 @@ get_installed_ver() { # Find installed package version for a given package ID
#-----------------------# #-----------------------#
local pkg_id=$1 local pkg_id=$1
find $TRACKING_DIR -name "${pkg_id}-[[:digit:]]*" | sed "s/.*${pkg_id}-//"
case ${pkg_id} in
html-tidy )
find $TRACKING_DIR -name "${pkg_id}-cvs_[[:digit:]]*" | sed "s/.*${pkg_id}-//"
;;
cdparanoia )
find $TRACKING_DIR -name "${pkg_id}-III-[[:digit:]]*" | sed "s/.*${pkg_id}-//"
;;
ffmpeg )
find $TRACKING_DIR -name "${pkg_id}-svn_[[:digit:]]*" | sed "s/.*${pkg_id}-//"
;;
psutils )
find $TRACKING_DIR -name "${pkg_id}-p[[:digit:]]*" | sed "s/.*${pkg_id}-//"
;;
* )
find $TRACKING_DIR -name "${pkg_id}-[[:digit:]]*" | sed "s/.*${pkg_id}-//" | sed "s/ /_/g"
;;
esac
} }
@ -57,18 +73,24 @@ generate_packages() { # Master packages file
# Extract Id and path for sect1 files # Extract Id and path for sect1 files
for file in `find $BLFS_XML -name "*.xml"` ; do for file in `find $BLFS_XML -name "*.xml"` ; do
pkg_id=$(grep "sect1 id" $file | sed -e 's/<sect1 id="//;s/".*//') pkg_id=$(grep "sect1 id" $file | sed -e 's/<sect1 id="//;s/".*//')
pkg_ver=$(get_pkg_ver $pkg_id) case ${pkg_id} in
dbus-bindings | \
perl-modules | \
python-modules ) pkg_ver=0.no_version ;;
* ) pkg_ver=$(get_pkg_ver $pkg_id) ;;
esac
installed_ver=$(get_installed_ver $pkg_id) installed_ver=$(get_installed_ver $pkg_id)
[[ ! -z "$pkg_id" ]] && echo -e "$pkg_id\t$file\t$pkg_ver\t$installed_ver" >> packages.tmp [[ ! -z "$pkg_id" ]] && echo -e "$pkg_id\t$file\t$pkg_ver\t$installed_ver" >> packages.tmp
done done
# IDs clean-up (unuseful pages or commented-out packages, could be more) # IDs clean-up (unuseful pages or commented-out packages, could be more)
sed -i '/template/d;/ntroduction/d;/preface/d;/alsa.xml/d' packages.tmp sed -i '/template/d;/ntroduction/d;/preface/d;/alsa.xml/d;/xorg.xml/d' packages.tmp
sed -i '/obsolete/d;/postlfs-/d;/-client.xml/d;/xorg7.xml/d' packages.tmp sed -i '/obsolete/d;/ispell\t/d;/postlfs-/d;/-client.xml/d;/xorg7.xml/d' packages.tmp
sed -i '/courier.xml/d;/-other\t/d;/others-/d;/other-/d' packages.tmp sed -i '/courier.xml/d;/-other\t/d;/others-/d;/other-/d;/^ash\t/d' packages.tmp
sed -i '/fw-firewall\t/d;/gcc2\t/d;/cvsserver\t/d;/svnserver\t/d' packages.tmp sed -i '/fw-firewall\t/d;/gcc2\t/d;/cvsserver\t/d;/svnserver\t/d' packages.tmp
sed -i '/fam\t/d;/libungif\t/d;/ncpfs\t/d;/slrn\t/d;/konq\t/d' packages.tmp sed -i '/fam\t/d;/libungif\t/d;/ncpfs\t/d;/slrn\t/d;/konq\t/d;/arts\t/d' packages.tmp
sed -i '/gst-plugins\t/d;/openquicktime\t/d;/compressdoc\t/d' packages.tmp sed -i '/gst-plugins\t/d;/gimp-print\t/d;/openquicktime\t/d;/compressdoc\t/d' packages.tmp
sed -i '/errata\t/d;/foreword\t/d;/organization\t/d;/whoread\t/d' packages.tmp
# Meta-packages version # Meta-packages version
ALSA_VER=$(get_pkg_ver alsa) ALSA_VER=$(get_pkg_ver alsa)
@ -204,6 +226,6 @@ alsa-plugins\nalsa-lib" > libs/alsa.dep
generate_xorg7() { # Xorg7 packages generate_xorg7() { # Xorg7 packages
#--------------------------# #--------------------------#
echo -e "x-config\nx-setup\nrman\nxterm2\nxorg7-driver\nxorg7-server\nluit\n\ echo -e "x-config\nx-setup\nrman\nxterm2\nxorg7-driver\nxorg7-server\nluit\n\
xorg7-font\nxorg7-data\nxorg7-app\nxbitmaps\nmesalib\nlibdrm\n\ xkeyboard-config\nxorg7-font\nxorg7-data\nxorg7-app\nmesalib\nlibdrm\nxbitmaps\n\
xorg7-lib\nxorg7-util\nxorg7-proto" > libs/xorg7.dep xorg7-lib\nlibxcb\nxcb-proto\nlibXdmcp\nlibXau\nxorg7-util\nxorg7-proto" > libs/xorg7.dep
} }

View file

@ -29,8 +29,8 @@ inline_doc
{ {
cat << EOF cat << EOF
<?xml version="1.0" encoding="ISO-8859-1"?> <?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" > "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" >
<book> <book>
@ -106,7 +106,7 @@ inline_doc
../libs/book.xsl \ ../libs/book.xsl \
$TARGET-index.xml > xsltproc.log 2>&1 $TARGET-index.xml > xsltproc.log 2>&1
mkdir HTML/{stylesheets,images} mkdir HTML/{stylesheets,images}
cp ../$BLFS_XML/stylesheets/*.css HTML/stylesheets cp ../$BLFS_XML/stylesheets/lfs-xsl/*.css HTML/stylesheets
cp ../$BLFS_XML/images/*.png HTML/images cp ../$BLFS_XML/images/*.png HTML/images
cd HTML cd HTML
sed -i -e "s@../stylesheets@stylesheets@g" *.html sed -i -e "s@../stylesheets@stylesheets@g" *.html

View file

@ -29,7 +29,7 @@
<xsl:variable name="filename" select="@id"/> <xsl:variable name="filename" select="@id"/>
<!-- Package name (use "Download FTP" by default. If empty, use "Download HTTP" --> <!-- Package name (use "Download FTP" by default. If empty, use "Download HTTP" -->
<xsl:param name="package"> <xsl:variable name="package">
<xsl:choose> <xsl:choose>
<xsl:when <xsl:when
test="string-length(sect2[@role='package']/itemizedlist/listitem[2]/para/ulink/@url) test="string-length(sect2[@role='package']/itemizedlist/listitem[2]/para/ulink/@url)
@ -46,14 +46,14 @@
</xsl:call-template> </xsl:call-template>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:param> </xsl:variable>
<!-- FTP dir name --> <!-- FTP dir name -->
<xsl:param name="ftpdir"> <xsl:variable name="ftpdir">
<xsl:call-template name="ftp_dir"> <xsl:call-template name="ftp_dir">
<xsl:with-param name="package" select="$package"/> <xsl:with-param name="package" select="$package"/>
</xsl:call-template> </xsl:call-template>
</xsl:param> </xsl:variable>
<!-- The build order --> <!-- The build order -->
<xsl:variable name="position" select="position()"/> <xsl:variable name="position" select="position()"/>
@ -86,7 +86,7 @@
<!-- Creating the scripts --> <!-- Creating the scripts -->
<exsl:document href="{$order}-z-{$filename}" method="text"> <exsl:document href="{$order}-z-{$filename}" method="text">
<xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text> <xsl:text>#!/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
<xsl:choose> <xsl:choose>
<!-- Package page --> <!-- Package page -->
<xsl:when test="sect2[@role='package'] and not(@id = 'xorg7-app' or <xsl:when test="sect2[@role='package'] and not(@id = 'xorg7-app' or
@ -106,8 +106,15 @@
<xsl:with-param name="ftpdir" select="$ftpdir"/> <xsl:with-param name="ftpdir" select="$ftpdir"/>
</xsl:apply-templates> </xsl:apply-templates>
<!-- Clean-up --> <!-- Clean-up -->
<xsl:text>cd $SRC_DIR/$PKG_DIR&#xA;</xsl:text> <xsl:if test="not(@id='mesalib')">
<xsl:text>rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text> <xsl:text>cd $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
<xsl:text>rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
</xsl:if>
<xsl:if test="@id='xorg7-server'">
<xsl:text>cd $SRC_DIR/MesaLib
UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
</xsl:if>
</xsl:when> </xsl:when>
<!-- Xorg7 pseudo-packages --> <!-- Xorg7 pseudo-packages -->
<xsl:when test="contains(@id,'xorg7') and not(@id = 'xorg7-server')"> <xsl:when test="contains(@id,'xorg7') and not(@id = 'xorg7-server')">
@ -148,14 +155,14 @@ cd xc&#xA;</xsl:text>
<xsl:text> <xsl:text>
if [[ -e unpacked ]] ; then if [[ -e unpacked ]] ; then
UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'` UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
rm -rf $UNPACKDIR [[ -n $UNPACKDIR ]] &amp;&amp; [[ -d $UNPACKDIR ]] &amp;&amp; rm -rf $UNPACKDIR
fi fi
tar -xvf $PACKAGE > unpacked tar -xvf $PACKAGE > unpacked
UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'` UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
cd $UNPACKDIR&#xA;</xsl:text> cd $UNPACKDIR&#xA;</xsl:text>
<xsl:apply-templates select=".//screen | .//para/command"/> <xsl:apply-templates select=".//screen | .//para/command"/>
<xsl:if test="$sudo = 'y'"> <xsl:if test="$sudo = 'y'">
<xsl:text>sudo </xsl:text> <xsl:text>sudo /sbin/</xsl:text>
</xsl:if> </xsl:if>
<xsl:text>ldconfig&#xA;&#xA;</xsl:text> <xsl:text>ldconfig&#xA;&#xA;</xsl:text>
</xsl:when> </xsl:when>
@ -168,29 +175,57 @@ cd $UNPACKDIR&#xA;</xsl:text>
<xsl:template match="sect2" mode="xorg7"> <xsl:template match="sect2" mode="xorg7">
<xsl:choose> <xsl:choose>
<xsl:when test="@role = 'package'"/> <xsl:when test="@role = 'package'">
<xsl:apply-templates select="itemizedlist/listitem/para" mode="xorg7"/>
</xsl:when>
<xsl:when test="not(@role)"> <xsl:when test="not(@role)">
<xsl:apply-templates select=".//screen"/> <xsl:text>SRC_ARCHIVE=$SRC_ARCHIVE
<xsl:apply-templates select="../sect2[@role='package']/itemizedlist/listitem/para" FTP_SERVER=$FTP_SERVER&#xA;</xsl:text>
mode="xorg7"/> <xsl:apply-templates select=".//screen" mode="sect-ver"/>
<xsl:text>WGET_LST=</xsl:text> <xsl:text>mkdir -p ${section}&#xA;cd ${section}&#xA;</xsl:text>
<xsl:apply-templates select=".//screen" mode="wget_lst"/> <xsl:apply-templates select="../sect2[@role='package']/itemizedlist/listitem/para" mode="xorg7-patch"/>
<xsl:text>&#xA;</xsl:text> <xsl:text>for line in $(grep -v '^#' ../${sect_ver}.wget) ; do
if [[ ! -f ${line} ]] ; then
if [[ -f $SRC_ARCHIVE/Xorg/${section}/${line} ]] ; then
cp $SRC_ARCHIVE/Xorg/${section}/${line} ${line}
elif [[ -f $SRC_ARCHIVE/Xorg/${line} ]] ; then
cp $SRC_ARCHIVE/Xorg/${line} ${line}
elif [[ -f $SRC_ARCHIVE/${section}/${line} ]] ; then
cp $SRC_ARCHIVE/${section}/${line} ${line}
elif [[ -f $SRC_ARCHIVE/${line} ]] ; then
cp $SRC_ARCHIVE/${line} ${line}
else
wget ${FTP_SERVER}conglomeration/Xorg/${line} || \
wget http://xorg.freedesktop.org/releases/individual/${section}/${line}
fi
fi
done
md5sum -c ../${sect_ver}.md5
cp ../${sect_ver}.wget ../${sect_ver}.wget.orig
cp ../${sect_ver}.md5 ../${sect_ver}.md5.orig&#xA;</xsl:text>
</xsl:when> </xsl:when>
<xsl:when test="@role = 'installation'"> <xsl:when test="@role = 'installation'">
<xsl:text>for package in $(cat $WGET_LST) ; do <xsl:text>for package in $(grep -v '^#' ../${sect_ver}.wget) ; do
packagedir=$(echo $package | sed 's/.tar.bz2//') packagedir=$(echo $package | sed 's/.tar.bz2//')
tar -xf $package tar -xf ${package}
cd $packagedir&#xA;</xsl:text> cd ${packagedir}&#xA;</xsl:text>
<xsl:apply-templates select=".//screen | .//para/command"/> <xsl:apply-templates select=".//screen | .//para/command"/>
<xsl:text> cd .. <xsl:text> cd ..
rm -rf $packagedir rm -rf ${packagedir}
done&#xA;</xsl:text> sed -i "/${package}/d" ../${sect_ver}.wget
sed -i "/${package}/d" ../${sect_ver}.md5
done
mv ../${sect_ver}.wget.orig ../${sect_ver}.wget
mv ../${sect_ver}.md5.orig ../${sect_ver}.md5&#xA;</xsl:text>
<xsl:if test="$sudo = 'y'"> <xsl:if test="$sudo = 'y'">
<xsl:text>sudo </xsl:text> <xsl:text>sudo /sbin/</xsl:text>
</xsl:if> </xsl:if>
<xsl:text>ldconfig&#xA;&#xA;</xsl:text> <xsl:text>ldconfig&#xA;&#xA;</xsl:text>
</xsl:when> </xsl:when>
<xsl:when test="@role = 'configuration'">
<xsl:apply-templates select=".//screen"/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
@ -356,10 +391,16 @@ done&#xA;</xsl:text>
<!-- The FTP_SERVER mirror --> <!-- The FTP_SERVER mirror -->
<xsl:text> wget ${FTP_SERVER}conglomeration/$PKG_DIR/$PACKAGE</xsl:text> <xsl:text> wget ${FTP_SERVER}conglomeration/$PKG_DIR/$PACKAGE</xsl:text>
<!-- Upstream HTTP URL --> <!-- Upstream HTTP URL -->
<xsl:if test="string-length(ulink/@url) &gt; '10' and <xsl:if test="string-length(ulink/@url) &gt; '10'">
not(contains(string(ulink/@url),'sourceforge'))">
<xsl:text> || \&#xA; wget </xsl:text> <xsl:text> || \&#xA; wget </xsl:text>
<xsl:value-of select="ulink/@url"/> <xsl:choose>
<xsl:when test="contains(ulink/@url,'?')">
<xsl:value-of select="substring-before(ulink/@url,'?')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="ulink/@url"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if> </xsl:if>
</xsl:when> </xsl:when>
<xsl:when test="contains(string(),'FTP')"> <xsl:when test="contains(string(),'FTP')">
@ -385,6 +426,15 @@ done&#xA;</xsl:text>
</xsl:template> </xsl:template>
<xsl:template match="itemizedlist/listitem/para" mode="xorg7"> <xsl:template match="itemizedlist/listitem/para" mode="xorg7">
<xsl:if test="contains(string(ulink/@url),'.md5') or
contains(string(ulink/@url),'.wget')">
<xsl:text>wget </xsl:text>
<xsl:value-of select="ulink/@url"/>
<xsl:text>&#xA;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="itemizedlist/listitem/para" mode="xorg7-patch">
<xsl:if test="contains(string(ulink/@url),'.patch')"> <xsl:if test="contains(string(ulink/@url),'.patch')">
<xsl:text>wget </xsl:text> <xsl:text>wget </xsl:text>
<xsl:value-of select="ulink/@url"/> <xsl:value-of select="ulink/@url"/>
@ -397,18 +447,22 @@ done&#xA;</xsl:text>
<xsl:template match="screen"> <xsl:template match="screen">
<xsl:if test="child::* = userinput and not(@role = 'nodump')"> <xsl:if test="child::* = userinput and not(@role = 'nodump')">
<xsl:if test="@role = 'root' and $sudo = 'y'"> <xsl:if test="@role = 'root' and $sudo = 'y'">
<xsl:text>sudo sh -c "</xsl:text> <xsl:text>sudo sh -c '</xsl:text>
</xsl:if> </xsl:if>
<xsl:apply-templates select="userinput"/> <xsl:apply-templates select="userinput"/>
<xsl:if test="@role = 'root' and $sudo = 'y'"> <xsl:if test="@role = 'root' and $sudo = 'y'">
<xsl:text>"</xsl:text> <xsl:text>'</xsl:text>
</xsl:if> </xsl:if>
<xsl:text>&#xA;</xsl:text> <xsl:text>&#xA;</xsl:text>
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>
<xsl:template match="screen" mode="wget_lst"> <xsl:template match="screen" mode="sect-ver">
<xsl:value-of select="substring-after(string(),' -i ')"/> <xsl:text>section=</xsl:text>
<xsl:value-of select="substring-before(substring-after(string(),'mkdir '),' &amp;')"/>
<xsl:text>&#xA;sect_ver=</xsl:text>
<xsl:value-of select="substring-before(substring-after(string(),'-c ../'),'.md5')"/>
<xsl:text>&#xA;</xsl:text>
</xsl:template> </xsl:template>
<xsl:template match="para/command"> <xsl:template match="para/command">
@ -427,9 +481,16 @@ done&#xA;</xsl:text>
</xsl:template> </xsl:template>
<xsl:template match="replaceable"> <xsl:template match="replaceable">
<xsl:text>**EDITME</xsl:text> <xsl:choose>
<xsl:apply-templates/> <xsl:when test="ancestor::sect1[@id='xorg7-server']">
<xsl:text>EDITME**</xsl:text> <xsl:text>$SRC_DIR/MesaLib</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>**EDITME</xsl:text>
<xsl:apply-templates/>
<xsl:text>EDITME**</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>

View file

@ -42,6 +42,9 @@
<!-- Locale settings --> <!-- Locale settings -->
<xsl:param name="lang" select="C"/> <xsl:param name="lang" select="C"/>
<!-- Sparc64 processor type -->
<xsl:param name="sparc" select="none"/>
<xsl:template match="/"> <xsl:template match="/">
<xsl:apply-templates select="//sect1"/> <xsl:apply-templates select="//sect1"/>
</xsl:template> </xsl:template>
@ -87,23 +90,31 @@
<!-- Creating dirs and files --> <!-- Creating dirs and files -->
<exsl:document href="{$dirname}/{$order}-{$filename}" method="text"> <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
<xsl:choose> <xsl:choose>
<xsl:when test="../@id='chapter-chroot'"> <xsl:when test="@id='ch-chroot-changingowner' or
<xsl:text>#!/tools/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text> @id='ch-chroot-creatingdirs' or
</xsl:when> @id='ch-chroot-createfiles' or
<xsl:when test="@id='ch-system-stripping'"> @id='ch-system-stripping'">
<xsl:text>#!/bin/sh&#xA;</xsl:text> <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text> <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:if test="sect2[@role='installation']"> <xsl:if test="not(@id='ch-system-stripping')">
<xsl:text>set -e</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
<xsl:if test="sect2[@role='installation'] and
not(@id='ch-system-multiarch-wrapper')">
<xsl:text>cd $PKGDIR&#xA;</xsl:text> <xsl:text>cd $PKGDIR&#xA;</xsl:text>
<xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'"> <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
<xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text> <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
</xsl:if> </xsl:if>
</xsl:if> </xsl:if>
<xsl:apply-templates select=".//para/userinput | .//screen"/> <xsl:apply-templates select=".//para/userinput | .//screen"/>
<xsl:if test="not(@id='ch-chroot-chroot')">
<xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
</xsl:if>
<xsl:text>exit</xsl:text> <xsl:text>exit</xsl:text>
</exsl:document> </exsl:document>
</xsl:if> </xsl:if>
@ -149,13 +160,6 @@
<xsl:value-of select="substring-after(string(),'tar.gz')"/> <xsl:value-of select="substring-after(string(),'tar.gz')"/>
<xsl:text>&#xA;</xsl:text> <xsl:text>&#xA;</xsl:text>
</xsl:when> </xsl:when>
<!-- Avoiding a race condition in a patch -->
<xsl:when test="contains(string(),'debian_fixes')">
<xsl:value-of select="substring-before(string(),'patch')"/>
<xsl:text>patch -Z</xsl:text>
<xsl:value-of select="substring-after(string(),'patch')"/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- Setting $LANG for /etc/profile --> <!-- Setting $LANG for /etc/profile -->
<xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
contains(string(),'export LANG=')"> contains(string(),'export LANG=')">
@ -282,6 +286,40 @@
<xsl:when test="ancestor::sect1[@id='ch-system-groff']"> <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
<xsl:value-of select="$page"/> <xsl:value-of select="$page"/>
</xsl:when> </xsl:when>
<xsl:when test="ancestor::sect1[@id='ch-cross-tools-flags']">
<xsl:choose>
<xsl:when test="contains(string(),'BUILD32')">
<xsl:choose>
<xsl:when test="$sparc = '1' or $sparc = '2'">
<xsl:text>-m32 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
</xsl:when>
<xsl:when test="$sparc = '3'">
<xsl:text>-m32 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="contains(string(),'BUILD64')">
<xsl:choose>
<xsl:when test="$sparc = '1' or $sparc = '2'">
<xsl:text>-m64 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
</xsl:when>
<xsl:when test="$sparc = '3'">
<xsl:text>-m64 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="contains(string(),'GCCTARGET')">
<xsl:choose>
<xsl:when test="$sparc = '1' or $sparc = '2'">
<xsl:text>-mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
</xsl:when>
<xsl:when test="$sparc = '3'">
<xsl:text>-mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>**EDITME</xsl:text> <xsl:text>**EDITME</xsl:text>
<xsl:apply-templates/> <xsl:apply-templates/>

781
CLFS/master.sh Executable file → Normal file

File diff suppressed because it is too large Load diff

View file

@ -66,10 +66,11 @@
</xsl:variable> </xsl:variable>
<!-- Creating dirs and files --> <!-- Creating dirs and files -->
<exsl:document href="{$dirname}/{$order}-{$filename}" method="text"> <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
<xsl:text>#!/bin/sh&#xA;</xsl:text> <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
<xsl:if test="not(@id='ch-system-stripping')"> <xsl:if test="not(@id='ch-system-stripping')">
<xsl:text>set -e&#xA;&#xA;</xsl:text> <xsl:text>set -e&#xA;</xsl:text>
</xsl:if> </xsl:if>
<xsl:text>&#xA;</xsl:text>
<xsl:if test="sect2[@role='installation']"> <xsl:if test="sect2[@role='installation']">
<xsl:text>cd $PKGDIR&#xA;</xsl:text> <xsl:text>cd $PKGDIR&#xA;</xsl:text>
<xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'"> <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">

241
CLFS2/master.sh Executable file → Normal file
View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# $Id$ # $Id$
################################### ###################################
@ -17,59 +17,42 @@ host_prep_Makefiles() { # Initialization of the system
CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")" CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
( (
cat << EOF cat << EOF
023-creatingtoolsdir:
@\$(call echo_message, Building)
@if [ ! -d \$(MOUNT_PT)/sources ]; then \\
mkdir \$(MOUNT_PT)/sources; \\
fi;
@chmod a+wt \$(MOUNT_PT)/sources
@touch \$@ && \\
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
025-addinguser: 023-creatingtoolsdir 025-addinguser:
@\$(call echo_message, Building) @\$(call echo_message, Building)
@if [ ! -d /home/\$(LUSER) ]; then \\ @if [ ! -d \$(LUSER_HOME) ]; then \\
groupadd \$(LGROUP); \\ groupadd \$(LGROUP); \\
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\ useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
else \\ else \\
touch luser-exist; \\ touch luser-exist; \\
fi; fi;
@chown -R \$(LUSER) \$(MOUNT_PT) && \\ @\$(call housekeeping)
chown \$(LUSER) \$(MOUNT_PT)/sources
@touch \$@ && \\
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
026-settingenvironment: 025-addinguser 026-settingenvironment: 025-addinguser
@\$(call echo_message, Building) @\$(call echo_message, Building)
@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\ mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
fi; fi;
@if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ @if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\ mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
fi; fi;
@echo "set +h" > /home/\$(LUSER)/.bashrc && \\ @echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\ echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
echo "CLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\ echo "CLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\ echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\ echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
echo "export CLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\ echo "export CLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
echo "" >> /home/\$(LUSER)/.bashrc && \\ echo "" >> \$(LUSER_HOME)/.bashrc && \\
echo "unset CFLAGS" >> /home/\$(LUSER)/.bashrc && \\ echo "unset CFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
echo "unset CXXFLAGS" >> /home/\$(LUSER)/.bashrc && \\ echo "unset CXXFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
echo "" >> /home/\$(LUSER)/.bashrc && \\ echo "" >> \$(LUSER_HOME)/.bashrc && \\
echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/\$(LUSER)/.bashrc && \\ echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> \$(LUSER_HOME)/.bashrc && \\
echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/\$(LUSER)/.bashrc && \\ echo "export CLFS_TARGET=\"${TARGET}\"" >> \$(LUSER_HOME)/.bashrc && \\
echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/\$(LUSER)/.bashrc && \\ echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
touch envars && \\ touch envars && \\
chown \$(LUSER):\$(LGROUP) envars && \\ chown \$(LUSER):\$(LGROUP) envars
chmod -R a+wt \$(MOUNT_PT) @\$(call housekeeping)
@touch \$@ && \\
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
027-create-directories: 026-settingenvironment 027-create-directories: 026-settingenvironment
@\$(call echo_message, Building) @\$(call echo_message, Building)
@ -87,10 +70,7 @@ cat << EOF
@for dir in \$(MOUNT_PT)/usr{,/local}; do \\ @for dir in \$(MOUNT_PT)/usr{,/local}; do \\
ln -s share/{man,doc,info} \$\$dir ; \\ ln -s share/{man,doc,info} \$\$dir ; \\
done done
@\$(call housekeeping)
@touch \$@ && \\
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
028-creating-sysfile: 027-create-directories 028-creating-sysfile: 027-create-directories
@\$(call echo_message, Building) @\$(call echo_message, Building)
@ -116,16 +96,15 @@ cat << EOF
@touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp} @touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp}
@chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog @chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog
@chown -R \$(LUSER) \$(MOUNT_PT) @chown -R \$(LUSER) \$(MOUNT_PT) && \\
chmod -R a+w \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
@touch \$@ && \\ chmod -R a+w \$(SRCSDIR)
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ @\$(call housekeeping)
echo --------------------------------------------------------------------------------\$(WHITE)
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
host_prep=" 023-creatingtoolsdir 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile" host_prep=" 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile"
} }
@ -139,18 +118,9 @@ cross_tools_Makefiles() { #
this_script=`basename $file` this_script=`basename $file`
# #
# Skip this script... # Skip this script...
# NOTE.. the book indicated you only needed to install groff or file if the host
# had older versions. The packages would be installed in the target directory
# and not the host.
case $this_script in case $this_script in
*cflags* | *variables* ) # work done in host_prep_Makefiles *cflags* | *variables* ) # work done in host_prep_Makefiles
continue ;; continue ;;
*file ) FileVer=`file --version | head -n1 | cut -d " " -f1`
[[ "$FileVer" = "file-4.17" ]] && continue
;;
*groff) GroffVer=`groff --version | head -n1 | cut -d " " -f4`
[[ "$GroffVer" = "1.19.2" ]] && continue
;;
*) ;; *) ;;
esac esac
@ -248,6 +218,11 @@ final_system_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
# Touch timestamp file if installed files logs will be created.
# But only for the firt build when running iterative builds.
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_TouchTimestamp
fi
LUSER_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"
@ -255,7 +230,14 @@ final_system_Makefiles() { #
# #
LUSER_wrt_RunAsUser "${file}" LUSER_wrt_RunAsUser "${file}"
# #
[[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}" # Write installed files log and remove the build directory(ies)
# except if the package build fails.
if [ "$pkg_tarball" != "" ] ; then
LUSER_RemoveBuildDirs "${name}"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_LogNewFiles "$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.
wrt_touch wrt_touch
@ -313,11 +295,21 @@ bootscripts_Makefiles() { #
LUSER_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" != "" ]] && LUSER_wrt_unpack "$pkg_tarball" if [ "$pkg_tarball" != "" ] ; then
LUSER_wrt_unpack "$pkg_tarball"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_TouchTimestamp
fi
fi
# #
LUSER_wrt_RunAsUser "${file}" LUSER_wrt_RunAsUser "${file}"
# #
[[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}" if [ "$pkg_tarball" != "" ] ; then
LUSER_RemoveBuildDirs "${name}"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_LogNewFiles "$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.
wrt_touch wrt_touch
@ -359,7 +351,7 @@ bootable_Makefiles() { #
# NOTE: new makfile format forces the last script, *chowning, into a separate # NOTE: new makfile format forces the last script, *chowning, into a separate
# phase. # phase.
case ${this_script} in case ${this_script} in
*chowning) chowning=${this_script} ;; *chowning) chowning=" ${this_script}" ;;
*) bootable="$bootable $this_script" ;; *) bootable="$bootable $this_script" ;;
esac esac
# #
@ -381,7 +373,12 @@ bootable_Makefiles() { #
LUSER_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" != "" ]] && LUSER_wrt_unpack "$pkg_tarball" if [ "$pkg_tarball" != "" ] ; then
LUSER_wrt_unpack "$pkg_tarball"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_TouchTimestamp
fi
fi
# #
# Select a script execution method # Select a script execution method
case $this_script in case $this_script in
@ -391,14 +388,19 @@ bootable_Makefiles() { #
LUSER_wrt_RunAsUser "${file}" LUSER_wrt_RunAsUser "${file}"
fi fi
;; ;;
*chowning) wrt_RunAsRoot "${this_script}" "${file}" *chowning) wrt_RunAsRoot "${file}"
;; ;;
*) LUSER_wrt_RunAsUser "${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" != "" ]] && LUSER_RemoveBuildDirs "${name}" if [ "$pkg_tarball" != "" ] ; then
LUSER_RemoveBuildDirs "${name}"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_LogNewFiles "$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.
wrt_touch wrt_touch
@ -429,43 +431,22 @@ build_Makefile() { # Construct a Makefile from the book scripts
final_system_Makefiles # $basicsystem final_system_Makefiles # $basicsystem
bootscripts_Makefiles # $bootscripttools bootscripts_Makefiles # $bootscripttools
bootable_Makefiles # $bootable bootable_Makefiles # $bootable
# Add the CUSTOM_TOOLS targets, if needed
[[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
# 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.
( wrt_Makefile_header
cat << EOF
$HEADER
SRC = /sources
MOUNT_PT = $BUILDDIR
PKG_LST = $PKG_LST
LUSER = $LUSER
LGROUP = $LGROUP
SCRIPT_ROOT = $SCRIPT_ROOT
BASEDIR = \$(MOUNT_PT)
SRCSDIR = \$(BASEDIR)/sources
CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands
LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/logs
TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/test-logs
SU_LUSER = su - \$(LUSER) -c
PRT_DU = echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n"
LUSER_HOME = /home/\$(LUSER)
export PATH := \${PATH}:/usr/sbin
include makefile-functions
EOF
) > $MKFILE
# 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: ck_UID mk_SETUP mk_LUSER mk_ROOT create-sbu_du-report all: ck_UID mk_SETUP mk_LUSER create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL mk_ROOT
@sudo make restore-luser-env
@sudo make do-housekeeping @sudo make do-housekeeping
@\$(call echo_finished,$VERSION) @\$(call echo_finished,$VERSION)
@ -479,35 +460,61 @@ ck_UID:
mk_SETUP: mk_SETUP:
@\$(call echo_SU_request) @\$(call echo_SU_request)
@sudo make SETUP @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
@touch \$@ @touch \$@
mk_LUSER: mk_SETUP mk_LUSER: mk_SETUP
@\$(call echo_SULUSER_request) @\$(call echo_SULUSER_request)
@(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" ) @(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) LUSER" )
@sudo make restore-luser-env
@touch \$@ @touch \$@
mk_ROOT: mk_CUSTOM_TOOLS: create-sbu_du-report
@sudo make ROOT @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
\$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
(sudo \$(SU_LUSER) "mkdir -p $BUILDDIR$TRACKING_DIR"); \\
(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
fi;
@touch \$@ @touch \$@
SETUP: $host_prep mk_BLFS_TOOL: mk_CUSTOM_TOOLS
@if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
\$(call sh_echo_PHASE,Building BLFS_TOOL); \\
(sudo \$(SU_LUSER) "mkdir -p $BUILDDIR$TRACKING_DIR"); \\
(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BLFS_TOOL"); \\
fi;
@touch \$@
LUSER: $cross_tools $basicsystem $bootscripttools $bootable mk_ROOT: create-sbu_du-report
@\$(call echo_SU_request)
@echo "$VERSION-sysroot - jhalfs build" > clfs-release && \\
sudo mv clfs-release \$(MOUNT_PT)/etc
@sudo make BREAKPOINT=\$(BREAKPOINT) ROOT
@touch \$@
ROOT: $chowning SETUP: $host_prep
LUSER: $cross_tools $basicsystem $bootscripttools $bootable
CUSTOM_TOOLS: $custom_list
BLFS_TOOL: $blfs_tool
ROOT: $chowning
create-sbu_du-report: mk_LUSER
@\$(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 \$@
restore-luser-env: restore-luser-env:
@\$(call echo_message, Building) @\$(call echo_message, Building)
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\ mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
fi; fi;
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\ mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
fi; fi;
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\ @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
touch \$@ && \\ touch \$@ && \\
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE) echo --------------------------------------------------------------------------------\$(WHITE)
@ -515,31 +522,15 @@ restore-luser-env:
do-housekeeping: do-housekeeping:
@-if [ ! -f luser-exist ]; then \\ @-if [ ! -f luser-exist ]; then \\
userdel \$(LUSER); \\ userdel \$(LUSER); \\
rm -rf /home/\$(LUSER); \\ rm -rf \$(LUSER_HOME); \\
fi; fi;
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
echo "Creating Makefile... ${BOLD}DONE${OFF}" echo "Creating Makefile... ${BOLD}DONE${OFF}"
} }

154
CLFS3/clfs3.xsl Normal file
View file

@ -0,0 +1,154 @@
<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
%general-entities;
]>
<!-- $Id$ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl"
version="1.0">
<!-- XSLT stylesheet to create shell scripts from CLFS2 books. -->
<!-- Endian level -->
<xsl:param name="endian" select="xbig"/>
<!-- Time zone -->
<xsl:param name="timezone" select="GMT"/>
<!-- Page size -->
<xsl:param name="page" select="letter"/>
<!-- Locale settings -->
<xsl:param name="lang" select="C"/>
<xsl:template match="/">
<xsl:apply-templates select="//sect1"/>
</xsl:template>
<xsl:template match="sect1">
<xsl:choose>
<xsl:when test="../@id='chapter-partitioning' or
../@id='chapter-getting-materials' or
../@id='chapter-final-preps'"/>
<xsl:otherwise>
<xsl:if test="count(descendant::screen/userinput) &gt; 0 and
count(descendant::screen/userinput) &gt;
count(descendant::screen[@role='nodump'])">
<!-- The dirs names -->
<xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
<xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
<xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
<xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
<!-- The file names -->
<xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
<xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
<xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
<!-- The build order -->
<xsl:variable name="position" select="position()"/>
<xsl:variable name="order">
<xsl:choose>
<xsl:when test="string-length($position) = 1">
<xsl:text>00</xsl:text>
<xsl:value-of select="$position"/>
</xsl:when>
<xsl:when test="string-length($position) = 2">
<xsl:text>0</xsl:text>
<xsl:value-of select="$position"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$position"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Creating dirs and files -->
<exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
<xsl:text>#!/bin/bash&#xA;set +h&#xA;set -e&#xA;&#xA;</xsl:text>
<!-- Set envars needed by uClibc -->
<xsl:if test="@id='ch-cross-tools-uclibc'">
<xsl:copy-of select="//sect1[@id='ch-cross-tools-toolchain']/screen"/>
<xsl:text>&#xA;&#xA;</xsl:text>
</xsl:if>
<xsl:if test="sect2[@role='installation']">
<xsl:text>cd $PKGDIR&#xA;</xsl:text>
</xsl:if>
<xsl:apply-templates select=".//para/userinput | .//screen"/>
<xsl:text>exit</xsl:text>
</exsl:document>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="screen">
<xsl:if test="child::* = userinput and not(@role = 'nodump')">
<xsl:apply-templates select="userinput" mode="screen"/>
</xsl:if>
</xsl:template>
<xsl:template match="para/userinput"/>
<xsl:template match="userinput" mode="screen">
<xsl:choose>
<!-- Estandarized package formats -->
<xsl:when test="contains(string(),'tar.gz')">
<xsl:value-of select="substring-before(string(),'tar.gz')"/>
<xsl:text>tar.*</xsl:text>
<xsl:value-of select="substring-after(string(),'tar.gz')"/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- Select Endian level for uClibc -->
<xsl:when test="$endian='xbig' and contains(string(),'LITTLE_ENDIAN')"/>
<xsl:when test="$endian='xlittle' and contains(string(),'BIG_ENDIAN')"/>
<!-- Setting $LANG for /etc/profile -->
<xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
contains(string(),'export LANG=')">
<xsl:value-of select="substring-before(string(),'export LANG=')"/>
<xsl:text>export LANG=</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:value-of select="substring-after(string(),'charmap]')"/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- Compile the keymap into the kernel has been disabled -->
<xsl:when test="contains(string(),'defkeymap')"/>
<!-- Copying the kernel config file -->
<xsl:when test="string() = 'make mrproper'">
<xsl:text>make mrproper&#xA;</xsl:text>
<xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
</xsl:when>
<!-- No interactive commands are needed if the .config file is the proper one -->
<xsl:when test="contains(string(),'menuconfig')"/>
<!-- Don't stop on strip run -->
<xsl:when test="contains(string(),'strip ')">
<xsl:apply-templates/>
<xsl:text> || true&#xA;</xsl:text>
</xsl:when>
<!-- The rest of commands -->
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="replaceable">
<xsl:choose>
<xsl:when test="ancestor::sect1[@id='ch-cross-tools-glibc']">
<xsl:value-of select="$timezone"/>
</xsl:when>
<xsl:when test="ancestor::sect1[@id='ch-cross-tools-groff'] or
ancestor::sect1[@id='ch-system-groff']">
<xsl:value-of select="$page"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>**EDITME</xsl:text>
<xsl:apply-templates/>
<xsl:text>EDITME**</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

586
CLFS3/master.sh Normal file
View file

@ -0,0 +1,586 @@
#!/bin/bash
# $Id$
###################################
### FUNCTIONS ###
###################################
#----------------------------#
host_prep_Makefiles() { # Initialization of the system
#----------------------------#
local CLFS_HOST
echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files ( SETUP ) ${R_arrow}"
# defined here, only for ease of reading
CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
(
cat << EOF
025-addinguser:
@\$(call echo_message, Building)
@if [ ! -d \$(LUSER_HOME) ]; then \\
groupadd \$(LGROUP); \\
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
else \\
touch luser-exist; \\
fi;
@\$(call housekeeping)
026-settingenvironment: 025-addinguser
@\$(call echo_message, Building)
@if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
fi;
@if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
fi;
@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=\$(MOUNT_PT)/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_MIPS_LEVEL=\"${MIPS_LEVEL}\"" >> \$(LUSER_HOME)/.bashrc && \\
echo "export BUILD=\"${ABI}\"" >> \$(LUSER_HOME)/.bashrc && \\
echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
touch envars && \\
chown \$(LUSER):\$(LGROUP) envars
@\$(call housekeeping)
027-create-directories: 026-settingenvironment
@\$(call echo_message, Building)
@mkdir -p \$(MOUNT_PT)/{bin,boot,dev,{etc/,}opt,home,lib,mnt}
@mkdir -p \$(MOUNT_PT)/{proc,media/{floppy,cdrom},sbin,srv,sys}
@mkdir -p \$(MOUNT_PT)/var/{lock,log,mail,run,spool}
@mkdir -p \$(MOUNT_PT)/var/{opt,cache,lib/{misc,locate},local}
@install -d -m 0750 \$(MOUNT_PT)/root
@install -d -m 1777 \$(MOUNT_PT){/var,}/tmp
@mkdir -p \$(MOUNT_PT)/usr/{,local/}{bin,include,lib,sbin,src}
@mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{doc,info,locale,man}
@mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{misc,terminfo,zoneinfo}
@mkdir -p \$(MOUNT_PT)/usr/{,local/}share/man/man{1,2,3,4,5,6,7,8}
@for dir in \$(MOUNT_PT)/usr{,/local}; do \\
ln -s share/{man,doc,info} \$\$dir ; \\
done
@\$(call housekeeping)
028-creating-sysfile: 027-create-directories
@\$(call echo_message, Building)
@touch \$(MOUNT_PT)/etc/mtab
@echo "root::0:0:root:/root:/bin/ash" >> \$(MOUNT_PT)/etc/passwd
@echo "root:x:0:" >> \$(MOUNT_PT)/etc/group
@echo "bin:x:1:" >> \$(MOUNT_PT)/etc/group
@echo "sys:x:2:" >> \$(MOUNT_PT)/etc/group
@echo "kmem:x:3" >> \$(MOUNT_PT)/etc/group
@echo "tty:x:4:" >> \$(MOUNT_PT)/etc/group
@echo "tape:x:5:" >> \$(MOUNT_PT)/etc/group
@echo "daemon:x:6:" >> \$(MOUNT_PT)/etc/group
@echo "floppy:x:7:" >> \$(MOUNT_PT)/etc/group
@echo "disk:x:8:" >> \$(MOUNT_PT)/etc/group
@echo "lp:x:9:" >> \$(MOUNT_PT)/etc/group
@echo "dialout:x:10:" >> \$(MOUNT_PT)/etc/group
@echo "audio:x:11:" >> \$(MOUNT_PT)/etc/group
@echo "video:x:12:" >> \$(MOUNT_PT)/etc/group
@echo "utmp:x:13:" >> \$(MOUNT_PT)/etc/group
@echo "usb:x:14:" >> \$(MOUNT_PT)/etc/group
@echo "cdrom:x:15:" >> \$(MOUNT_PT)/etc/group
@touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp}
@chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog
@chown -R \$(LUSER) \$(MOUNT_PT) && \\
chmod -R a+w \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
chmod -R a+w \$(SRCSDIR)
@\$(call housekeeping)
EOF
) >> $MKFILE.tmp
host_prep=" 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile"
}
#-----------------------------#
systemprep_Makefiles() { #
#-----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}system prep tools ( LUSER ) ${R_arrow}"
for file in systemprep/* ; do
# Keep the script file name
this_script=`basename $file`
# Set the dependency for the first target.
if [ -z $PREV ] ; then PREV=028-creating-sysfile ; 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\}-@@'`
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.
LUSER_wrt_target "${this_script}" "$PREV"
#
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
LUSER_wrt_unpack "$pkg_tarball"
fi
#
LUSER_wrt_RunAsUser "${file}"
#
[[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
#
# 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 ....
}
#-----------------------------#
cross_tools_Makefiles() { #
#-----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools ( LUSER ) ${R_arrow}"
for file in cross-tools/* ; do
# Keep the script file name
this_script=`basename $file`
#
# Skip this script...
# NOTE.. the book indicated you only needed to install groff or file if the host
# had older versions. The packages would be installed in the target directory
# and not the host.
case $this_script in
*cflags* | *variables* | *abi | *toolchain*) # work done in host_prep_Makefiles
continue ;;
*) ;;
esac
#
# Set the dependency for the first target.
if [ -z $PREV ] ; then PREV=028-creating-sysfile ; 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@@' \
-e 's@-64@@' \
-e 's@-n32@@'`
case $name in
uclibc*) name="uClibc" ;;
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.
LUSER_wrt_target "${this_script}" "$PREV"
#
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
LUSER_wrt_unpack "$pkg_tarball"
# Touch timestamp file if installed files logs will be created.
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_TouchTimestamp
fi
# If using optimizations, write the instructions
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
fi
#
LUSER_wrt_RunAsUser "${file}"
#
# Write installed files log and remove the build directory(ies)
# except if the package build fails.
if [ "$pkg_tarball" != "" ] ; then
LUSER_RemoveBuildDirs "${name}"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_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 ....
}
#-----------------------------#
final_system_Makefiles() { #
#-----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}final system ( LUSER ) ${R_arrow}"
for file in final-system/* ; do
# Keep the script file name
this_script=`basename $file`
# 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@@' \
-e 's@n32@@'`
# Find the version of the command files, if it corresponds with the building of
# a specific package.
pkg_tarball=$(get_package_tarball_name $name)
# Append each name of the script files to a list (this will become
# the names of the targets in the Makefile
basicsystem="$basicsystem ${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.
LUSER_wrt_target "${this_script}" "$PREV"
#
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
# Touch timestamp file if installed files logs will be created.
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_TouchTimestamp
fi
LUSER_wrt_unpack "$pkg_tarball"
# If using optimizations, write the instructions
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
fi
#
LUSER_wrt_RunAsUser "${file}"
#
# Write installed files log and remove the build directory(ies)
# except if the package build fails.
if [ "$pkg_tarball" != "" ] ; then
LUSER_RemoveBuildDirs "${name}"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_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 final-system/* ...
}
#-----------------------------#
bootscripts_Makefiles() { #
#-----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}bootscripts ( LUSER ) ${R_arrow}"
for file in bootscripts/* ; do
# Keep the script file name
this_script=`basename $file`
case $this_script in
*console*) continue ;; # Use the files that came with the bootscripts
*network*) continue ;; # Manually create these files
*) ;;
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
*bootscripts*) name=clfs-embedded-bootscripts ;;
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.
LUSER_wrt_target "${this_script}" "$PREV"
#
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
LUSER_wrt_unpack "$pkg_tarball"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_TouchTimestamp
fi
fi
#
LUSER_wrt_RunAsUser "${file}"
#
if [ "$pkg_tarball" != "" ] ; then
LUSER_RemoveBuildDirs "${name}"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_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 bootscripts/* ...
}
#-----------------------------#
bootable_Makefiles() { #
#-----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable ( LUSER ) ${R_arrow}"
for file in bootable/* ; do
# 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 ;;
*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 $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
# 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.
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
case $this_script in
*kernel*) name=linux
;;
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.
LUSER_wrt_target "${this_script}" "$PREV"
#
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
LUSER_wrt_unpack "$pkg_tarball"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_TouchTimestamp
fi
fi
#
# Select a script execution method
case $this_script in
*fstab*) if [[ -n "$FSTAB" ]]; then
LUSER_wrt_CopyFstab
else
LUSER_wrt_RunAsUser "${file}"
fi
;;
*chowning) wrt_RunAsRoot "${file}"
;;
*) LUSER_wrt_RunAsUser "${file}"
;;
esac
#
# Housekeeping...remove any build directory(ies) except if the package build fails.
if [ "$pkg_tarball" != "" ] ; then
LUSER_RemoveBuildDirs "${name}"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_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
}
#-----------------------------#
build_Makefile() { # Construct a Makefile from the book scripts
#-----------------------------#
echo "Creating Makefile... ${BOLD}START${OFF}"
cd $JHALFSDIR/${PROGNAME}-commands
# Start with a clean Makefile.tmp file
>$MKFILE.tmp
host_prep_Makefiles
[[ "${PLATFORM% -*}" = "WRT" ]] && systemprep_Makefiles # $cross_tools
cross_tools_Makefiles # $cross_tools
final_system_Makefiles # $basicsystem
bootscripts_Makefiles # $bootscripttools
bootable_Makefiles # $bootable
# Add the CUSTOM_TOOLS targets, if needed
[[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
# Add a header, some variables and include the function file
# to the top of the real Makefile.
wrt_Makefile_header
# Drop in the main target 'all:' and the chapter targets with each sub-target
# as a dependency.
(
cat << EOF
all: ck_UID mk_SETUP mk_LUSER create-sbu_du-report mk_CUSTOM_TOOLS mk_ROOT
@sudo make restore-luser-env
@sudo make do-housekeeping
@\$(call echo_finished,$VERSION)
ck_UID:
@if [ \`id -u\` = "0" ]; then \\
echo "--------------------------------------------------"; \\
echo "You cannot run this makefile from the root account"; \\
echo "--------------------------------------------------"; \\
exit 1; \\
fi
mk_SETUP:
@\$(call echo_SU_request)
@sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
@touch \$@
mk_LUSER: mk_SETUP
@\$(call echo_SULUSER_request)
@(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) LUSER" )
@touch \$@
mk_CUSTOM_TOOLS: create-sbu_du-report
@if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
\$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
(sudo \$(SU_LUSER) "mkdir -p $BUILDDIR$TRACKING_DIR"); \\
(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
fi;
@touch \$@
mk_ROOT:
@\$(call echo_SU_request)
@echo "$VERSION-embedded - jhalfs build" > clfs-release && \\
sudo mv clfs-release \$(MOUNT_PT)/etc
@sudo make BREAKPOINT=\$(BREAKPOINT) ROOT
@touch \$@
SETUP: $host_prep
LUSER: $cross_tools $basicsystem $bootscripttools $bootable
CUSTOM_TOOLS: $custom_list
ROOT: $chowning
create-sbu_du-report: mk_LUSER
@\$(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 \$@
restore-luser-env:
@\$(call echo_message, Building)
@if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
fi;
@if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
fi;
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
touch \$@ && \\
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
do-housekeeping:
@-if [ ! -f luser-exist ]; then \\
userdel \$(LUSER); \\
rm -rf \$(LUSER_HOME); \\
fi;
EOF
) >> $MKFILE
# Bring over the items from the Makefile.tmp
cat $MKFILE.tmp >> $MKFILE
rm $MKFILE.tmp
echo "Creating Makefile... ${BOLD}DONE${OFF}"
}

526
Config.in
View file

@ -14,10 +14,10 @@ menu "--- BOOK Settings"
bool "Cross-Compiled Linux From Scratch" bool "Cross-Compiled Linux From Scratch"
config BOOK_CLFS2 config BOOK_CLFS2
bool "Cross-Compiled Linux From Scratch (Version 2)" bool "Cross-Compiled Linux From Scratch (Sysroot method)"
# config BOOK_CLFS3 config BOOK_CLFS3
# bool "Cross-Compiled Linux From Scratch (Embedded Systems)" bool "Cross-Compiled Linux From Scratch (Embedded Systems)"
config BOOK_HLFS config BOOK_HLFS
bool "Hardened Linux From Scratch" bool "Hardened Linux From Scratch"
@ -31,7 +31,7 @@ menu "--- BOOK Settings"
default "lfs" if BOOK_LFS default "lfs" if BOOK_LFS
default "clfs" if BOOK_CLFS default "clfs" if BOOK_CLFS
default "clfs2" if BOOK_CLFS2 default "clfs2" if BOOK_CLFS2
# default "clfs3" if BOOK_CLFS3 default "clfs3" if BOOK_CLFS3
default "hlfs" if BOOK_HLFS default "hlfs" if BOOK_HLFS
default "blfs" if BOOK_BLFS default "blfs" if BOOK_BLFS
@ -57,7 +57,7 @@ menu "--- BOOK Settings"
#-- A local working copy #-- A local working copy
config BRANCH config BRANCH
bool "Branch or stable book" if !BOOK_CLFS2 bool "Branch or stable book" if !BOOK_CLFS2 && !BOOK_CLFS3
help help
#-- A supported SVN branch or stable released book #-- A supported SVN branch or stable released book
endchoice endchoice
@ -83,9 +83,9 @@ menu "--- BOOK Settings"
choice choice
prompt "Target architecture" prompt "Target architecture"
default ARCH_X86 default ARCH_X86
depends BOOK_CLFS || BOOK_CLFS2 depends BOOK_CLFS || BOOK_CLFS2 || BOOK_CLFS3
help help
#-- Choose a base architecture #-- Choose the target system base architecture
config ARCH_X86 config ARCH_X86
bool "x86" bool "x86"
@ -94,118 +94,252 @@ menu "--- BOOK Settings"
bool "mips" if !BOOK_CLFS2 bool "mips" if !BOOK_CLFS2
config ARCH_PPC config ARCH_PPC
bool "ppc" if !BOOK_CLFS2 bool "ppc" if BOOK_CLFS
config ARCH_SPARC config ARCH_SPARC
bool "sparc" if !BOOK_CLFS2 bool "sparc" if BOOK_CLFS
config ARCH_ALPHA config ARCH_ALPHA
bool "alpha" if !BOOK_CLFS2 bool "alpha" if !BOOK_CLFS3
config ARCH_ARM config ARCH_ARM
bool "arm" if !BOOK_CLFS bool "arm" if !BOOK_CLFS
config ARCH_HPPA
bool "hppa" if BOOK_CLFS2
endchoice
choice
prompt "Hardware Platform"
depends BOOK_CLFS3 && ARCH_MIPS
default PLATFORM_GENERIC
help
# Chose a destination platform
# Platform specific files will be included
config PLATFORM_GENERIC
bool "Generic platform"
config PLATFORM_WRT
bool "WRT - MIPS based wireless router" if ARCH_MIPS
endchoice endchoice
choice choice
prompt "Library" prompt "Library"
depends (BOOK_CLFS || BOOK_CLFS2) depends (BOOK_CLFS && !ARCH_ALPHA) || (BOOK_CLFS3 && ARCH_MIPS)
default DATA_32 if !ARCH_ALPHA default DATA_32
default DATA_64 if ARCH_ALPHA help
#-- Choose the target system libraries type
config DATA_32 config DATA_32
bool "32-bit" if !ARCH_ALPHA bool "32-bit"
config DATA_64 config DATA_64
bool "64-bit" if !ARCH_PPC && !ARCH_ARM && !(BOOK_CLFS2 && ARCH_X86) bool "64-bit" if !ARCH_PPC
config DATA_MULTI config DATA_MULTI
bool "multilib" if !ARCH_ALPHA && !ARCH_ARM && !(BOOK_CLFS2 && ARCH_X86) bool "multilib" if !(BOOK_CLFS3 && ARCH_MIPS )
endchoice endchoice
choice choice
prompt "Target" prompt "Processor type"
depends (BOOK_CLFS || BOOK_CLFS2) && ((ARCH_X86 && DATA_32) || ARCH_MIPS) depends (BOOK_CLFS || BOOK_CLFS2 || BOOK_CLFS3) && ((ARCH_X86 && !(DATA_64 || DATA_MULTI)) || ARCH_MIPS || ARCH_HPPA || ARCH_ALPHA || (ARCH_SPARC && (DATA_64 || DATA_MULTI)) || (ARCH_ARM && BOOK_CLFS3))
help
#-- Choose the target system processor
config PROC_i486 config PROC_i486
bool "i486" if ARCH_X86 && DATA_32 bool "486 Compatibles" if ARCH_X86
config PROC_i586 config PROC_i586
bool "i586" if ARCH_X86 && DATA_32 bool "Pentium, K6, 586 Compatibles" if ARCH_X86
config PROC_i686 config PROC_i686
bool "i686" if ARCH_X86 && DATA_32 bool "Pentium II, Pentium III, Pentium 4, Athlon, Duron" if ARCH_X86
config PROC_mipsel config PROC_mipsel
bool "mips -little endian" if ARCH_MIPS bool "MIPS Little Endian" if ARCH_MIPS
config PROC_mips config PROC_mips
bool "mips" if ARCH_MIPS bool "MIPS Big Endian" if ARCH_MIPS
config PROC_unknown
bool "Unknown" if ARCH_HPPA || ARCH_ALPHA
config PROC_hppa1
bool "PA 7000 Series" if ARCH_HPPA
config PROC_hppa2
bool "PA 8000 Series" if ARCH_HPPA
config PROC_EV5
bool "EV5 Series" if ARCH_ALPHA
config PROC_EV56
bool "EV56 Series" if ARCH_ALPHA
config PROC_PCA56
bool "PCA56 Series" if ARCH_ALPHA
config PROC_PCA57
bool "PCA57 Series" if ARCH_ALPHA
config PROC_EV6
bool "EV6 Series" if ARCH_ALPHA
config PROC_EV67
bool "EV67 Series" if ARCH_ALPHA
config PROC_EV68
bool "EV68 Series" if ARCH_ALPHA
config PROC_ARM
bool "Generic arm, little endian" if ARCH_ARM
config PROC_ARM5L
bool "Generic arm, version 5, little endian" if ARCH_ARM
config PROC_ARM5B
bool "Generic arm, version 5, big endian" if ARCH_ARM
config PROC_ULTRA1
bool "UtraSparc" if ARCH_SPARC && (DATA_64 || DATA_MULTI)
config PROC_ULTRA2
bool "UtraSparc2" if ARCH_SPARC && (DATA_64 || DATA_MULTI)
config PROC_ULTRA3
bool "UtraSparc3" if ARCH_SPARC && (DATA_64 || DATA_MULTI)
endchoice
choice
prompt "MIPS 64 ABI"
depends BOOK_CLFS3 && ARCH_MIPS && DATA_64
default ABI_64
help
#-- Choose the target system ABI to use
config ABI_32
bool "o32"
config ABI_N32
bool "n32"
config ABI_64
bool "n64"
endchoice endchoice
config TARGET config TARGET
string string
depends DATA_32 default "i486-pc-linux-gnu" if !BOOK_CLFS3 && PROC_i486
default "i486-pc-linux-gnu" if ARCH_X86 && PROC_i486 default "i586-pc-linux-gnu" if !BOOK_CLFS3 && PROC_i586
default "i586-pc-linux-gnu" if ARCH_X86 && PROC_i586 default "i686-pc-linux-gnu" if !BOOK_CLFS3 && PROC_i686
default "i686-pc-linux-gnu" if ARCH_X86 && PROC_i686
default "mipsel-unknown-linux-gnu" if ARCH_MIPS && PROC_mipsel
default "mips-unknown-linux-gnu" if ARCH_MIPS && PROC_mips
default "powerpc-unknown-linux-gnu" if ARCH_PPC
default "sparc-unknown-linux-gnu" if ARCH_SPARC
default "arm-unknown-linux-gnu" if ARCH_ARM
config TARGET default "i486-pc-linux-uclibc" if BOOK_CLFS3 && PROC_i486
string default "i586-pc-linux-uclibc" if BOOK_CLFS3 && PROC_i586
depends DATA_64 default "i686-pc-linux-uclibc" if BOOK_CLFS3 && PROC_i686
default "x86_64-unknown-linux-gnu" if ARCH_X86
default "mips64el-unknown-linux-gnu" if ARCH_MIPS && PROC_mipsel
default "mips64-unknown-linux-gnu" if ARCH_MIPS && PROC_mips
default "sparc64-unknown-linux-gnu" if ARCH_SPARC
default "alpha-unknown-linux-gnu" if ARCH_ALPHA
config TARGET default "x86_64-unknown-linux-gnu" if ARCH_X86 && (DATA_64 || DATA_MULTI)
string
depends DATA_MULTI
default "x86_64-unknown-linux-gnu" if ARCH_X86
default "mips64el-unknown-linux-gnu" if ARCH_MIPS && PROC_mipsel
default "mips64-unknown-linux-gnu" if ARCH_MIPS && PROC_mips
default "sparc64-unknown-linux-gnu" if ARCH_SPARC
default "powerpc64-unknown-linux-gnu" if ARCH_PPC
default "mipsel-unknown-linux-gnu" if !BOOK_CLFS3 && PROC_mipsel && DATA_32
default "mips-unknown-linux-gnu" if !BOOK_CLFS3 && PROC_mips && DATA_32
default "mips64el-unknown-linux-gnu" if !BOOK_CLFS3 && PROC_mipsel && (DATA_64 || DATA_MULTI)
default "mips64-unknown-linux-gnu" if !BOOK_CLFS3 && PROC_mips && (DATA_64 || DATA_MULTI)
default "mipsel-unknown-linux-uclibc" if BOOK_CLFS3 && PROC_mipsel && DATA_32
default "mips-unknown-linux-uclibc" if BOOK_CLFS3 && PROC_mips && DATA_32
default "mips64el-unknown-linux-uclibc" if BOOK_CLFS3 && PROC_mipsel && DATA_64
default "mips64-unknown-linux-uclibc" if BOOK_CLFS3 && PROC_mips && DATA_64
default "powerpc-unknown-linux-gnu" if ARCH_PPC && DATA_32
default "powerpc64-unknown-linux-gnu" if ARCH_PPC && DATA_MULTI
default "sparc-unknown-linux-gnu" if ARCH_SPARC && DATA_32
default "sparc64-unknown-linux-gnu" if ARCH_SPARC && (DATA_64 || DATA_MULTI)
default "hppa-unknown-linux-gnu" if PROC_unknown && ARCH_HPPA
default "hppa1.1-unknown-linux-gnu" if PROC_hppa1
default "hppa2.0-unknown-linux-gnu" if PROC_hppa2
default "arm-unknown-linux-gnu" if ARCH_ARM && BOOK_CLFS2
default "arm-unknown-linux-uclibc" if PROC_ARM
default "armv5l-unknown-linux-uclibc" if PROC_ARM5L
default "armv5b-unknown-linux-uclibc" if PROC_ARM5B
default "alpha-unknown-linux-gnu" if PROC_unknown && ARCH_ALPHA
default "alphaev5-unknown-linux-gnu" if PROC_EV5
default "alphaev56-unknown-linux-gnu" if PROC_EV56
default "alphapca56-unknown-linux-gnu" if PROC_PCA56
default "alphapca57-unknown-linux-gnu" if PROC_PCA57
default "alphaev6-unknown-linux-gnu" if PROC_EV6
default "alphaev67-unknown-linux-gnu" if PROC_EV67
default "alphaev68-unknown-linux-gnu" if PROC_EV68
config TARGET32 config TARGET32
string string
depends DATA_MULTI depends DATA_MULTI
default "i686-pc-linux-gnu" if ARCH_X86 default "i686-pc-linux-gnu" if ARCH_X86
default "mipsel-unknown-linux-gnu" if ARCH_MIPS && PROC_mipsel default "mipsel-unknown-linux-gnu" if PROC_mipsel
default "mips-unknown-linux-gnu" if ARCH_MIPS && PROC_mips default "mips-unknown-linux-gnu" if PROC_mips
default "sparc-unknown-linux-gnu" if ARCH_SPARC default "sparc-unknown-linux-gnu" if ARCH_SPARC
default "powerpc-unknown-linux-gnu" if ARCH_PPC default "powerpc-unknown-linux-gnu" if ARCH_PPC
config ARCH config PLATFORM
string string
depends DATA_32 default "GENERIC" if (!BOOK_CLFS3) || PLATFORM_GENERIC
default "x86" if ARCH_X86 default "WRT - Wireless Router" if PLATFORM_WRT
default "ppc" if ARCH_PPC
default "mips" if ARCH_MIPS config SPARC64_PROC
default "sparc" if ARCH_SPARC string
default "arm" if ARCH_ARM default "none" if !(ARCH_SPARC && (DATA_64 || DATA_MULTI))
default "1" if PROC_ULTRA1
default "2" if PROC_ULTRA2
default "3" if PROC_ULTRA3
config ARCH config ARCH
string string
depends DATA_64 default "x86" if ARCH_X86 && (DATA_32 || BOOK_CLFS2 || BOOK_CLFS3)
default "x86_64-64" if ARCH_X86 default "x86_64" if ARCH_X86 && DATA_MULTI
default "mips64-64" if ARCH_MIPS default "x86_64-64" if ARCH_X86 && DATA_64
default "sparc64-64" if ARCH_SPARC
default "wrt" if PLATFORM_WRT && BOOK_CLFS3
default "mips" if ARCH_MIPS && (DATA_32 || BOOK_CLFS3)
default "mips64" if ARCH_MIPS && DATA_MULTI
default "mips64-64" if ARCH_MIPS && DATA_64 && BOOK_CLFS
default "ppc" if ARCH_PPC && DATA_32
default "ppc64" if ARCH_PPC && DATA_MULTI
default "sparc" if ARCH_SPARC && DATA_32
default "sparc64" if ARCH_SPARC && DATA_MULTI
default "sparc64-64" if ARCH_SPARC && DATA_64
default "alpha" if ARCH_ALPHA default "alpha" if ARCH_ALPHA
default "arm" if ARCH_ARM
default "hppa" if ARCH_HPPA
config ARCH config MIPS_LEVEL
string string
depends DATA_MULTI depends BOOK_CLFS3 && ARCH_MIPS
default "x86_64" if ARCH_X86 default "1" if DATA_32
default "mips64" if ARCH_MIPS default "3" if DATA_64
default "sparc64" if ARCH_SPARC
default "ppc64" if ARCH_PPC config ABI
string
depends BOOK_CLFS3
default "-m32" if ARCH_X86 || ARCH_ARM
# default "-m64" if NO USED YET IN THE BOOK
default "-mabi=32" if ABI_32 || (ARCH_MIPS && DATA_32)
default "-mabi=n32" if ABI_N32
default "-mabi=64" if ABI_64
config ENDIAN
string
depends BOOK_CLFS3 && (ARCH_MIPS || ARCH_ARM)
default "little" if PROC_mipsel || PROC_ARM || PROC_ARM5L
default "big" if PROC_mips || PROC_ARM5B
choice choice
prompt "Build method" prompt "Build method"
@ -265,23 +399,120 @@ menu "--- BOOK Settings"
string string
default "glibc" if LIB_GLIBC default "glibc" if LIB_GLIBC
default "uclibc" if LIB_UCLIBC default "uclibc" if LIB_UCLIBC
choice
prompt "Kernel series"
depends on BOOK_HLFS
help
#-- Which kernel series to use: 2.6/2.4
config KERNEL_26
bool "2.6 kernel series"
config KERNEL_24
bool "2.4 kernel series"
endchoice
config KERNEL
depends on BOOK_HLFS
string
default "2.6" if KERNEL_26
default "2.4" if KERNEL_24
# menu "HLFS Additional Features"
# depends on BOOK_HLFS
#
# config SET_SSP
# bool "Stack-smashing protector"
# default y
#
# config SET_ASLR
# bool "Address-space layout randomization"
# default y
#
# config SET_PAX
# bool "PaX-aware ELF executables and kernel"
# default y
#
# config SET_HARDENED_TMP
# bool "Hardened temporary files creation"
# default y
#
# config SET_WARNINGS
# bool "Additional warnings"
# default y
#
# config SET_MISC
# bool "Miscellaneous features"
# default y
#
# config SET_BLOWFISH
# bool "Blowfish passwords"
# default y
# endmenu
config SSP
# depends on SET_SSP
string
default ",ssp,"
config ASLR
# depends on SET_ASLR
string
default ",aslr,"
config PAX
# depends on SET_PAX
string
default ",pax,"
config HARDENED_TMP
# depends on SET_HARDENED_TMP
string
default ",hardened_tmp,"
config WARNINGS
# depends on SET_WARNINGS
string
default ",warnings,"
config MISC
# depends on SET_MISC
string
default ",misc,"
config BLOWFISH
# depends on SET_BLOWFISH
string
default ",blowfish,"
#--- End HLFS specific params #--- End HLFS specific params
#--- Custom Tools support
config CUSTOM_TOOLS
bool "Add custom tools support"
default n
depends on !BOOK_BLFS
help
#--- Activating this option additional packages you create
# will be installed after finished the xLFS system build.
#
#--- End Custom Tools support
#--- blfs-tool Support #--- blfs-tool Support
config BLFS_TOOL config BLFS_TOOL
bool "Add blfs-tool support" bool "Add blfs-tool support"
default n default n
# depends on !BOOK_BLFS depends on !BOOK_BLFS && !BOOK_CLFS3
depends on BOOK_LFS || BOOK_CLFS
help help
#--- Activating this option additional packages needed to #--- Activating this option will install additional
# use blfs-tool will be installed. # packages needed to use blfs-tool when booting
# the new system.
# #
# The blfs-tool files will be installed under # The blfs-tool files will be installed under
# $BUILD_DIR/blfs_root. # $BUILD_DIR/blfs_root.
# After booting the new xLFS system you should to # After booting the new xLFS system you should to
# create an user account and move the blfs-root # create an user account and move the /blfs-root
# directory to the user's home, making he the # directory to the user's home, making he the
# directory and files owner, before start # directory and files owner, before start
# using blfs-tool. # using blfs-tool.
@ -339,12 +570,12 @@ menu "--- BOOK Settings"
default y default y
depends on DEP_DBXML depends on DEP_DBXML
config DEP_DBXSL #config DEP_DBXSL
bool "DocBook XSL (required)" #bool "DocBook XSL (required)"
default y #default y
config DEP_LINKS config DEP_LYNX
bool "links (required)" bool "lynx (required)"
default y default y
config DEP_SUDO config DEP_SUDO
@ -355,16 +586,27 @@ menu "--- BOOK Settings"
bool "wget (recommended)" bool "wget (recommended)"
default y default y
config DEP_SVN
bool "SVN client (optional)"
default y
config DEP_GPM config DEP_GPM
bool "GPM (optional, see help)" bool "GPM (optional, see help)"
default y default y
help help
#-- You MUST to install manually the gpm bootscript #-- You MUST to install manually the gpm bootscript
# and create its configuration file # and create its configuration file.
#
# An alternative is to unselect this option and
# install gpm, its configuration file, and its
# bootscript using the custom tools support.
config DEP_SVN
bool "SVN client (optional, see help)"
default n
help
#-- Subversion-1.3.1 will be installed. This version is
# old but does not rely on additional packages to be
# built.
#
# If you are happy with this old version and don't
# need extra features, select this option.
endmenu endmenu
#--- End blfs-tool Support #--- End blfs-tool Support
@ -389,28 +631,23 @@ menu "--- BOOK Settings"
config TRACKING_DIR config TRACKING_DIR
string "Installed packages database directory" string "Installed packages database directory"
default "/var/lib/jhalfs/BLFS" default "/var/lib/jhalfs/BLFS"
depends on BOOK_BLFS || BLFS_TOOL depends on BOOK_BLFS || BLFS_TOOL || CUSTOM_TOOLS
help help
#-- Full path to the directory where the installed #-- Full path to the directory where the installed
# packages database will be created. # packages database will be created.
# #
# You MUST to create manually this directory. # If you are installing blfs-tool on a running xLFS system
# you MUST to create manually this directory.
#
# If you are installing blfs-tool as part of a xLFS build
# and/or using the customized scripts feature, you will
# need to fix that directory permissions after booting
# the new system.
# #
# Note that the user that will build the packages must # Note that the user that will build the packages must
# have read and write privileges on that directory. # have read and write privileges on that directory.
#--- End BLFS specific params #--- End BLFS specific params
#--- Custom Tools support
config CUSTOM_TOOLS
bool "Add custom tool support"
default n
depends on BOOK_LFS
help
#--- Activating this option additional packages you create
# will be installed.
#
#--- End Custom Tools support
#--- End BOOK Settings #--- End BOOK Settings
endmenu endmenu
@ -419,7 +656,7 @@ menu "--- General Settings"
#--- Set User Account #--- Set User Account
config CONFIG_USER config CONFIG_USER
bool "Change the default user/group for this build" bool "Change the default user/group and homedir for this build"
default n default n
help #-- Unprivileged user and group name help #-- Unprivileged user and group name
# If you do not have the priv to create/delete # If you do not have the priv to create/delete
@ -427,15 +664,17 @@ menu "--- General Settings"
# user id for the build # user id for the build
# #
# default values for each book # default values for each book
# LFS lfs # LFS lfs
# CLFS clfs # CLFS* clfs
# CLFS2 clfs # HLFS hlfs
# HLFS hlfs #
# Also, if your host place users home dirs into a
# directory other than /home you can specify it here.
config DEF_USER config DEF_USER
string string
default "lfs" if BOOK_LFS default "lfs" if BOOK_LFS
default "clfs" if BOOK_CLFS || BOOK_CLFS2 default "clfs" if BOOK_CLFS || BOOK_CLFS2 || BOOK_CLFS3
default "hlfs" if BOOK_HLFS default "hlfs" if BOOK_HLFS
config SET_USER config SET_USER
@ -443,7 +682,6 @@ menu "--- General Settings"
depends CONFIG_USER depends CONFIG_USER
default DEF_USER default DEF_USER
config CONFIG_GROUP config CONFIG_GROUP
bool "Set Group?" bool "Set Group?"
default n default n
@ -454,6 +692,16 @@ menu "--- General Settings"
depends CONFIG_GROUP depends CONFIG_GROUP
default DEF_USER default DEF_USER
config CONFIG_HOME
bool "Set home dir?"
default n
depends CONFIG_USER
config SET_HOME
string "Path to the directory where user home dir will be created"
depends CONFIG_HOME
default "/home"
config LUSER config LUSER
string string
default DEF_USER if !CONFIG_USER default DEF_USER if !CONFIG_USER
@ -463,6 +711,11 @@ menu "--- General Settings"
string string
default LUSER if !CONFIG_GROUP default LUSER if !CONFIG_GROUP
default SET_GROUP if CONFIG_GROUP default SET_GROUP if CONFIG_GROUP
config LHOME
string
default "/home" if !CONFIG_HOME
default SET_HOME if CONFIG_HOME
#--- End Set User Account #--- End Set User Account
config BUILDDIR config BUILDDIR
@ -470,6 +723,9 @@ menu "--- General Settings"
default "/mnt/build_dir" default "/mnt/build_dir"
help help
#-- The directory where the created system will be located. #-- The directory where the created system will be located.
# NOTE: A working directory named jhalfs will be created
# here, so ensure this does not conflict with the jhalfs
# source directory.
config GETPKG config GETPKG
bool "Retrieve source files" bool "Retrieve source files"
@ -502,7 +758,7 @@ menu "--- General Settings"
config GETKERNEL config GETKERNEL
bool "Always retrieve kernel package (see help)" bool "Always retrieve kernel package (see help)"
default y if BOOK_LFS && relSVN default y if BOOK_LFS || BOOK_HLFS
depends GETPKG depends GETPKG
help help
#-- Get the kernel package and patches even if no kernel #-- Get the kernel package and patches even if no kernel
@ -510,7 +766,10 @@ menu "--- General Settings"
# NOTE: # NOTE:
# The kernel package must be available when building # The kernel package must be available when building
# the SVN version of LFS to can install the headers files. # the SVN version of LFS or HLFS to can install the
# headers files.
#
# If building LFS-6.2 this setting can be disabled.
config RUNMAKE config RUNMAKE
bool "Run the makefile" bool "Run the makefile"
@ -526,7 +785,6 @@ menu "--- General Settings"
# The directory is cleaned only if it was populated by a # The directory is cleaned only if it was populated by a
# previous JHALFS run. # previous JHALFS run.
# #
# NOTE::You must be 'root' for this function to work
#--- End General Settings #--- End General Settings
endmenu endmenu
@ -537,7 +795,7 @@ menu "--- Build Settings"
#--- Test Suites #--- Test Suites
config CONFIG_TESTS config CONFIG_TESTS
bool "Run testsuites" bool "Run testsuites"
depends !BOOK_CLFS2 depends !BOOK_CLFS2 && !BOOK_CLFS3
default y default y
help help
#-- Run test suites #-- Run test suites
@ -598,6 +856,16 @@ menu "--- Build Settings"
#--- End Test Suites #--- End Test Suites
#--- Installed files logs
config INSTALL_LOG
bool "Create installed files logs"
default n
help
#-- Select this if you want to create logs of the files
# installed by each package on the final system.
#--- End Installed files logs
#--- FSTAB #--- FSTAB
config HAVE_FSTAB config HAVE_FSTAB
bool "Use a custom fstab file" bool "Use a custom fstab file"
@ -637,10 +905,12 @@ menu "--- Build Settings"
config STRIP config STRIP
bool "Strip Installed Binaries/Libraries" bool "Strip Installed Binaries/Libraries"
default y default y
depends on !BOOK_CLFS3
config VIMLANG config VIMLANG
bool "Install vim-lang package" bool "Install vim-lang package"
default y default y
depends on !BOOK_HLFS && !BOOK_CLFS3
help help
#-- Install the optional vim-lang package #-- Install the optional vim-lang package
@ -657,13 +927,6 @@ menu "--- Build Settings"
help help
#-- Language information in /etc/profile See <locale -a> for values #-- Language information in /etc/profile See <locale -a> for values
config LC_ALL
string "Language"
default "$LC_ALL"
depends on !BOOK_LFS
help
#-- Language information in /etc/profile See <locale -a> for values
#--- Groff page #--- Groff page
choice choice
prompt "Groff page size" prompt "Groff page size"
@ -697,7 +960,7 @@ menu "--- Advanced Features"
#--- ICA/farce #--- ICA/farce
config COMPARE config COMPARE
bool "Run comparison analysis on final stage" bool "Run comparison analysis on final stage"
depends !BOOK_CLFS2 depends !BOOK_CLFS2 && !BOOK_CLFS3
default n default n
help help
#-- Should some iterative comparison analysis by made? #-- Should some iterative comparison analysis by made?
@ -736,7 +999,7 @@ menu "--- Advanced Features"
#--- End ICA/farce #--- End ICA/farce
#--- Optimizations #--- Optimizations
if !BOOK_CLFS2 if !BOOK_CLFS2 && !BOOK_CLFS3
config CONFIG_OPTIMIZE config CONFIG_OPTIMIZE
bool "Use optimization (see help)" bool "Use optimization (see help)"
default n default n
@ -784,13 +1047,29 @@ endif
string "jhalfs directory" string "jhalfs directory"
default "$BUILDDIR/$SCRIPT_ROOT" default "$BUILDDIR/$SCRIPT_ROOT"
config LOGDIRBASE
string "Build logs directory basename"
default "logs"
config LOGDIR config LOGDIR
string "Build logs directory" string "Build logs directory"
default "$JHALFSDIR/logs" default "$JHALFSDIR/$LOGDIRBASE"
config TESTLOGDIRBASE
string "Test suites logs directory basename"
default "test-logs"
config TESTLOGDIR config TESTLOGDIR
string "Test suites logs directory" string "Test suites logs directory"
default "$JHALFSDIR/test-logs" default "$JHALFSDIR/$TESTLOGDIRBASE"
config FILELOGDIRBASE
string "Installed files logs directory basename"
default "installed-files"
config FILELOGDIR
string "Installed files logs directory"
default "$JHALFSDIR/$FILELOGDIRBASE"
config ICALOGDIR config ICALOGDIR
string "ICA logs directory" string "ICA logs directory"
@ -817,3 +1096,16 @@ endif
#--- End Advanced Features #--- End Advanced Features
endmenu endmenu
config REBUILD_MAKEFILE
bool "Rebuild the Makefile (see help)"
default n
depends on !BOOK_BLFS
help
#-- Rebuild the Makefile
#
# This option alow to rebuild the Makefile after
# customizing the base system build scripts.
#
# See README.CUSTOM for more info about this feature.

View file

@ -16,6 +16,9 @@
<!-- What libc implentation must be used? --> <!-- What libc implentation must be used? -->
<xsl:param name="model" select="glibc"/> <xsl:param name="model" select="glibc"/>
<!-- What kernel serie must be used? -->
<xsl:param name="kernel" select="2.6"/>
<!-- Is the host kernel using grsecurity? --> <!-- Is the host kernel using grsecurity? -->
<xsl:param name="grsecurity_host" select="n"/> <xsl:param name="grsecurity_host" select="n"/>
@ -33,6 +36,9 @@
--> -->
<xsl:param name="bomb-testsuite" select="n"/> <xsl:param name="bomb-testsuite" select="n"/>
<!-- Additional features -->
<xsl:param name="features">,ssp,aslr,pax,hardened_tmp,warnings,misc,blowfish,</xsl:param>
<!-- Time zone --> <!-- Time zone -->
<xsl:param name="timezone" select="GMT"/> <xsl:param name="timezone" select="GMT"/>
@ -41,7 +47,6 @@
<!-- Locale settings --> <!-- Locale settings -->
<xsl:param name="lang" select="C"/> <xsl:param name="lang" select="C"/>
<xsl:param name="lc_all" select="C"/>
<xsl:template match="/"> <xsl:template match="/">
<xsl:apply-templates select="//sect1"/> <xsl:apply-templates select="//sect1"/>
@ -51,10 +56,11 @@
<xsl:if test="(../@id='chapter-temporary-tools' or <xsl:if test="(../@id='chapter-temporary-tools' or
../@id='chapter-building-system' or ../@id='chapter-building-system' or
../@id='chapter-bootable') and ../@id='chapter-bootable') and
((@condition=$model or not(@condition)) and (count(descendant::screen/userinput) &gt; 0 and
count(descendant::screen/userinput) &gt; 0 and
count(descendant::screen/userinput) &gt; count(descendant::screen/userinput) &gt;
count(descendant::screen[@role='nodump']))"> count(descendant::screen[@role='nodump'])) and
((@condition=$model or not(@condition)) and
(@vendor=$kernel or not(@vendor)))">
<!-- The dirs names --> <!-- The dirs names -->
<xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/> <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
<xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/> <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
@ -84,45 +90,48 @@
<!-- Creating dirs and files --> <!-- Creating dirs and files -->
<exsl:document href="{$dirname}/{$order}-{$filename}" method="text"> <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
<xsl:choose> <xsl:choose>
<xsl:when test="@id='ch-system-changingowner' or <xsl:when test="@id='ch-system-creatingdirs' or
@id='ch-system-creatingdirs' or @id='ch-system-createfiles' or
@id='ch-system-createfiles'"> @id='ch-system-changingowner' or
<xsl:text>#!/tools/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
</xsl:when>
<xsl:when test="@id='ch-tools-stripping' or
@id='ch-system-strippingagain'"> @id='ch-system-strippingagain'">
<xsl:text>#!/bin/sh&#xA;</xsl:text> <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text> <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:if test="(sect2[@role='installation'] and <xsl:if test="not(@id='ch-tools-stripping') and
not(@id='bootable-kernel'))"> not(@id='ch-system-strippingagain')">
<xsl:text>set -e&#xA;</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
<xsl:if test="(sect2[@role='installation'])">
<xsl:text>cd $PKGDIR&#xA;</xsl:text> <xsl:text>cd $PKGDIR&#xA;</xsl:text>
<xsl:if test="@id='ch-tools-uclibc' or @id='ch-system-uclibc'"> <xsl:if test="@id='ch-system-uclibc'">
<xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; &#xA;</xsl:text> <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; &#xA;</xsl:text>
</xsl:if> </xsl:if>
<!-- SVN toolchain format, from inside ./sources dir unpack binutils and gcc -->
<!-- NEW toolchain format, from inside ./sources dir unpack binutils and gcc --> <xsl:if test="@id='ch-tools-embryo-toolchain' or
<xsl:if test="@id='ch-tools-embryo-toolchain' or
@id='ch-tools-cocoon-toolchain' or @id='ch-tools-cocoon-toolchain' or
@id='ch-system-butterfly-toolchain'"> @id='ch-system-butterfly-toolchain'">
<xsl:text>tar -xvf gcc-core-&gcc-version;.*; &#xA;</xsl:text> <xsl:text>tar -xvf gcc-core-&gcc-version;.*; &#xA;</xsl:text>
<xsl:text>tar -xvf gcc-g++-&gcc-version;.*; &#xA;</xsl:text>
<xsl:text>tar -xvf binutils-&binutils-version;.*; &#xA;</xsl:text> <xsl:text>tar -xvf binutils-&binutils-version;.*; &#xA;</xsl:text>
</xsl:if> </xsl:if>
<xsl:if test="@id='ch-tools-cocoon-toolchain' or
@id='ch-system-butterfly-toolchain'">
<xsl:text>tar -xvf gcc-g++-&gcc-version;.*; &#xA;</xsl:text>
</xsl:if>
<!-- ONLY butterfly has a testsuite --> <!-- ONLY butterfly has a testsuite -->
<xsl:if test="@id='ch-system-butterfly-toolchain' and $testsuite != '0'"> <xsl:if test="@id='ch-system-butterfly-toolchain' and $testsuite != '0'">
<xsl:text>tar -xvf gcc-testsuite-&gcc-version;.*; &#xA;</xsl:text> <xsl:text>tar -xvf gcc-testsuite-&gcc-version;.*; &#xA;</xsl:text>
</xsl:if> </xsl:if>
<!-- END new toolchain format --> <!-- END SVN toolchain format -->
<xsl:if test="@id='bootable-bootscripts'">
<xsl:text>pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd; &#xA;</xsl:text>
</xsl:if>
</xsl:if> </xsl:if>
<xsl:apply-templates select=".//para/userinput | .//screen"/> <xsl:apply-templates select=".//para/userinput | .//screen"/>
<xsl:if test="not(@id='ch-system-chroot') and
not(@id='ch-system-revisedchroot')">
<xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
</xsl:if>
<xsl:text>exit</xsl:text> <xsl:text>exit</xsl:text>
</exsl:document> </exsl:document>
</xsl:if> </xsl:if>
@ -130,7 +139,9 @@
<xsl:template match="screen"> <xsl:template match="screen">
<xsl:if test="(@condition=$model or not(@condition)) and <xsl:if test="(@condition=$model or not(@condition)) and
child::* = userinput and not(@role = 'nodump')"> (@vendor=$kernel or not(@vendor)) and
child::* = userinput and (not(@role) or
(@role and contains($features,concat(',',@role,','))))">
<xsl:apply-templates select="userinput" mode="screen"/> <xsl:apply-templates select="userinput" mode="screen"/>
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>
@ -160,44 +171,19 @@
<xsl:template match="userinput" mode="screen"> <xsl:template match="userinput" mode="screen">
<xsl:choose> <xsl:choose>
<!-- Estandarized package formats -->
<xsl:when test="contains(string(),'tar.gz')">
<xsl:value-of select="substring-before(string(),'tar.gz')"/>
<xsl:text>tar.*</xsl:text>
<xsl:value-of select="substring-after(string(),'tar.gz')"/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- Avoiding a race condition in a patch -->
<xsl:when test="contains(string(),'debian_fixes')">
<xsl:value-of select="substring-before(string(),'patch')"/>
<xsl:text>patch -Z</xsl:text>
<xsl:value-of select="substring-after(string(),'patch')"/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- grsecurity kernel in the host? --> <!-- grsecurity kernel in the host? -->
<xsl:when test="ancestor::sect1[@id='ch-system-kernfs'] and <xsl:when test="ancestor::sect1[@id='ch-system-kernfs'] and
contains(string(),'sysctl') contains(string(),'sysctl')
and $grsecurity_host ='n'"/> and $grsecurity_host ='n'"/>
<!-- Setting $LC_ALL and $LANG for /etc/profile --> <!-- Setting $LANG for /etc/profile -->
<xsl:when test="ancestor::sect1[@id='bootable-profile'] and <xsl:when test="ancestor::sect1[@id='bootable-profile'] and
contains(string(),'export LANG=')"> contains(string(),'export LANG=')">
<xsl:value-of select="substring-before(string(),'export LC_ALL=')"/> <xsl:value-of select="substring-before(string(),'export LANG=')"/>
<xsl:text>export LC_ALL=</xsl:text> <xsl:text>export LANG=</xsl:text>
<xsl:value-of select="$lc_all"/>
<xsl:text>&#xA;export LANG=</xsl:text>
<xsl:value-of select="$lang"/> <xsl:value-of select="$lang"/>
<xsl:text>&#xA;export INPUTRC</xsl:text> <xsl:value-of select="substring-after(string(),'CC]')"/>
<xsl:value-of select="substring-after(string(),'INPUTRC')"/>
<xsl:text>&#xA;</xsl:text> <xsl:text>&#xA;</xsl:text>
</xsl:when> </xsl:when>
<!-- Fixing bootscripts installation -->
<xsl:when test="ancestor::sect1[@id='bootable-bootscripts'] and
string() = 'make install'">
<xsl:text>make install&#xA;</xsl:text>
<xsl:text>cd ../blfs-bootscripts-&blfs-bootscripts-version;&#xA;</xsl:text>
</xsl:when>
<!-- Compile the keymap into the kernel has been dissabled -->
<xsl:when test="contains(string(),'defkeymap')"/>
<!-- Copying the kernel config file --> <!-- Copying the kernel config file -->
<xsl:when test="string() = 'make mrproper'"> <xsl:when test="string() = 'make mrproper'">
<xsl:text>make mrproper&#xA;</xsl:text> <xsl:text>make mrproper&#xA;</xsl:text>
@ -205,6 +191,13 @@
</xsl:when> </xsl:when>
<!-- No interactive commands are needed if the .config file is the proper one --> <!-- No interactive commands are needed if the .config file is the proper one -->
<xsl:when test="string() = 'make menuconfig'"/> <xsl:when test="string() = 'make menuconfig'"/>
<!-- For uClibc we need to set CONFIG_SITE -->
<xsl:when test="contains(string(),'CONFIG_SITE')">
<xsl:value-of select="substring-before(string(),'export')"/>
<xsl:text>echo "export</xsl:text>
<xsl:value-of select="substring-after(string(),'export')"/>
<xsl:text>" &gt;&gt; ~/.bashrc&#xA;</xsl:text>
</xsl:when>
<!-- For uClibc we need to cd to the Gettext package --> <!-- For uClibc we need to cd to the Gettext package -->
<xsl:when test="contains(string(),'cd gettext-runtime/')"> <xsl:when test="contains(string(),'cd gettext-runtime/')">
<xsl:text>cd ../gettext-*/gettext-runtime</xsl:text> <xsl:text>cd ../gettext-*/gettext-runtime</xsl:text>
@ -245,16 +238,17 @@
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:when> </xsl:when>
<!-- Fixing butterfly toolchain test suites run --> <!-- Fixing butterfly toolchain test suite run -->
<xsl:when test="string() = 'make -k check' or string() = 'make check'"> <xsl:when test="ancestor::sect1[@id='ch-system-butterfly-toolchain']
and string() = 'make -k check'">
<xsl:choose> <xsl:choose>
<xsl:when test="$testsuite != '0'"> <xsl:when test="$testsuite != '0'">
<xsl:apply-templates/>
<xsl:choose> <xsl:choose>
<xsl:when test="$bomb-testsuite = 'n'"> <xsl:when test="$bomb-testsuite = 'n'">
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text> <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:apply-templates/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text> <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
<xsl:if test="contains(string(),' -k ')"> <xsl:if test="contains(string(),' -k ')">
<xsl:text> || true</xsl:text> <xsl:text> || true</xsl:text>
@ -266,29 +260,38 @@
</xsl:choose> </xsl:choose>
</xsl:when> </xsl:when>
<!-- Fixing Glbc test suite --> <!-- Fixing Glbc test suite -->
<xsl:when test="contains(string(),'glibc-check-log')"> <xsl:when test="contains(string(),'rm -v configparms') and
contains(string(),'-fno-stack-protector')">
<xsl:choose> <xsl:choose>
<xsl:when test="$testsuite != '0'"> <xsl:when test="$testsuite != '0'">
<xsl:value-of select="substring-before(string(),'&gt; glibc-')"/> <xsl:apply-templates/>
<xsl:choose> <xsl:text>&#xA;</xsl:text>
<xsl:when test="$bomb-testsuite = 'n'">
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
<xsl:if test="contains(string(),' -k ')">
<xsl:text> || true</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when> </xsl:when>
</xsl:choose> </xsl:choose>
</xsl:when> </xsl:when>
<!-- Don't stop on strip run and chapter05 GCC installation test--> <xsl:when test="contains(string(),'glibc-check-log')">
<xsl:when test="contains(string(),'strip ') or <xsl:choose>
ancestor::sect2[@id='testing-gcc'] and <xsl:when test="$testsuite != '0'">
not(contains(string(),'EOF'))"> <xsl:value-of select="substring-before(string(),'2&gt;&amp;1')"/>
<xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
<!-- Fixing Cocoon sanity checks -->
<xsl:when test="contains(string(),'./strcat-overflow')">
<xsl:text>set +e&#xA;</xsl:text>
<xsl:apply-templates/>
<xsl:text>&#xA;set -e&#xA;</xsl:text>
</xsl:when>
<!-- Fixing Butterfly sanity checks -->
<xsl:when test="contains(string(),'./fortify-test')
or contains(string(),'./ssp-test')">
<xsl:text>! </xsl:text>
<xsl:apply-templates/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- Don't stop on strip run -->
<xsl:when test="contains(string(),'strip ')">
<xsl:apply-templates/> <xsl:apply-templates/>
<xsl:text> || true&#xA;</xsl:text> <xsl:text> || true&#xA;</xsl:text>
</xsl:when> </xsl:when>
@ -301,7 +304,8 @@
</xsl:template> </xsl:template>
<xsl:template match="literal"> <xsl:template match="literal">
<xsl:if test="@condition=$model or not(@condition)"> <xsl:if test="(@condition=$model or not(@condition)) and
(@vendor=$kernel or not(@vendor))">
<xsl:apply-templates/> <xsl:apply-templates/>
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>

337
HLFS/master.sh Executable file → Normal file
View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
set -e # Enable error trapping set -e # Enable error trapping
# $Id$ # $Id$
@ -19,7 +19,7 @@ process_toolchain() { # embryo,cocoon and butterfly need special handling
local TC_MountPT local TC_MountPT
local remove_existing local remove_existing
tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'` tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@' -e 's,'$N',,'`
case $tc_phase in case $tc_phase in
embryo | \ embryo | \
cocoon) # Vars for LUSER phase cocoon) # Vars for LUSER phase
@ -93,14 +93,7 @@ chapter3_Makefiles() { # Initialization of the system
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter3 ( SETUP ) ${R_arrow}" echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter3 ( SETUP ) ${R_arrow}"
# Define a few model dependant variables # If $LUSER_HOME is already present in the host, we asume that the
if [[ ${MODEL} = "uclibc" ]]; then
TARGET="pc-linux-gnu"; LOADER="ld-uClibc.so.0"
else
TARGET="pc-linux-gnu"; LOADER="ld-linux.so.2"
fi
# If /home/$LUSER is already present in the host, we asume that the
# hlfs user and group are also presents in the host, and a backup # hlfs user and group are also presents in the host, and a backup
# of their bash init files is made. # of their bash init files is made.
( (
@ -110,55 +103,42 @@ cat << EOF
@mkdir \$(MOUNT_PT)/tools && \\ @mkdir \$(MOUNT_PT)/tools && \\
rm -f /tools && \\ rm -f /tools && \\
ln -s \$(MOUNT_PT)/tools / ln -s \$(MOUNT_PT)/tools /
@if [ ! -d \$(MOUNT_PT)/sources ]; then \\ @\$(call housekeeping)
mkdir \$(MOUNT_PT)/sources; \\
fi;
@chmod a+wt \$(MOUNT_PT)/sources && \\
touch \$@ && \\
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
021-addinguser: 020-creatingtoolsdir 021-addinguser: 020-creatingtoolsdir
@\$(call echo_message, Building) @\$(call echo_message, Building)
@if [ ! -d /home/\$(LUSER) ]; then \\ @if [ ! -d \$(LUSER_HOME) ]; then \\
groupadd \$(LGROUP); \\ groupadd \$(LGROUP); \\
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\ useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
else \\ else \\
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) && \\ chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
chown \$(LUSER) \$(MOUNT_PT)/sources && \\ chmod a+wt \$(SRCSDIR)
touch \$@ && \\ @\$(call housekeeping)
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
022-settingenvironment: 021-addinguser 022-settingenvironment: 021-addinguser
@\$(call echo_message, Building) @\$(call echo_message, Building)
@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\ mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
fi; fi;
@if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ @if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\ mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
fi; fi;
@echo "set +h" > /home/\$(LUSER)/.bashrc && \\ @echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\ echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
echo "HLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\ echo "HLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\ echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\ echo "PATH=/tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
echo "export HLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\ echo "export HLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
echo "" >> /home/\$(LUSER)/.bashrc && \\ echo "" >> \$(LUSER_HOME)/.bashrc && \\
echo "target=$(uname -m)-${TARGET}" >> /home/\$(LUSER)/.bashrc && \\ echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc && \\
echo "ldso=/tools/lib/${LOADER}" >> /home/\$(LUSER)/.bashrc && \\ chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
echo "export target ldso" >> /home/\$(LUSER)/.bashrc && \\
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\
chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
chmod -R a+wt \$(MOUNT_PT) && \\ chmod -R a+wt \$(MOUNT_PT) && \\
touch envars && \\ touch envars && \\
chown \$(LUSER) envars && \\ chown \$(LUSER) envars
touch \$@ && \\ @\$(call housekeeping)
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
chapter3=" 020-creatingtoolsdir 021-addinguser 022-settingenvironment" chapter3=" 020-creatingtoolsdir 021-addinguser 022-settingenvironment"
@ -182,8 +162,6 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
*tcl* ) [[ "$TEST" = "0" ]] && continue; ;; *tcl* ) [[ "$TEST" = "0" ]] && continue; ;;
*expect* ) [[ "$TEST" = "0" ]] && continue; ;; *expect* ) [[ "$TEST" = "0" ]] && continue; ;;
*dejagnu* ) [[ "$TEST" = "0" ]] && continue; ;; *dejagnu* ) [[ "$TEST" = "0" ]] && continue; ;;
# Nothing interestin in this script
*introduction* ) continue ;;
# Test if the stripping phase must be skipped # Test if the stripping phase must be skipped
*stripping* ) [[ "$STRIP" = "n" ]] && continue ;; *stripping* ) [[ "$STRIP" = "n" ]] && continue ;;
*) ;; *) ;;
@ -194,7 +172,7 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
chapter5="$chapter5 $this_script" chapter5="$chapter5 $this_script"
# Grab the name of the target # Grab the name of the target
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'` name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'`
# Adjust 'name' # Adjust 'name'
case $name in case $name in
@ -224,8 +202,11 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
# #
LUSER_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. Fix GCC tarball name for 2.4-branch.
pkg_tarball=$(get_package_tarball_name $name) case $name in
gcc ) pkg_tarball=$(get_package_tarball_name gcc-core) ;;
* ) pkg_tarball=$(get_package_tarball_name $name) ;;
esac
# 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.
@ -262,7 +243,6 @@ chapter6_Makefiles() { # sysroot or chroot build phase
local file local file
local this_script local this_script
# Set envars and scripts for iteration targets # Set envars and scripts for iteration targets
LOGS="" # Start with an empty global LOGS envar
if [[ -z "$1" ]] ; then if [[ -z "$1" ]] ; then
local N="" local N=""
else else
@ -273,16 +253,17 @@ chapter6_Makefiles() { # sysroot or chroot build phase
for script in chapter06$N/* ; do for script in chapter06$N/* ; do
# Overwrite existing symlinks, files, and dirs # Overwrite existing symlinks, files, and dirs
sed -e 's/ln -s /ln -sf /g' \ sed -e 's/ln -s /ln -sf /g' \
-e 's/^mv /&-f/g' -i ${script} -e 's/^mv /&-f /g' \
-e 's/mkdir -v/&p/g' -i ${script}
# Rename the scripts
mv ${script} ${script}$N
done done
# Remove Bzip2 binaries before make install # Remove Bzip2 binaries before make install
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$N
# Fix how Module-Init-Tools do the install target # Fix how Module-Init-Tools do the install target
sed -e 's@make install@make INSTALL=install install@' -i chapter06$N/*-module-init-tools sed -e 's@make install@make INSTALL=install install@' -i chapter06$N/*-module-init-tools$N
# Delete *old Readline libraries just after make install
sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i chapter06$N/*-readline
# Don't readd already existing groups # Don't readd already existing groups
sed -e '/groupadd/d' -i chapter06$N/*-udev sed -e '/groupadd/d' -i chapter06$N/*-udev$N
fi fi
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}" echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}"
@ -298,18 +279,23 @@ chapter6_Makefiles() { # sysroot or chroot build phase
*chroot* ) continue ;; *chroot* ) continue ;;
# Test if the stripping phase must be skipped # Test if the stripping phase must be skipped
*-stripping* ) [[ "$STRIP" = "n" ]] && continue ;; *-stripping* ) [[ "$STRIP" = "n" ]] && continue ;;
# Skip linux-headers in iterative builds
*linux-headers*) [[ -n "$N" ]] && continue ;;
esac esac
# Grab the name of the target # Grab the name of the target
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'` name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's,'$N',,'`
case $name in case $name in
uclibc) name="uClibc" ;; uclibc) name="uClibc" ;;
esac esac
# 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. Fix GCC tarball name for 2.4-branch.
pkg_tarball=$(get_package_tarball_name $name) case $name in
gcc ) pkg_tarball=$(get_package_tarball_name gcc-core) ;;
* ) pkg_tarball=$(get_package_tarball_name $name) ;;
esac
if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
case "${this_script}" in case "${this_script}" in
@ -320,11 +306,10 @@ chapter6_Makefiles() { # sysroot or chroot build phase
# Append each name of the script files to a list (this will become # 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
chapter6="$chapter6 ${this_script}${N}" case "${this_script}" in
*kernfs* ) runasroot=" ${this_script}" ;;
# Append each name of the script files to a list (this will become * ) chapter6="$chapter6 ${this_script}" ;;
# the names of the logs to be moved for each iteration) esac
LOGS="$LOGS ${this_script}"
#--------------------------------------------------------------------# #--------------------------------------------------------------------#
@ -334,44 +319,60 @@ 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
CHROOT_wrt_target "${this_script}${N}" "$PREV" CHROOT_wrt_target "${this_script}" "$PREV"
process_toolchain "${this_script}" "${file}" # Touch timestamp file if installed files logs will be created.
wrt_touch # But only for the firt build when running iterative builds.
PREV=$this_script if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
continue CHROOT_wrt_TouchTimestamp
fi
process_toolchain "${this_script}" "${file}"
if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
CHROOT_wrt_LogNewFiles "$name"
fi
wrt_touch
PREV=$this_script
continue
fi fi
# kernfs is run in SUDO target
CHROOT_wrt_target "${this_script}${N}" "$PREV" case "${this_script}" in
*kernfs* ) LUSER_wrt_target "${this_script}" "$PREV" ;;
* ) CHROOT_wrt_target "${this_script}" "$PREV" ;;
esac
# 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
# 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
CHROOT_Unpack "$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
# 2.4-branch toolchain is ernabled here.
case $name in case $name in
glibc ) [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}" glibc | gcc | binutils)
;; [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}" ;;
* ) [[ "$TEST" > "1" ]] && CHROOT_wrt_test_log "${this_script}" * ) [[ "$TEST" > "1" ]] && CHROOT_wrt_test_log "${this_script}" ;;
;;
esac esac
# 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
# In the mount of kernel filesystems we need to set HLFS and not to use chroot. # In kernfs we need to set HLFS and not to use chroot.
case "${this_script}" in case "${this_script}" in
*kernfs* | *changingowner*) *kernfs* ) wrt_RunAsRoot "${file}" ;;
wrt_RunAsRoot "${this_script}" "${file}" * ) CHROOT_wrt_RunAsRoot "${file}" ;;
;;
*) # The rest of Chapter06
CHROOT_wrt_RunAsRoot "${file}"
;;
esac esac
# #
# Remove the build directory(ies) except if the package build fails. # Write installed files log and remove the build directory(ies)
# except if the package build fails.
if [ "$pkg_tarball" != "" ] ; then if [ "$pkg_tarball" != "" ] ; then
CHROOT_wrt_RemoveBuildDirs "$name" CHROOT_wrt_RemoveBuildDirs "$name"
if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
CHROOT_wrt_LogNewFiles "$name"
fi
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.
@ -382,7 +383,7 @@ chapter6_Makefiles() { # sysroot or chroot build phase
#--------------------------------------------------------------------# #--------------------------------------------------------------------#
# Keep the script file name for Makefile dependencies. # Keep the script file name for Makefile dependencies.
PREV=${this_script}${N} PREV=${this_script}
# Set system_build envar for iteration targets # Set system_build envar for iteration targets
system_build=$chapter6 system_build=$chapter6
done # end for file in chapter06/* done # end for file in chapter06/*
@ -400,19 +401,14 @@ chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..e
# Keep the script file name # Keep the script file name
this_script=`basename $file` this_script=`basename $file`
# Grub must be configured manually.
# The filesystems can't be unmounted via Makefile and the user
# should enter the chroot environment to create the root
# password, edit several files and setup Grub.
case $this_script in case $this_script in
*usage) continue ;; # Contains example commands *grub) continue ;; # Grub must be configured manually.
*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
*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
@ -430,10 +426,21 @@ chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..e
case "${this_script}" in case "${this_script}" in
*bootscripts*) *bootscripts*)
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_TouchTimestamp
fi
CHROOT_Unpack $(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
;; ;;
*kernel)
name="linux"
pkg_tarball=$(get_package_tarball_name $name)
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_TouchTimestamp
fi
CHROOT_Unpack "$pkg_tarball"
;;
esac esac
case "${this_script}" in case "${this_script}" in
@ -456,11 +463,18 @@ chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..e
cat << EOF cat << EOF
@ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\ @ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
rm -r \$(SRC)/\$\$ROOT rm -r \$(SRC)/\$\$ROOT
@rm -r \`cat sources-dir\` && \\ @rm -rf \`cat sources-dir\` && \\
rm sources-dir rm sources-dir
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_LogNewFiles "$name"
fi
;; ;;
*kernel) CHROOT_wrt_RemoveBuildDirs "dummy"
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_LogNewFiles "$name"
fi ;;
esac esac
# 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.
@ -491,43 +505,14 @@ build_Makefile() { # Construct a Makefile from the book scripts
# Add the iterations targets, if needed # Add the iterations targets, if needed
[[ "$COMPARE" = "y" ]] && wrt_compare_targets [[ "$COMPARE" = "y" ]] && wrt_compare_targets
chapter7_Makefiles chapter7_Makefiles
# Add the CUSTOM_TOOLS targets, if needed
[[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
# 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.
( wrt_Makefile_header
cat << EOF
$HEADER
SRC = /sources
MOUNT_PT = $BUILDDIR
PKG_LST = $PKG_LST
LUSER = $LUSER
LGROUP = $LGROUP
SCRIPT_ROOT = $SCRIPT_ROOT
BASEDIR = \$(MOUNT_PT)
SRCSDIR = \$(BASEDIR)/sources
CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands
LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/logs
TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/test-logs
crSRCSDIR = /sources
crCMDSDIR = /\$(SCRIPT_ROOT)/$PROGNAME-commands
crLOGDIR = /\$(SCRIPT_ROOT)/logs
crTESTLOGDIR = /\$(SCRIPT_ROOT)/test-logs
SU_LUSER = su - \$(LUSER) -c
LUSER_HOME = /home/\$(LUSER)
PRT_DU = echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n"
PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) / \`\n"
export PATH := \${PATH}:/usr/sbin
include makefile-functions
EOF
) > $MKFILE
# Add chroot commands # Add chroot commands
CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`" CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
@ -535,7 +520,7 @@ EOF
for file in chapter06/*chroot* ; do for file in chapter06/*chroot* ; do
chroot=`cat $file | \ chroot=`cat $file | \
sed -e "s@chroot@$CHROOT_LOC@" \ sed -e "s@chroot@$CHROOT_LOC@" \
-e '/#!\/bin\/sh/d' \ -e '/#!\/bin\/bash/d' \
-e '/^export/d' \ -e '/^export/d' \
-e '/^logout/d' \ -e '/^logout/d' \
-e 's@ \\\@ @g' | \ -e 's@ \\\@ @g' | \
@ -545,7 +530,8 @@ EOF
-e 's|exit||g' \ -e 's|exit||g' \
-e 's|$| -c|' \ -e 's|$| -c|' \
-e 's|"$$HLFS"|$(MOUNT_PT)|'\ -e 's|"$$HLFS"|$(MOUNT_PT)|'\
-e 's|set -e||'` -e 's|set -e||' \
-e 's|set +h||'`
echo -e "CHROOT$i= $chroot\n" >> $MKFILE echo -e "CHROOT$i= $chroot\n" >> $MKFILE
i=`expr $i + 1` i=`expr $i + 1`
done done
@ -555,8 +541,10 @@ EOF
( (
cat << EOF cat << EOF
all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL
@sudo make do-housekeeping @sudo make do-housekeeping
@echo "$VERSION - jhalfs build" > hlfs-release && \\
sudo install -m444 hlfs-release \$(MOUNT_PT)/etc/hlfs-release
@\$(call echo_finished,$VERSION) @\$(call echo_finished,$VERSION)
ck_UID: ck_UID:
@ -569,12 +557,12 @@ ck_UID:
mk_SETUP: mk_SETUP:
@\$(call echo_SU_request) @\$(call echo_SU_request)
@sudo make SETUP @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
@touch \$@ @touch \$@
mk_LUSER: mk_SETUP mk_LUSER: mk_SETUP
@\$(call echo_SULUSER_request) @\$(call echo_SULUSER_request)
@(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" ) @(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) LUSER" )
@sudo make restore-luser-env @sudo make restore-luser-env
@touch \$@ @touch \$@
@ -583,43 +571,65 @@ mk_SUDO: mk_LUSER
@touch \$@ @touch \$@
mk_CHROOT: mk_SUDO mk_CHROOT: mk_SUDO
@if [ ! -e \$(MOUNT_PT)/bin ]; then \\ @if [ ! -e \$(MOUNT_PT)/dev ]; then \\
mkdir \$(MOUNT_PT)/bin; \\ mkdir \$(MOUNT_PT)/dev && \\
cd \$(MOUNT_PT)/bin && \\ sudo mknod -m 666 \$(MOUNT_PT)/dev/null c 1 3 && \\
ln -sf /tools/bin/bash bash; ln -sf bash sh; \\ sudo mknod -m 600 \$(MOUNT_PT)/dev/console c 5 1 && \\
sudo chown -R 0:0 \$(MOUNT_PT)/bin; \\ sudo chown -R 0:0 \$(MOUNT_PT)/dev; \\
fi; fi;
@sudo sed -e 's|^ln -sv |ln -svf |' -i \$(CMDSDIR)/chapter06/064-createfiles
@\$(call echo_CHROOT_request) @\$(call echo_CHROOT_request)
@( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make CHROOT") @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT")
@touch \$@ @touch \$@
mk_BOOT: mk_CHROOT mk_BOOT: mk_CHROOT
@\$(call echo_CHROOT_request) @\$(call echo_CHROOT_request)
@( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BOOT") @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BOOT")
@touch \$@
mk_CUSTOM_TOOLS: create-sbu_du-report
@if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
\$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
(sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
fi;
@touch \$@
mk_BLFS_TOOL: mk_CUSTOM_TOOLS
@if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
\$(call sh_echo_PHASE,Building BLFS_TOOL); \\
sudo mkdir -p $BUILDDIR$TRACKING_DIR; \\
(sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BLFS_TOOL"); \\
fi;
@touch \$@ @touch \$@
SETUP: $chapter3 SETUP: $chapter3
LUSER: $chapter5
SUDO: $runasroot
CHROOT: SHELL=/tools/bin/bash
CHROOT: $chapter6
BOOT: $chapter7
CUSTOM_TOOLS: $custom_list
BLFS_TOOL: $blfs_tool
LUSER: $chapter5
SUDO: 060-kernfs 062-changingowner
CHROOT: $chapter6
BOOT: $chapter7
create-sbu_du-report: mk_BOOT
@\$(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 \$@
restore-luser-env: restore-luser-env:
@\$(call echo_message, Building) @\$(call echo_message, Building)
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\ mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
fi; fi;
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\ mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
fi; fi;
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\ @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
touch \$@ && \\ touch \$@ && \\
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE) echo --------------------------------------------------------------------------------\$(WHITE)
@ -633,7 +643,7 @@ do-housekeeping:
@-rm /tools @-rm /tools
@-if [ ! -f luser-exist ]; then \\ @-if [ ! -f luser-exist ]; then \\
userdel \$(LUSER); \\ userdel \$(LUSER); \\
rm -rf /home/\$(LUSER); \\ rm -rf \$(LUSER_HOME); \\
fi; fi;
@ -641,21 +651,6 @@ 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

View file

@ -44,8 +44,13 @@
</xsl:template> </xsl:template>
<xsl:template match="sect1"> <xsl:template match="sect1">
<xsl:if test="count(descendant::screen/userinput) &gt; 0 and <xsl:if test="(../@id='chapter-temporary-tools' or
count(descendant::screen/userinput) &gt; count(descendant::screen[@role='nodump'])"> ../@id='chapter-building-system' or
../@id='chapter-bootscripts' or
../@id='chapter-bootable') and
count(descendant::screen/userinput) &gt; 0 and
count(descendant::screen/userinput) &gt;
count(descendant::screen[@role='nodump'])">
<!-- The dirs names --> <!-- The dirs names -->
<xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/> <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
<xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/> <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
@ -75,31 +80,36 @@
<!-- Creating dirs and files --> <!-- Creating dirs and files -->
<exsl:document href="{$dirname}/{$order}-{$filename}" method="text"> <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
<xsl:choose> <xsl:choose>
<xsl:when test="@id='ch-system-changingowner' or <xsl:when test="@id='ch-system-creatingdirs' or
@id='ch-system-creatingdirs' or @id='ch-system-createfiles' or
@id='ch-system-createfiles'">
<xsl:text>#!/tools/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
</xsl:when>
<xsl:when test="@id='ch-tools-stripping' or
@id='ch-system-strippingagain'"> @id='ch-system-strippingagain'">
<xsl:text>#!/bin/sh&#xA;</xsl:text> <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text> <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:if test="not(@id='ch-tools-stripping') and
not(@id='ch-system-strippingagain')">
<xsl:text>set -e&#xA;</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
<xsl:if test="sect2[@role='installation']"> <xsl:if test="sect2[@role='installation']">
<xsl:text>cd $PKGDIR&#xA;</xsl:text> <xsl:text>cd $PKGDIR&#xA;</xsl:text>
<xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'"> <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
<xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text> <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
</xsl:if> </xsl:if>
</xsl:if> </xsl:if>
<xsl:apply-templates select=".//para/userinput | .//screen"/> <xsl:apply-templates select=".//screen"/>
<xsl:if test="$testsuite='3' and @id='ch-tools-glibc'"> <xsl:if test="$testsuite='3' and @id='ch-tools-glibc'">
<xsl:copy-of select="//sect1[@id='ch-system-glibc']/sect2[2]/screen[@role='nodump']"/> <xsl:copy-of select="//userinput[@remap='locale-test']"/>
<xsl:text>&#xA;</xsl:text> <xsl:text>&#xA;</xsl:text>
</xsl:if> </xsl:if>
<xsl:text>exit</xsl:text> <xsl:if test="not(@id='ch-system-chroot') and
not(@id='ch-system-revisedchroot')">
<xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
</xsl:if>
<xsl:text>exit&#xA;</xsl:text>
</exsl:document> </exsl:document>
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>
@ -110,31 +120,6 @@
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>
<xsl:template match="para/userinput">
<xsl:if test="(contains(string(),'test') or
contains(string(),'check')) and
(($testsuite = '2' and
ancestor::chapter[@id='chapter-building-system']) or
$testsuite = '3')">
<xsl:choose>
<xsl:when test="$bomb-testsuite = 'n'">
<xsl:value-of select="substring-before(string(),'make')"/>
<xsl:text>make -k</xsl:text>
<xsl:value-of select="substring-after(string(),'make')"/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
<xsl:if test="contains(string(),' -k ')">
<xsl:text> || true</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template match="userinput" mode="screen"> <xsl:template match="userinput" mode="screen">
<xsl:choose> <xsl:choose>
<!-- Estandarized package formats --> <!-- Estandarized package formats -->
@ -171,18 +156,20 @@
<xsl:text>make mrproper&#xA;</xsl:text> <xsl:text>make mrproper&#xA;</xsl:text>
<xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text> <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
</xsl:when> </xsl:when>
<!-- The Coreutils and Module-Init-Tools test suites are optional --> <!-- The Bash, Coreutils, and Module-Init-Tools test suites are optional -->
<xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
ancestor::sect1[@id='ch-system-module-init-tools']) and ancestor::sect1[@id='ch-system-bash'] or
(contains(string(),'check') or ancestor::sect1[@id='ch-system-module-init-tools'])
contains(string(),'dummy'))"> and @remap = 'test'">
<xsl:choose> <xsl:choose>
<xsl:when test="$testsuite = '0' or $testsuite = '1'"/> <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
<xsl:otherwise> <xsl:otherwise>
<xsl:if test="not(contains(string(),'check'))"> <xsl:if test="not(contains(string(),'check')) and
not(contains(string(),'make tests'))">
<xsl:apply-templates/> <xsl:apply-templates/>
<xsl:text>&#xA;</xsl:text> <xsl:text>&#xA;</xsl:text>
</xsl:if> </xsl:if>
<!-- Coreutils and Module-Init-Tools -->
<xsl:if test="contains(string(),'check')"> <xsl:if test="contains(string(),'check')">
<xsl:choose> <xsl:choose>
<xsl:when test="$bomb-testsuite = 'n'"> <xsl:when test="$bomb-testsuite = 'n'">
@ -201,12 +188,35 @@
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:if> </xsl:if>
<!-- Bash -->
<xsl:if test="contains(string(),'make tests')">
<xsl:choose>
<xsl:when test="$bomb-testsuite = 'n'">
<xsl:value-of select="substring-before(string(),'tests')"/>
<xsl:text>-k tests</xsl:text>
<xsl:value-of select="substring-after(string(),'tests')"/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
<xsl:if test="contains(string(),' -k ')">
<xsl:text> || true</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:when> </xsl:when>
<!-- Fixing toolchain test suites run --> <!-- Fixing toolchain test suites run -->
<xsl:when test="string() = 'make check' or <xsl:when test="(string() = 'make check' or
string() = 'make -k check'"> string() = 'make -k check') and
(ancestor::sect1[@id='ch-system-gcc'] or
ancestor::sect1[@id='ch-system-glibc'] or
ancestor::sect1[@id='ch-system-binutils'] or
ancestor::sect1[@id='ch-tools-gcc-pass2'])">
<xsl:choose> <xsl:choose>
<xsl:when test="(($testsuite = '1' or $testsuite = '2') and <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
ancestor::chapter[@id='chapter-building-system']) or ancestor::chapter[@id='chapter-building-system']) or
@ -246,6 +256,36 @@
</xsl:when> </xsl:when>
</xsl:choose> </xsl:choose>
</xsl:when> </xsl:when>
<!-- The rest of testsuites -->
<xsl:when test="@remap = 'test'">
<xsl:choose>
<xsl:when test="$testsuite = '0'"/>
<xsl:when test="$testsuite = '1' and
not(ancestor::sect1[@id='ch-system-gcc']) and
not(ancestor::sect1[@id='ch-system-glibc']) and
not(ancestor::sect1[@id='ch-system-binutils'])"/>
<xsl:when test="$testsuite = '2' and
ancestor::chapter[@id='chapter-temporary-tools']"/>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$bomb-testsuite = 'n'">
<xsl:value-of select="substring-before(string(),'make')"/>
<xsl:text>make -k</xsl:text>
<xsl:value-of select="substring-after(string(),'make')"/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
<xsl:if test="contains(string(),' -k ')">
<xsl:text> || true</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- Don't stop on strip run --> <!-- Don't stop on strip run -->
<xsl:when test="contains(string(),'strip ')"> <xsl:when test="contains(string(),'strip ')">
<xsl:apply-templates/> <xsl:apply-templates/>

299
LFS/master.sh Executable file → Normal file
View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# $Id$ # $Id$
@ -15,7 +15,7 @@ chapter4_Makefiles() { #
#----------------------------# #----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4 ( SETUP ) ${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 $LUSER_HOME 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
# of their bash init files is made. # of their bash init files is made.
( (
@ -24,47 +24,41 @@ chapter4_Makefiles() { #
@\$(call echo_message, Building) @\$(call echo_message, Building)
@mkdir \$(MOUNT_PT)/tools && \\ @mkdir \$(MOUNT_PT)/tools && \\
rm -f /tools && \\ rm -f /tools && \\
ln -s \$(MOUNT_PT)/tools / && \\ ln -s \$(MOUNT_PT)/tools /
touch \$@ && \\ @\$(call housekeeping)
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
021-addinguser: 020-creatingtoolsdir 021-addinguser: 020-creatingtoolsdir
@\$(call echo_message, Building) @\$(call echo_message, Building)
@if [ ! -d /home/\$(LUSER) ]; then \\ @if [ ! -d \$(LUSER_HOME) ]; then \\
groupadd \$(LGROUP); \\ groupadd \$(LGROUP); \\
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\ useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
else \\ else \\
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) && \\ chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
chmod -R a+wt \$(MOUNT_PT) && \\ chmod a+wt \$(SRCSDIR)
touch \$@ && \\ @\$(call housekeeping)
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
022-settingenvironment: 021-addinguser 022-settingenvironment: 021-addinguser
@\$(call echo_message, Building) @\$(call echo_message, Building)
@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\ mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
fi; fi;
@if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ @if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\ mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
fi; fi;
@echo "set +h" > /home/\$(LUSER)/.bashrc && \\ @echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\ echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
echo "LFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\ echo "LFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\ echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\ echo "PATH=/tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
echo "export LFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\ echo "export LFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\ echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc && \\
chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\ chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
touch envars && \\ touch envars && \\
chown \$(LUSER) envars && \\ chown \$(LUSER) envars
touch \$@ && \\ @\$(call housekeeping)
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
EOF EOF
) > $MKFILE.tmp ) > $MKFILE.tmp
@ -95,11 +89,11 @@ 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
# DO NOT append the changingowner script. # DO NOT append the changingowner script, it need be run as root.
# A hack is necessary: create script in chap5 BUT run as a dependency for # A hack is necessary: create script in chap5 BUT run as a dependency for
# chap6 CHROOT # SUDO target
case "${this_script}" in case "${this_script}" in
*changingowner) : ;; *changingowner) runasroot="$runasroot ${this_script}" ;;
*) chapter5="$chapter5 ${this_script}" ;; *) chapter5="$chapter5 ${this_script}" ;;
esac esac
@ -136,7 +130,7 @@ chapter5_Makefiles() {
# 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.
# 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 "$file" ;;
*) LUSER_wrt_RunAsUser "$file" ;; *) LUSER_wrt_RunAsUser "$file" ;;
esac esac
@ -165,7 +159,6 @@ chapter6_Makefiles() {
#----------------------------# #----------------------------#
# Set envars and scripts for iteration targets # Set envars and scripts for iteration targets
LOGS="" # Start with an empty global LOGS envar
if [[ -z "$1" ]] ; then if [[ -z "$1" ]] ; then
local N="" local N=""
else else
@ -178,9 +171,11 @@ chapter6_Makefiles() {
sed -e 's/ln -sv/&f/g' \ sed -e 's/ln -sv/&f/g' \
-e 's/mv -v/&f/g' \ -e 's/mv -v/&f/g' \
-e 's/mkdir -v/&p/g' -i ${script} -e 's/mkdir -v/&p/g' -i ${script}
# Rename the scripts
mv ${script} ${script}$N
done done
# Remove Bzip2 binaries before make install # Remove Bzip2 binaries before make install (LFS-6.2 compatibility)
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$N
fi fi
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}" echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}"
@ -191,13 +186,15 @@ chapter6_Makefiles() {
# We'll run the chroot commands differently than the others, so skip them in the # We'll run the chroot commands differently than the others, so skip them in the
# dependencies and target creation. # dependencies and target creation.
# Skip also linux-headers in iterative builds.
case "${this_script}" in case "${this_script}" in
*chroot) continue ;; *chroot) continue ;;
*stripping*) [[ "${STRIP}" = "n" ]] && continue ;; *stripping*) [[ "${STRIP}" = "n" ]] && continue ;;
*linux-headers*) [[ -n "$N" ]] && continue ;;
esac esac
# Grab the name of the target # Grab the name of the target.
name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@'` name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' -e 's,'$N',,'`
# 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. We need this here to can skip scripts not needed for # a specific package. We need this here to can skip scripts not needed for
@ -213,11 +210,11 @@ chapter6_Makefiles() {
# Append each name of the script files to a list (this will become # 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)
chapter6="$chapter6 ${this_script}${N}" # The kernfs script must be run as part of SUDO target.
case "${this_script}" in
# Append each name of the script files to a list (this will become *kernfs) runasroot="$runasroot ${this_script}" ;;
# the names of the logs to be moved for each iteration) *) chapter6="$chapter6 ${this_script}" ;;
LOGS="$LOGS ${this_script}" esac
#--------------------------------------------------------------------# #--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
@ -225,11 +222,21 @@ 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.
CHROOT_wrt_target "${this_script}${N}" "$PREV" # In the mount of kernel filesystems we need to set LFS
# and not to use chroot.
case "${this_script}" in
*kernfs) LUSER_wrt_target "${this_script}" "$PREV" ;;
*) CHROOT_wrt_target "${this_script}" "$PREV" ;;
esac
# 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
# 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
CHROOT_Unpack "$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
@ -247,13 +254,17 @@ chapter6_Makefiles() {
# In the mount of kernel filesystems we need to set LFS # In the mount of kernel filesystems we need to set LFS
# 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 "$file" ;;
*) CHROOT_wrt_RunAsRoot "$file" ;; *) CHROOT_wrt_RunAsRoot "$file" ;;
esac esac
# Remove the build directory(ies) except if the package build fails. # Write installed files log and remove the build directory(ies)
# except if the package build fails.
if [ "$pkg_tarball" != "" ] ; then if [ "$pkg_tarball" != "" ] ; then
CHROOT_wrt_RemoveBuildDirs "$name" CHROOT_wrt_RemoveBuildDirs "$name"
if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
CHROOT_wrt_LogNewFiles "$name"
fi
fi fi
# Include a touch of the target name so make can check # Include a touch of the target name so make can check
@ -265,32 +276,26 @@ chapter6_Makefiles() {
#--------------------------------------------------------------------# #--------------------------------------------------------------------#
# Keep the script file name for Makefile dependencies. # Keep the script file name for Makefile dependencies.
PREV=${this_script}${N} PREV=${this_script}
# Set system_build envar for iteration targets # Set system_build envar for iteration targets
system_build=$chapter6 system_build=$chapter6
done # end for file in chapter06/* done # end for file in chapter06/*
} }
#----------------------------# #----------------------------#
chapter789_Makefiles() { chapter78_Makefiles() {
#----------------------------# #----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8/9 ( BOOT ) ${R_arrow}" echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8 ( BOOT ) ${R_arrow}"
for file in chapter0{7,8,9}/* ; do for file in chapter0{7,8}/* ; do
# Keep the script file name # Keep the script file name
this_script=`basename $file` this_script=`basename $file`
# Grub must be configured manually. # Grub must be configured manually.
# The filesystems can't be unmounted via Makefile and the user # Handle fstab creation.
# should enter the chroot environment to create the root
# password, edit several files and setup Grub.
#
# If no .config file is supplied, the kernel build is skipped # If no .config file is supplied, the kernel build is skipped
#
case ${this_script} in case ${this_script} in
*grub) continue ;; *grub) continue ;;
*reboot) continue ;;
*console) continue ;; # Use the file generated by lfs-bootscripts
*fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;; *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 ;;
@ -298,7 +303,7 @@ chapter789_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
chapter789="$chapter789 ${this_script}" chapter78="$chapter78 ${this_script}"
#--------------------------------------------------------------------# #--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
@ -313,11 +318,17 @@ chapter789_Makefiles() {
*bootscripts) *bootscripts)
name="lfs-bootscripts" name="lfs-bootscripts"
pkg_tarball=$(get_package_tarball_name $name) pkg_tarball=$(get_package_tarball_name $name)
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_TouchTimestamp
fi
CHROOT_Unpack "$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)
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_TouchTimestamp
fi
CHROOT_Unpack "$pkg_tarball" CHROOT_Unpack "$pkg_tarball"
;; ;;
esac esac
@ -335,8 +346,14 @@ chapter789_Makefiles() {
esac esac
case "${this_script}" in case "${this_script}" in
*bootscripts) CHROOT_wrt_RemoveBuildDirs "dummy" ;; *bootscripts) CHROOT_wrt_RemoveBuildDirs "dummy"
*kernel) CHROOT_wrt_RemoveBuildDirs "dummy" ;; if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_LogNewFiles "$name"
fi ;;
*kernel) CHROOT_wrt_RemoveBuildDirs "dummy"
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_LogNewFiles "$name"
fi ;;
esac esac
# Include a touch of the target name so make can check # Include a touch of the target name so make can check
@ -349,7 +366,7 @@ chapter789_Makefiles() {
# Keep the script file name for Makefile dependencies. # Keep the script file name for Makefile dependencies.
PREV=${this_script} PREV=${this_script}
done # for file in chapter0{7,8,9}/* done # for file in chapter0{7,8}/*
} }
@ -371,46 +388,15 @@ build_Makefile() { #
chapter6_Makefiles chapter6_Makefiles
# Add the iterations targets, if needed # Add the iterations targets, if needed
[[ "$COMPARE" = "y" ]] && wrt_compare_targets [[ "$COMPARE" = "y" ]] && wrt_compare_targets
chapter789_Makefiles chapter78_Makefiles
# Add the CUSTOM_TOOLS targets, if needed
[[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
# Add the BLFS_TOOL targets, if needed # Add the BLFS_TOOL targets, if needed
[[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets [[ "$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.
( wrt_Makefile_header
cat << EOF
$HEADER
SRC = /sources
MOUNT_PT = $BUILDDIR
PKG_LST = $PKG_LST
LUSER = $LUSER
LGROUP = $LGROUP
SCRIPT_ROOT = $SCRIPT_ROOT
BASEDIR = \$(MOUNT_PT)
SRCSDIR = \$(BASEDIR)/sources
CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands
LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/logs
TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/test-logs
crSRCSDIR = /sources
crCMDSDIR = /\$(SCRIPT_ROOT)/$PROGNAME-commands
crLOGDIR = /\$(SCRIPT_ROOT)/logs
crTESTLOGDIR = /\$(SCRIPT_ROOT)/test-logs
SU_LUSER = su - \$(LUSER) -c
LUSER_HOME = /home/\$(LUSER)
PRT_DU = 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
EOF
) > $MKFILE
# Add chroot commands # Add chroot commands
CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`" CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
@ -418,7 +404,7 @@ EOF
for file in chapter06/*chroot* ; do for file in chapter06/*chroot* ; do
chroot=`cat $file | \ chroot=`cat $file | \
sed -e "s@chroot@$CHROOT_LOC@" \ sed -e "s@chroot@$CHROOT_LOC@" \
-e '/#!\/bin\/sh/d' \ -e '/#!\/bin\/bash/d' \
-e 's@ \\\@ @g' | \ -e 's@ \\\@ @g' | \
tr -d '\n' | \ tr -d '\n' | \
sed -e 's/ */ /g' \ sed -e 's/ */ /g' \
@ -426,7 +412,8 @@ EOF
-e 's|exit||g' \ -e 's|exit||g' \
-e 's|$| -c|' \ -e 's|$| -c|' \
-e 's|"$$LFS"|$(MOUNT_PT)|' \ -e 's|"$$LFS"|$(MOUNT_PT)|' \
-e 's|set -e||'` -e 's|set -e||' \
-e 's|set +h||'`
echo -e "CHROOT$i= $chroot\n" >> $MKFILE echo -e "CHROOT$i= $chroot\n" >> $MKFILE
i=`expr $i + 1` i=`expr $i + 1`
done done
@ -436,8 +423,10 @@ EOF
( (
cat << EOF cat << EOF
all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL
@sudo make do_housekeeping @sudo make do_housekeeping
@echo "$VERSION - jhalfs build" > lfs-release && \\
sudo mv lfs-release \$(MOUNT_PT)/etc
@\$(call echo_finished,$VERSION) @\$(call echo_finished,$VERSION)
ck_UID: ck_UID:
@ -450,66 +439,74 @@ ck_UID:
mk_SETUP: mk_SETUP:
@\$(call echo_SU_request) @\$(call echo_SU_request)
@sudo make SETUP @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
@touch \$@ @touch \$@
mk_LUSER: mk_SETUP mk_LUSER: mk_SETUP
@\$(call echo_SULUSER_request) @\$(call echo_SULUSER_request)
@( sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" ) @( sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) LUSER" )
@sudo make restore-luser-env @sudo make restore-luser-env
@touch \$@ @touch \$@
mk_SUDO: mk_LUSER mk_SUDO: mk_LUSER
@sudo make SUDO @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
touch \$@ @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 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) @\$(call echo_CHROOT_request)
@( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make CHROOT") @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT")
@touch \$@ @touch \$@
mk_BOOT: mk_CHROOT mk_BOOT: mk_CHROOT
@\$(call echo_CHROOT_request) @\$(call echo_CHROOT_request)
@( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BOOT") @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BOOT")
@touch \$@
mk_CUSTOM_TOOLS: create-sbu_du-report
@if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
\$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
(sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
fi;
@touch \$@
mk_BLFS_TOOL: mk_CUSTOM_TOOLS
@if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
\$(call sh_echo_PHASE,Building BLFS_TOOL); \\
sudo mkdir -p $BUILDDIR$TRACKING_DIR; \\
(sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BLFS_TOOL"); \\
fi;
@touch \$@ @touch \$@
SETUP: $chapter4 SETUP: $chapter4
LUSER: $chapter5
SUDO: $runasroot
CHROOT: SHELL=/tools/bin/bash
CHROOT: $chapter6
BOOT: $chapter78
CUSTOM_TOOLS: $custom_list
BLFS_TOOL: $blfs_tool
LUSER: $chapter5
SUDO: 057-changingowner 059-kernfs
CHROOT: $chapter6
BOOT: $chapter789
create-sbu_du-report: mk_BOOT
@\$(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 \$@
restore-luser-env: restore-luser-env:
@\$(call echo_message, Building) @\$(call echo_message, Building)
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\ mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
fi; fi;
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\ mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
fi; fi;
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\ @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash*
touch \$@ && \\ @\$(call housekeeping)
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
do_housekeeping: do_housekeeping:
@-umount \$(MOUNT_PT)/sys @-umount \$(MOUNT_PT)/sys
@ -520,45 +517,13 @@ do_housekeeping:
@-rm /tools @-rm /tools
@-if [ ! -f luser-exist ]; then \\ @-if [ ! -f luser-exist ]; then \\
userdel \$(LUSER); \\ userdel \$(LUSER); \\
rm -rf /home/\$(LUSER); \\ rm -rf \$(LUSER_HOME); \\
fi; fi;
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 -p $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

340
LICENSE Normal file
View file

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

55
README
View file

@ -24,6 +24,9 @@ $Id$
configuration of the uClibc package when building a HLFS system using configuration of the uClibc package when building a HLFS system using
uClibc rather than glibc. uClibc rather than glibc.
*. Read carefully this file and the other README.* files before start
using the tool.
2. PREREQUISITES:: 2. PREREQUISITES::
To use this tool you MUST: To use this tool you MUST:
@ -43,23 +46,17 @@ $Id$
4. CONFIGURATION:: 4. CONFIGURATION::
::NEWS::
There is a new configuration method for jhalfs.
We have installed the familiar menu based configuration tool driven by We have installed the familiar menu based configuration tool driven by
GNU make. see the section RUNNING, for details GNU make. see the section RUNNING, for details
5. RUNNING:: 5. RUNNING::
::NEWS::
jhalfs is now launched via GNU make instead of individual symlinks.
The command <make> will launch a menu based configuration program. You will The command <make> will launch a menu based configuration program. You will
recognize the layout from building the kernel or uClibc/BusyBox. The recognize the layout from building the kernel or uClibc/BusyBox. The
underlying menu code was borrowed from BusyBox and slightly modified for underlying menu code was borrowed from BusyBox and slightly modified for
our use. our use.
Help on parameter function is available from the online help. Please Help on parameter function is available from the on-line help. Please
make use of that feature for additional information not in this file. make use of that feature for additional information not in this file.
Once you have set the parameters you wish and have saved your work the Once you have set the parameters you wish and have saved your work the
@ -81,7 +78,16 @@ $Id$
6. BLFS_TOOL SUPPORT:: 6. BLFS_TOOL SUPPORT::
For books that support it, there is an option to install blfs-tool and its For books that support it, there is an option to install blfs-tool and its
dependendencies on the final system. dependencies on the final system. The pre-made build dependencies
scripts has been written based on a LFS build. For CLFS and HLFS
builds you may need to adjust that scripts, that are found into the
common/blfs-tool-deps directory in the jhalfs sources tree.
WARNING:: If you add blfs-tool support on a CLFS Sysroot build
you MUST to edit the dependencies scripts to fix the
installation paths.
Be careful when you modify the scripts as you can
easily disable the host system.
After booting the new xLFS system some steps are needed to finish After booting the new xLFS system some steps are needed to finish
blfs-tool installation: blfs-tool installation:
@ -95,6 +101,9 @@ $Id$
- Give the user read and write privileges over the $TRACKING_DIR - Give the user read and write privileges over the $TRACKING_DIR
directory and the files that it contains. directory and the files that it contains.
- If you think that you may need the libxml2/libxslt Python modules,
remove the libxml2 and libxslt trackin files found in $TRACKING_DIR.
- Configure sudo, adding the needed privileges for the user. - Configure sudo, adding the needed privileges for the user.
We assume that blfs-tool will be used on a running fresh xLFS system. We assume that blfs-tool will be used on a running fresh xLFS system.
@ -113,6 +122,9 @@ $Id$
/CLFS2/master.sh /CLFS2/master.sh
/clfs2.xsl /clfs2.xsl
/CLFS3/master.sh
/clfs3.xsl
/HLFS/master.sh /HLFS/master.sh
/hlfs.xsl /hlfs.xsl
@ -121,16 +133,17 @@ $Id$
/common/common_functions /common/common_functions
/makefile_functions /makefile_functions
/func_check_versions.sh
/func_validate_configs.sh
/packages.xsl /packages.xsl
/urls.xsl /urls.xsl
/create-sbu_du-report.sh /create-sbu_du-report.sh
/func_compare.sh
/progress_bar.sh /progress_bar.sh
/blfs-tool-deps/9xx-* /blfs-tool-deps/9xx-*
/libs/func_*
/contrib/jhalfs-paco.patch /custom/template
/config/
/examples/*
/examples_CLFS-E/*
/extras/do_copy_files /extras/do_copy_files
/do_ica_prep /do_ica_prep
@ -151,8 +164,9 @@ $Id$
README README
README.BLFS README.BLFS
README.CLFS
README.HLFS README.HLFS
README.PACO README.CUSTOM
TODO TODO
LICENSE LICENSE
@ -217,7 +231,7 @@ $Id$
Q. "What is the function of "User account" and "Group account" menu settings?" Q. "What is the function of "User account" and "Group account" menu settings?"
A. If you are running jhalfs from a low or non-privileged account you may not A. If you are running jhalfs from a low or non-privileged account you may not
have the priv to create/delete the user needed to build temporally tools. have the priv to create/delete the user needed to build temporary tools.
These settings allow you to use your own user and group name to do that These settings allow you to use your own user and group name to do that
build steps. build steps.
@ -244,6 +258,19 @@ $Id$
understanding of host/target hardware combination. Please read the book understanding of host/target hardware combination. Please read the book
carefully and don't skip the easy parts (there are none..) carefully and don't skip the easy parts (there are none..)
Q. "How could I stop the build at a predefined chosen point?"
A. Launch the Makefile manually passing the last numbered target to be build
as the break point. For example:
make BREAKPOINT=84-bash
The build can be stopped also at the end of a top-level build phase by
calling directly the appropriate mk_* target. For example:
make mk_LUSER
See the Makefile to know the proper target names for that book build.
Authors: Authors:
George Boudreau George Boudreau
Manuel Canales Esparcia Manuel Canales Esparcia

View file

@ -2,22 +2,25 @@ $Id$
1. INTRODUCTION:: 1. INTRODUCTION::
To automatize packages build from the BLFS book instructions is a huge If you want to add blfs-tool support into a xLFS base system build,
task. The BLFS book isn't linear, some package pages need to use a non read the "BLFS_TOOL SUPPORT" section found in the README and be sure
default layout, there are circular dependencies, several packages can be to follow the after-booting installation intructions.
installed on a non default prefix, build commands can change based on what
dependencies will be used, etc.
Said that, the goal of blfs-tool is try to help you solving packages To automate package builds from the BLFS book instructions is a huge
dependencies and creating your own build scripts and Makefile. Few of the task. Some of the issues are: the BLFS book isn't linear; some package
auto-generated build scripts and Makefile could work "as is", thus as a pages use a custom layout; there are circular dependencies; several
general rule you will need to review and edit the scripts while reading packages can be installed on a non-default prefix; build commands can
the book. change based on what dependencies will be used, etc.
That being said, the goal of the blfs-tool is to help you solve package
dependencies, create build scripts and a Makefile. Few of the auto-generated
build scripts and Makefile will work "as is", thus, as a general rule,
you will need to review and edit the scripts while reading the book.
2. PREREQUISITES:: 2. PREREQUISITES::
To use this tool you MUST to: To use this tool you MUST:
- have experience building BLFS packages - have experience building BLFS packages
- know how to edit and write shell scripts - know how to edit and write shell scripts
@ -30,20 +33,21 @@ $Id$
3. USAGE:: 3. USAGE::
Due the complexity of the BLFS book, the scripts and Makefile generation is Due the complexity of the BLFS book, the scripts and Makefile generation
done in several steps: is done in several steps:
3.1 INSTALLED PACKAGES TRACKING SYSTEM 3.1 INSTALLED PACKAGES TRACKING SYSTEM
This tool includes a very simple tracking system to know what packages This tool includes a very simple tracking system to log which packages
has been installed using the tool. It is used to skip installed packages have been installed using the tool. It is used to skip installed packages
from target selection menu and to know if an installed package has been updated from target selection menu and to test if an installed package has been
on the BLFS book. Don't rely on this feature as a packages management tool. updated in the BLFS book. Do not rely on this feature as a package
management tool.
The directory where tracking files will be stored need be created The directory where tracking files will be stored needs to be created
before installing blfs-tool. You can place that directory anywhere, taking before installing blfs-tool. You can place this directory anywhere, taking
care that the builder user must have read and write privileges on that care that the user must have read and write privileges on that directory
directory and on all files it contains. and on all files it contains.
To use the default path set in the installation menu, run as root: To use the default path set in the installation menu, run as root:
@ -52,12 +56,12 @@ $Id$
3.2 BLFS_TOOL INSTALLATION:: 3.2 BLFS_TOOL INSTALLATION::
Run "make" to launch the jhalfs menuconfig interface. Select the BLFS Run "make" to launch the jhalfs menuconfig interface. Select the BLFS
book and it version. Then set the installation directory (default book and version. Then set the installation directory (default
$HOME/blfs_root), the BLFS sources directory (default blfs-xml), and $HOME/blfs_root), the BLFS sources directory (default blfs-xml), and
the installed packages tracking directory (default /var/lib/jhalfs/BLFS). the installed packages tracking directory (default /var/lib/jhalfs/BLFS).
All required files will be placed in the installation directory and All required files will be placed in the installation directory and
BLFS XML sources will be checkout to the named sub-directory. BLFS XML sources will be installed in the named sub-directory.
Installed files: Installed files:
@ -70,9 +74,9 @@ $Id$
update_book.sh update the XML book sources and regenerates packages update_book.sh update the XML book sources and regenerates packages
database and meta-packages dependencies tree database and meta-packages dependencies tree
gen_config.sh regenerates Config.in gen_config.sh regenerates Config.in
gen_pkg_book.sh solve dependencies and generates linear BLFS books gen_pkg_book.sh resolves dependencies and generates linear BLFS books
and build scripts and build scripts
gen-makefile.sh generates target Makefile gen-makefile.sh generates the target Makefile
progress_bar.sh the target Makefile progress bar progress_bar.sh the target Makefile progress bar
Makefile run gen_config.sh to update Config.in, Makefile run gen_config.sh to update Config.in,
then launch the menuconfig interface, and lastly run then launch the menuconfig interface, and lastly run
@ -89,180 +93,148 @@ $Id$
3.3 UPDATING BOOK SOURCES:: 3.3 UPDATING BOOK SOURCES::
If using the development book version, and if you want to update already If you are using the development book version and you want to update
installed packages to the new version found in that book, you need to update installed packages to the latest version found in that book, you need to
the XML sources and packages database. update the XML sources and packages database.
To do that run "./update_book.sh" To do that run "./update_book.sh"
On the next configuration run, packages already installed but listed On the next configuration run, packages already installed but listed
with a new version in the book will be available for target selection and with a new version in the book will be available for target selection
used to solve dependencies. and used to solve dependencies.
3.4 CONFIGURING AND PARSING THE BOOK:: 3.4 CONFIGURING AND PARSING THE BOOK::
Next step is to create a book and build scripts in dependencies build order The next step is to create a book and build scripts in dependency
for a target package. A target can be a package or a meta-package. build order for a target package. A target can be a package or a
meta-package.
WARNING: WARNING:
Only one target (meta-package or individual package) must be Only one target (meta-package or individual package) must be
selected on each configuration run. selected on each configuration run.
That is due that there is no way to solve dependencies properly There is no way to solve dependencies properly when more
when more than one target are selected at the same time. than one target are selected.
Run <make> to launch the configuration interface. The main menu contains Run <make> to launch the configuration interface. The main menu contains
three block: meta-package selection, individual package selection, and three blocks: meta-package selection, individual package selection, and
build options. build options.
When a meta-package is selected is possible to unselect unwanted components. When a meta-package is selected, it is possible to unselect unwanted
That unselected components will be skipped if no other components depends components. The unselected components will be skipped if no other components
on them. depends on them.
In the build options section the dependencies level and default packages In the build options section, the dependencies level and default packages
used to solve alternatives are set. Can be set also if the build will be used to solve alternatives are set. You can also select whether the build will
made as a normal user or as root. That settings are saved to be reused on be made as a normal user or as root. That settings are saved to be reused in
future configuration runs. future configuration runs.
If, for example, your target selection is Xsoft-->Graphweb-->galeon a If, for example, your target selection is Xsoft-->Graphweb-->galeon, a
directory named "galeon" will be created. Inside that directory you will directory named "galeon" will be created. Inside that directory you will
find a directory named "HTML" that contains a galeon-based HTML book with find a directory named "HTML" that contains a galeon-based HTML book with
its dependencies in build order, and a "scripts" directory with build its dependencies in build order, and a "scripts" directory with build
scripts for that packages. scripts for that packages.
There is also two other directories, "dependencies" and "xincludes", that There are also two other directories ("dependencies" and "xincludes")
contains files generated while resolving dependencies trees. that contain files generated while resolving dependencies trees.
3.5 EDITING BUILD SCRIPTS 3.5 EDITING BUILD SCRIPTS
Now is time to review the generated book and scripts, making in the Now it is time to review the generated book and scripts, making any changes
scripts any changes required to fix generation bugs or to fit your needs. to the scripts necessary to fix generation bugs or to suit your needs.
Scripts for additional packages (i.e., for non-BLFS packages) can be Scripts for additional packages (i.e., for non-BLFS packages) can be
inserted in an easy way due how the scripts are named. For example, if you easily inserted. For example, if you want to install the external dependency
want to install the external dependency "bar" before "foo" package and the "bar" before "foo" package and the "foo" script is named "064-z-foo", you
"foo" script is named "064-z-foo", you need to create a "064-y-bar" build need to create a "064-y-bar" build script.
script.
Remember that the packages tracking system isn't a packages management tool Remember, the package tracking system isn't a package management tool
and know nothing about packages not in the BLFS book. and knows nothing about packages not in the BLFS book.
Also, review and edit envars.conf. That file is used to set global envars Also, review and edit envars.conf. This file is used to set global envars
needed by the build scripts. needed by the build scripts.
3.6 CREATING THE MAKEFILE 3.6 CREATING THE MAKEFILE
When the build scripts are ready to be run, the Makefile can be When the build scripts are ready to be run, the Makefile can be
created. Be sure that you cd into the "package" directory and run created. Be sure that you cd into the "package" directory and run
../gen-makefile.sh
../gen_makefile.sh Review the Makefile, and, if all looks sane, start the build.
Review the Makefile and if all looks sane, start the build.
4. GENERATED BUILD SCRIPTS ISSUES:: 4. GENERATED BUILD SCRIPTS ISSUES::
In this section known issues with the generated build scripts are In this section, known issues with the generated build scripts are
discussed. They are due build procedures and/or BLFS layout particularities discussed. They are due to build procedures and/or BLFS layout particularities
than we can't handle. In several cases editing the build scripts is mandatory. that we can't handle. In several cases, editing the build scripts is mandatory.
You may need also to insert some build script created by you to resolve You may also need to insert some build scripts created by you to resolve
unhandled dependencies and/or to remove some script installing the affected unhandled dependencies and/or to remove some script installing the affected
package by hand. package by hand.
4.1 BLFS BOOTSCRIPTS 4.1 BLFS BOOTSCRIPTS
For now, bootscripts installation will fail. You will need to edit the For now, bootscripts installation will fail. You will need to edit
scripts for packages that install bootscripts and fix their installation the scripts for packages that install bootscripts and fix their
command. That could be fixed in the future, but not sure. installation command. That could be fixed in the future.
4.2 PACKAGES CONFIGURATION 4.2 PACKAGE CONFIGURATION
For that packages that have a "Configuration" section, you should to For those packages that have a "Configuration" section, you should
edit it build script to fit the configuration to your needs. edit the build script to fit the needs of your system.
4.4 PDL and Perl modules. 4.4 PDL, Perl modules, and Glib-Bindings.
The generated scripts for that packages are plainly broken and can't The generated scripts for these packages are broken and can not
be fixed. You must to replace it by your own ones or install that be fixed. You must rename it as the sub-package to be installed and
packages by hand. edit it to use the proper commads for that sub-package.
4.4 GCC, JDK, Sane, and KDE-multimedia You may need to create additional scripts for these sub-package
dependencies, if any.
On the pages for that packages, the BLFS book actually have instructions 4.4 GCC, JDK, Sane, and KDE-multimedia, freetype2, MesaLib and others
to install two packages. You must to edit the scripts to fix it. We will
try to fix some of them, but may not be possible. On the pages for these packages, the BLFS book actually has instructions
to download and install two or more packages. You must edit the scripts to
fix this.
We will try to fix some of them, but this may not be possible.
4.5 XORG7 4.5 XORG7
The generated scripts for Xorg7 pseudo-packages don't have support for The generated scripts for Xorg7 pseudo-packages have $SRC_ARCHIVE
$SRC_ARCHIVE nor MD5 checking. support for individual packages, but not for patches nor *.wget and *.md5
files.
If you has downloaded previously the packages, you must to edit the scripts If you have previously downloaded the patches, you must edit
to make it to use your local packages. the scripts to use your local packages.
Also, you will need to edit the scripts to fix the commands that must The *.wget and *.md5 files should be downladed always from inside
be applied only to a concrete individual sub-package. For example the "for" the scripts to be sure that the most current individual packages are
loop to install xorg7-util packages may read like: used. Thus don't reuse previouly existing ones.
for package in $(cat $WGET_LST) ; do In the script for xorg7-font, be sure to move the fonts directories
packagedir=$(echo $package | sed 's/.tar.bz2//') symlinks creation to after the "for ... done" loop.
tar -xf $package
cd $packagedir
sed -i "s@/usr/X11R6@$XORG_PREFIX@" X11.tmpl &&
./configure $XORG_CONFIG --with-config-dir=$XORG_PREFIX/lib/X11/config
sudo sh -c "make install"
./configure $XORG_CONFIG --with-config-dir=$XORG_PREFIX/lib/X11/config &&
make
sudo sh -c "make install"
./configure $XORG_CONFIG &&
make
sudo sh -c "make install"
cd ..
rm -rf $packagedir
done
After reading the HTML page to know what commands is for what package,
the loop can be changed to read something like:
for package in $(cat $WGET_LST) ; do
packagedir=$(echo $package | sed 's/.tar.bz2//')
tar -xf $package
cd $packagedir
if [ ${packagedir} = "xorg-cf-files" ] ; then
sed -i "s@/usr/X11R6@$XORG_PREFIX@" X11.tmpl &&
./configure $XORG_CONFIG --with-config-dir=$XORG_PREFIX/lib/X11/config
sudo sh -c "make install"
elif [ ${packagedir} = "Imake" ] ; then
./configure $XORG_CONFIG --with-config-dir=$XORG_PREFIX/lib/X11/config &&
make
sudo sh -c "make install"
else
./configure $XORG_CONFIG &&
make
sudo sh -c "make install"
fi
cd ..
rm -rf $packagedir
done
4.6 PATCHES 4.6 PATCHES
By default all required patches will be downloaded from the NET. By default, all required patches will be downloaded from the NET.
If you has downloaded previously the patches, you must to edit the scripts If you have previously downloaded the patches, you must edit the
to make it to use your local patches. scripts to use your local patches.
Also, be sure that all scripts have the commands to download/apply the Also, be sure that all scripts have the commands to download/apply the
required patches. Due book layout issues some patches may be missing. required patches. Due to book layout issues, some patches may be missing.
4.7 ROOT COMMANDS 4.7 ROOT COMMANDS
If building as a normal user (the default setting) be sure that all If building as a normal user (the default setting), be sure that all
commands that need root privileges are run using sudo. commands that require root privileges are run using sudo. Also make sure
necessary root privilege commands are visible in your PATH.
Due book layout issues some sudo command may be missing. Due to book layout issues, some sudo commands may be missing.
4.8 OTHERS 4.8 OTHERS
May have other issues that we are not aware on them yet. If you find There may be other issues that we are not aware of. If you find
someone, please report it to <alfs-discuss@linuxfromscratch.org>. any, please report it to <alfs-discuss@linuxfromscratch.org>.

44
README.CLFS Normal file
View file

@ -0,0 +1,44 @@
# $Id$
CLFS-1.x NOTES
None for now.
CLFS SYSROOT METHOD NOTES
.- If you want to install additional custom packages via "Add custom tools
support" and/or select "Add blfs-tool support", be sure to review and edit
their packages build scripts to follow the sysroot build method or you will
end messing your host system. Be very careful with this.
.- If you install additional packages not using the "Add custom tools support"
feature (i,e, you will install it manually after finished the Makefile run)
you will need to run manually the "Changing the Ownership Of The CLFS System"
phase commands found in the book.
CLFS EMBEDDED SYSTEMS NOTES
.- Mips, WRT and ARM builds are broken due a book bug on the uClibc
*ENDIAN* configuration settings.
.- To install CBLFS packages you must to use the "Add custom tools support"
feature. To learn how it works and how to use it, see the section titled
"Adding Post-System Build Configuration Files and Extra Packages"
found in README.CUSTOM. That is also applicable to bootloaders installation.
.- If you install additional packages not using the "Add custom tools support"
feature (i,e, you will install it manually after finished the Makefile run)
you will need to run manually the "Changing the Ownership Of The CLFS System"
phase commands found in the book.
.- If your target is a MIPS wireless router, you must to select "mips" as
your target architecture and "WRT - MIPS based wireless route" as your
hardware platform.
.- The backup & clean-up phases aren't run. This is to allow users to
review the installed files and do a more in-deeper clean-up before creating
the system tarball.

View file

@ -1,3 +1,6 @@
#
# $Id$
#
HOW TO ADD CUSTOM SCRIPTS TO THE JHALFS MAKEFILE HOW TO ADD CUSTOM SCRIPTS TO THE JHALFS MAKEFILE
@ -7,6 +10,102 @@ needs of every individual and requests are made "Can you add xxxx package".
Rather than adding numerous package scripts and switches for each request it Rather than adding numerous package scripts and switches for each request it
was easier to add a tool for the user(s) to code their own package needs. was easier to add a tool for the user(s) to code their own package needs.
There is two areas that can be customized: how the base system is build
and what additional configurations and packages requires your hardware to can
boot and work with. Each one of this areas is handled in a different way.
BASE SYSTEM CUSTOMIZATION
There is two ways to alter how the base system will be built:
- Using a working copy of the book sources and editing the XML files.
This is the way used by book editors to test packages upgrades,
command changes, build order changes. etc.
This method requires you know very well the book sources and what
files need be edited. It will not be discussed here.
- Editing the generated build scripts to make any change you would.
This is the method discussed below.
EDITING THE BASE SCRIPTS
First step is to generate the build scripts with book defaults. To do that,
configure jhalfs activating any option you want included, but do not select
"Run the Makefile" option.
Under the ${BUILD_DIR}/${SCRIPT_ROOT}/${PROGNAME}-commands directory
(using the defaults values to do an LFS build, that directory name is
/mnt/build_dir/jhalfs/lfs-commands) you will find the default build scripts.
If all you want is modify, add, or remove some command from a package
installation, for example to change it ./configure line, just edit the related
script. If changing or adding a patch, be sure to copy the new patch to the
${BUILD_DIR}/sources directory. When done, run 'make' from inside the
${BUILD_DIR}/${SCRIPT_ROOT} directory.
REPLACING OR INSERTING PACKAGES AND CHANGING BUILD ORDER
To remove a package from the system, just remove its script(s).
To change the version of some package to build a newest or oldest one than the
one found in the book, edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to
change it tarball name and place the new tarball in the ${BUILD_DIR}/sources
directory,
To replace a package by an equivalent one, rename the replaced package script
to reflect the new package name (for example, 102-man-db -> 102-man), edit the
script to made the required commands changes, place the new tarball in the
${BUILD_DIR}/sources directory, and edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list
file to replace the removed package tarball name by the new package tarball name.
To change the build order, rename the scripts changing the first 3-digits
string until have it ordered in the way you want.
To insert a new package, for example to build Cracklib to can build Shadow
with Cracklib support, first you should decide before what default package it
need be installed, in this example before 107-shadow. Then create a new script
containing the needed commands, using an existing one as template, and name it with
the same 3-digits string used for that mentioned default package, but adding
another 1-digit string. In our example, the new script to build Cracklib just
before Shadow will be named 107-1-cracklib. This naming schema allow to insert
up to 10 scripts before each one of the default scripts. Place the tarball for
the new package and required patches, if any, if ${BUILD_DIR}/sources and edit
${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to add the tarball name for that
package.
When ready, launch again the jhalfs configuration interface. Be sure that
are selected exactly the same options than when generating the default build
scripts. Be sure that "Rebuild files" is unselected and select "Run the Makefile"
if you want. Then select "Rebuild the Makefile". This will create a new Makefile
based on the changes you made to the build scripts.
ADDING POST-SYSTEM BUILD CONFIGURATION FILES AND EXTRA PACKAGES
The installation of BLFS packages is handled via blfs-tool and activated
when you select the appropriate menu option. See README and README.BLFS for
more info.
The feature described below was added so users could install remaining
configuration files, build the packages necessary to access the Internet
or to support specific hardware, or to install basic utilities that need
have available from the beginning, and was not intended to replace the BLFS
install system.
:::NOTICE:::
The following examples are for use with LFS and are not applicable to any
of the CLFS-sysroot or CLFS-Embedded books. The directory examples_CLFS-E
contains code extracted from Beyond CLFS-embedded. Any packages you chose to
add should honour the DESTDIR=${CLFS} switch or equivalent.
LAYOUT LAYOUT
A new directory has been added to JHALFS tree which will contain the A new directory has been added to JHALFS tree which will contain the
@ -14,8 +113,10 @@ configuration scripts and a few examples. A switch has been added to the
configuration file which enables/disables the inclusion of personal scripts. configuration file which enables/disables the inclusion of personal scripts.
custom custom
/config <-- where to put your scripts. /config <-- where to put your scripts.
template <-- ALL scripts MUST look like this /examples <-- a few example scripts
/examples_CLFS-E <-- example scripts for CLFS-Embedded
template <-- ALL scripts MUST look like this
@ -33,7 +134,7 @@ configuration file which enables/disables the inclusion of personal scripts.
and rename it. and rename it.
2. Populate the variables with the necessary values. 2. Populate the variables with the necessary values.
Variable function is self explanitory except for the inclusion of the Variable function is self explanatory except for the inclusion of the
build cmds. If the package you want to include is found in the BLFS build cmds. If the package you want to include is found in the BLFS
book then you only need to copy/paste the cmd strings between the xEOFx book then you only need to copy/paste the cmd strings between the xEOFx
pairs, otherwise you will need to define the build cmds yourself. pairs, otherwise you will need to define the build cmds yourself.
@ -44,7 +145,7 @@ configuration file which enables/disables the inclusion of personal scripts.
3. As mentioned previously the build order is dictated by the 3 digit number 3. As mentioned previously the build order is dictated by the 3 digit number
in the file name. If a package has dependencies it must be numerically in the file name. If a package has dependencies it must be numerically
larger than the dependency files. larger than the dependency files.
ie. The package mc has glib as a dependency and build order is i.e. The package mc has glib as a dependency and build order is
950-glib 950-glib
951-mc 951-mc
@ -53,16 +154,6 @@ configuration file which enables/disables the inclusion of personal scripts.
file and NOT in the package script. The gpm script is included as an file and NOT in the package script. The gpm script is included as an
example of multiple patch files and the need for a blfs bootscript. example of multiple patch files and the need for a blfs bootscript.
RUNNING:::
Although your scripts are added to the generated makefile they are not
automatically built. You must tell the makefile to build the tools with
the cmd
make mk_CUSTOM_TOOLS
:::FINAL COMMENT:::
This feature was added so users could build the packages necessary to access
the internet and was not intended to replace the BLFS install system.
#--------- GLIB example ----------- #--------- GLIB example -----------
@ -78,6 +169,10 @@ PKG_FILE="glib-1.2.10.tar.gz"
URL="http://gd.tuwien.ac.at/graphics/gimp/gtk/v1.2/${PKG_FILE}" URL="http://gd.tuwien.ac.at/graphics/gimp/gtk/v1.2/${PKG_FILE}"
MD5="6fe30dad87c77b91b632def29dd69ef9" MD5="6fe30dad87c77b91b632def29dd69ef9"
# The following code removes previously defined PATCHx variables
for i in PATCH{1..10}; do
unset $i
done
# Patches are named PATCH[1..10] # Patches are named PATCH[1..10]
# This information is used to download the patch only # This information is used to download the patch only
# If you do not have the MD5SUM the download will proceed with a warning. # If you do not have the MD5SUM the download will proceed with a warning.
@ -108,7 +203,11 @@ PKG_VERSION="1.20.1"
PKG_FILE="gmp-1.20.1.tar.bz2" PKG_FILE="gmp-1.20.1.tar.bz2"
URL="ftp://arcana.linux.it/pub/gpm/gpm-1.20.1.tar.bz2" URL="ftp://arcana.linux.it/pub/gpm/gpm-1.20.1.tar.bz2"
MD5="2c63e827d755527950d9d13fe3d87692" MD5="2c63e827d755527950d9d13fe3d87692"
for i in PATCH{1..10}; do
unset $i
done
# MD5SUM is not absolutely necessary but JHALFS whines and complains
# Add the MD5SUM if you can
PATCH1=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-segfault-1.patch" PATCH1=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-segfault-1.patch"
PATCH2=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-silent-1.patch" PATCH2=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-silent-1.patch"
@ -141,3 +240,29 @@ EOF
xEOFx xEOFx
) > tmp ) > tmp
#--------- CMDS ONLY example -----------
# This is an example of a self contained cmd script
# There are no referenced to a package or package dir.
# This method is useful for creating user files/profiles/etc
# at build time.
PKG=""
PKG_VERSION=""
PKG_FILE=""
URL=""
MD5=""
for i in PATCH{1..10}; do
unset $i
done
PATCH1=""
( cat << "xEOFx"
echo "JUST A USELESS TRACE"
xEOFx
) > tmp

View file

@ -7,11 +7,5 @@ $Id$
changes can occur and the build could be broken for extended periods of changes can occur and the build could be broken for extended periods of
time. time.
As of Sept.15.2006 jhalfs cannot build the svn book. This is a book As of July 26.2007, the Glibc-based systems builds should work.
problem and not jhalfs. uClibc-based system still fail due book issues.
Automation failures:
1.Directory /dev and devices nodes /dev/null, /dev/console needed to be
created in kernfs
3.Remove the creation of /null and /console node from the devices script.

25
TODO Normal file
View file

@ -0,0 +1,25 @@
jhalfs TODO
---------------
MASTER SCRIPT
-------------
- Nothing for now.
xLFS MODULES
------------
- To develop a new "restart" Makefile target code to can resume an stopped build
after a host reboot, if possible.
BLFS MODULE (See BLFS/TODO)
-----------
OTHERS
------
- Bugs haunting and code clean-up.

View file

@ -38,13 +38,13 @@ declare -r L_arrow=$'\e[1;33m<\e[0m'
simple_error() { # Basic error trap.... JUST DIE simple_error() { # Basic error trap.... JUST DIE
#-----------------------# #-----------------------#
# If +e then disable text output # If +e then disable text output
if [[ "$-" =~ "e" ]]; then if [[ "$-" =~ e ]]; then
echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2 echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
fi fi
} }
see_ya() { see_ya() {
echo -e "\n${L_arrow}${BOLD}jhalfs-X${R_arrow} exit${OFF}\n" echo -e "\n${L_arrow}${BOLD}jhalfs-trunk${R_arrow} exit${OFF}\n"
} }
##### Simple error TRAPS ##### Simple error TRAPS
# ctrl-c SIGINT # ctrl-c SIGINT
@ -73,12 +73,12 @@ source configuration
[[ $VERBOSITY > 0 ]] && echo "OK" [[ $VERBOSITY > 0 ]] && echo "OK"
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..." [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
source $COMMON_DIR/func_check_version.sh source $COMMON_DIR/libs/func_check_version.sh
[[ $? > 0 ]] && echo " function module did not load.." && exit 2 [[ $? > 0 ]] && echo " function module did not load.." && exit 2
[[ $VERBOSITY > 0 ]] && echo "OK" [[ $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/libs/func_validate_configs.sh
[[ $? > 0 ]] && echo " function module did not load.." && exit 2 [[ $? > 0 ]] && echo " function module did not load.." && exit 2
[[ $VERBOSITY > 0 ]] && echo "OK" [[ $VERBOSITY > 0 ]] && echo "OK"
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}" [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
@ -95,8 +95,8 @@ case $BRANCH_ID in
*EDIT* ) echo " You forgot to set the branch or stable book version." *EDIT* ) echo " You forgot to set the branch or stable book version."
echo " Please rerun make and fix the configuration." echo " Please rerun make and fix the configuration."
exit 2 ;; exit 2 ;;
branch-* ) TREE=branches/${BRANCH_ID#branch-}/BOOK ;; branch-* ) TREE=branches/${BRANCH_ID#branch-} ;;
* ) TREE=tags/${BRANCH_ID}/BOOK ;; * ) TREE=tags/${BRANCH_ID} ;;
esac esac
# Check for minimun dependencies versions # Check for minimun dependencies versions
@ -112,8 +112,8 @@ check_version "2004" "${tidyVer}"
XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?> 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'?> <?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' <!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
'http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd'> 'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd'>
<article> <article>
<title>Test file</title> <title>Test file</title>
<sect1> <sect1>
@ -123,18 +123,18 @@ XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?>
</article>" </article>"
if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then
check_version "4.4" "4.4" "DocBook XML DTD" check_version "4.5" "4.5" "DocBook XML DTD"
else else
echo "Warning: not found a working DocBook XML DTD 4.4 installation" echo "Warning: not found a working DocBook XML DTD 4.5 installation"
exit 2 exit 2
fi fi
if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then # if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then
check_version "1.69.1" "1.69.1" "DocBook XSL" # check_version "1.69.1" "1.69.1" "DocBook XSL"
else # else
echo "Warning: not found a working DocBook XSL 1.69.1 installation" # echo "Warning: not found a working DocBook XSL 1.69.1 installation"
exit 2 # exit 2
fi # fi
echo "${SD_BORDER}${nl_}" echo "${SD_BORDER}${nl_}"
@ -178,5 +178,5 @@ else
fi fi
# Run the menuconfig interface # Run the menuconfig interface
make make -B

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# $Id$ # $Id$

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# $Id$ # $Id$

View file

@ -1,24 +1,13 @@
#!/bin/sh #!/bin/bash
# $Id$ # $Id$
set -e set -e
cd $PKGDIR cd $PKGDIR
patch -Np1 -i ../tidy-051026-prevent_PRE_newlines-1.patch
sh build/gnuauto/setup.sh
./configure --prefix=/usr ./configure --prefix=/usr
make make
make install make install
(cd ../ && tar -xvf tidy_docs_051020.tgz) make -C htmldoc install_apidocs
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-051020
cp -v -R htmldoc/* /usr/share/doc/tidy-051020
exit exit

View file

@ -1,10 +1,11 @@
#!/bin/sh #!/bin/bash
# $Id$ # $Id$
set -e set -e
cd $PKGDIR cd $PKGDIR
patch -Np1 -i ../unzip-5.52-security_fix-1.patch
make -f unix/Makefile LOCAL_UNZIP=-D_FILE_OFFSET_BITS=64 linux make -f unix/Makefile LOCAL_UNZIP=-D_FILE_OFFSET_BITS=64 linux
make prefix=/usr install make prefix=/usr install

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# $Id$ # $Id$
@ -7,58 +7,58 @@ set -e
cd /sources cd /sources
mkdir docbook-xml mkdir docbook-xml
cd docbook-xml cd docbook-xml
unzip ../docbook-xml-4.4.zip unzip ../docbook-xml-4.5.zip
install -v -d -m755 /usr/share/xml/docbook/xml-dtd-4.4 install -v -d -m755 /usr/share/xml/docbook/xml-dtd-4.5
install -v -d -m755 /etc/xml install -v -d -m755 /etc/xml
chown -R root:root . chown -R root:root .
cp -v -af docbook.cat *.dtd ent/ *.mod \ cp -v -af docbook.cat *.dtd ent/ *.mod \
/usr/share/xml/docbook/xml-dtd-4.4 /usr/share/xml/docbook/xml-dtd-4.5
if [ ! -e /etc/xml/docbook ]; then if [ ! -e /etc/xml/docbook ]; then
xmlcatalog --noout --create /etc/xml/docbook xmlcatalog --noout --create /etc/xml/docbook
fi fi
xmlcatalog --noout --add "public" \ xmlcatalog --noout --add "public" \
"-//OASIS//DTD DocBook XML V4.4//EN" \ "-//OASIS//DTD DocBook XML V4.5//EN" \
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" \ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" \
/etc/xml/docbook /etc/xml/docbook
xmlcatalog --noout --add "public" \ xmlcatalog --noout --add "public" \
"-//OASIS//DTD DocBook XML CALS Table Model V4.4//EN" \ "-//OASIS//DTD DocBook XML CALS Table Model V4.5//EN" \
"file:///usr/share/xml/docbook/xml-dtd-4.4/calstblx.dtd" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/calstblx.dtd" \
/etc/xml/docbook /etc/xml/docbook
xmlcatalog --noout --add "public" \ xmlcatalog --noout --add "public" \
"-//OASIS//DTD XML Exchange Table Model 19990315//EN" \ "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
"file:///usr/share/xml/docbook/xml-dtd-4.4/soextblx.dtd" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/soextblx.dtd" \
/etc/xml/docbook /etc/xml/docbook
xmlcatalog --noout --add "public" \ xmlcatalog --noout --add "public" \
"-//OASIS//ELEMENTS DocBook XML Information Pool V4.4//EN" \ "-//OASIS//ELEMENTS DocBook XML Information Pool V4.5//EN" \
"file:///usr/share/xml/docbook/xml-dtd-4.4/dbpoolx.mod" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/dbpoolx.mod" \
/etc/xml/docbook /etc/xml/docbook
xmlcatalog --noout --add "public" \ xmlcatalog --noout --add "public" \
"-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.4//EN" \ "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.5//EN" \
"file:///usr/share/xml/docbook/xml-dtd-4.4/dbhierx.mod" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/dbhierx.mod" \
/etc/xml/docbook /etc/xml/docbook
xmlcatalog --noout --add "public" \ xmlcatalog --noout --add "public" \
"-//OASIS//ELEMENTS DocBook XML HTML Tables V4.4//EN" \ "-//OASIS//ELEMENTS DocBook XML HTML Tables V4.5//EN" \
"file:///usr/share/xml/docbook/xml-dtd-4.4/htmltblx.mod" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/htmltblx.mod" \
/etc/xml/docbook /etc/xml/docbook
xmlcatalog --noout --add "public" \ xmlcatalog --noout --add "public" \
"-//OASIS//ENTITIES DocBook XML Notations V4.4//EN" \ "-//OASIS//ENTITIES DocBook XML Notations V4.5//EN" \
"file:///usr/share/xml/docbook/xml-dtd-4.4/dbnotnx.mod" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/dbnotnx.mod" \
/etc/xml/docbook /etc/xml/docbook
xmlcatalog --noout --add "public" \ xmlcatalog --noout --add "public" \
"-//OASIS//ENTITIES DocBook XML Character Entities V4.4//EN" \ "-//OASIS//ENTITIES DocBook XML Character Entities V4.5//EN" \
"file:///usr/share/xml/docbook/xml-dtd-4.4/dbcentx.mod" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/dbcentx.mod" \
/etc/xml/docbook /etc/xml/docbook
xmlcatalog --noout --add "public" \ xmlcatalog --noout --add "public" \
"-//OASIS//ENTITIES DocBook XML Additional General Entities V4.4//EN" \ "-//OASIS//ENTITIES DocBook XML Additional General Entities V4.5//EN" \
"file:///usr/share/xml/docbook/xml-dtd-4.4/dbgenent.mod" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/dbgenent.mod" \
/etc/xml/docbook /etc/xml/docbook
xmlcatalog --noout --add "rewriteSystem" \ xmlcatalog --noout --add "rewriteSystem" \
"http://www.oasis-open.org/docbook/xml/4.4" \ "http://www.oasis-open.org/docbook/xml/4.5" \
"file:///usr/share/xml/docbook/xml-dtd-4.4" \ "file:///usr/share/xml/docbook/xml-dtd-4.5" \
/etc/xml/docbook /etc/xml/docbook
xmlcatalog --noout --add "rewriteURI" \ xmlcatalog --noout --add "rewriteURI" \
"http://www.oasis-open.org/docbook/xml/4.4" \ "http://www.oasis-open.org/docbook/xml/4.5" \
"file:///usr/share/xml/docbook/xml-dtd-4.4" \ "file:///usr/share/xml/docbook/xml-dtd-4.5" \
/etc/xml/docbook /etc/xml/docbook
if [ ! -e /etc/xml/catalog ]; then if [ ! -e /etc/xml/catalog ]; then
xmlcatalog --noout --create /etc/xml/catalog xmlcatalog --noout --create /etc/xml/catalog
@ -79,7 +79,7 @@ xmlcatalog --noout --add "delegateURI" \
"http://www.oasis-open.org/docbook/" \ "http://www.oasis-open.org/docbook/" \
"file:///etc/xml/docbook" \ "file:///etc/xml/docbook" \
/etc/xml/catalog /etc/xml/catalog
for DTDVERSION in 4.1.2 4.2 4.3 for DTDVERSION in 4.1.2 4.2 4.3 4.4
do do
xmlcatalog --noout --add "public" \ xmlcatalog --noout --add "public" \
"-//OASIS//DTD DocBook XML V$DTDVERSION//EN" \ "-//OASIS//DTD DocBook XML V$DTDVERSION//EN" \
@ -87,11 +87,11 @@ do
/etc/xml/docbook /etc/xml/docbook
xmlcatalog --noout --add "rewriteSystem" \ xmlcatalog --noout --add "rewriteSystem" \
"http://www.oasis-open.org/docbook/xml/$DTDVERSION" \ "http://www.oasis-open.org/docbook/xml/$DTDVERSION" \
"file:///usr/share/xml/docbook/xml-dtd-4.4" \ "file:///usr/share/xml/docbook/xml-dtd-4.5" \
/etc/xml/docbook /etc/xml/docbook
xmlcatalog --noout --add "rewriteURI" \ xmlcatalog --noout --add "rewriteURI" \
"http://www.oasis-open.org/docbook/xml/$DTDVERSION" \ "http://www.oasis-open.org/docbook/xml/$DTDVERSION" \
"file:///usr/share/xml/docbook/xml-dtd-4.4" \ "file:///usr/share/xml/docbook/xml-dtd-4.5" \
/etc/xml/docbook /etc/xml/docbook
xmlcatalog --noout --add "delegateSystem" \ xmlcatalog --noout --add "delegateSystem" \
"http://www.oasis-open.org/docbook/xml/$DTDVERSION/" \ "http://www.oasis-open.org/docbook/xml/$DTDVERSION/" \

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# $Id$ # $Id$

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# $Id$ # $Id$

View file

@ -1,12 +0,0 @@
#!/bin/sh
# $Id$
set -e
cd $PKGDIR
./configure --prefix=/usr
make CFLAGS="-O2 -Wno-sign-compare -Wno-pointer-sign"
make install
exit

View file

@ -0,0 +1,19 @@
#!/bin/bash
# $Id$
set -e
cd $PKGDIR
./configure --prefix=/usr \
--sysconfdir=/etc/lynx \
--datadir=/usr/share/doc/lynx-2.8.6 \
--with-zlib \
--with-bzlib \
--with-screen=ncursesw \
--enable-locale-charset
make
make install-full
chgrp -v -R root /usr/share/doc/lynx-2.8.6/lynx_doc
exit

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# $Id$ # $Id$

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# $Id$ # $Id$

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# $Id$ # $Id$

View file

@ -12,10 +12,10 @@ ${DD_BORDER}
${tab_}${tab_}${BOLD}${RED}W A R N I N G${OFF} ${tab_}${tab_}${BOLD}${RED}W A R N I N G${OFF}
Looks like the \$BUILDDIR directory contains subdirectories Looks like the \$BUILDDIR directory contains subdirectories
from a previous HLFS build. from a previous build.
Please format the partition mounted on \$BUILDDIR or set Please format the partition mounted on \$BUILDDIR or set
a different build directory before running jhalfs-X. a different build directory before running jhalfs.
${OFF} ${OFF}
${DD_BORDER} ${DD_BORDER}
-EOF- -EOF-
@ -23,384 +23,12 @@ ${DD_BORDER}
} }
HEADER="# This file is automatically generated by jhalfs-X
# DO NOT EDIT THIS FILE MANUALLY
#
# Generated on `date \"+%F %X %Z\"`"
#------------------------------------------------------#
# NEW Makefile scripting functions #
#------------------------------------------------------#
unset get_package_tarball_name
#----------------------------------#
get_package_tarball_name() { #
#----------------------------------#
local script_name=$1
# The use of 'head' is necessary to limit the return value to the FIRST match..
# hopefully this will not cause problems.
#
case $script_name in
tcl) echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
linux-headers)
if [ "${PROGNAME}" = "lfs" ]; then
# Uses kernel headers directly
echo $(grep "^linux-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
else
# CLFS/CLFS use massaged headers package
echo $(grep "^linux-headers-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
fi
;;
*) echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
esac
}
unset wrt_RunaAsRoot
#----------------------------------#
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
}
#------------------------------------------------------#
#------------------------------------------------------#
#----------------------------------#
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 optSAVE_PREVIOUS=$2
if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then
(
cat << EOF
@\$(call remove_existing_dirs,$FILE)
EOF
) >> $MKFILE.tmp
fi
(
cat << EOF
@\$(call unpack,$FILE)
@\$(call get_pkg_root_LUSER)
EOF
) >> $MKFILE.tmp
}
#------------------------------------------------------#
#------------------------------------------------------#
#----------------------------------#
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 optSAVE_PREVIOUS=$2
if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then
(
cat << EOF
@\$(call remove_existing_dirs,$FILE)
EOF
) >> $MKFILE.tmp
fi
(
cat << EOF
@\$(call unpack,$FILE)
@\$(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
) >> $MKFILE.tmp
}
#----------------------------------#
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 optSAVE_PREVIOUS=$2
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
(
cat << EOF
@\$(call remove_existing_dirs2,$FILE)
EOF
) >> $MKFILE.tmp
fi
(
cat << EOF
@\$(call unpack3,$FILE)
@\$(call get_pkg_root2)
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
CHROOT_wrt_test_log() { #
#----------------------------------#
local TESTLOGFILE=$1
(
cat << EOF
@echo "export TEST_LOG=/\$(SCRIPT_ROOT)/test-logs/$TESTLOGFILE" >> envars && \\
echo -e "\n\`date\`\n" >test-logs/$TESTLOGFILE
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
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
(
cat << EOF
@\$(call remove_build_dirs2,$name)
EOF
) >> $MKFILE.tmp
}
unset wrt_touch
#----------------------------------#
wrt_touch() { #
#----------------------------------#
(
cat << EOF
@\$(call housekeeping)
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_blfs_tool_targets() { #
#----------------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}BLFS_TOOL ${R_arrow}"
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 #
#------------------------------------------------------#
#----------------------------# #----------------------------#
run_make() { # 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 not running the build as root
if [ "$UID" = "0" ] ; then if [ "$UID" = "0" ] ; then
echo "You must not be logged in as root to build the system." echo "You must not be logged in as root to build the system."
exit 1 exit 1
@ -422,12 +50,24 @@ clean_builddir() { #
if [ "${CLEAN}" = "y" ]; then if [ "${CLEAN}" = "y" ]; then
# 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-X run." echo "Looks like $BUILDDIR was not populated by a previous jhalfs run."
exit 1
# Test that dev filesystems are not mounted in $BUILDDIR
elif mount | grep $BUILDDIR/dev > /dev/null ; then
echo "Looks like kernel fylesystems are yet mounted on $BUILDDIR."
exit 1 exit 1
else else
# Clean the build directory # Clean the build directory
echo -n "Cleaning $BUILDDIR ..." echo -n "Cleaning $BUILDDIR ..."
sudo rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,cross-tools,usr,var} # First delete proc and sys directories, if exist.
# Both should be empty, if not be sure to exit.
if [ -d $BUILDDIR/proc ] ; then
sudo rmdir $BUILDDIR/proc || exit 1
fi
if [ -d $BUILDDIR/sys ] ; then
sudo rmdir $BUILDDIR/sys || exit 1
fi
sudo rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,root,sbin,srv,tmp,tools,cross-tools,usr,var}
echo "done" echo "done"
echo -n "Cleaning $JHALFSDIR ..." echo -n "Cleaning $JHALFSDIR ..."
sudo rm -rf $JHALFSDIR sudo rm -rf $JHALFSDIR
@ -439,481 +79,31 @@ clean_builddir() { #
fi fi
} }
#----------------------------# VERBOSITY2=$VERBOSITY
get_book() { #
#----------------------------#
cd $JHALFSDIR
if [ -z $WORKING_COPY ] ; then [[ $VERBOSITY2 > 0 ]] && echo ""
# Check for Subversion instead of just letting the script hit 'svn' and fail.
test `type -p svn` || eval "echo \"This feature requires Subversion.\"
exit 1"
echo -n "Downloading the $PROGNAME document, $LFSVRS version... "
case $PROGNAME in [[ $VERBOSITY2 > 0 ]] && echo -n "Loading <func_book_parser>..."
lfs) svn_root="LFS" ;; source $COMMON_DIR/libs/func_book_parser
hlfs) svn_root="HLFS" ;; [[ $? > 0 ]] && echo "file libs/func_book_parser did not load.." && exit 1
clfs) svn_root="cross-lfs" ;; [[ $VERBOSITY2 > 0 ]] && echo "OK"
clfs2) svn_root="cross-lfs" ;;
*) echo "BOOK not defined in function <get_book>"
exit 1 ;;
esac
# Grab a fresh book if it's missing, otherwise, update it from the
# repo. If we've already extracted the commands, move on to getting the
# sources.
if [ -d ${PROGNAME}-$LFSVRS ] ; then
cd ${PROGNAME}-$LFSVRS
if LC_ALL=C svn up | grep -q At && \
test -d $JHALFSDIR/${PROGNAME}-commands && \
test -f $JHALFSDIR/pkg_tarball_list ; then
# Set the canonical book version
echo -ne "done\n"
cd $JHALFSDIR
case $PROGNAME in
clfs | clfs2)
VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
*)
VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
esac
get_sources
else
echo -ne "done\n"
extract_commands
fi
else
svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
echo -ne "done\n"
extract_commands
fi
else
echo -ne "Using $BOOK as book's sources ...\n"
extract_commands
fi
echo -ne " Document version ${L_arrow}${BOLD}${VERSION}${R_arrow}\n"
}
#----------------------------# [[ $VERBOSITY2 > 0 ]] && echo -n "Loading <func_download_pkgs>..."
extract_commands() { # source $COMMON_DIR/libs/func_download_pkgs
#----------------------------# [[ $? > 0 ]] && echo "file libs/func_download_pkgs did not load.." && exit 1
[[ $VERBOSITY2 > 0 ]] && echo "OK"
# Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
exit 1"
cd $JHALFSDIR [[ $VERBOSITY2 > 0 ]] && echo -n "Loading <func_wrt_Makefile>..."
case $PROGNAME in source $COMMON_DIR/libs/func_wrt_Makefile
clfs | clfs2 ) [[ $? > 0 ]] && echo "file libs/func_wrt_Makefile did not load.." && exit 1
VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; [[ $VERBOSITY2 > 0 ]] && echo "OK"
*)
VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
esac
# Start clean
if [ -d ${PROGNAME}-commands ]; then
rm -rf ${PROGNAME}-commands
mkdir -v ${PROGNAME}-commands
fi
echo -n "Extracting commands for"
# Dump the commands in shell script form from the HLFS book. [[ $VERBOSITY2 > 0 ]] && echo -n "Loading <func_blfs_deps>..."
case ${PROGNAME} in source $COMMON_DIR/libs/func_blfs_deps
clfs) [[ $? > 0 ]] && echo "file libs/func_blfs_deps did not load.." && exit 1
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture" [[ $VERBOSITY2 > 0 ]] && echo "OK"
xsltproc --nonet \
--xinclude \
--stringparam method $METHOD \
--stringparam testsuite $TEST \
--stringparam bomb-testsuite $BOMB_TEST \
--stringparam vim-lang $VIMLANG \
--stringparam timezone $TIMEZONE \
--stringparam page $PAGE \
--stringparam lang $LANG \
-o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
;;
clfs2) [[ $VERBOSITY2 > 0 ]] && echo -n " ..."
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
xsltproc --nonet \
--xinclude \
--stringparam vim-lang $VIMLANG \
--stringparam timezone $TIMEZONE \
--stringparam page $PAGE \
--stringparam lang $LANG \
-o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
;;
hlfs)
echo -n " ${L_arrow}${BOLD}$MODEL${R_arrow} HLFS libc implementation"
xsltproc --nonet \
--xinclude \
--stringparam model $MODEL \
--stringparam testsuite $TEST \
--stringparam bomb-testsuite $BOMB_TEST \
--stringparam timezone $TIMEZONE \
--stringparam page $PAGE \
--stringparam lang $LANG \
--stringparam lc_all $LC_ALL \
--stringparam grsecurity_host $GRSECURITY_HOST \
-o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
;;
lfs)
echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build"
xsltproc --nonet \
--xinclude \
--stringparam testsuite $TEST \
--stringparam bomb-testsuite $BOMB_TEST \
--stringparam vim-lang $VIMLANG \
--stringparam timezone $TIMEZONE \
--stringparam page $PAGE \
--stringparam lang $LANG \
-o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
;;
*) exit 1 ;;
esac
[[ "${BLFS_TOOL}" = "y" ]] && copy_blfs_deps_scripts
echo " ...OK"
# Make the scripts executable.
chmod -R +x $JHALFSDIR/${PROGNAME}-commands
# Create the packages file. We need it for proper Makefile creation
create_package_list
# Done. Moving on...
get_sources
}
#----------------------------#
create_package_list() { #
#----------------------------#
# Create the packages file. We need it for proper Makefile creation
rm -f pkg_tarball_list
echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK $ARCH"
case ${PROGNAME} in
clfs | clfs2)
xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
$BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
;;
hlfs)
xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
$BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
;;
lfs)
xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
$BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
;;
esac
if [[ "${BLFS_TOOL}" = "y" ]] ; then
(
cat << EOF
$LIBXML_PKG
$LIBXSLT_PKG
$TIDY_PKG
$UNZIP_PKG
$DBXML_PKG
$DBXSL_PKG
$LINKS_PKG
$SUDO_PKG
$WGET_PKG
$SVN_PKG
$GPM_PKG
EOF
) >> pkg_tarball_list
fi
echo " ...OK"
}
#----------------------------#
get_sources() { # Download file, write name to MISSING_FILES.DMP if an error
#----------------------------#
local saveIFS=$IFS
local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE
# Test if the packages must be downloaded
[ ! "$GETPKG" = "y" ] && return
gs_wrt_message(){
echo "${RED}$1${OFF}"
echo "$1" >> MISSING_FILES.DMP
}
# Housekeeping
[[ ! -d $BUILDDIR/sources ]] && mkdir $BUILDDIR/sources
cd $BUILDDIR/sources
[[ -f MD5SUMS ]] && rm MD5SUMS
[[ -f MISSING_FILES.DMP ]] && rm MISSING_FILES.DMP
[[ -f urls.lst ]] && rm urls.lst
# Generate URLs file
create_urls
IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only
for line in `cat urls.lst`; do
IFS=$saveIFS # Restore the system defaults
# Skip some packages if they aren't needed
case $line in
*/tcl* | */expect* | */dejagnu* | */tree* | */gcc-testsuite* )
[[ "$TEST" = "0" ]] && continue
;;
*/vim-*-lang* )
[[ "$VIMLANG" = "0" ]] && continue
;;
*linux/linux-* )
[[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] && \
[[ "$GETKERNEL" = "n" ]] && continue
;;
esac
# Locations
URL1=`echo $line | cut -d" " -f2` # Preferred URL
URL2=`echo $line | cut -d" " -f1` # Fallback Upstream URL
FILE=`basename $URL1` # File name
BOOKMD5=`echo $line | cut -d" " -f3` # MD5 book value
# Validation pair
MD5="$BOOKMD5 $FILE"
HAVEMD5=1
set -e
# If the file exists in the archive copy it to the
# $BUILDDIR/sources dir. MD5SUM will be validated later.
if [ ! -z ${SRC_ARCHIVE} ] &&
[ -d ${SRC_ARCHIVE} ] &&
[ -f ${SRC_ARCHIVE}/$FILE ]; then
cp ${SRC_ARCHIVE}/$FILE .
echo "$FILE: -- copied from $SRC_ARCHIVE"
fromARCHIVE=1
else
echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE}${OFF}"
fromARCHIVE=0
# If the file does not exist yet in /sources download a fresh one
if [ ! -f $FILE ] ; then
if ! wget $URL1 && ! wget $URL2 ; then
gs_wrt_message "$FILE not found in the SRC_ARCHIVE or on any server..SKIPPING"
continue
fi
fi
fi
# IF the md5sum does not match the existing files
if ! echo "$MD5" | md5sum -c - >/dev/null ; then
[[ $fromARCHIVE = "1" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match SRC_ARCHIVE copy${OFF}"
[[ $fromARCHIVE = "0" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}"
# Remove the old file and download a new one
rm -fv $FILE
# Force storage in SRC_ARCHIVE
fromARCHIVE=0;
# Try to retrieve again the file. Servers in reverse order.
if ! wget $URL2 && ! wget $URL1 ; then
gs_wrt_message "$FILE not found on the servers.. SKIPPING"
continue
fi
fi
# Validate the MD5SUM one last time
if ! echo "$MD5" | md5sum -c - >/dev/null ; then
gs_wrt_message "$FILE does not match MD5SUMS value"
# Force generation of MD5SUM
HAVEMD5=0
fi
# Generate a fresh MD5SUM for this file
if [[ "$HAVEMD5" = "0" ]] ; then
echo "${BOLD}${YELLOW}Generating a new MD5SUM for ${OFF}$FILE"
echo "NEW MD5SUM: $(md5sum $FILE)" >> MISSING_FILES.DMP
fi
# Good or bad we write the original md5sum to a file
echo "$MD5" >> MD5SUMS
# Copy the freshly downloaded file
# to the source archive.
if [ ! -z ${SRC_ARCHIVE} ] &&
[ -d ${SRC_ARCHIVE} ] &&
[ -w ${SRC_ARCHIVE} ] &&
[ "$fromARCHIVE" = "0" ] ; then
echo "Storing file:<$FILE> in the package archive"
cp -f $FILE ${SRC_ARCHIVE}
fi
done
if [[ -s MISSING_FILES.DMP ]]; then
echo -e "\n\n${tab_}${RED} One or more files were not retrieved or have bad MD5SUMS.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n"
# Do not allow the automatic execution of the Makefile.
echo "${tab_}${BOLD}${RED}*** ${YELLOW}Automatic execution of the generated makefile has been inhibited. ${RED}***${OFF}${nl_}"
RUNMAKE="n"
fi
}
#----------------------------#
create_urls() { #
#----------------------------#
cd $JHALFSDIR
case ${PROGNAME} in
clfs)
echo -n "Creating CLFS <${ARCH}> specific URLs file"
xsltproc --nonet --xinclude \
--stringparam server $SERVER \
-o $BUILDDIR/sources/urls.lst urls.xsl \
$BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
echo " ...OK"
;;
clfs2)
echo -n "Creating CLFS2 <${ARCH}> specific URLs file"
xsltproc --nonet --xinclude \
--stringparam server $SERVER \
-o $BUILDDIR/sources/urls.lst urls.xsl \
$BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
echo " ...OK"
;;
hlfs)
echo -n "Creating HLFS <${MODEL}> specific URLs file"
xsltproc --nonet --xinclude \
--stringparam server $SERVER \
--stringparam model $MODEL \
-o $BUILDDIR/sources/urls.lst urls.xsl \
$BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
echo " ...OK"
;;
lfs)
echo -n "Creating LFS specific URLs file"
xsltproc --nonet --xinclude \
--stringparam server $SERVER \
-o ../sources/urls.lst urls.xsl \
$BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
echo " ...OK"
;;
esac
cd $BUILDDIR/sources
if [[ "${BLFS_TOOL}" = "y" ]]; then
add_blfs_deps_urls
fi
if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
add_CustomToolsURLS
fi
}
#----------------------------# Hardcoded URLs and MD5.
add_blfs_deps_urls() { # No easy way to extract it.
#----------------------------# Some FTP mirrors may not work
local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
if [[ "${DEP_LIBXML}" = "y" ]] ; then
echo "${LIBXML_URL} ${BLFS_SERVER}libxml2/${LIBXML_PKG} ${LIBXML_MD5}" >> urls.lst
fi
if [[ "${DEP_LIBXSLT}" = "y" ]] ; then
echo "${LIBXSLT_URL} ${BLFS_SERVER}libxslt/${LIBXSLT_PKG} ${LIBXSLT_MD5}" >> urls.lst
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
echo "${TIDY_DOCS_URL} ${BLFS_SERVER}tidy/${TIDY_DOCS} ${TIDY_DOCS_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
echo "${DBXSL_URL} ${BLFS_SERVER}docbook-xsl/${DBXSL_PKG} ${DBXSL_MD5}" >> urls.lst
fi
if [[ "${DEP_LINKS}" = "y" ]] ; then
echo "${LINKS_URL} ${BLFS_SERVER}links/${LINKS_PKG} ${LINKS_MD5}" >> urls.lst
fi
if [[ "${DEP_SUDO}" = "y" ]] ; then
echo "${SUDO_URL} ${BLFS_SERVER}sudo/${SUDO_PKG} ${SUDO_MD5}" >> urls.lst
echo "${SUDO_PATCH_URL} ${BLFS_SERVER}sudo/${SUDO_PATCH} ${SUDO_PATCH_MD5}" >> urls.lst
fi
if [[ "${DEP_WGET}" = "y" ]] ; then
echo "${WGET_URL} ${BLFS_SERVER}wget/${WGET_PKG} ${WGET_MD5}" >> urls.lst
fi
if [[ "${DEP_SVN}" = "y" ]] ; then
echo "${SVN_URL} ${BLFS_SERVER}subversion/${SVN_PKG} ${SVN_MD5}" >> urls.lst
fi
if [[ "${DEP_GPM}" = "y" ]] ; then
echo "${GPM_URL} ${BLFS_SERVER}gpm/${GPM_PKG} ${GPM_MD5}" >> urls.lst
echo "${GPM_PATCH_1_URL} ${BLFS_SERVER}gpm/${GPM_PATCH_1} ${GPM_PATCH_1_MD5}" >> urls.lst
echo "${GPM_PATCH_2_URL} ${BLFS_SERVER}gpm/${GPM_PATCH_2} ${GPM_PATCH_2_MD5}" >> urls.lst
fi
}
#----------------------------# Maybe there is a better way to do this, but this
copy_blfs_deps_scripts() { # method avoid to place the test on all
#----------------------------# $PROGNAME/master.sh scripts.
mkdir -p ${PROGNAME}-commands/blfs-tool-deps
if [[ "${DEP_LIBXML}" = "y" ]] ; then
mv blfs-tool-deps/901-libxml2 ${PROGNAME}-commands/blfs-tool-deps
fi
if [[ "${DEP_LIBXSLT}" = "y" ]] ; then
mv blfs-tool-deps/902-libxslt ${PROGNAME}-commands/blfs-tool-deps
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
mv blfs-tool-deps/906-docbook-xsl ${PROGNAME}-commands/blfs-tool-deps
fi
if [[ "${DEP_LINKS}" = "y" ]] ; then
mv blfs-tool-deps/908-links ${PROGNAME}-commands/blfs-tool-deps
fi
if [[ "${DEP_SUDO}" = "y" ]] ; then
mv blfs-tool-deps/909-sudo ${PROGNAME}-commands/blfs-tool-deps
fi
if [[ "${DEP_WGET}" = "y" ]] ; then
mv blfs-tool-deps/910-wget ${PROGNAME}-commands/blfs-tool-deps
fi
if [[ "${DEP_SVN}" = "y" ]] ; then
mv blfs-tool-deps/911-subversion ${PROGNAME}-commands/blfs-tool-deps
fi
if [[ "${DEP_GPM}" = "y" ]] ; then
mv blfs-tool-deps/907-gpm ${PROGNAME}-commands/blfs-tool-deps
fi
rm -rf blfs-tool-deps
}

View file

@ -6,6 +6,8 @@ set -e
LOGSDIR=$1 LOGSDIR=$1
VERSION=$2 VERSION=$2
LINE="================================================================================"
# Make sure that we have a directory as first argument # Make sure that we have a directory as first argument
[[ ! -d "$LOGSDIR" ]] && \ [[ ! -d "$LOGSDIR" ]] && \
echo -e "\nUSAGE: create-sbu_du-report.sh logs_directory [book_version]\n" && exit echo -e "\nUSAGE: create-sbu_du-report.sh logs_directory [book_version]\n" && exit
@ -19,12 +21,14 @@ VERSION=$2
# If there is iteration logs directories, copy the logs inside iteration-1 # If there is iteration logs directories, copy the logs inside iteration-1
# to the top level dir # to the top level dir
[[ -d "$LOGSDIR"/iteration-1 ]] && \ [[ -d "$LOGSDIR"/build_1 ]] && \
cp $LOGSDIR/iteration-1/* $LOGSDIR cp $LOGSDIR/build_1/* $LOGSDIR
# Set the report file # Set the report file
REPORT="$VERSION"-SBU_DU-$(date --iso-8601).report REPORT="$VERSION"-SBU_DU-$(date --iso-8601).report
[ -f $REPORT ] && : >$REPORT
# Dump generation time stamp and book version # Dump generation time stamp and book version
echo -e "\n`date`\n" > "$REPORT" echo -e "\n`date`\n" > "$REPORT"
echo -e "Book version is:\t$VERSION\n" >> "$REPORT" echo -e "Book version is:\t$VERSION\n" >> "$REPORT"
@ -44,82 +48,74 @@ echo -e "\n\t\tMemory info:\n" >> "$REPORT"
free >> "$REPORT" free >> "$REPORT"
# Parse only that logs that have time data # Parse only that logs that have time data
BUILDLOGS=`grep -l "^real\>" $LOGSDIR/*` BUILDLOGS="`grep -l "^Totalseconds:" ${LOGSDIR}/*`"
# Match the first timed log to extract the SBU unit value from it # Match the first timed log to extract the SBU unit value from it
BASELOG=`grep -l "^real\>" $LOGSDIR/* | head -n1` BASELOG=`grep -l "^Totalseconds:" $LOGSDIR/* | head -n1`
echo -e "\n\nUsing $BASELOG to obtain the SBU unit value." >> "$REPORT" echo -e "\nUsing ${BASELOG#*[[:digit:]]-} to obtain the SBU unit value."
BASEMINUTES=`grep "^real\>" $BASELOG | cut -f2 | sed -e 's/m.*//'` SBU_UNIT=`sed -n 's/^Totalseconds:\s\([[:digit:]]*\)$/\1/p' $BASELOG`
BASESECONDS=`grep "^real\>" $BASELOG | cut -f2 | sed -e 's/.*m//;s/s//'` echo -e "\nThe SBU unit value is equal to $SBU_UNIT seconds.\n"
SBU_UNIT=`echo "scale=3; $BASEMINUTES * 60 + $BASESECONDS" | bc` echo -e "\n\n$LINE\n\nThe SBU unit value is equal to $SBU_UNIT seconds.\n" >> "$REPORT"
echo -e "The SBU unit value is equal to $SBU_UNIT seconds.\n" >> "$REPORT"
# Set the first value to 0 for grand totals calculation # Set the first value to 0 for grand totals calculation
SBU2=0 SBU2=0
INSTALL2=0 INSTALL2=0
INSTALLMB2=0 INSTALLMB2=0
# Start the loop
for log in $BUILDLOGS ; do for log in $BUILDLOGS ; do
#Start SBU calculation # Strip the filename
# Build time PACKAGE="${log#*[[:digit:]]*-}"
BUILDTIME=`grep "^real\>" $log | cut -f2`
# Build time in seconds
MINUTES=`grep "^real\>" $log | cut -f2 | sed -e 's/m.*//'`
SECS=`grep "^real\>" $log | cut -f2 | sed -e 's/.*m//;s/s//'`
TIME=`echo "scale=3; $MINUTES * 60 + $SECS" | bc`
# Calculate build time in SBU
SBU=`echo "scale=3; $TIME / $SBU_UNIT" | bc`
# Append SBU value to SBU2 for grand total
SBU2="$SBU2 + $SBU"
#Start disk usage calculation # Start SBU calculation
# Disk usage before unpacking the package # Build time
TIME=`sed -n 's/^Totalseconds:\s\([[:digit:]]*\)$/\1/p' $log`
SECS=`perl -e 'print ('$TIME' % '60')';`
MINUTES=`perl -e 'printf "%.0f" , (('$TIME' - '$SECS') / '60')';`
SBU=`perl -e 'printf "%.1f" , ('$TIME' / '$SBU_UNIT')';`
# Append SBU value to SBU2 for grand total
SBU2=`perl -e 'printf "%.1f" , ('$SBU2' + '$SBU')';`
# Start disk usage calculation
# Disk usage before unpacking the package
DU1=`grep "^KB: " $log | head -n1 | cut -f1 | sed -e 's/KB: //'` DU1=`grep "^KB: " $log | head -n1 | cut -f1 | sed -e 's/KB: //'`
DU1MB=`echo "scale=2; $DU1 / 1024" | bc` DU1MB=`perl -e 'printf "%.3f" , ('$DU1' / '1024')';`
# Disk usage before deleting the source and build dirs # Disk usage before deleting the source and build dirs
DU2=`grep "^KB: " $log | tail -n1 | cut -f1 | sed -e 's/KB: //'` DU2=`grep "^KB: " $log | tail -n1 | cut -f1 | sed -e 's/KB: //'`
DU2MB=`echo "scale=2; $DU2 / 1024" | bc` DU2MB=`perl -e 'printf "%.3f" , ('$DU2' / '1024')';`
# Calculate disk space required to do the build # Calculate disk space required to do the build
REQUIRED1=`echo "$DU2 - $DU1" | bc` REQUIRED1=`perl -e 'print ('$DU2' - '$DU1')';`
REQUIRED2=`echo "scale=2; $DU2MB - $DU1MB" | bc` REQUIRED2=`perl -e 'printf "%.3f" , ('$DU2MB' - '$DU1MB')';`
# Append installed files disk usage to the previous entry, # Append installed files disk usage to the previous entry,
# except for the first parsed log # except for the first parsed log
if [ "$log" != "$BASELOG" ] ; then if [ "$log" != "$BASELOG" ] ; then
INSTALL=`echo "$DU1 - $DU1PREV" | bc` INSTALL=`perl -e 'print ('$DU1' - '$DU1PREV')';`
INSTALLMB=`echo "scale=2; $DU1MB - $DU1MBPREV" | bc` INSTALLMB=`perl -e 'printf "%.3f" , ('$DU1MB' - '$DU1MBPREV')';`
echo -e "Installed files disk usage:\t\t\t\t$INSTALL KB or $INSTALLMB MB\n" >> "$REPORT" echo -e "Installed files disk usage:\t\t\t\t$INSTALL KB or $INSTALLMB MB\n" >> $REPORT
# Append install values for grand total # Append install values for grand total
INSTALL2="$INSTALL2 + $INSTALL" INSTALL2=`perl -e 'printf "%.3f" , ('$INSTALL2' + '$INSTALL')';`
INSTALLMB2="$INSTALLMB2 + $INSTALLMB" INSTALLMB2=`perl -e 'printf "%.3f" , ('$INSTALLMB2' + '$INSTALLMB')';`
fi fi
# Set variables to calculate installed files disk usage # Set variables to calculate installed files disk usage
DU1PREV=$DU1 DU1PREV=$DU1
DU1MBPREV=$DU1MB DU1MBPREV=$DU1MB
# Append log name # Dump time and disk usage values
echo -e "\n\t$log" >> "$REPORT" echo -e "$LINE\n\t\t\t\t[$PACKAGE]\n" >> $REPORT
echo -e "Build time is:\t\t\t\t\t\t$MINUTES minutes and $SECS seconds" >> $REPORT
# Dump time values echo -e "Build time in seconds is:\t\t\t\t$TIME" >> $REPORT
echo -e "Build time is:\t\t\t$BUILDTIME" >> "$REPORT" echo -e "Approximate SBU time is:\t\t\t\t$SBU" >> $REPORT
echo -e "Build time in seconds is\t$TIME" >> "$REPORT" echo -e "Disk usage before unpacking the package:\t\t$DU1 KB or $DU1MB MB" >> $REPORT
echo -e "Approximate SBU time is:\t$SBU" >> "$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" >> $REPORT
# Dump disk usage values
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 "Required space to build the package:\t\t\t$REQUIRED1 KB or $REQUIRED2 MB\n" >> "$REPORT"
done done
# Dump grand totals # Dump grand totals
TOTALSBU=`echo "scale=3; ${SBU2}" | bc` echo -e "\n$LINE\n\nTotal time required to build the systen:\t\t$SBU2 SBU" >> $REPORT
echo -e "\nTotal time required to build the systen:\t$TOTALSBU SBU\n" >> "$REPORT" # Total disk usage: including /tools but not /sources.
TOTALINSTALL=`echo "${INSTALL2}" | bc` echo -e "Total Installed files disk usage:\t\t\t$INSTALL2 KB or $INSTALLMB2 MB" >> $REPORT
TOTALINSTALLMB=`echo "scale=2; ${INSTALLMB2}" | bc`
echo -e "Total Installed files disk usage
(including /tools but not /sources):\t$TOTALINSTALL KB or $TOTALINSTALLMB MB\n" >> "$REPORT"

View file

@ -1,100 +0,0 @@
#!/bin/sh
#----------------------------------#
add_CustomTools() { # Add any users supplied scripts
#----------------------------------#
PREV_SCRIPT=""
CUSTOM_LIST=""
echo "Adding custom packages... ${BOLD}START${OFF}"
cd $JHALFSDIR
> ${MKFILE}.tmp2
# First some build commands and a placeholder for the build list.
# This will not cause problems if there are no custom scripts.
( cat << xEOFx
mk_CUSTOM_TOOLS:
@\$(call echo_CHROOT_request)
@ sudo mkdir -p /home/georgeb/TRIAL/var/lib/jhalfs/BLFS
@( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make CUSTOM_TOOLS")
@touch \$@
CUSTOM_TOOLS:
xEOFx
) >> ${MKFILE}.tmp2
for this_script in custom-commands/config/*; do
if [[ `basename ${this_script}` = "*" ]]; then
break
fi
source $this_script
THIS_SCRIPT=$(basename ${this_script})
echo "$tab_${GREEN}Adding${OFF} ${THIS_SCRIPT}"
( cat << EOF
${THIS_SCRIPT}: ${PREV_SCRIPT}
@\$(call echo_message, Building)
@./progress_bar.sh \$@ \$\$PPID &
@\$(call remove_existing_dirs2,${PKG_FILE})
@\$(call unpack3,${PKG_FILE})
@\$(call get_pkg_root2)
@( time { source envars && /\$(SCRIPT_ROOT)/custom-commands/scripts/${THIS_SCRIPT} >>logs/${THIS_SCRIPT} 2>&1 ; } ) 2>>logs/${THIS_SCRIPT}
@\$(call remove_build_dirs2,${PKG})
@touch \$@
@touch /var/lib/jhalfs/BLFS/${PKG}-${PKG_VERSION}
@\$(call housekeeping)
EOF
) >> ${MKFILE}.tmp2
# Create the build script file
( cat <<- xEOFx
set -e
cd \$PKGDIR
`cat tmp`
exit
xEOFx
) > custom-commands/scripts/$THIS_SCRIPT
chmod 755 custom-commands/scripts/$THIS_SCRIPT
rm -f tmp
PREV_SCRIPT=$THIS_SCRIPT
CUSTOM_LIST="${CUSTOM_LIST}${THIS_SCRIPT} "
done
# Add the dependancy list.
sed "s|^CUSTOM_TOOLS:|CUSTOM_TOOLS: ${CUSTOM_LIST}|" -i ${MKFILE}.tmp2
cat ${MKFILE}.tmp2 >> ${MKFILE}
rm ${MKFILE}.tmp2
echo "Adding custom packages... ${BOLD}DONE${OFF}"
}
#----------------------------------#
add_CustomToolsURLS() { # Add any users supplied scripts URL information
#----------------------------------#
local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
local this_script
local URL PKG PKG_VERSION PKG_FILE MD5
> urls.lst.tmp
for this_script in $JHALFSDIR/custom-commands/config/*; do
if [[ `basename ${this_script}` = "*" ]]; then
CUSTOM_TOOLS="n"
break
fi
source $this_script
echo "${URL} ${BLFS_SERVER}${PKG}/${PKG_FILE} ${MD5}" >> urls.lst.tmp
# Add any patches..
for PATCH in PATCH{1..10}; do
[[ -n ${!PATCH} ]] && echo "dummy-url ${!PATCH}" >> urls.lst.tmp
done
done
cat urls.lst.tmp >> $BUILDDIR/sources/urls.lst
rm urls.lst.tmp
}

201
common/libs/func_blfs_deps Normal file
View file

@ -0,0 +1,201 @@
#!/bin/bash
# $Id$
#----------------------------# Hardcoded URLs and MD5.
add_blfs_deps_urls() { # No easy way to extract it.
#----------------------------# Some FTP mirrors may not work
local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
if [[ "${DEP_LIBXML}" = "y" ]] ; then
echo "${LIBXML_URL} ${BLFS_SERVER}libxml2/${LIBXML_PKG} ${LIBXML_MD5}" >> urls.lst
fi
if [[ "${DEP_LIBXSLT}" = "y" ]] ; then
echo "${LIBXSLT_URL} ${BLFS_SERVER}libxslt/${LIBXSLT_PKG} ${LIBXSLT_MD5}" >> urls.lst
fi
if [[ "${DEP_TIDY}" = "y" ]] ; then
echo "${TIDY_URL} ${BLFS_SERVER}tidy/${TIDY_PKG} ${TIDY_MD5}" >> urls.lst
fi
if [[ "${DEP_UNZIP}" = "y" ]] ; then
echo "${UNZIP_URL} ${BLFS_SERVER}unzip/${UNZIP_PKG} ${UNZIP_MD5}" >> urls.lst
echo "${UNZIP_PATCH_URL} ${BLFS_SERVER}unzip/${UNZIP_PATCH} ${UNZIP_PATCH_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
# echo "${DBXSL_URL} ${BLFS_SERVER}docbook-xsl/${DBXSL_PKG} ${DBXSL_MD5}" >> urls.lst
# fi
if [[ "${DEP_LYNX}" = "y" ]] ; then
echo "${LYNX_URL} ${BLFS_SERVER}lynx/${LYNX_PKG} ${LYNX_MD5}" >> urls.lst
fi
if [[ "${DEP_SUDO}" = "y" ]] ; then
echo "${SUDO_URL} ${BLFS_SERVER}sudo/${SUDO_PKG} ${SUDO_MD5}" >> urls.lst
echo "${SUDO_PATCH_URL} ${BLFS_SERVER}sudo/${SUDO_PATCH} ${SUDO_PATCH_MD5}" >> urls.lst
fi
if [[ "${DEP_WGET}" = "y" ]] ; then
echo "${WGET_URL} ${BLFS_SERVER}wget/${WGET_PKG} ${WGET_MD5}" >> urls.lst
fi
if [[ "${DEP_SVN}" = "y" ]] ; then
echo "${SVN_URL} ${BLFS_SERVER}subversion/${SVN_PKG} ${SVN_MD5}" >> urls.lst
fi
if [[ "${DEP_GPM}" = "y" ]] ; then
echo "${GPM_URL} ${BLFS_SERVER}gpm/${GPM_PKG} ${GPM_MD5}" >> urls.lst
echo "${GPM_PATCH_1_URL} ${BLFS_SERVER}gpm/${GPM_PATCH_1} ${GPM_PATCH_1_MD5}" >> urls.lst
echo "${GPM_PATCH_2_URL} ${BLFS_SERVER}gpm/${GPM_PATCH_2} ${GPM_PATCH_2_MD5}" >> urls.lst
fi
}
#----------------------------# Maybe there is a better way to do this, but this
copy_blfs_deps_scripts() { # method avoid to place the test on all
#----------------------------# $PROGNAME/master.sh scripts.
mkdir -p ${PROGNAME}-commands/blfs-tool-deps
if [[ "${DEP_LIBXML}" = "y" ]] ; then
mv blfs-tool-deps/901-libxml2 ${PROGNAME}-commands/blfs-tool-deps
fi
if [[ "${DEP_LIBXSLT}" = "y" ]] ; then
mv blfs-tool-deps/902-libxslt ${PROGNAME}-commands/blfs-tool-deps
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
# mv blfs-tool-deps/906-docbook-xsl ${PROGNAME}-commands/blfs-tool-deps
# fi
if [[ "${DEP_LYNX}" = "y" ]] ; then
mv blfs-tool-deps/908-lynx ${PROGNAME}-commands/blfs-tool-deps
fi
if [[ "${DEP_SUDO}" = "y" ]] ; then
mv blfs-tool-deps/909-sudo ${PROGNAME}-commands/blfs-tool-deps
fi
if [[ "${DEP_WGET}" = "y" ]] ; then
mv blfs-tool-deps/910-wget ${PROGNAME}-commands/blfs-tool-deps
fi
if [[ "${DEP_SVN}" = "y" ]] ; then
mv blfs-tool-deps/911-subversion ${PROGNAME}-commands/blfs-tool-deps
fi
if [[ "${DEP_GPM}" = "y" ]] ; then
mv blfs-tool-deps/907-gpm ${PROGNAME}-commands/blfs-tool-deps
fi
rm -rf blfs-tool-deps
}
#----------------------------------#
wrt_blfs_tool_targets() { #
#----------------------------------#
PREV=""
echo "${tab_}${GREEN}Processing... ${L_arrow}BLFS_TOOL ${R_arrow}"
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
lynx ) pkg_tarball=${LYNX_PKG} ;;
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.
if [ "$PROGNAME" = "clfs2" ]; then
LUSER_wrt_target "${this_script}" "$PREV"
else
CHROOT_wrt_target "${this_script}" "$PREV"
fi
# Insert instructions for unpacking the package and changing directories
# DocBook-XML is a zip, the build script will handle that.
if [ "$PROGNAME" = "clfs2" ]; then
[[ ! "$name" = "docbook-xml" ]] && LUSER_wrt_unpack "$pkg_tarball"
else
[[ ! "$name" = "docbook-xml" ]] && CHROOT_Unpack "$pkg_tarball"
fi
# Run the script.
if [ "$PROGNAME" = "clfs2" ]; then
LUSER_wrt_RunAsUser "${file}"
else
CHROOT_wrt_RunAsRoot "$file"
fi
# Remove the build directory(ies) except if the package build fails.
if [ "$PROGNAME" = "clfs2" ]; then
[[ ! "$name" = "docbook-xml" ]] && LUSER_RemoveBuildDirs "$name"
else
[[ ! "$name" = "docbook-xml" ]] && CHROOT_wrt_RemoveBuildDirs "$name"
fi
# Touch the tracking file.
case $name in
docbook-xml ) pkg_ver=DocBook-4.5 ;;
lynx ) pkg_ver=lynx-2.8.6 ;;
tidy ) pkg_ver=html-tidy-cvs_20070326 ;;
unzip ) pkg_ver=unzip-5.52 ;;
* ) pkg_ver=$(echo $pkg_tarball | sed -e 's/.tar.*//;s/.tgz//;s/.zip//') ;;
esac
if [ "$PROGNAME" = "clfs2" ]; then
echo -e "\t@touch \$(MOUNT_PT)$TRACKING_DIR/$pkg_ver" >> $MKFILE.tmp
else
echo -e "\t@touch $TRACKING_DIR/$pkg_ver" >> $MKFILE.tmp
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
}

View file

@ -0,0 +1,216 @@
#!/bin/bash
# $Id$
#----------------------------#
get_book() { #
#----------------------------#
cd $JHALFSDIR
if [ -z $WORKING_COPY ] ; then
# Check for Subversion instead of just letting the script hit 'svn' and fail.
test `type -p svn` || eval "echo \"This feature requires Subversion.\"
exit 1"
echo -n "Downloading the $PROGNAME document, $LFSVRS version... "
case $PROGNAME in
lfs) svn_root="LFS" ;;
hlfs) svn_root="HLFS" ;;
clfs) svn_root="cross-lfs" ;;
clfs2) svn_root="cross-lfs" ;;
clfs3) svn_root="cross-lfs" ;;
*) echo "BOOK not defined in function <get_book>"
exit 1 ;;
esac
# Grab a fresh book if it's missing, otherwise, update it from the
# repo. If we've already extracted the commands, move on to getting the
# sources.
if [ -d ${PROGNAME}-$LFSVRS ] ; then
cd ${PROGNAME}-$LFSVRS
if LC_ALL=C svn up | grep -q At && \
test -d $JHALFSDIR/${PROGNAME}-commands && \
test -f $JHALFSDIR/pkg_tarball_list ; then
# Set the canonical book version
echo -ne "done\n"
cd $JHALFSDIR
case $PROGNAME in
clfs | clfs2 | clfs3 )
VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
*)
VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
esac
get_sources
else
echo -ne "done\n"
extract_commands
fi
else
svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
echo -ne "done\n"
extract_commands
fi
else
echo -ne "Using $BOOK as book's sources ...\n"
extract_commands
fi
echo -ne " Document version ${L_arrow}${BOLD}${VERSION}${R_arrow}\n"
}
#----------------------------#
extract_commands() { #
#----------------------------#
# Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
exit 1"
cd $JHALFSDIR
case $PROGNAME in
clfs | clfs2 | clfs3 )
VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
*)
VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
esac
# Start clean
if [ -d ${PROGNAME}-commands ]; then
rm -rf ${PROGNAME}-commands
mkdir -v ${PROGNAME}-commands
fi
echo -n "Extracting commands for"
# Dump the commands in shell script form from the HLFS book.
case ${PROGNAME} in
clfs)
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
xsltproc --nonet \
--xinclude \
--stringparam method $METHOD \
--stringparam testsuite $TEST \
--stringparam bomb-testsuite $BOMB_TEST \
--stringparam vim-lang $VIMLANG \
--stringparam timezone $TIMEZONE \
--stringparam page $PAGE \
--stringparam lang $LANG \
--stringparam sparc $SPARC64_PROC \
-o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
;;
clfs2)
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
xsltproc --nonet \
--xinclude \
--stringparam vim-lang $VIMLANG \
--stringparam timezone $TIMEZONE \
--stringparam page $PAGE \
--stringparam lang $LANG \
-o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
;;
clfs3)
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
xsltproc --nonet \
--xinclude \
--stringparam endian x$ENDIAN \
--stringparam timezone $TIMEZONE \
--stringparam page $PAGE \
--stringparam lang $LANG \
-o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
;;
hlfs)
echo -n " ${L_arrow}${BOLD}$MODEL + $KERNEL${R_arrow} HLFS flavour... "
xsltproc --nonet \
--xinclude \
--stringparam model $MODEL \
--stringparam kernel $KERNEL \
--stringparam testsuite $TEST \
--stringparam bomb-testsuite $BOMB_TEST \
--stringparam features x$SSP$ASLR$PAX$HARDENED_TMP$WARNINGS$MISC$BLOWFISH \
--stringparam timezone $TIMEZONE \
--stringparam page $PAGE \
--stringparam lang $LANG \
--stringparam grsecurity_host $GRSECURITY_HOST \
-o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
;;
lfs)
echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... "
xsltproc --nonet \
--xinclude \
--stringparam testsuite $TEST \
--stringparam bomb-testsuite $BOMB_TEST \
--stringparam vim-lang $VIMLANG \
--stringparam timezone $TIMEZONE \
--stringparam page $PAGE \
--stringparam lang $LANG \
-o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
;;
*) echo -n " ${L_arrow}${BOLD}${PROGNAME}${R_arrow} book invalid, terminate build... "
exit 1 ;;
esac
[[ "${BLFS_TOOL}" = "y" ]] && copy_blfs_deps_scripts
echo "done"
# Make the scripts executable.
chmod -R +x $JHALFSDIR/${PROGNAME}-commands
# Create the packages file. We need it for proper Makefile creation
create_package_list
# Done. Moving on...
get_sources
}
#----------------------------#
create_package_list() { #
#----------------------------#
# Create the packages file. We need it for proper Makefile creation
rm -f pkg_tarball_list
echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK"
if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
echo -n "... "
case ${PROGNAME} in
clfs | clfs2 | clfs3 )
xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
$BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
;;
hlfs)
xsltproc --nonet --xinclude \
--stringparam model $MODEL \
--stringparam kernel $KERNEL \
-o pkg_tarball_list packages.xsl \
$BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
;;
lfs)
xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
$BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
;;
esac
if [[ "${BLFS_TOOL}" = "y" ]] ; then
(
cat << EOF
$LIBXML_PKG
$LIBXSLT_PKG
$TIDY_PKG
$UNZIP_PKG
$DBXML_PKG
$DBXSL_PKG
$LYNX_PKG
$SUDO_PKG
$WGET_PKG
$SVN_PKG
$GPM_PKG
EOF
) >> pkg_tarball_list
fi
echo "done"
}

View file

@ -34,13 +34,25 @@ inline_doc
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 # Ask the user instead of bomb, to make happy that packages which version
# ouput don't follow our expectations
echo "If you are sure that you have instaled a proper version of ${BOLD}$TXT${OFF}"
echo "but jhalfs has failed to detect it, press 'c' and 'ENTER' keys to continue,"
echo -n "otherwise press 'ENTER' key to stop jhalfs. "
read ANSWER
if [ x$ANSWER != "xc" ] ; then
echo "${nl_}Please, install a proper $TXT version.${nl_}"
exit 1
else
minor=$ref_minor
revision=$ref_revision
fi
} }
echo -ne "${TXT}${dotSTR:${#TXT}} ${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}" echo -ne "${TXT}${dotSTR:${#TXT}} ${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}"
# echo -ne "$TXT:\t${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}" # 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) IFS=".-(pa" # 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
# #
@ -66,33 +78,26 @@ check_prerequisites() { #
#----------------------------# #----------------------------#
# LFS/HLFS/CLFS prerequisites # LFS/HLFS/CLFS prerequisites
if [ ! "${PROGNAME}" = "hlfs" ]; then check_version "2.6.2" "`uname -r`" "KERNEL"
check_version "2.6.2" "`uname -r`" "KERNEL" check_version "3.0" "$BASH_VERSION" "BASH"
check_version "2.0.5" "$BASH_VERSION" "BASH" check_version "3.0.1" "`gcc -dumpversion`" "GCC"
check_version "3.0.0" "`gcc -dumpversion`" "GCC" libcVer="`/lib/libc.so.6 | head -n1`"
libcVer="`/lib/libc.so.6 | head -n1`" libcVer="${libcVer##*version }"
libcVer="${libcVer##*version }" check_version "2.2.5" ${libcVer%%,*} "GLIBC"
check_version "2.2.5" ${libcVer%%,*} "GLIBC" check_version "2.12" "$(ld --version | head -n1 | cut -d" " -f4)" "BINUTILS"
check_version "2.12" "$(ld --version | head -n1 | cut -d" " -f4)" "BINUTILS" check_version "1.15" "$(tar --version | head -n1 | cut -d" " -f4)" "TAR"
check_version "1.14" "$(tar --version | head -n1 | cut -d" " -f4)" "TAR" bzip2Ver="$(bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f8)"
bzip2Ver="$(bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f8)" check_version "1.0.2" "${bzip2Ver%%,*}" "BZIP2"
check_version "1.0.2" "${bzip2Ver%%,*}" "BZIP2" check_version "1.875" "$(bison --version | head -n1 | cut -d" " -f4)" "BISON"
check_version "5.0" "$(chown --version | head -n1 | cut -d")" -f2)" "COREUTILS" check_version "5.2.1" "$(chown --version | head -n1 | cut -d")" -f2)" "COREUTILS"
check_version "2.8" "$(diff --version | head -n1 | cut -d" " -f4)" "DIFF" 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 "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 "3.0" "$(gawk --version | head -n1 | cut -d" " -f3)" "GAWK"
check_version "2.5" "$(grep --version | head -n1 | cut -d" " -f4)" "GREP" check_version "2.5" "$(grep --version | head -n1 | awk '{print $NF}')" "GREP"
check_version "1.2.4" "$(gzip --version 2>&1 | head -n1 | cut -d" " -f2)" "GZIP" 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 | cut -c1-4)" "MAKE" check_version "3.79.1" "$(make --version | head -n1 | cut -d " " -f3 | cut -c1-4)" "MAKE"
check_version "2.5.4" "$(patch --version | head -n1 | cut -d" " -f2)" "PATCH" 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" 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 # Check for minimum sudo version
SUDO_LOC="$(whereis -b sudo | cut -d" " -f2)" SUDO_LOC="$(whereis -b sudo | cut -d" " -f2)"
@ -125,8 +130,8 @@ check_prerequisites() { #
# Check if the proper DocBook-XML-DTD and DocBook-XSL are correctly installed # Check if the proper DocBook-XML-DTD and DocBook-XSL are correctly installed
XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?> 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'?> <?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' <!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
'http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd'> 'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd'>
<article> <article>
<title>Test file</title> <title>Test file</title>
<sect1> <sect1>
@ -137,21 +142,21 @@ XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?>
if [[ -z "$DEP_DBXML" ]] ; then if [[ -z "$DEP_DBXML" ]] ; then
if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then
check_version "4.4" "4.4" "DocBook XML DTD" check_version "4.5" "4.5" "DocBook XML DTD"
else else
echo "Warning: not found a working DocBook XML DTD 4.4 installation" echo "Warning: not found a working DocBook XML DTD 4.5 installation"
exit 2 exit 2
fi fi
fi fi
if [[ -z "$DEP_DBXSL" ]] ; then # if [[ -z "$DEP_DBXSL" ]] ; then
if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then # if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then
check_version "1.69.1" "1.69.1" "DocBook XSL" # check_version "1.69.1" "1.69.1" "DocBook XSL"
else # else
echo "Warning: not found a working DocBook XSL 1.69.1 installation" # echo "Warning: not found a working DocBook XSL 1.69.1 installation"
exit 2 # exit 2
fi # fi
fi # fi
fi # end BLFS_TOOL=Y fi # end BLFS_TOOL=Y

View file

@ -14,6 +14,7 @@ wrt_compare_targets() { #
CHROOT_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"
wrt_touch
PREV_IT=$ITERATION PREV_IT=$ITERATION
PREV=$ITERATION PREV=$ITERATION
done done
@ -25,10 +26,8 @@ wrt_system_build() { #
local RUN=$1 local RUN=$1
local PREV_IT=$2 local PREV_IT=$2
if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "chroot" ]] ; then if [[ "$PROGNAME" = "clfs" ]] ; then
chroot_final_system_Makefiles $RUN final_system_Makefiles $RUN
elif [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
boot_final_system_Makefiles $RUN
else else
chapter6_Makefiles $RUN chapter6_Makefiles $RUN
fi fi
@ -46,8 +45,6 @@ wrt_system_build() { #
chapter6="$chapter6 iteration-$RUN" chapter6="$chapter6 iteration-$RUN"
fi fi
fi fi
echo -e "\nsystem_build_$RUN: $PREV_IT $system_build" >> $MKFILE.tmp
} }
#----------------------------------# #----------------------------------#
@ -56,7 +53,7 @@ wrt_compare_work() { #
local ITERATION=$1 local ITERATION=$1
local PREV_IT=$2 local PREV_IT=$2
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"
local ROOT_DIR=/ local ROOT_DIR=/
local DEST_TOPDIR=/${SCRIPT_ROOT} local DEST_TOPDIR=/${SCRIPT_ROOT}
@ -67,8 +64,8 @@ wrt_compare_work() { #
local DEST_ICA=$DEST_TOPDIR/ICA && \ local DEST_ICA=$DEST_TOPDIR/ICA && \
( (
cat << EOF cat << EOF
@extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >>logs/$ITERATION.log 2>&1 && \\ @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >>logs/\$@ 2>&1 && \\
extras/do_ica_prep $DEST_ICA/$ITERATION >>logs/$ITERATION.log 2>&1 extras/do_ica_prep $DEST_ICA/$ITERATION >>logs/\$@ 2>&1
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
if [[ "$ITERATION" != "iteration-1" ]] ; then if [[ "$ITERATION" != "iteration-1" ]] ; then
@ -80,8 +77,8 @@ EOF
local DEST_FARCE=$DEST_TOPDIR/farce && \ local DEST_FARCE=$DEST_TOPDIR/farce && \
( (
cat << EOF cat << EOF
@extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_FARCE/$ITERATION >>logs/$ITERATION.log 2>&1 && \\ @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_FARCE/$ITERATION >>logs/\$@ 2>&1 && \\
extras/filelist $DEST_FARCE/$ITERATION $DEST_FARCE/filelist-$ITERATION >>logs/$ITERATION.log 2>&1 extras/filelist $DEST_FARCE/$ITERATION $DEST_FARCE/filelist-$ITERATION >>logs/\$@ 2>&1
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
if [[ "$ITERATION" != "iteration-1" ]] ; then if [[ "$ITERATION" != "iteration-1" ]] ; then
@ -93,7 +90,7 @@ EOF
#----------------------------------# #----------------------------------#
wrt_do_ica_work() { # wrt_do_ica_work() { #
#----------------------------------# #----------------------------------#
echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/$ITERATION.log 2>&1" >> $MKFILE.tmp echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/\$@ 2>&1" >> $MKFILE.tmp
} }
#----------------------------------# #----------------------------------#
@ -104,24 +101,39 @@ wrt_do_farce_work() { #
local PREFILE=$3/filelist-$1 local PREFILE=$3/filelist-$1
local ITEDIR=$3/$2 local ITEDIR=$3/$2
local ITEFILE=$3/filelist-$2 local ITEFILE=$3/filelist-$2
echo -e "\t@extras/farce --directory $OUTPUT $PREDIR $PREFILE $ITEDIR $ITEFILE >>logs/$ITERATION.log 2>&1" >> $MKFILE.tmp echo -e "\t@extras/farce --directory $OUTPUT $PREDIR $PREFILE $ITEDIR $ITEFILE >>logs/\$@ 2>&1" >> $MKFILE.tmp
} }
#----------------------------------# #----------------------------------#
wrt_logs() { # wrt_logs() { #
#----------------------------------# #----------------------------------#
local ITERATION=iteration-$1 local build=build_$1
local file
( (
cat << EOF cat << EOF
@pushd logs 1> /dev/null && \\ @cd logs && \\
mkdir $ITERATION && \\ mkdir $build && \\
mv ${LOGS} $ITERATION && \\ mv -f ${system_build} $build && \\
popd 1> /dev/null if [ ! $build = build_1 ] ; then \\
@touch \$@ && \\ cd $build && \\
sleep .25 && \\ for file in \`ls .\` ; do \\
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\
echo --------------------------------------------------------------------------------\$(WHITE) done ; \\
fi ;
@cd /\$(SCRIPT_ROOT)
@if [ -d test-logs ] ; then \\
cd test-logs && \\
mkdir $build && \\
mv -f ${system_build} $build && \\
if [ ! $build = build_1 ] ; then \\
cd $build && \\
for file in \`ls .\` ; do \\
mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\
done ; \\
fi ; \\
cd /\$(SCRIPT_ROOT) ; \\
fi ;
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }

View file

@ -0,0 +1,118 @@
#!/bin/bash
# $Id$
#----------------------------------#
wrt_CustomTools_target() { # Add any users supplied scripts
#----------------------------------#
PREV=""
echo " Adding custom packages... ${BOLD}START${OFF}"
# Create the custom_tools scripts directory
mkdir -p custom-tools
for file in $JHALFSDIR/custom-commands/*; do
if [[ `basename ${file}` = "*" ]]; then
break
fi
source $file
this_script=$(basename ${file})
echo "$tab_${GREEN}Adding${OFF} ${this_script}"
# Create a Makefile entry
if [[ "x${PKG}" = "x" ]]; then
# Create an entry for a self contained cmd script that does not
# reference a package tarball
case $PROGNAME in
clfs2 | clfs3 )
LUSER_wrt_target "${this_script}" "$PREV"
LUSER_wrt_RunAsUser "custom-tools/${this_script}"
;;
*)
CHROOT_wrt_target "${this_script}" "$PREV"
CHROOT_wrt_RunAsRoot "custom-tools/${this_script}"
;;
esac
wrt_touch
# Create the build script file
( cat <<- xEOFx
#!/bin/bash
set -e
`cat tmp`
exit
xEOFx
) > custom-tools/${this_script}
else
# Create an entry for package
case $PROGNAME in
clfs2 | clfs3 )
LUSER_wrt_target "${this_script}" "$PREV"
LUSER_wrt_unpack "${PKG_FILE}"
LUSER_wrt_RunAsUser "custom-tools/${this_script}"
LUSER_RemoveBuildDirs "${PKG}"
echo -e "\t@touch \$(MOUNT_PT)$TRACKING_DIR/${PKG}-${PKG_VERSION}" >> $MKFILE.tmp
;;
*)
CHROOT_wrt_target "${this_script}" "$PREV"
CHROOT_Unpack "${PKG_FILE}"
CHROOT_wrt_RunAsRoot "custom-tools/${this_script}"
CHROOT_wrt_RemoveBuildDirs "${PKG}"
echo -e "\t@touch $TRACKING_DIR/${PKG}-${PKG_VERSION}" >> $MKFILE.tmp
;;
esac
wrt_touch
# Create the build script file
( cat <<- xEOFx
#!/bin/bash
set -e
cd \$PKGDIR
`cat tmp`
exit
xEOFx
) > custom-tools/$this_script
fi
rm -f tmp
PREV=$this_script
custom_list="${custom_list} ${this_script}"
done
# Make the scripts executable.
chmod +x custom-tools/*
echo " Adding custom packages... ${BOLD}DONE${OFF}"
}
#----------------------------------#
add_CustomToolsURLS() { # Add any users supplied scripts URL information
#----------------------------------#
local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
local this_script
local URL PKG PKG_VERSION PKG_FILE MD5
> urls.lst.tmp
for this_script in $JHALFSDIR/custom-commands/*; do
if [[ `basename ${this_script}` = "*" ]]; then
CUSTOM_TOOLS="n"
break
fi
source $this_script
# A cmd only script had no PKG defined
[[ "x${PKG}" = "x" ]] && continue
echo "${URL} ${BLFS_SERVER}${PKG}/${PKG_FILE} ${MD5}" >> urls.lst.tmp
# Add any patches..
for PATCH in PATCH{1..10}; do
[[ -n ${!PATCH} ]] && echo "dummy-url ${!PATCH}" >> urls.lst.tmp
done
done
cat urls.lst.tmp >> $BUILDDIR/sources/urls.lst
rm urls.lst.tmp
}

View file

@ -0,0 +1,195 @@
#!/bin/bash
# $Id$
#----------------------------#
get_sources() { # Download file, write name to MISSING_FILES.DMP if an error
#----------------------------#
local saveIFS=$IFS
local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE
# Test if the packages must be downloaded
[ ! "$GETPKG" = "y" ] && return
gs_wrt_message(){
echo "${RED}$1${OFF}"
echo "$1" >> MISSING_FILES.DMP
}
# Housekeeping
[[ ! -d $BUILDDIR/sources ]] && mkdir $BUILDDIR/sources
cd $BUILDDIR/sources
[[ -f MD5SUMS ]] && rm MD5SUMS
[[ -f MISSING_FILES.DMP ]] && rm MISSING_FILES.DMP
[[ -f urls.lst ]] && rm urls.lst
# Generate URLs file
create_urls
IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only
for line in `cat urls.lst`; do
IFS=$saveIFS # Restore the system defaults
# Skip some packages if they aren't needed
case $line in
*/tcl* | */expect* | */dejagnu* | */tree* | */gcc-testsuite* )
[[ "$TEST" = "0" ]] && continue
;;
*/vim-*-lang* )
[[ "$VIMLANG" = "0" ]] && continue
;;
*linux/linux-* )
[[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] && \
[[ "$GETKERNEL" = "n" ]] && continue
;;
esac
# Locations
URL1=`echo $line | cut -d" " -f2` # Preferred URL
URL2=`echo $line | cut -d" " -f1` # Fallback Upstream URL
FILE=`basename $URL1` # File name
BOOKMD5=`echo $line | cut -d" " -f3` # MD5 book value
# Validation pair
MD5="$BOOKMD5 $FILE"
HAVEMD5=1
set -e
# If the file exists in the archive copy it to the
# $BUILDDIR/sources dir. MD5SUM will be validated later.
if [ ! -z ${SRC_ARCHIVE} ] &&
[ -d ${SRC_ARCHIVE} ] &&
[ -f ${SRC_ARCHIVE}/$FILE ]; then
cp ${SRC_ARCHIVE}/$FILE .
echo "$FILE: -- copied from $SRC_ARCHIVE"
fromARCHIVE=1
else
echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE}${OFF}"
fromARCHIVE=0
# If the file does not exist yet in /sources download a fresh one
if [ ! -f $FILE ] ; then
if ! wget $URL1 && ! wget $URL2 ; then
gs_wrt_message "$FILE not found in the SRC_ARCHIVE or on any server..SKIPPING"
continue
fi
fi
fi
# IF the md5sum does not match the existing files
if ! echo "$MD5" | md5sum -c - >/dev/null ; then
[[ $fromARCHIVE = "1" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match SRC_ARCHIVE copy${OFF}"
[[ $fromARCHIVE = "0" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}"
# Remove the old file and download a new one
rm -fv $FILE
# Force storage in SRC_ARCHIVE
fromARCHIVE=0;
# Try to retrieve again the file. Servers in reverse order.
if ! wget $URL2 && ! wget $URL1 ; then
gs_wrt_message "$FILE not found on the servers.. SKIPPING"
continue
fi
fi
# Validate the MD5SUM one last time
if ! echo "$MD5" | md5sum -c - >/dev/null ; then
gs_wrt_message "$FILE does not match MD5SUMS value"
# Force generation of MD5SUM
HAVEMD5=0
fi
# Generate a fresh MD5SUM for this file
if [[ "$HAVEMD5" = "0" ]] ; then
echo "${BOLD}${YELLOW}Generating a new MD5SUM for ${OFF}$FILE"
echo "NEW MD5SUM: $(md5sum $FILE)" >> MISSING_FILES.DMP
fi
# Good or bad we write the original md5sum to a file
echo "$MD5" >> MD5SUMS
# Copy the freshly downloaded file
# to the source archive.
if [ ! -z ${SRC_ARCHIVE} ] &&
[ -d ${SRC_ARCHIVE} ] &&
[ -w ${SRC_ARCHIVE} ] &&
[ "$fromARCHIVE" = "0" ] ; then
echo "Storing file:<$FILE> in the package archive"
cp -f $FILE ${SRC_ARCHIVE}
fi
done
if [[ -s MISSING_FILES.DMP ]]; then
echo -e "\n\n${tab_}${RED} One or more files were not retrieved or have bad MD5SUMS.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n"
# Do not allow the automatic execution of the Makefile.
echo "${tab_}${BOLD}${RED}*** ${YELLOW}Automatic execution of the generated makefile has been inhibited. ${RED}***${OFF}${nl_}"
RUNMAKE="n"
fi
}
#----------------------------#
create_urls() { #
#----------------------------#
cd $JHALFSDIR
case ${PROGNAME} in
clfs)
echo -n "Creating CLFS <${ARCH}> specific URLs file"
xsltproc --nonet --xinclude \
--stringparam server $SERVER \
--stringparam family clfs \
-o $BUILDDIR/sources/urls.lst urls.xsl \
$BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
echo " ...OK"
;;
clfs2)
echo -n "Creating CLFS2 <${ARCH}> specific URLs file"
xsltproc --nonet --xinclude \
--stringparam server $SERVER \
--stringparam family clfs \
-o $BUILDDIR/sources/urls.lst urls.xsl \
$BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
echo " ...OK"
;;
clfs3)
echo -n "Creating CLFS3 <${ARCH}> specific URLs file"
xsltproc --nonet --xinclude \
--stringparam server $SERVER \
--stringparam family clfs \
-o $BUILDDIR/sources/urls.lst urls.xsl \
$BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
echo " ...OK"
;;
hlfs)
echo -n "Creating HLFS <${MODEL}> + <${KERNEL}> specific URLs file"
xsltproc --nonet --xinclude \
--stringparam server $SERVER \
--stringparam family lfs \
--stringparam model $MODEL \
--stringparam kernel $KERNEL \
-o $BUILDDIR/sources/urls.lst urls.xsl \
$BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
echo " ...OK"
;;
lfs)
echo -n "Creating LFS specific URLs file"
xsltproc --nonet --xinclude \
--stringparam server $SERVER \
--stringparam family lfs \
-o ../sources/urls.lst urls.xsl \
$BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
echo " ...OK"
;;
esac
cd $BUILDDIR/sources
if [[ "${BLFS_TOOL}" = "y" ]]; then
add_blfs_deps_urls
fi
if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
add_CustomToolsURLS
fi
}

View file

@ -12,27 +12,61 @@ validate_config() { # Are the config values sane (within reason)
input vars: none input vars: none
externals: color constants externals: color constants
PROGNAME (lfs,clfs,hlfs) PROGNAME (lfs,hlfs,clfs,clfs2,clfs3,blfs)
modifies: none modifies: none
returns: nothing returns: nothing
on error: write text to console and dies on error: write text to console and dies
on success: write text to console and returns on success: write text to console and returns
inline_doc inline_doc
# First internal variables, then the ones that change the book's flavour, and lastly system configuration variables # Common settings by Config.in sections and books family
local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL PAGE TIMEZONE LANG LC_ALL LUSER LGROUP BLFS_TOOL" local -r BOOK_common="BOOK CUSTOM_TOOLS"
local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TARGET32 TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL" local -r BOOK_clfsX="ARCH TARGET"
local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET OPTIMIZE REPORT STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL" local -r GENERAL_common="LUSER LGROUP LHOME BUILDDIR CLEAN GETPKG SRC_ARCHIVE \
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 CUSTOM_TOOLS" SERVER GETKERNEL RUNMAKE"
local -r BUILD_chroot="TEST BOMB_TEST STRIP"
local -r BUILD_common="FSTAB CONFIG TIMEZONE PAGE LANG INSTALL_LOG"
local -r ADVANCED_chroot="COMPARE RUN_ICA RUN_FARCE ITERATIONS OPTIMIZE"
local -r ADVANCED_common="REPORT REBUILD_MAKEFILE"
# BOOK Settings by book
local -r LFS_book="$BOOK_common BLFS_TOOL"
#local -r HLFS_added="SET_SSP SET_ASLR SET_PAX SET_HARDENED_TMP SET_WARNINGS \
# SET_MISC SET_BLOWFISH"
local -r HLFS_added=""
local -r HLFS_book="$BOOK_common BLFS_TOOL MODEL KERNEL GRSECURITY_HOST $HLFS_added"
local -r CLFS_book="$BOOK_common BLFS_TOOL METHOD $BOOK_clfsX TARGET32 BOOT_CONFIG"
local -r CLFS2_book="$BOOK_common BLFS_TOOL $BOOK_clfsX"
local -r CLFS3_book="$BOOK_common $BOOK_clfsX PLATFORM MIPS_LEVEL"
# Build Settings by book
local -r LFS_build="$BUILD_chroot VIMLANG $BUILD_common"
local -r HLFS_build="$BUILD_chroot $BUILD_common"
local -r CLFS_build="$BUILD_chroot VIMLANG $BUILD_common"
local -r CLFS2_build="STRIP VIMLANG $BUILD_common"
local -r CLFS3_build=" $BUILD_common"
# Full list of books settings
local -r lfs_PARAM_LIST="$LFS_book $GENERAL_common $LFS_build $ADVANCED_chroot $ADVANCED_common"
local -r hlfs_PARAM_LIST="$HLFS_book $GENERAL_common $HLFS_build $ADVANCED_chroot $ADVANCED_common"
local -r clfs_PARAM_LIST="$CLFS_book $GENERAL_common $CLFS_build $ADVANCED_chroot $ADVANCED_common"
local -r clfs2_PARAM_LIST="$CLFS2_book $GENERAL_common $CLFS2_build $ADVANCED_common"
local -r clfs3_PARAM_LIST="$CLFS3_book $GENERAL_common $CLFS3_build $ADVANCED_common"
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_TIDY DEP_UNZIP DEP_DBXML DEP_DBXSL DEP_LINKS DEP_SUDO DEP_WGET DEP_SVN DEP_GPM" # Additional variables (add DEP_DBXSL when required again)
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_LYNX DEP_SUDO DEP_WGET \
DEP_SVN DEP_GPM"
local -r custom_tool_PARAM_LIST="TRACKING_DIR"
# Internal variables
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}'
local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}' local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
local PARAM_LIST= local PARAM_LIST=
local config_param local config_param
local validation_str local validation_str
local save_param local save_param
@ -97,23 +131,6 @@ inline_doc
PARAM_GROUP=${PROGNAME}_PARAM_LIST PARAM_GROUP=${PROGNAME}_PARAM_LIST
for config_param in ${!PARAM_GROUP}; do for config_param in ${!PARAM_GROUP}; do
case $config_param in case $config_param in
# Allways display this, if found in ${PROGNAME}_PARAM_LIST
GETPKG | \
RUNMAKE | \
TEST | \
OPTIMIZE | \
STRIP | \
VIMLANG | \
MODEL | \
METHOD | \
ARCH | \
TARGET | \
GRSECURITY_HOST | \
BLFS_TOOL | \
CUSTOM_TOOLS | \
TIMEZONE | \
PAGE) echo -e "`eval echo $PARAM_VALS`" ;;
# Envvars that depend on other settings to be displayed # Envvars that depend on other settings to be displayed
GETKERNEL ) if [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] ; then GETKERNEL ) if [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] ; then
[[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`"
@ -124,6 +141,8 @@ inline_doc
ITERATIONS) [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;; ITERATIONS) [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
BOMB_TEST) [[ ! "$TEST" = "0" ]] && echo -e "`eval echo $PARAM_VALS`" ;; BOMB_TEST) [[ ! "$TEST" = "0" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
TARGET32) [[ -n "${TARGET32}" ]] && echo -e "`eval echo $PARAM_VALS`" ;; TARGET32) [[ -n "${TARGET32}" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
MIPS_LEVEL) [[ "${ARCH}" = "mips" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
SERVER) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
# Envars that requires some validation # Envars that requires some validation
LUSER) echo -e "`eval echo $PARAM_VALS`" LUSER) echo -e "`eval echo $PARAM_VALS`"
@ -132,32 +151,21 @@ inline_doc
LGROUP) echo -e "`eval echo $PARAM_VALS`" LGROUP) echo -e "`eval echo $PARAM_VALS`"
[[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die [[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die
;; ;;
REPORT) echo -e "`eval echo $PARAM_VALS`"
if [[ "${!config_param}" = "y" ]]; then
if [[ `type -p bc` ]]; then
continue
else
echo -e " ${BOLD}The bc binary was not found${OFF}"
echo -e " The SBU and disk usage report creation will be skiped"
REPORT=n
continue
fi
fi ;;
# BOOK validation. Very ugly, need be fixed # BOOK validation. Very ugly, need be fixed
BOOK) if [[ "${WORKING_COPY}" = "y" ]] ; then BOOK) if [[ "${WORKING_COPY}" = "y" ]] ; then
validate_dir -z -d validate_dir -z -d
else else
echo -e "`eval echo $PARAM_VALS`" echo -e "`eval echo $PARAM_VALS`"
fi ;; fi
;;
# Validate directories, testable states: # Validate directories, testable states:
# fatal -z -d -w, # fatal -z -d -w,
# warning -z+ -w+ # warning -z+ -w+
SRC_ARCHIVE) [[ "$GETPKG" = "y" ]] && validate_dir -z+ -d -w+ ;; SRC_ARCHIVE) [[ "$GETPKG" = "y" ]] && validate_dir -z+ -d -w+ ;;
# The build directory/partition MUST exist and be writable by the user # The build directory/partition MUST exist and be writable by the user
BUILDDIR) validate_dir -z -d -w BUILDDIR) validate_dir -z -d -w
[[ "xx x/x" =~ "x${!config_param}x" ]] && write_error_and_die ;; [[ "xx x/x" =~ x${!config_param}x ]] && write_error_and_die ;;
LHOME) validate_dir -z -d ;;
# Validate files, testable states: # Validate files, testable states:
# fatal -z -e -s -w -x -r, # fatal -z -e -s -w -x -r,
@ -166,9 +174,8 @@ inline_doc
CONFIG) validate_file -z+ -e -s ;; CONFIG) validate_file -z+ -e -s ;;
BOOT_CONFIG) [[ "${METHOD}" = "boot" ]] && validate_file -z -e -s ;; BOOT_CONFIG) [[ "${METHOD}" = "boot" ]] && validate_file -z -e -s ;;
# Treatment of 'special' parameters # Treatment of LANG parameter
LANG | \ LANG ) # See it the locale value has been set
LC_ALL) # See it the locale values exist on this machine
echo -n "`eval echo $PARAM_VALS`" echo -n "`eval echo $PARAM_VALS`"
[[ -z "${!config_param}" ]] && [[ -z "${!config_param}" ]] &&
echo " -- Variable $config_param cannot be empty!" && echo " -- Variable $config_param cannot be empty!" &&
@ -180,6 +187,9 @@ inline_doc
BRANCH_ID | BLFS_ROOT | BLFS_XML ) echo "`eval echo $PARAM_VALS`" ;; BRANCH_ID | BLFS_ROOT | BLFS_XML ) echo "`eval echo $PARAM_VALS`" ;;
TRACKING_DIR ) validate_dir -z -d -w ;; TRACKING_DIR ) validate_dir -z -d -w ;;
# Display non-validated envars found in ${PROGNAME}_PARAM_LIST
* ) echo -e "`eval echo $PARAM_VALS`" ;;
esac esac
done done
@ -190,6 +200,12 @@ inline_doc
done done
fi fi
if [[ "${CUSTOM_TOOLS}" = "y" ]] && [[ "${BLFS_TOOL}" = "n" ]] ; then
for config_param in ${custom_tool_PARAM_LIST}; do
echo -e "`eval echo $PARAM_VALS`"
done
fi
set -e set -e
echo "${nl_}***${BOLD}${GREEN} ${PARAM_GROUP%%_*T} config parameters look good${OFF} ***${nl_}" echo "${nl_}***${BOLD}${GREEN} ${PARAM_GROUP%%_*T} config parameters look good${OFF} ***${nl_}"
} }

View file

@ -0,0 +1,386 @@
#!/bin/bash
# $Id$
#=== MAKEFILE HEADER ===
#----------------------------------#
wrt_Makefile_header() { #
#----------------------------------#
(
cat << EOF
# This file is automatically generated by jhalfs
# DO NOT EDIT THIS FILE MANUALLY
#
# Generated on `date "+%F %X %Z"`
SHELL = /bin/bash
SRC = /sources
MOUNT_PT = $BUILDDIR
PKG_LST = $PKG_LST
LUSER = $LUSER
LGROUP = $LGROUP
LHOME = $LHOME
SCRIPT_ROOT = $SCRIPT_ROOT
BASEDIR = \$(MOUNT_PT)
SRCSDIR = \$(BASEDIR)/sources
CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands
LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$LOGDIRBASE
TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$TESTLOGDIRBASE
crCMDSDIR = /\$(SCRIPT_ROOT)/$PROGNAME-commands
crLOGDIR = /\$(SCRIPT_ROOT)/$LOGDIRBASE
crTESTLOGDIR = /\$(SCRIPT_ROOT)/$TESTLOGDIRBASE
crFILELOGDIR = /\$(SCRIPT_ROOT)/$FILELOGDIRBASE
SU_LUSER = su - \$(LUSER) -c
LUSER_HOME = \$(LHOME)/\$(LUSER)
PRT_DU = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found \$(MOUNT_PT) \`\n"
PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found / \`\n"
ADD_REPORT = $REPORT
ADD_CUSTOM_TOOLS = $CUSTOM_TOOLS
ADD_BLFS_TOOLS = $BLFS_TOOL
export PATH := \${PATH}:/usr/sbin
include makefile-functions
EOF
) > $MKFILE
}
#=======================
#==== PACKAGES NAMES ===
#----------------------------------#
get_package_tarball_name() { #
#----------------------------------#
local script_name=`echo ${1} | sed -e 's@[0-9]\{1\}-@@'`
# The use of 'head' is necessary to limit the return value to the FIRST match..
# hopefully this will not cause problems.
#
case $script_name in
tcl) echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
powerpc-utils) echo $(grep "^powerpc-utils" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
uClibc)
if [[ "${PROGNAME}" = "clfs3" ]]; then
echo $(grep "^uClibc-" $JHALFSDIR/pkg_tarball_list | head -n1 )
else
echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
fi
;;
linux-headers)
if [[ "${PROGNAME}" = "lfs" ]] || [[ "${PROGNAME}" = "hlfs" ]] ; then
# Uses kernel headers directly
echo $(grep "^linux-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
else
# CLFS{,2,3} use massaged headers package
echo $(grep "^linux-headers-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
fi
;;
*) echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
esac
}
#=======================
#==== TARGET HEADER ====
#----------------------------------#
LUSER_wrt_target() { # Create target and initialize log file
#----------------------------------#
local i=$1
local PREV=$2
(
cat << EOF
$i: $PREV
@\$(call echo_message, Building)
@export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
@echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@
@\$(PRT_DU) >>logs/\$@
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
CHROOT_wrt_target() { # Create target and initialize log file
#----------------------------------#
local i=$1
local PREV=$2
(
cat << EOF
$i: $PREV
@\$(call echo_message, Building)
@export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
@echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@
@\$(PRT_DU_CR) >>logs/\$@
EOF
) >> $MKFILE.tmp
}
#=======================
#======== UNPACK =======
#----------------------------------#
LUSER_wrt_unpack() { # Unpack and set 'ROOT' var
#----------------------------------#
local FILE=$1
local optSAVE_PREVIOUS=$2
if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then
(
cat << EOF
@\$(call remove_existing_dirs,$FILE)
EOF
) >> $MKFILE.tmp
fi
(
cat << EOF
@\$(call unpack,$FILE)
@\$(call get_pkg_root_LUSER)
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
CHROOT_Unpack() { #
#----------------------------------#
local FILE=$1
local optSAVE_PREVIOUS=$2
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
(
cat << EOF
@\$(call remove_existing_dirs2,$FILE)
EOF
) >> $MKFILE.tmp
fi
(
cat << EOF
@\$(call unpack2,$FILE)
@\$(call get_pkg_root2)
EOF
) >> $MKFILE.tmp
}
#=======================
#===== TESTS LOGS ======
#----------------------------------#
LUSER_wrt_test_log() { # Initialize testsuite log file
#----------------------------------#
local TESTLOGFILE=$1
(
cat << EOF
@echo "export TEST_LOG=\$(TESTLOGDIR)/$TESTLOGFILE" >> envars && \\
echo "\$(nl_)\`date\`\$(nl_)" >\$(TESTLOGDIR)/\$@
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
CHROOT_wrt_test_log() { #
#----------------------------------#
local TESTLOGFILE=$1
(
cat << EOF
@echo "export TEST_LOG=\$(crTESTLOGDIR)/$TESTLOGFILE" >> envars && \\
echo "\$(nl_)\`date\`\$(nl_)" >test-logs/\$@
EOF
) >> $MKFILE.tmp
}
#=======================
#======== RUN AS =======
#----------------------------------#
wrt_RunAsRoot() { # Some scripts must be run as root..
#----------------------------------#
local MOUNT_ENV
local file=$1
case ${PROGNAME} in
lfs ) MOUNT_ENV="LFS" ;;
clfs ) MOUNT_ENV="CLFS" ;;
clfs2 ) MOUNT_ENV="CLFS" ;;
clfs3 ) MOUNT_ENV="CLFS" ;;
hlfs ) MOUNT_ENV="HLFS" ;;
*) echo "undefined progname $PROGNAME"; exit 1 ;;
esac
(
cat << EOF
@export ${MOUNT_ENV}=\$(MOUNT_PT) && \\
${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 && \\
\$(PRT_DU) >>logs/\$@
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
LUSER_wrt_RunAsUser() { # Calculate time with perl, footer to log file
#----------------------------------#
local file=$1
(
cat << EOF
@source ~/.bashrc && \\
\$(CMDSDIR)/`dirname $file`/\$@ >> logs/\$@ 2>&1 && \\
\$(PRT_DU) >>logs/\$@
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
CHROOT_wrt_RunAsRoot() { #
#----------------------------------#
local file=$1
(
cat << EOF
@source envars && \\
\$(crCMDSDIR)/`dirname $file`/\$@ >>logs/\$@ 2>&1 && \\
\$(PRT_DU_CR) >>logs/\$@
EOF
) >> $MKFILE.tmp
}
#=======================
#====== COPY FSTAB =====
#----------------------------------#
LUSER_wrt_CopyFstab() { #
#----------------------------------#
(
cat << EOF
@cp -v \$(MOUNT_PT)/sources/fstab \$(MOUNT_PT)/etc/fstab >>logs/\$@ 2>&1 && \\
\$(PRT_DU) >>logs/\$@
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
CHROOT_wrt_CopyFstab() { #
#----------------------------------#
(
cat << EOF
@cp -v /sources/fstab /etc/fstab >>logs/\$@ 2>&1 && \\
\$(PRT_DU_CR) >>logs/\$@
EOF
) >> $MKFILE.tmp
}
#=======================
#==== INSTALLED FILES LOGS ====
#----------------------------------#
LUSER_wrt_TouchTimestamp() { #
#----------------------------------#
(
cat << EOF
@\$(call touch_timestamp_LUSER)
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
CHROOT_wrt_TouchTimestamp() { #
#----------------------------------#
(
cat << EOF
@\$(call touch_timestamp)
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
LUSER_wrt_LogNewFiles() { #
#----------------------------------#
local name=$1
(
cat << EOF
@\$(call log_new_files_LUSER,$name)
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
CHROOT_wrt_LogNewFiles() { #
#----------------------------------#
local name=$1
(
cat << EOF
@\$(call log_new_files,$name)
EOF
) >> $MKFILE.tmp
}
#=======================
#==== RM BUILD DIRS ====
#----------------------------------#
LUSER_RemoveBuildDirs() { #
#----------------------------------#
local name=$1
(
cat << EOF
@\$(call remove_build_dirs,$name)
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
CHROOT_wrt_RemoveBuildDirs() { #
#----------------------------------#
local name=$1
(
cat << EOF
@\$(call remove_build_dirs2,$name)
EOF
) >> $MKFILE.tmp
}
#=======================
#======== TOUCH ========
#----------------------------------#
wrt_touch() { #
#----------------------------------#
(
cat << EOF
@\$(call housekeeping)
EOF
) >> $MKFILE.tmp
}
#=======================

View file

@ -10,16 +10,24 @@ WHITE = ""
YELLOW = "" YELLOW = ""
OFF = "" OFF = ""
BOLD = ""
REVERSE = "" REVERSE = ""
tab_ = " "
nl_ = ""
#==== BUILD MESSAGES ===
define echo_PHASE define echo_PHASE
@clear
@echo $(BOLD)-------------------------------------------------------------------------------- @echo $(BOLD)--------------------------------------------------------------------------------
@echo -e \\t\\tExecuting $(BLUE)$(1)$(WHITE) scripts @echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts
@echo $(BOLD)-------------------------------------------------------------------------------- @echo $(BOLD)--------------------------------------------------------------------------------
#echo $(WHITE) @echo $(WHITE)
endef
define sh_echo_PHASE
echo $(BOLD)--------------------------------------------------------------------------------;\
echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts; \
echo $(BOLD)--------------------------------------------------------------------------------echo $(WHITE)
endef endef
define echo_SU_request define echo_SU_request
@ -30,15 +38,13 @@ define echo_SU_request
endef endef
define echo_SULUSER_request define echo_SULUSER_request
@clear
@echo $(BOLD)-------------------------------------------------------------------------------- @echo $(BOLD)--------------------------------------------------------------------------------
@echo $(BOLD)$(BLUE)$@ @echo $(BOLD)$(BLUE)$@
@echo $(WHITE)You are going to log into the user account $(BOLD)$(YELLOW)$(LUSER)$(OFF) @echo $(WHITE)You are going to log into the user account $(BOLD)$(YELLOW)$(LUSER)$(OFF)
@echo su requires a password @echo sudo requires a password
endef endef
define echo_CHROOT_request define echo_CHROOT_request
@clear
@echo $(BOLD)-------------------------------------------------------------------------------- @echo $(BOLD)--------------------------------------------------------------------------------
@echo $(BOLD)$(BLUE)$@ @echo $(BOLD)$(BLUE)$@
@echo $(WHITE)You are going to CHROOT into $(MOUNT_PT) $(BOLD)$(YELLOW)$(LUSER)$(OFF) @echo $(WHITE)You are going to CHROOT into $(MOUNT_PT) $(BOLD)$(YELLOW)$(LUSER)$(OFF)
@ -50,39 +56,44 @@ define echo_message
@echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)$(WHITE) @echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)$(WHITE)
endef endef
#=======================
#=== BUILD FUNCTIONS ===
define remove_existing_dirs define remove_existing_dirs
@PKG_PATH=`ls -t $(SRCSDIR)/$(1) | head -n1` && \ @PKG_PATH=`ls -t $(SRCSDIR)/$(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 $(SRCSDIR)/$$ROOT && \ [ -n "$$ROOT" ] && \
rm -rf $(SRCSDIR)/$${ROOT%-*}-build if [ -d $(SRCDIR)/$$ROOT ]; then \
rm -rf $(SRCSDIR)/$$ROOT && \
rm -rf $(SRCSDIR)/$${ROOT%-*}-build; \
fi;
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 && \ [ -n "$$ROOT" ] && \
rm -rf $(SRC)/$${ROOT%-*}-build if [ -d $(SRC)/$$ROOT ]; then \
rm -rf $(SRC)/$$ROOT && \
rm -rf $(SRC)/$${ROOT%-*}-build; \
fi;
endef endef
define remove_build_dirs #==#
@ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
rm -rf $(SRCSDIR)/$$ROOT && \ define unpack
rm -rf $(SRCSDIR)/$(1)-build @cd $(SRCSDIR) && \
tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
endef endef
define remove_build_dirs2 define unpack2
@ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \ @cd $(SRC) && \
rm -rf $(SRC)/$$ROOT && \ tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
rm -rf $(SRC)/$(1)-build
endef endef
define housekeeping #==#
@touch $@ && \
sleep .25 && \
echo -e "\n" $(BOLD)Target $(BLUE)$@ $(WHITE)$(BOLD)OK && \
echo --------------------------------------------------------------------------------$(WHITE)
endef
define get_pkg_root define get_pkg_root
@ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \ @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
@ -104,30 +115,70 @@ define get_pkg_root_LUSER
echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars
endef endef
define unpack #==#
@cd $(SRCSDIR) && \
tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST) define touch_timestamp
@touch $(SRC)/timestamp-marker && sleep 1
endef endef
define unpack2 define touch_timestamp_LUSER
@cd $(SRCSDIR) && \ @touch $(SRCSDIR)/timestamp-marker && sleep 1
/tools/bin/tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
endef endef
define unpack3 define log_new_files
@cd $(SRC) && \ @find / -xdev ! -path "/$(SCRIPT_ROOT)/*" ! -path "/tmp/*" ! -path "$(SRC)/*" \
tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST) -newer $(SRC)/timestamp-marker -not -type d \
-printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(crFILELOGDIR)/$(1)
endef endef
define log_new_files_LUSER
@find $(BASEDIR) -xdev ! -path "$(BASEDIR)/$(SCRIPT_ROOT)/*" ! -path "$(BASEDIR)/tmp/*" ! -path "$(SRCSDIR)/*" \
-newer $(SRCSDIR)/timestamp-marker -not -type d \
-printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(BASEDIR)$(crFILELOGDIR)/$(1)
endef
#==@
define remove_build_dirs
@ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
rm -rf $(SRCSDIR)/$$ROOT && \
rm -rf $(SRCSDIR)/$(1)-build
endef
define remove_build_dirs2
@ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
rm -rf $(SRC)/$$ROOT && \
rm -rf $(SRC)/$(1)-build
endef
#==#
define housekeeping
@touch $@ && \
sleep .25 && \
echo -e "\n" $(BOLD)Target $(BLUE)$@ $(WHITE)$(BOLD)OK && \
echo --------------------------------------------------------------------------------$(WHITE) && \
if [ "$(BREAKPOINT)" = "$@" ] ; then \
echo $(tab_)$(RED)The build has been stopped at $(BLUE)$@ $(RED)as requested$(WHITE) ; \
false ; \
fi
endef
#=======================
#==== FINAL MESSAGES ===
define echo_report define echo_report
@echo echo ; \
@echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created ; \
@echo echo ; \
@echo ${WHITE}Please send the $(BOLD)$(MOUNT_PT)/jhalfs/$(1)$(WHITE) echo $(WHITE)Please send the $(BOLD)$(MOUNT_PT)/jhalfs/$(1)$(WHITE) ; \
@echo file to $(BOLD)manuel@linuxfromscratch.org$(WHITE) echo file to $(BOLD)manuel@linuxfromscratch.org$(WHITE) ; \
@echo echo ; \
@echo That will help us to keep more accurate SBU and echo That will help us to keep more accurate SBU and ; \
@echo disk usage values into the book. Thanks. echo disk usage values into the book. Thanks. ; \
echo $(BOLD)--------------------------------------------------------------------------------$(WHITE)
endef endef
define echo_finished define echo_finished
@ -135,39 +186,39 @@ define echo_finished
@echo -------------------------------------------------------------------------------- @echo --------------------------------------------------------------------------------
@echo $(BOLD) Finished the build of $(BLUE)$(1)$(BOLD) @echo $(BOLD) Finished the build of $(BLUE)$(1)$(BOLD)
@echo -------------------------------------------------------------------------------- @echo --------------------------------------------------------------------------------
@echo -e \\t\\t$(RED)W A R N I N G$(BOLD) @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
@echo -------------------------------------------------------------------------------- @echo --------------------------------------------------------------------------------
@echo @echo
@echo To be able to boot your new system you need to follow @echo To be able to boot your new system you need to follow
@echo the next steps:$(WHITE) @echo the next steps:$(WHITE)
@echo @echo
@echo -e \\t- Enter to the chroot using the command found @echo $(tab_)- Enter to the chroot using the command found
@echo -e \\tin the section -Entering the Chroot Environment- @echo $(tab_)in the section -Entering the Chroot Environment-
@echo -e \\texcept if building CLFS with METHOD=boot. @echo $(tab_)except if building CLFS with METHOD=boot.
@echo @echo
@echo -e \\t- Set a password for the root user. @echo $(tab_)- Set a password for the root user.
@echo @echo
@echo -e \\t- Edit or create /etc/fstab, /etc/hosts, /etc/sysconfig/clock, @echo $(tab_)- Edit or create /etc/fstab, /etc/hosts, /etc/sysconfig/clock,
@echo -e \\t/etc/sysconfig/console, /etc/sysconfig/network, @echo $(tab_)/etc/sysconfig/console, /etc/sysconfig/network,
@echo -e \\t/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and @echo $(tab_)/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and
@echo -e \\tany other configuration file required to suit your needs. @echo $(tab_)any other configuration file required to suit your needs.
@echo @echo
@echo -e \\t- Exit from the chroot. @echo $(tab_)- Exit from the chroot.
@echo @echo
@echo -e \\t- Set-up the boot loader, except if building CLFS with METHOD=boot. @echo $(tab_)- Set-up the boot loader, except if building CLFS with METHOD=boot.
@echo -e \\tYou can set-up the host bootloader or the new boot-loader @echo $(tab_)You can set-up the host bootloader or the new boot-loader
@echo -e \\tinstalled on the new system. @echo $(tab_)installed on the new system.
@echo -e \\tIf the last, you must to mount the virtual filesystems, re-enter @echo $(tab_)If the last, you must to mount the virtual filesystems, re-enter
@echo -e \\tthe chroot and be sure that /dev is populated with the @echo $(tab_)the chroot and be sure that /dev is populated with the
@echo -e \\trequired devices before configure the boot-loader. When ready, @echo $(tab_)required devices before configure the boot-loader. When ready,
@echo -e \\texit from the chroot and umount the filesystems @echo $(tab_)exit from the chroot and umount the filesystems
@echo @echo
@echo If you are an experienced LFS user, several of those steps can be @echo If you are an experienced LFS user, several of those steps can be
@echo skipped or done in a different way. But then, that is something @echo skipped or done in a different way. But then, that is something
@echo that you already know and there is no need to discuss it here. @echo that you already know and there is no need to discuss it here.
@echo $(BOLD) @echo $(BOLD)
@echo -------------------------------------------------------------------------------- @echo --------------------------------------------------------------------------------
@echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD) @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
@echo --------------------------------------------------------------------------------$(WHITE) @echo --------------------------------------------------------------------------------$(WHITE)
endef endef
@ -176,22 +227,22 @@ define echo_boot_finished
@echo -------------------------------------------------------------------------------- @echo --------------------------------------------------------------------------------
@echo $(BOLD) Finished building a minimal boot system for $(BLUE)$(1)$(BOLD) @echo $(BOLD) Finished building a minimal boot system for $(BLUE)$(1)$(BOLD)
@echo -------------------------------------------------------------------------------- @echo --------------------------------------------------------------------------------
@echo -e \\t\\t$(RED)W A R N I N G$(BOLD) @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
@echo -------------------------------------------------------------------------------- @echo --------------------------------------------------------------------------------
@echo @echo
@echo The build is not complete. Follow the next steps:$(WHITE) @echo The build is not complete. Follow the next steps:$(WHITE)
@echo @echo
@echo -e \\t- Edit or create $(MOUNT_PT)/etc/fstab @echo $(tab_)- Edit or create $(MOUNT_PT)/etc/fstab
@echo -e \\t and any other configuration file required to suit your needs. @echo $(tab_) and any other configuration file required to suit your needs.
@echo $(BOLD) @echo $(BOLD)
@echo $(BOLD)$(YELLOW) @echo $(BOLD)$(YELLOW)
@echo 1.If it is necessary, transfer the newly created partition to the target machine @echo 1.If it is necessary, transfer the newly created partition to the target machine
@echo 2.Boot the new partition. @echo 2.Boot the new partition.
@echo 3.Once you are logged in issue the following commands @echo 3.Once you are logged in issue the following commands
@echo -e \\t $(BOLD})cd /jhalfs @echo $(tab_) $(BOLD)cd /jhalfs
@echo -e \\t $(BOLD)make makesys @echo $(tab_) $(BOLD)make makesys
@echo The build process should resume. Follow any instructions that appear. @echo The build process should resume. Follow any instructions that appear.
@echo -------------------------------------------------------------------------------- @echo --------------------------------------------------------------------------------
@echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD) @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
@echo --------------------------------------------------------------------------------$(WHITE) @echo --------------------------------------------------------------------------------$(WHITE)
endef endef

View file

@ -7,12 +7,22 @@
<xsl:output method="text"/> <xsl:output method="text"/>
<!-- The libc model used for HLFS -->
<xsl:param name="model" select="glibc"/>
<!-- The kernel series used for HLFS -->
<xsl:param name="kernel" select="2.6"/>
<xsl:template match="/"> <xsl:template match="/">
<xsl:apply-templates select="//para"/> <xsl:apply-templates select="//para"/>
</xsl:template> </xsl:template>
<xsl:template match="para"> <xsl:template match="para">
<xsl:if test="contains(string(),'Download:')"> <xsl:if test="contains(string(),'Download:') and
(ancestor::varlistentry[@condition=$model]
or not(ancestor::varlistentry[@condition])) and
(ancestor::varlistentry[@vendor=$kernel]
or not(ancestor::varlistentry[@vendor]))">
<xsl:call-template name="package_name"> <xsl:call-template name="package_name">
<xsl:with-param name="url" select="ulink/@url"/> <xsl:with-param name="url" select="ulink/@url"/>
</xsl:call-template> </xsl:call-template>

10
common/progress_bar.sh Executable file → Normal file
View file

@ -1,4 +1,3 @@
#!/bin/bash
# $Id$ # $Id$
@ -24,6 +23,13 @@ declare -a GRAPHIC_STR="| / - \\ + "
declare -i SEC=0 # Seconds accumulator declare -i SEC=0 # Seconds accumulator
declare -i PREV_SEC=0 declare -i PREV_SEC=0
# Prevent segfault on stripping phases
if [[ "$BASHBIN" = "/tools/bin/bash" ]] ; then
SLEEP=/tools/bin/sleep
else
SLEEP=/bin/sleep
fi
write_or_exit() { write_or_exit() {
# make has been killed or failed or run to completion, leave # make has been killed or failed or run to completion, leave
[[ ! -e /proc/${MAKE_PPID} ]] && echo -n "${CURSOR_ON}" && exit [[ ! -e /proc/${MAKE_PPID} ]] && echo -n "${CURSOR_ON}" && exit
@ -44,7 +50,7 @@ while true ; do
# Loop through the animation string # Loop through the animation string
for GRAPHIC_CHAR in ${GRAPHIC_STR} ; do for GRAPHIC_CHAR in ${GRAPHIC_STR} ; do
write_or_exit "${CSI}$((SEC + 3))G${GRAPHIC_CHAR}" write_or_exit "${CSI}$((SEC + 3))G${GRAPHIC_CHAR}"
sleep .12 # This value MUST be less than .2 seconds. $SLEEP .12 # This value MUST be less than .2 seconds.
done done
# A BASH internal variable, the number of seconds the script # A BASH internal variable, the number of seconds the script

View file

@ -10,9 +10,15 @@
<!-- The FTP server used as fallback --> <!-- The FTP server used as fallback -->
<xsl:param name="server">ftp://ftp.osuosl.org</xsl:param> <xsl:param name="server">ftp://ftp.osuosl.org</xsl:param>
<!-- The book family (lfs or clfs). Needed to use the proper FTP path. -->
<xsl:param name="family">lfs</xsl:param>
<!-- The libc model used for HLFS --> <!-- The libc model used for HLFS -->
<xsl:param name="model" select="glibc"/> <xsl:param name="model" select="glibc"/>
<!-- The kernel series used for HLFS -->
<xsl:param name="kernel" select="2.6"/>
<xsl:template match="/"> <xsl:template match="/">
<xsl:apply-templates select="//ulink"/> <xsl:apply-templates select="//ulink"/>
</xsl:template> </xsl:template>
@ -23,8 +29,10 @@
duplicated URLs due that may be splitted for PDF output --> duplicated URLs due that may be splitted for PDF output -->
<xsl:if test="(ancestor::varlistentry[@condition=$model] <xsl:if test="(ancestor::varlistentry[@condition=$model]
or not(ancestor::varlistentry[@condition])) and or not(ancestor::varlistentry[@condition])) and
(contains(@url, '.tar.') or contains(@url, '.tgz') (ancestor::varlistentry[@vendor=$kernel]
or contains(@url, '.patch')) and or not(ancestor::varlistentry[@vendor])) and
(contains(@url, '.bz2') or contains(@url, '.tar.gz') or
contains(@url, '.tgz') or contains(@url, '.patch')) and
not(ancestor-or-self::*/@condition = 'pdf')"> not(ancestor-or-self::*/@condition = 'pdf')">
<!-- Extract the package name --> <!-- Extract the package name -->
<xsl:variable name="package"> <xsl:variable name="package">
@ -42,10 +50,10 @@
<xsl:value-of select="$cut"/> <xsl:value-of select="$cut"/>
</xsl:variable> </xsl:variable>
<xsl:variable name="dirname" select="substring-before($package2, '-0')"/> <xsl:variable name="dirname" select="substring-before($package2, '-0')"/>
<!-- Write the upstream URLs, except the redirected ones --> <!-- Write the upstream URLs, fixing the redirected ones -->
<xsl:choose> <xsl:choose>
<xsl:when test="contains(@url,'?')"> <xsl:when test="contains(@url,'?')">
<xsl:text>dummy-url</xsl:text> <xsl:value-of select="substring-before(@url,'?')"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="@url"/> <xsl:value-of select="@url"/>
@ -54,7 +62,9 @@
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
<!-- Write FTP mirror URLs --> <!-- Write FTP mirror URLs -->
<xsl:value-of select="$server"/> <xsl:value-of select="$server"/>
<xsl:text>/pub/lfs/conglomeration/</xsl:text> <xsl:text>/pub/</xsl:text>
<xsl:value-of select="$family"/>
<xsl:text>/conglomeration/</xsl:text>
<xsl:choose> <xsl:choose>
<!-- Fix some directories. Test against $dirname to be sure that we <!-- Fix some directories. Test against $dirname to be sure that we
are matching the start of a package name, not a string in a patch name are matching the start of a package name, not a string in a patch name
@ -77,7 +87,7 @@
<xsl:when test="contains($package, 'tcl')"> <xsl:when test="contains($package, 'tcl')">
<xsl:text>tcl/</xsl:text> <xsl:text>tcl/</xsl:text>
</xsl:when> </xsl:when>
<xsl:when test="contains($dirname, 'uClibc')"> <xsl:when test="contains($package, 'uClibc')">
<xsl:text>uClibc/</xsl:text> <xsl:text>uClibc/</xsl:text>
</xsl:when> </xsl:when>
<xsl:when test="contains($dirname, 'udev')"> <xsl:when test="contains($dirname, 'udev')">

View file

@ -1,8 +1,14 @@
#
# $Id$
#
PKG="bc" PKG="bc"
PKG_VERSION="1.06" PKG_VERSION="1.06"
PKG_FILE="bc-1.06.tar.gz" PKG_FILE="bc-1.06.tar.gz"
URL="http://ftp.gnu.org/gnu/bc/${PKG_FILE}" URL="http://ftp.gnu.org/gnu/bc/${PKG_FILE}"
MD5="d44b5dddebd8a7a7309aea6c36fda117" MD5="d44b5dddebd8a7a7309aea6c36fda117"
for i in PATCH{1..10}; do
unset $i
done
( cat << "xEOFx" ( cat << "xEOFx"
sed -i '/PROTO.*readline/d' bc/scan.l && sed -i '/PROTO.*readline/d' bc/scan.l &&

View file

@ -1,8 +1,14 @@
#
# $Id$
#
PKG="glib" PKG="glib"
PKG_VERSION="1.2.10" PKG_VERSION="1.2.10"
PKG_FILE="glib-1.2.10.tar.gz" PKG_FILE="glib-1.2.10.tar.gz"
URL="http://gd.tuwien.ac.at/graphics/gimp/gtk/v1.2/${PKG_FILE}" URL="http://gd.tuwien.ac.at/graphics/gimp/gtk/v1.2/${PKG_FILE}"
MD5="6fe30dad87c77b91b632def29dd69ef9" MD5="6fe30dad87c77b91b632def29dd69ef9"
for i in PATCH{1..10}; do
unset $i
done
PATCH1="http://www.linuxfromscratch.org/patches/blfs/svn/glib-1.2.10-gcc34-1.patch 0077a1cce5e8a2231ac5a9b08c6263ba" PATCH1="http://www.linuxfromscratch.org/patches/blfs/svn/glib-1.2.10-gcc34-1.patch 0077a1cce5e8a2231ac5a9b08c6263ba"

View file

@ -1,9 +1,14 @@
#
# $Id$
#
PKG="mc" PKG="mc"
PKG_VERSION="4.6.1" PKG_VERSION="4.6.1"
PKG_FILE="mc-4.6.1.tar.gz" PKG_FILE="mc-4.6.1.tar.gz"
URL="http://www.ibiblio.org/pub/Linux/utils/file/managers/mc/${PKG_FILE}" URL="http://www.ibiblio.org/pub/Linux/utils/file/managers/mc/${PKG_FILE}"
MD5="18b20db6e40480a53bac2870c56fc3c4" MD5="18b20db6e40480a53bac2870c56fc3c4"
PATCH1="" for i in PATCH{1..10}; do
unset $i
done
( cat << "xEOFx" ( cat << "xEOFx"
./configure --prefix=/usr && ./configure --prefix=/usr &&

26
custom/examples/960-pppd Normal file
View file

@ -0,0 +1,26 @@
#
# $Id$
#
# The PPP package contains the pppd daemon and the chat program.
# This is used for connecting to other machines; often for connecting
# to the Internet via a dial-up or PPPoE connection to an ISP.
#
PKG="ppp"
PKG_VERSION="2.4.4"
PKG_FILE="ppp-${PKG_VERSION}.tar.gz"
URL="http://samba.org/ftp/ppp/${PKG_FILE}"
MD5="183800762e266132218b204dfb428d29"
for i in PATCH{1..10}; do
unset $i
done
( cat << "xEOFx"
./configure --prefix=/usr &&
make
make install &&
make install-etcppp
xEOFx
) > tmp

View file

@ -0,0 +1,35 @@
#
# $Id$
#
# The OpenSSL package contains management tools and libraries
# relating to cryptography. These are useful for providing
# cryptography functions to other packages, notably OpenSSH,
# email applications and web browsers (for accessing HTTPS sites).
#
PKG="openssl"
PKG_VERSION="0.9.8d"
PKG_FILE="openssl-${PKG_VERSION}.tar.gz"
URL="ftp://ftp.openssl.org/source/${PKG_FILE}"
MD5="8ed1853538e1d05a1f5ada61ebf8bffa"
for i in PATCH{1..10}; do
unset $i
done
PATCH1=" http://www.linuxfromscratch.org/patches/blfs/svn/openssl-0.9.8d-fix_manpages-1.patch"
( cat << "xEOFx"
sed -i -e 's/mcpu/march/' config
patch -Np1 -i ../openssl-0.9.8d-fix_manpages-1.patch &&
./config --openssldir=/etc/ssl --prefix=/usr shared &&
make MANDIR=/usr/share/man
make MANDIR=/usr/share/man install &&
cp -v -r certs /etc/ssl &&
install -v -d -m755 /usr/share/doc/openssl-0.9.8d &&
cp -v -r doc/{HOWTO,README,*.{txt,html,gif}} \
/usr/share/doc/openssl-0.9.8d
xEOFx
) > tmp

View file

@ -1,9 +1,14 @@
#
# $Id$
#
PKG="gpm" PKG="gpm"
PKG_VERSION="1.20.1" PKG_VERSION="1.20.1"
PKG_FILE="gpm-1.20.1.tar.bz2" PKG_FILE="gpm-${PKG_VERSION}.tar.bz2"
URL="ftp://arcana.linux.it/pub/gpm/${PKG_FILE}" URL="ftp://arcana.linux.it/pub/gpm/${PKG_FILE}"
MD5="2c63e827d755527950d9d13fe3d87692" MD5="2c63e827d755527950d9d13fe3d87692"
for i in PATCH{1..10}; do
unset $i
done
PATCH1=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-segfault-1.patch" PATCH1=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-segfault-1.patch"
PATCH2=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-silent-1.patch" PATCH2=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-silent-1.patch"

32
custom/examples/963-lynx Normal file
View file

@ -0,0 +1,32 @@
#
# $Id$
#
# Lynx is a text based web browser.
#
PKG="lynx"
PKG_VERSION="2.8.6"
PKG_FILE="lynx${PKG_VERSION}.tar.bz2"
URL="ftp://lynx.isc.org/lynx2.8.6/${PKG_FILE}"
MD5="dc80497b7dda6a28fd80404684d27548"
for i in PATCH{1..10}; do
unset $i
done
( cat << "xEOFx"
./configure --prefix=/usr \
--sysconfdir=/etc/lynx \
--datadir=/usr/share/doc/lynx-2.8.6 \
--with-zlib \
--with-bzlib \
--with-screen=ncursesw \
--enable-locale-charset &&
make
make install-full &&
chgrp -v -R root /usr/share/doc/lynx-2.8.6/lynx_doc
xEOFx
) > tmp

View file

@ -0,0 +1,27 @@
#
# $Id$
#
# dhcpcd is an implementation of the DHCP client specified in RFC2131.
# This is useful for connecting your computer to a network which uses
# DHCP to assign network addresses.
#
PKG="dhcpcd"
PKG_VERSION="2.0.8"
PKG_FILE="dhcpcd-${PKG_VERSION}.tar.bz2"
URL="ftp://ftp.osuosl.org/pub/gentoo/distfiles/${PKG_FILE}"
MD5="ec91c33b6d9cb46a42f9564e573fd249"
for i in PATCH{1..10}; do
unset $i
done
( cat << "xEOFx"
./configure --prefix="" --mandir=/usr/share/man &&
make
make install &&
chmod -v 754 /etc/dhcpc/dhcpcd.exe
xEOFx
) > tmp

25
custom/examples/965-eject Normal file
View file

@ -0,0 +1,25 @@
#
# $Id$
#
# Program for ejecting removable media under software control.
# Can also control the auto-eject feature of some drives and
# can be used to switch CDs on an IDE/ATAPI CD changer.
#
PKG="eject"
PKG_VERSION="2.10"
PKG_FILE="eject-${PKG_VERSION}.tar.gz"
URL="ftp://sunsite.unc.edu/pub/Linux/utils/disk-management/${PKG_FILE}"
MD5="82e3a7a4d7e3323018c6938015ff25f7"
PATCH1=""
( cat << "xEOFx"
./configure --prefix=/usr \
--enable-default-device=/dev/cdrom \
--disable-nls
make
make install
xEOFx
) > tmp

33
custom/examples/997-nasm Normal file
View file

@ -0,0 +1,33 @@
#
# $Id$
# NASM (Netwide Assembler) is an 80x86 assembler designed
# for portability and modularity. It includes a
# disassembler as well.
PKG="nasm"
PKG_VERSION="0.98.39"
PKG_FILE="nasm-${PKG_VERSION}.tar.bz2"
URL="http://downloads.sourceforge.net/nasm/${PKG_FILE}"
MD5="2032ad44c7359f7a9a166a40a633e772"
for i in PATCH{1..10}; do
unset $i
done
PATCH1="http://www.linuxfromscratch.org/patches/blfs/svn/nasm-0.98.39-security_fix-1.patch"
( cat << "xEOFx"
patch -Np1 -i ../nasm-0.98.39-security_fix-1.patch &&
./configure --prefix=/usr &&
make
make -C rdoff/doc
make -C rdoff/doc html
make install &&
make install_rdf &&
install -v -m644 rdoff/doc/rdoff.info /usr/share/info &&
install -v -m755 -d /usr/share/doc/nasm/html &&
install -v -m644 rdoff/doc/v1-v2.txt /usr/share/doc/nasm &&
cp -v -R rdoff/doc/rdoff /usr/share/doc/nasm/html
xEOFx
) > tmp

View file

@ -0,0 +1,35 @@
#
# $Id$
#
# SYSLINUX is a collection of boot loaders for the Linux
# operating system which operates off Linux ext2/3
# filesystems, MS-DOS FAT filesystems, network servers
# using PXE firmware, or from CD-ROMs. The FAT
# filesystem version can be installed from DOS, NT, or
# Linux.
#
# It includes a sophisticated API for add-on "COM32"
# modules, including a significant subset of the
# standard C library.
#
# It also includes MEMDISK, a tool to boot legacy
# operating systems from nontraditional media like PXE
# or CD-ROM.
#
PKG="syslinux"
PKG_VERSION="3.36"
PKG_FILE="syslinux-$PKG_VERSION}.tar.bz2"
URL="http://www.kernel.org/pub/linux/utils/boot/syslinux/${PKG_FILE}"
MD5="d1bfdaa53d31f572f540be55d1480027"
for i in PATCH{1..10}; do
unset $i
done
( cat << "xEOFx"
make
make install
xEOFx
) > tmp

View file

@ -1,9 +1,14 @@
#
# $Id$
#
PKG="blfs-bootscripts" PKG="blfs-bootscripts"
PKG_VERSION="20060910" PKG_VERSION="20060910"
PKG_FILE="blfs-bootscripts-${PKG_VERSION}.tar.bz2" PKG_FILE="blfs-bootscripts-${PKG_VERSION}.tar.bz2"
URL="http://www.linuxfromscratch.org/blfs/downloads/svn/${PKG_FILE}" URL="http://www.linuxfromscratch.org/blfs/downloads/svn/${PKG_FILE}"
MD5="e1715c58dc694bf474c4468e6bade3ad" MD5="e1715c58dc694bf474c4468e6bade3ad"
PATCH1="" for i in PATCH{1..10}; do
unset $i
done
( cat << "xEOFx" ( cat << "xEOFx"
@ -12,6 +17,6 @@ PATCH1=""
# EXAMPLE # EXAMPLE
# #
make install-gpm make install-gpm
make install-service-dhcpcd
xEOFx xEOFx
) > tmp ) > tmp

View file

@ -0,0 +1,49 @@
#
# $Id$
#
# Code taken from CLFS-Embedded
# Chapter 12 Beyond CLFS Embedded
#
# Dropbear is a relatively small SSH 2 server and client.
# Dropbear has a small memory footprint suitable for memory-constrained
# environments, while still having the same features as OpenSSH. It
# does not depend on OpenSSL and it has a MIT style license. Optionally
# it can even be made smaller.
#
PKG="DROPBEAR"
PKG_VERSION="0.48.1"
PKG_FILE="${PKG}-${PKG_VERSION}.tar.gz"
URL="http://matt.ucc.asn.au/dropbear/releases/${PKG_FILE}"
MD5="ca8e53a766faec831882831364568421"
for i in PATCH{1..10}; do
unset $i
done
PATCH1="http://svn.cross-lfs.org/svn/repos/cross-lfs/branches/clfs-embedded/patches/dropbear-0.48.1-autotool-1.patch"
( cat << "xEOFx"
patch -Np1 -i ../dropbear-0.48.1-autotool-1.patch
cp Makefile.in{,.orig}
sed -e s/@LD@/@CC@/ Makefile.in.orig > Makefile.in
CC="${CC} ${BUILD}" ./configure --prefix=/usr --host=${CLFS_TARGET}
cp -v options.h options.h.backup
sed -e "s@/dev/random@/dev/urandom@" options.h.backup > options.h
make MULTI=1 PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"
make MULTI=1 PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp" install DESTDIR=${CLFS}
ln -svf ../../usr/bin/dropbearmulti ${CLFS}/usr/sbin/dropbear
ln -svf ../../usr/bin/dropbearmulti ${CLFS}/usr/bin/dbclient
ln -svf ../../usr/bin/dropbearmulti ${CLFS}/usr/bin/dropbearkey
ln -svf ../../usr/bin/dropbearmulti ${CLFS}/usr/bin/dropbearconvert
ln -svf ../../usr/bin/dropbearmulti ${CLFS}/usr/bin/scp
install -dv ${CLFS}/etc/ssh
xEOFx
) > tmp

View file

@ -0,0 +1,42 @@
#
# $Id:$
#
# Code taken from CLFS-Embedded
# Chapter 12 Beyond CLFS Embedded
#
# iptables is the userspace command line program
# used to configure the Linux firewall.
#
PKG="iptables"
PKG_VERSION="1.3.7"
PKG_FILE="${PKG}-${PKG_VERSION}.tar.bz2"
URL=" http://www.netfilter.org/projects/iptables/files/iptables-1.3.7.tar.bz2"
MD5="077e886a9c90a11bb47f3d7a4fc4a689"
for i in PATCH{1..10}; do
unset $i
done
PATCH1="http://svn.cross-lfs.org/svn/repos/cross-lfs/branches/clfs-embedded/patches/iptables-1.3.7-do_multi-1.patch"
( cat << "xEOFx"
patch -Np1 -i ../iptables-1.3.7-do_multi-1.patch
make CC="${CC} ${BUILD}" \
COPT_FLAGS="-Os" \
LD=${LD} DO_MULTI=1 \
PREFIX=/usr \
KERNEL_DIR=${CLFS}/lib/modules/2.6.19.2/build \
LIBDIR=/lib \
BINDIR=/sbin
make CC="${CC} ${BUILD}" \
COPT_FLAGS="-Os" \
LD=${LD} DO_MULTI=1 \
PREFIX=/usr \
KERNEL_DIR=${CLFS}/lib/modules/2.6.19.2/build \
LIBDIR=/lib BINDIR=/sbin \
DESTDIR=${CLFS} install
xEOFx
) > tmp

View file

@ -1,4 +1,6 @@
# #
# $Id$
#
# Any comments you wish to add # Any comments you wish to add
# #
@ -7,6 +9,9 @@ PKG_VERSION=""
PKG_FILE="" PKG_FILE=""
URL="" URL=""
MD5="" MD5=""
for i in PATCH{1..10}; do
unset $i
done
PATCH1="" PATCH1=""
( cat << "xEOFx" ( cat << "xEOFx"

309
jhalfs
View file

@ -36,13 +36,13 @@ declare -r L_arrow=$'\e[1;33m<\e[0m'
simple_error() { # Basic error trap.... JUST DIE simple_error() { # Basic error trap.... JUST DIE
#-----------------------# #-----------------------#
# If +e then disable text output # If +e then disable text output
if [[ "$-" =~ "e" ]]; then if [[ "$-" =~ e ]]; then
echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2 echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
fi fi
} }
see_ya() { see_ya() {
echo -e "\n${L_arrow}${BOLD}jhalfs-X${R_arrow} exit${OFF}\n" echo -e "\n${L_arrow}${BOLD}jhalfs-trunk${R_arrow} exit${OFF}\n"
} }
##### Simple error TRAPS ##### Simple error TRAPS
# ctrl-c SIGINT # ctrl-c SIGINT
@ -62,7 +62,7 @@ trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
version=" version="
${BOLD} \"jhalfs-X\"${OFF} builder tool (experimental) \$Rev$ ${BOLD} \"jhalfs-trunk\"${OFF} builder tool (development) \$Rev$
\$Date$ \$Date$
Written by George Boudreau and Manuel Canales Esparcia, Written by George Boudreau and Manuel Canales Esparcia,
@ -108,6 +108,24 @@ REPORT=${REPORT:=n}
VIMLANG=${VIMLANG:-n} VIMLANG=${VIMLANG:-n}
GRSECURITY_HOST=${GRSECURITY_HOST:-n} GRSECURITY_HOST=${GRSECURITY_HOST:-n}
CUSTOM_TOOLS=${CUSTOM_TOOLS:-n} CUSTOM_TOOLS=${CUSTOM_TOOLS:-n}
REBUILD_MAKEFILE=${REBUILD_MAKEFILE:-n}
INSTALL_LOG=${INSTALL_LOG:-n}
CLEAN=${CLEAN:=n}
SET_SSP=${SET_SSP:=n}
SET_ASLR=${SET_ASLR:=n}
SET_PAX=${SET_PAX:=n}
SET_HARDENED_TMP=${SET_HARDENED_TMP:=n}
SET_WARNINGS=${SET_WARNINGS:=n}
SET_MISC=${SET_MISC:=n}
SET_BLOWFISH=${SET_BLOWFISH:=n}
# Sanity check on the location of $BUILDDIR / $JHALFSDIR
CWD=$(cd `dirname $0` && pwd)
if [[ $JHALFSDIR == $CWD ]]; then
echo " The jhalfs source directory conflicts with the jhalfs build directory."
echo " Please move the source directory or change the build directory."
exit 2
fi
# Book surces envars # Book surces envars
BRANCH_ID=${BRANCH_ID:=development} BRANCH_ID=${BRANCH_ID:=development}
@ -115,7 +133,8 @@ BRANCH_ID=${BRANCH_ID:=development}
case $BRANCH_ID in case $BRANCH_ID in
development ) development )
case $PROGNAME in case $PROGNAME in
clfs2 ) TREE=branches/clfs-2.0/BOOK ;; clfs2 ) TREE=branches/clfs-sysroot/BOOK ;;
clfs3 ) TREE=branches/clfs-embedded/BOOK ;;
*) TREE=trunk/BOOK ;; *) TREE=trunk/BOOK ;;
esac esac
LFSVRS=development LFSVRS=development
@ -133,7 +152,7 @@ case $BRANCH_ID in
LFSVRS=${BRANCH_ID} LFSVRS=${BRANCH_ID}
TREE=tags/${BRANCH_ID}/BOOK TREE=tags/${BRANCH_ID}/BOOK
;; ;;
clfs | clfs2 ) clfs | clfs2 | clfs3)
LFSVRS=${BRANCH_ID} LFSVRS=${BRANCH_ID}
TREE=tags/${BRANCH_ID} TREE=tags/${BRANCH_ID}
;; ;;
@ -153,50 +172,46 @@ if [[ "${BLFS_TOOL}" = "y" ]] ; then
*EDIT* ) echo " You forgot to set the BLFS branch or stable book version." *EDIT* ) echo " You forgot to set the BLFS branch or stable book version."
echo " Please rerun make and fix the configuration." echo " Please rerun make and fix the configuration."
exit 2 ;; exit 2 ;;
branch-* ) BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-}/BOOK ;; branch-* ) BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-} ;;
* ) BLFS_TREE=tags/${BLFS_BRANCH_ID}/BOOK ;; * ) BLFS_TREE=tags/${BLFS_BRANCH_ID} ;;
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() # 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.29.tar.gz"
LIBXML_URL="ftp://xmlsoft.org/libxml2/${LIBXML_PKG}" LIBXML_URL="ftp://xmlsoft.org/libxml2/${LIBXML_PKG}"
LIBXML_MD5="2d8d3805041edab967368b497642f981" LIBXML_MD5="8b99b6e8b08e838438d9e6b639d79ebd"
# libxslt # libxslt
LIBXSLT_PKG="libxslt-1.1.17.tar.gz" LIBXSLT_PKG="libxslt-1.1.21.tar.gz"
LIBXSLT_URL="ftp://xmlsoft.org/libxslt/${LIBXSLT_PKG}" LIBXSLT_URL="ftp://xmlsoft.org/libxslt/${LIBXSLT_PKG}"
LIBXSLT_MD5="fde6a7a93c0eb14cba628692fa3a1000" LIBXSLT_MD5="59fe34e85692f71df2a38c2ee291b3ca"
# tidy # tidy
TIDY_PKG="tidy_src_051026.tgz" TIDY_PKG="tidy-cvs_20070326.tar.bz2"
TIDY_URL="http://tidy.sourceforge.net/src/${TIDY_PKG}" TIDY_URL="http://anduin.linuxfromscratch.org/files/BLFS/sources/${TIDY_PKG}"
TIDY_MD5="1e39fafd6808978871346658c8da1454" TIDY_MD5="468bfaa5cf917a8ecbe7834c13a61376"
# 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"
# tidy docs
TIDY_DOCS="tidy_docs_051020.tgz"
TIDY_DOCS_URL="http://tidy.sourceforge.net/docs/${TIDY_DOCS}"
TIDY_DOCS_MD5="86de2f198e57399c063d2567b2a25628"
# unzip # unzip
UNZIP_PKG="unzip552.tar.gz" UNZIP_PKG="unzip552.tar.gz"
UNZIP_URL="ftp://ftp.info-zip.org/pub/infozip/src/${UNZIP_PKG}" UNZIP_URL="http://downloads.sourceforge.net/infozip/${UNZIP_PKG}"
UNZIP_MD5="9d23919999d6eac9217d1f41472034a9" UNZIP_MD5="9d23919999d6eac9217d1f41472034a9"
# unzip security patch
UNZIP_PATCH="unzip-5.52-security_fix-1.patch"
UNZIP_PATCH_URL="http://www.linuxfromscratch.org/patches/blfs/svn/${UNZIP_PATCH}"
UNZIP_PATCH_MD5="00ebf64fdda2ad54ddfc619f85f328bb"
# DocBook XML DTD # DocBook XML DTD
DBXML_PKG="docbook-xml-4.4.zip" DBXML_PKG="docbook-xml-4.5.zip"
DBXML_URL="http://www.docbook.org/xml/4.4/${DBXML_PKG}" DBXML_URL="http://www.docbook.org/xml/4.5/${DBXML_PKG}"
DBXML_MD5="cbb04e9a700955d88c50962ef22c1634" DBXML_MD5="03083e288e87a7e829e437358da7ef9e"
# 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}"
DBXSL_MD5="6ebd29a67f2dcc3f2220f475ee6f6552" # DBXSL_MD5="6ebd29a67f2dcc3f2220f475ee6f6552"
# Links # Links
LINKS_PKG="links-2.1pre21.tar.bz2" LYNX_PKG="lynx2.8.6.tar.bz2"
LINKS_URL="http://links.twibright.com/download/${LINKS_PKG}" LYNX_URL="http://lynx.isc.org/release/${LYNX_PKG}"
LINKS_MD5="7687e2c32e337e11c6e9d8cd8c5202c9" LYNX_MD5="dc80497b7dda6a28fd80404684d27548"
# sudo # sudo
SUDO_PKG="sudo-1.6.8p12.tar.gz" SUDO_PKG="sudo-1.6.8p12.tar.gz"
SUDO_URL="http://www.courtesan.com/sudo/dist/${SUDO_PKG}" SUDO_URL="http://anduin.linuxfromscratch.org/sources/BLFS/svn/s/${SUDO_PKG}"
SUDO_MD5="b29893c06192df6230dd5f340f3badf5" SUDO_MD5="b29893c06192df6230dd5f340f3badf5"
# sudo envar fix patch # sudo envar fix patch
SUDO_PATCH="sudo-1.6.8p12-envvar_fix-1.patch" SUDO_PATCH="sudo-1.6.8p12-envvar_fix-1.patch"
@ -212,7 +227,7 @@ if [[ "${BLFS_TOOL}" = "y" ]] ; then
SVN_MD5="07b95963968ae345541ca99d0e7bf082" SVN_MD5="07b95963968ae345541ca99d0e7bf082"
# GPM # GPM
GPM_PKG="gpm-1.20.1.tar.bz2" GPM_PKG="gpm-1.20.1.tar.bz2"
GPM_URL="ftp://arcana.linux.it/pub/gpm/${GPM_PKG}" GPM_URL="ftp://ftp.linux.ee/pub/gentoo/distfiles/distfiles/${GPM_PKG}"
GPM_MD5="2c63e827d755527950d9d13fe3d87692" GPM_MD5="2c63e827d755527950d9d13fe3d87692"
# GPM segfaul patch # GPM segfaul patch
GPM_PATCH_1="gpm-1.20.1-segfault-1.patch" GPM_PATCH_1="gpm-1.20.1-segfault-1.patch"
@ -235,10 +250,9 @@ declare -r SVN_2="svn://svn.linuxfromscratch.org"
# Set true internal variables # Set true internal variables
COMMON_DIR="common" COMMON_DIR="common"
PACKAGE_DIR=$(echo $PROGNAME | tr [a-z] [A-Z]) PACKAGE_DIR=$(echo $PROGNAME | tr '[a-z]' '[A-Z]')
MODULE=$PACKAGE_DIR/master.sh MODULE=$PACKAGE_DIR/master.sh
[[ $VERBOSITY > 0 ]] && echo -n "Loading common-functions module..." [[ $VERBOSITY > 0 ]] && echo -n "Loading common-functions module..."
source $COMMON_DIR/common-functions source $COMMON_DIR/common-functions
[[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit [[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit
@ -253,17 +267,17 @@ source $MODULE
#*******************************************************************# #*******************************************************************#
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..." [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
source $COMMON_DIR/func_check_version.sh source $COMMON_DIR/libs/func_check_version.sh
[[ $? > 0 ]] && echo " function module did not load.." && exit 2 [[ $? > 0 ]] && echo " function module did not load.." && exit 2
[[ $VERBOSITY > 0 ]] && echo "OK" [[ $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/libs/func_validate_configs.sh
[[ $? > 0 ]] && echo " function module did not load.." && exit 2 [[ $? > 0 ]] && echo " function module did not load.." && exit 2
[[ $VERBOSITY > 0 ]] && echo "OK" [[ $VERBOSITY > 0 ]] && echo "OK"
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <custom_pkgs>..." [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_custom_pkgs>..."
source $COMMON_DIR/custom_pkgs source $COMMON_DIR/libs/func_custom_pkgs
[[ $? > 0 ]] && echo " function module did not load.." && exit 2 [[ $? > 0 ]] && echo " function module did not load.." && exit 2
[[ $VERBOSITY > 0 ]] && echo "OK" [[ $VERBOSITY > 0 ]] && echo "OK"
@ -294,8 +308,8 @@ echo "${nl_}${SD_BORDER}${nl_}"
# compare module # compare module
if [[ "$COMPARE" = "y" ]]; then if [[ "$COMPARE" = "y" ]]; then
[[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..." [[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..."
source $COMMON_DIR/func_compare.sh source $COMMON_DIR/libs/func_compare.sh
[[ $? > 0 ]] && echo "$COMMON_DIR/func_compare.sh did not load.." && exit [[ $? > 0 ]] && echo "$COMMON_DIR/libs/func_compare.sh did not load.." && exit
[[ $VERBOSITY > 0 ]] && echo "OK" [[ $VERBOSITY > 0 ]] && echo "OK"
fi fi
# #
@ -316,116 +330,127 @@ if [[ "$OPTIMIZE" != "0" ]]; then
fi fi
# #
# If $BUILDDIR has subdirectories like tools/ or bin/, stop the run if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
# and notify the user about that.
if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] && [ -z $CLEAN ] ; then
eval "$no_empty_builddir"
fi
# If requested, clean the build directory # If $BUILDDIR has subdirectories like tools/ or bin/, stop the run
clean_builddir # and notify the user about that.
if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] && [ -z $CLEAN ] ; then
eval "$no_empty_builddir"
fi
if [[ ! -d $JHALFSDIR ]]; then # If requested, clean the build directory
mkdir -p $JHALFSDIR clean_builddir
fi
# if [[ ! -d $JHALFSDIR ]]; then
# Create $BUILDDIR/sources even though it could be created by get_sources() mkdir -p $JHALFSDIR
if [[ ! -d $BUILDDIR/sources ]]; then fi
mkdir -p $BUILDDIR/sources
fi # Create $BUILDDIR/sources even though it could be created by get_sources()
# if [[ ! -d $BUILDDIR/sources ]]; then
# Create the log directory mkdir -p $BUILDDIR/sources
if [[ ! -d $LOGDIR ]]; then fi
mkdir $LOGDIR #
fi # Create the log directory
>$LOGDIR/$LOG if [[ ! -d $LOGDIR ]]; then
# mkdir $LOGDIR
[[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR fi
# >$LOGDIR/$LOG
cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/ #
# # Copy common helper files
[[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/ cp $COMMON_DIR/{makefile-functions,progress_bar.sh,packages.xsl} $JHALFSDIR/
# #
if [[ "$COMPARE" = "y" ]]; then # Fix the XSL book parser
mkdir -p $JHALFSDIR/extras sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
cp extras/* $JHALFSDIR/extras export XSL=$JHALFSDIR/${XSL}
fi #
#
if [[ -n "$FILES" ]]; then # Copy urls.xsl, if needed
# pushd/popd necessary to deal with multiple files [[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
pushd $PACKAGE_DIR 1> /dev/null #
cp $FILES $JHALFSDIR/ # Create the test-log directory, if needed
popd 1> /dev/null [[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR
fi #
# # Create the installed-files directory, if needed
if [[ "${PROGNAME}" = "lfs" ]]; then [[ "$INSTALL_LOG" = "y" ]] && [[ ! -d $FILELOGDIR ]] && install -d -m 1777 $FILELOGDIR
#
# Prepare report creation, if needed
if [[ "$REPORT" = "y" ]]; then
cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/
# After being sure that all looks sane, dump the settings to a file
# This file will be used to create the REPORT header
validate_config > $JHALFSDIR/jhalfs.config
fi
#
# Copy optimize files, if needed
[[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
#
# Copy compare files, if needed
if [[ "$COMPARE" = "y" ]]; then
mkdir -p $JHALFSDIR/extras
cp extras/* $JHALFSDIR/extras
fi
#
# Copy custom tools config files, if requested
if [[ "${CUSTOM_TOOLS}" = "y" ]]; then if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
echo "Copying custom tool scripts to $JHALFSDIR" echo "Copying custom tool scripts to $JHALFSDIR"
mkdir -p $JHALFSDIR/custom-commands/config mkdir -p $JHALFSDIR/custom-commands
mkdir -p $JHALFSDIR/custom-commands/scripts cp -f custom/config/* $JHALFSDIR/custom-commands
cp -Rf custom/* $JHALFSDIR/custom-commands
fi fi
fi #
# Install blfs-tool, if requested.
# if [[ "${BLFS_TOOL}" = "y" ]] ; then
if [[ "$REPORT" = "y" ]]; then # Install the files
cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/ [[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -p ${BUILDDIR}${BLFS_ROOT}
# After being sure that all looks sane, dump the settings to a file cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
# This file will be used to create the REPORT header cp -r menu ${BUILDDIR}${BLFS_ROOT}
validate_config > $JHALFSDIR/jhalfs.config cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
fi cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
# # Clean-up
[[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/ rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
# rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
cp $COMMON_DIR/packages.xsl $JHALFSDIR/ rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
# # Set some harcoded envars to their proper values
sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL} sed -i 's,blfs-xml,'$BLFS_XML',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,libs/book.xsl}
export XSL=$JHALFSDIR/${XSL} sed -i 's,tracking-dir,'$TRACKING_DIR',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,gen-makefile.sh}
# Copy the dependencies build scripts
# Install blfs-tool, if requested. cp -r $COMMON_DIR/blfs-tool-deps $JHALFSDIR/
if [[ "${BLFS_TOOL}" = "y" ]] ; then rm -rf $JHALFSDIR/blfs-tool-deps/.svn
# Install the files
[[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -p ${BUILDDIR}${BLFS_ROOT}
cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
cp -r menu ${BUILDDIR}${BLFS_ROOT}
cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
# Clean-up
rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
# Set some harcoded envars to their proper values
sed -i 's,blfs-xml,'$BLFS_XML',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,libs/book.xsl}
sed -i 's,tracking-dir,'$TRACKING_DIR',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,gen-makefile.sh}
# Copy the dependencies build scripts
cp -r $COMMON_DIR/blfs-tool-deps $JHALFSDIR/
rm -rf $JHALFSDIR/blfs-tool-deps/.svn
fi
get_book
echo "${SD_BORDER}${nl_}"
# Get the BLFS book, if requested.
if [[ "${BLFS_TOOL}" = "y" ]] ; then
echo -n "Downloading the BLFS document, $BLFS_BRANCH_ID version... "
if [[ ! -d ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} ]] ; then
mkdir -p ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML}
svn co $SVN_2/BLFS/$BLFS_TREE ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} >>$LOGDIR/$LOG 2>&1
else
pushd ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} 1> /dev/null
svn up >>$LOGDIR/$LOG 2>&1
popd 1> /dev/null
fi fi
echo -ne "done\n" #
get_book
echo "${SD_BORDER}${nl_}" echo "${SD_BORDER}${nl_}"
# Get the BLFS book, if requested.
if [[ "${BLFS_TOOL}" = "y" ]] ; then
echo -n "Downloading the BLFS document, $BLFS_BRANCH_ID version... "
if [[ ! -d ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} ]] ; then
mkdir -p ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML}
svn co $SVN_2/BLFS/$BLFS_TREE ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} >>$LOGDIR/$LOG 2>&1
else
pushd ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} 1> /dev/null
svn up >>$LOGDIR/$LOG 2>&1
popd 1> /dev/null
fi
echo -ne "done\n"
echo "${SD_BORDER}${nl_}"
fi
fi
# When regeneration the Makefile we need to know also the canonical book version
if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then
case $PROGNAME in
clfs | clfs2 | clfs3 )
VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
*)
VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
esac
fi fi
build_Makefile build_Makefile
if [[ "${PROGNAME}" = "lfs" ]]; then
if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
add_CustomTools
fi
fi
echo "${SD_BORDER}${nl_}" echo "${SD_BORDER}${nl_}"
run_make run_make

View file

@ -55,6 +55,10 @@ endif
endif endif
endif endif
ifeq (/usr/include/locale.h, $(wildcard /usr/include/locale.h))
HOSTNCURSES += -DLOCALE=1
endif
CONF_SRC = conf.c CONF_SRC = conf.c
MCONF_SRC = mconf.c MCONF_SRC = mconf.c
LXD_SRC = lxdialog/checklist.c lxdialog/menubox.c lxdialog/textbox.c \ LXD_SRC = lxdialog/checklist.c lxdialog/menubox.c lxdialog/textbox.c \

View file

@ -26,6 +26,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifdef LOCALE
#include <locale.h>
#endif
#ifdef CURSES_LOC #ifdef CURSES_LOC
#ifdef __sun__ #ifdef __sun__
#define CURS_MACROS #define CURS_MACROS

View file

@ -144,6 +144,9 @@ void dialog_clear (void)
void void
init_dialog (void) init_dialog (void)
{ {
#ifdef LOCALE
setlocale(LC_CTYPE, ""); /* required by ncurses on linux UTF-8 console */
#endif
initscr (); /* Init curses */ initscr (); /* Init curses */
keypad (stdscr, TRUE); keypad (stdscr, TRUE);
cbreak (); cbreak ();

View file

@ -12,9 +12,11 @@
# instead of just set to null. # instead of just set to null.
MAKEFLAGS="-j3" MAKEFLAGS="-j3"
#--- List of packages that don't support well MAKEFLAGS. #--- List of packages that have issues with jobs control.
# This list may be different for you. # This list may be different for you.
BLACK_LIST="autoconf dejagnu gettext groff" # If your MAKEFLAGS don't contains a -jX option, you can set
# a empty list here.
BLACK_LIST="autoconf dejagnu gettext groff man-db"
#--- Default optimization mode #--- Default optimization mode
# This mode is overridden by definitions in opt_override; # This mode is overridden by definitions in opt_override;

View file

@ -75,7 +75,7 @@ wrt_makeflags() { # Apply MAKEFLAGS to build
local pkg=$1 local pkg=$1
local MKF local MKF
if [[ "$BLACK_LIST" =~ "$pkg" ]]; then if [[ "$BLACK_LIST" =~ ${pkg} ]]; then
MKF=unset MKF=unset
else else
MKF=$MAKEFLAGS MKF=$MAKEFLAGS