Ported Makefile clean-up and 0/1 to n/y migration code from experimental.

There is no obvious bugs, let users to find hidden bugs.
This commit is contained in:
Manuel Canales Esparcia 2006-08-16 17:42:54 +00:00
parent 5be3651d7f
commit 401f81e4da
20 changed files with 568 additions and 522 deletions

View file

@ -28,13 +28,13 @@
<xsl:param name="testsuite" select="1"/> <xsl:param name="testsuite" select="1"/>
<!-- Bomb on test suites failures? <!-- Bomb on test suites failures?
0 = no, I want to build the full system and review the logs n = no, I want to build the full system and review the logs
1 = yes, bomb at the first test suite failure to can review the build dir y = yes, bomb at the first test suite failure to can review the build dir
--> -->
<xsl:param name="bomb-testsuite" select="0"/> <xsl:param name="bomb-testsuite" select="n"/>
<!-- Install vim-lang package? --> <!-- Install vim-lang package? -->
<xsl:param name="vim-lang" select="1"/> <xsl:param name="vim-lang" select="y"/>
<!-- Time zone --> <!-- Time zone -->
<xsl:param name="timezone" select="GMT"/> <xsl:param name="timezone" select="GMT"/>
@ -102,7 +102,7 @@
</xsl:choose> </xsl:choose>
<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 = '1'"> <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>
@ -125,7 +125,7 @@
contains(string(),'check')) and contains(string(),'check')) and
($testsuite = '2' or $testsuite = '3')"> ($testsuite = '2' or $testsuite = '3')">
<xsl:choose> <xsl:choose>
<xsl:when test="$bomb-testsuite = '0'"> <xsl:when test="$bomb-testsuite = 'n'">
<xsl:value-of select="substring-before(string(),'make')"/> <xsl:value-of select="substring-before(string(),'make')"/>
<xsl:text>make -k</xsl:text> <xsl:text>make -k</xsl:text>
<xsl:value-of select="substring-after(string(),'make')"/> <xsl:value-of select="substring-after(string(),'make')"/>
@ -197,7 +197,7 @@
</xsl:if> </xsl:if>
<xsl:if test="contains(string(),'check')"> <xsl:if test="contains(string(),'check')">
<xsl:choose> <xsl:choose>
<xsl:when test="$bomb-testsuite = '0'"> <xsl:when test="$bomb-testsuite = 'n'">
<xsl:value-of select="substring-before(string(),'check')"/> <xsl:value-of select="substring-before(string(),'check')"/>
<xsl:text>-k check</xsl:text> <xsl:text>-k check</xsl:text>
<xsl:value-of select="substring-after(string(),'check')"/> <xsl:value-of select="substring-after(string(),'check')"/>
@ -222,7 +222,7 @@
<xsl:choose> <xsl:choose>
<xsl:when test="$testsuite != '0'"> <xsl:when test="$testsuite != '0'">
<xsl:choose> <xsl:choose>
<xsl:when test="$bomb-testsuite = '0'"> <xsl:when test="$bomb-testsuite = 'n'">
<xsl:text>make -k check &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>
@ -242,7 +242,7 @@
<xsl:when test="$testsuite != '0'"> <xsl:when test="$testsuite != '0'">
<xsl:value-of select="substring-before(string(),'&gt;g')"/> <xsl:value-of select="substring-before(string(),'&gt;g')"/>
<xsl:choose> <xsl:choose>
<xsl:when test="$bomb-testsuite = '0'"> <xsl:when test="$bomb-testsuite = 'n'">
<xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text> <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>

View file

@ -54,8 +54,8 @@ CONFIG=
BOOT_CONFIG= BOOT_CONFIG=
# Get the kernel package and patches even if no configutation file # Get the kernel package and patches even if no configutation file
# has been supplied? 0(no)/1(yes) # has been supplied? n(no)/y(yes)
GETKERNEL=0 GETKERNEL=n
#--- Book's sources directory #--- Book's sources directory
# If you have previously checked out the book from the repository # If you have previously checked out the book from the repository

View file

@ -6,7 +6,6 @@
################################### ###################################
#----------------------------# #----------------------------#
host_prep_Makefiles() { # Initialization of the system host_prep_Makefiles() { # Initialization of the system
#----------------------------# #----------------------------#
@ -498,7 +497,7 @@ final_system_Makefiles() { #
# Test if the stripping phase must be skipped. # Test if the stripping phase must be skipped.
# Skip alsp temp-perl for iterative runs # Skip alsp temp-perl for iterative runs
case $this_script in case $this_script in
*stripping*) [[ "$STRIP" = "0" ]] && continue ;; *stripping*) [[ "$STRIP" = "n" ]] && continue ;;
*temp-perl*) [[ -n "$N" ]] && continue ;; *temp-perl*) [[ -n "$N" ]] && continue ;;
esac esac
@ -608,7 +607,7 @@ bm_final_system_Makefiles() { #
# Test if the stripping phase must be skipped # Test if the stripping phase must be skipped
# Skip alsp temp-perl for iterative runs # Skip alsp temp-perl for iterative runs
case $this_script in case $this_script in
*stripping*) [[ "$STRIP" = "0" ]] && continue ;; *stripping*) [[ "$STRIP" = "n" ]] && continue ;;
*temp-perl*) [[ -n "$N" ]] && continue ;; *temp-perl*) [[ -n "$N" ]] && continue ;;
esac esac
@ -883,7 +882,7 @@ bootable_Makefiles() { #
done done
# Add SBU-disk_usage report target if required # Add SBU-disk_usage report target if required
if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi if [[ "$REPORT" = "y" ]] ; then wrt_report ; fi
} }
@ -962,7 +961,7 @@ bm_bootable_Makefiles() { #
done done
# Add SBU-disk_usage report target if required # Add SBU-disk_usage report target if required
if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi if [[ "$REPORT" = "y" ]] ; then wrt_report ; fi
} }
@ -986,7 +985,7 @@ build_Makefile() { # Construct a Makefile from the book scripts
fi fi
final_system_Makefiles # $basicsystem final_system_Makefiles # $basicsystem
# Add the iterations targets, if needed # Add the iterations targets, if needed
[[ "$COMPARE" != "0" ]] && wrt_compare_targets [[ "$COMPARE" = "y" ]] && wrt_compare_targets
bootscripts_Makefiles # $bootscripttools bootscripts_Makefiles # $bootscripttools
bootable_Makefiles # $bootabletools bootable_Makefiles # $bootabletools
else else
@ -996,7 +995,7 @@ build_Makefile() { # Construct a Makefile from the book scripts
fi fi
bm_final_system_Makefiles # $basicsystem bm_final_system_Makefiles # $basicsystem
# Add the iterations targets, if needed # Add the iterations targets, if needed
[[ "$COMPARE" != "0" ]] && wrt_compare_targets [[ "$COMPARE" = "y" ]] && wrt_compare_targets
bm_bootscripts_Makefiles # $bootscipttools bm_bootscripts_Makefiles # $bootscipttools
bm_bootable_Makefiles # $bootabletoosl bm_bootable_Makefiles # $bootabletoosl
fi fi
@ -1009,11 +1008,29 @@ build_Makefile() { # Construct a Makefile from the book scripts
cat << EOF cat << EOF
$HEADER $HEADER
SRC= /sources SRC = /sources
MOUNT_PT= $BUILDDIR MOUNT_PT = $BUILDDIR
PKG_LST= $PKG_LST PKG_LST = $PKG_LST
LUSER= $LUSER LUSER = $LUSER
LGROUP= $LGROUP 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) \$(MOUNT_PT)\`\n"
include makefile-functions include makefile-functions

View file

@ -17,7 +17,7 @@
<xsl:param name="keymap" select="none"/> <xsl:param name="keymap" select="none"/>
<!-- Install vim-lang package? --> <!-- Install vim-lang package? -->
<xsl:param name="vim-lang" select="1"/> <xsl:param name="vim-lang" select="y"/>
<!-- Time zone --> <!-- Time zone -->
<xsl:param name="timezone" select="GMT"/> <xsl:param name="timezone" select="GMT"/>
@ -75,7 +75,7 @@
</xsl:if> </xsl:if>
<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 = '1'"> <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>

View file

@ -33,8 +33,8 @@ FSTAB=
CONFIG= CONFIG=
# Get the kernel package and patches even if no configutation file # Get the kernel package and patches even if no configutation file
# has been supplied? 0(no)/1(yes) # has been supplied? n(no)/y(yes)
GETKERNEL=0 GETKERNEL=n
#--- Book's sources directory #--- Book's sources directory
# If you have previously checked out the book from the repository # If you have previously checked out the book from the repository

View file

@ -215,7 +215,7 @@ final_system_Makefiles() { #
# Test if the stripping phase must be skipped. # Test if the stripping phase must be skipped.
# Skip alsp temp-perl for iterative runs # Skip alsp temp-perl for iterative runs
case $this_script in case $this_script in
*stripping*) [[ "$STRIP" = "0" ]] && continue ;; *stripping*) [[ "$STRIP" = "n" ]] && continue ;;
esac esac
# Grab the name of the target, strip id number, XXX-script # Grab the name of the target, strip id number, XXX-script
@ -403,7 +403,7 @@ bootable_Makefiles() { #
done done
# Add SBU-disk_usage report target if required # Add SBU-disk_usage report target if required
if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi if [[ "$REPORT" = "y" ]] ; then wrt_report ; fi
} }
@ -429,11 +429,22 @@ build_Makefile() { # Construct a Makefile from the book scripts
cat << EOF cat << EOF
$HEADER $HEADER
SRC= /sources SRC = /sources
MOUNT_PT= $BUILDDIR MOUNT_PT = $BUILDDIR
PKG_LST= $PKG_LST PKG_LST = $PKG_LST
LUSER= $LUSER LUSER = $LUSER
LGROUP= $LGROUP 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)
include makefile-functions include makefile-functions

107
Config.in
View file

@ -58,7 +58,7 @@ menu "--- BOOK Settings"
endchoice endchoice
config BRANCH_ID config BRANCH_ID
string "Branch (mandatory)" string "Book Version (mandatory)"
default "**EDIT ME**" default "**EDIT ME**"
depends BRANCH depends BRANCH
help help
@ -250,7 +250,7 @@ menu "--- BOOK Settings"
#--- End CLFS specific params #--- End CLFS specific params
#--- HLFS specific params #--- HLFS specific params
config CONFIG_GRSECURITY_HOST config GRSECURITY_HOST
bool "Building on grsecurity enabled host?" bool "Building on grsecurity enabled host?"
default n default n
depends on BOOK_HLFS depends on BOOK_HLFS
@ -356,7 +356,7 @@ menu "--- General Settings"
help help
#-- The directory where the created system will be located. #-- The directory where the created system will be located.
config CONFIG_GETPKG config GETPKG
bool "Retrieve source files" bool "Retrieve source files"
default n default n
help help
@ -368,28 +368,28 @@ menu "--- General Settings"
config SRC_ARCHIVE config SRC_ARCHIVE
string "Package Archive Directory" string "Package Archive Directory"
default "$SRC_ARCHIVE" default "$SRC_ARCHIVE"
depends CONFIG_GETPKG depends GETPKG
help help
#-- A local archive for packages/file (not $BUILDDIR/sources) #-- A local archive for packages/file (not $BUILDDIR/sources)
# Used only if GETPKG = 1 # Used only if GETPKG = 1
# 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.
config CONFIG_GETKERNEL config GETKERNEL
bool "Always retrieve kernel package" bool "Always retrieve kernel package"
default n default n
depends CONFIG_GETPKG depends GETPKG
help help
#-- Get the kernel package and patches even if no configuration #-- Get the kernel package and patches even if no configuration
# file has been supplied. # file has been supplied.
config CONFIG_RUNMAKE config RUNMAKE
bool "Run the makefile" bool "Run the makefile"
default n default n
help help
#-- Automatically run the makefile once it has been created #-- Automatically run the makefile once it has been created
config CONFIG_REBUILD config CLEAN
bool "Rebuild files" bool "Rebuild files"
default n default n
help help
@ -409,7 +409,7 @@ menu "--- Build Settings"
config CONFIG_TESTS config CONFIG_TESTS
bool "Run testsuites" bool "Run testsuites"
depends !BOOK_CLFS2 depends !BOOK_CLFS2
default n default y
help help
#-- Run test suites #-- Run test suites
# #
@ -454,19 +454,20 @@ menu "--- Build Settings"
choice choice
prompt "Flavour ->" prompt "Flavour ->"
depends CONFIG_TESTS depends CONFIG_TESTS
default NO_BOMB
config NO_BOMB config NO_BOMB
bool "Don't stop on test suite failures" bool "Don't stop on test suite failures"
default n
config BOMB config BOMB
bool "Abort the build at the first test suite failure" bool "Abort the build at the first test suite failure"
default n
endchoice endchoice
config BOMB_TEST config BOMB_TEST
int bool
default "0" if NO_BOMB default BOMB
default "1" if BOMB
#--- End Test Suites #--- End Test Suites
#--- FSTAB #--- FSTAB
@ -515,15 +516,15 @@ menu "--- Build Settings"
# a keymap included in the kernel # a keymap included in the kernel
#--- End Kernel #--- End Kernel
config CONFIG_STRIP config STRIP
bool "Strip Installed Binaries/Libraries" bool "Strip Installed Binaries/Libraries"
default y default y
config CONFIG_VIMLANG config VIMLANG
bool "Install vim-lang package" bool "Install vim-lang package"
default y default y
help help
#-- install the optional vim-lang package #-- Install the optional vim-lang package
config TIMEZONE config TIMEZONE
string "TimeZone" string "TimeZone"
@ -571,12 +572,12 @@ endmenu
menu "--- Advanced Features" menu "--- Advanced Features"
depends on !BOOK_BLFS depends on !BOOK_BLFS
config CONFIG_REPORT config REPORT
bool "Create SBU and disk usage report" bool "Create SBU and disk usage report"
default y default y
#--- ICA/farce #--- ICA/farce
config CONFIG_COMPARE config COMPARE
bool "Run comparison analysis on final stage" bool "Run comparison analysis on final stage"
depends !BOOK_CLFS2 depends !BOOK_CLFS2
default n default n
@ -596,21 +597,21 @@ menu "--- Advanced Features"
# #
config ITERATIONS config ITERATIONS
int "Number of test runs (2,3,4,5)" int "Number of test runs (2,3,4,5)" if COMPARE
depends on CONFIG_COMPARE depends on COMPARE
range 2 5 range 2 5
default 3 default 3
config CONFIG_ICA config RUN_ICA
bool "ICA testing" bool "ICA testing"
depends on CONFIG_COMPARE depends on COMPARE
default y default y
help help
#-- Run ICA testing #-- Run ICA testing
config CONFIG_FARCE config RUN_FARCE
bool "farce testing" bool "farce testing"
depends on CONFIG_COMPARE depends on COMPARE
default n default n
help help
#-- Run farce testing #-- Run farce testing
@ -667,61 +668,3 @@ endmenu
# string "BLFS packages" # string "BLFS packages"
# default "none" # default "none"
# depends CONFIG_BLFS_CMDS # depends CONFIG_BLFS_CMDS
# convert CONFIG_XXXX n/y to XXXX 0/1
config GRSECURITY_HOST
int
default 0 if !CONFIG_GRSECURITY_HOST
default 1 if CONFIG_GRSECURITY_HOST
config COMPARE
int
default 0 if !CONFIG_COMPARE
default 1 if CONFIG_COMPARE
config GETPKG
int
default 0 if !CONFIG_GETPKG
default 1 if CONFIG_GETPKG
config GETKERNEL
int
default 0 if !CONFIG_GETKERNEL
default 1 if CONFIG_GETKERNEL
config RUNMAKE
int
default 0 if !CONFIG_RUNMAKE
default 1 if CONFIG_RUNMAKE
config STRIP
int
default 0 if !CONFIG_STRIP
default 1 if CONFIG_STRIP
config REPORT
int
default 0 if !CONFIG_REPORT
default 1 if CONFIG_REPORT
config VIMLANG
int
default 0 if !CONFIG_VIMLANG
default 1 if CONFIG_VIMLANG
config RUN_ICA
int
default 0 if !CONFIG_ICA
default 1 if CONFIG_ICA
config RUN_FARCE
int
default 0 if !CONFIG_FARCE
default 1 if CONFIG_FARCE
config CLEAN
int
default 0 if !CONFIG_REBUILD
default 1 if CONFIG_REBUILD

View file

@ -9,8 +9,8 @@
#--- Which library model to use uclibc/glibc #--- Which library model to use uclibc/glibc
MODEL=glibc MODEL=glibc
#--- The host system has grsecurity options enabled? 0(no)/1(yes) #--- The host system has grsecurity options enabled? n(no)/y(yes)
GRSECURITY_HOST=0 GRSECURITY_HOST=n
#--- Unprivileged user and group name #--- Unprivileged user and group name
LUSER=hlfs LUSER=hlfs
@ -24,8 +24,8 @@ FSTAB=
CONFIG= CONFIG=
# Get the kernel package and patches even if no configutation file # Get the kernel package and patches even if no configutation file
# has been supplied? 0(no)/1(yes) # has been supplied? n(no)/y(yes)
GETKERNEL=0 GETKERNEL=n
#--- Book's sources directory #--- Book's sources directory
# If you have previously checked out the book from the repository # If you have previously checked out the book from the repository

View file

@ -17,7 +17,7 @@
<xsl:param name="model" select="glibc"/> <xsl:param name="model" select="glibc"/>
<!-- Is the host kernel using grsecurity? --> <!-- Is the host kernel using grsecurity? -->
<xsl:param name="grsecurity_host" select="0"/> <xsl:param name="grsecurity_host" select="n"/>
<!-- Compile the keymap into the kernel? --> <!-- Compile the keymap into the kernel? -->
<xsl:param name="keymap" select="none"/> <xsl:param name="keymap" select="none"/>
@ -31,10 +31,10 @@
<xsl:param name="testsuite" select="1"/> <xsl:param name="testsuite" select="1"/>
<!-- Bomb on test suites failures? <!-- Bomb on test suites failures?
0 = no, I want to build the full system and review the logs n = no, I want to build the full system and review the logs
1 = yes, bomb at the first test suite failure to can review the build dir y = yes, bomb at the first test suite failure to can review the build dir
--> -->
<xsl:param name="bomb-testsuite" select="0"/> <xsl:param name="bomb-testsuite" select="n"/>
<!-- Time zone --> <!-- Time zone -->
<xsl:param name="timezone" select="GMT"/> <xsl:param name="timezone" select="GMT"/>
@ -143,7 +143,7 @@
contains(string(),'check')) and contains(string(),'check')) and
($testsuite = '2' or $testsuite = '3')"> ($testsuite = '2' or $testsuite = '3')">
<xsl:choose> <xsl:choose>
<xsl:when test="$bomb-testsuite = '0'"> <xsl:when test="$bomb-testsuite = 'n'">
<xsl:value-of select="substring-before(string(),'make')"/> <xsl:value-of select="substring-before(string(),'make')"/>
<xsl:text>make -k</xsl:text> <xsl:text>make -k</xsl:text>
<xsl:value-of select="substring-after(string(),'make')"/> <xsl:value-of select="substring-after(string(),'make')"/>
@ -180,7 +180,7 @@
<!-- 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 ='0'"/> and $grsecurity_host ='n'"/>
<!-- Setting $LC_ALL and $LANG for /etc/profile --> <!-- Setting $LC_ALL and $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=')">
@ -230,7 +230,7 @@
</xsl:if> </xsl:if>
<xsl:if test="contains(string(),'check')"> <xsl:if test="contains(string(),'check')">
<xsl:choose> <xsl:choose>
<xsl:when test="$bomb-testsuite = '0'"> <xsl:when test="$bomb-testsuite = 'n'">
<xsl:value-of select="substring-before(string(),'check')"/> <xsl:value-of select="substring-before(string(),'check')"/>
<xsl:text>-k check</xsl:text> <xsl:text>-k check</xsl:text>
<xsl:value-of select="substring-after(string(),'check')"/> <xsl:value-of select="substring-after(string(),'check')"/>
@ -255,7 +255,7 @@
<xsl:when test="$testsuite != '0'"> <xsl:when test="$testsuite != '0'">
<xsl:apply-templates/> <xsl:apply-templates/>
<xsl:choose> <xsl:choose>
<xsl:when test="$bomb-testsuite = '0'"> <xsl:when test="$bomb-testsuite = 'n'">
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text> <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
@ -275,7 +275,7 @@
<xsl:when test="$testsuite != '0'"> <xsl:when test="$testsuite != '0'">
<xsl:value-of select="substring-before(string(),'&gt; glibc-')"/> <xsl:value-of select="substring-before(string(),'&gt; glibc-')"/>
<xsl:choose> <xsl:choose>
<xsl:when test="$bomb-testsuite = '0'"> <xsl:when test="$bomb-testsuite = 'n'">
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text> <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>

View file

@ -13,15 +13,22 @@ process_toolchain() { # embryo,cocoon and butterfly need special handling
local toolchain=$1 local toolchain=$1
local this_script=$2 local this_script=$2
local tc_phase local tc_phase
local binutil_tarball
local gcc_core_tarball
echo "${tab_}${tab_}${GREEN}toolchain ${L_arrow}${toolchain}${R_arrow}" echo "${tab_}${tab_}${GREEN}toolchain ${L_arrow}${toolchain}${R_arrow}"
# #
# Safe method to remove existing toolchain dirs # Safe method to remove existing toolchain dirs
pkg_tarball=$(get_package_tarball_name "binutils") binutil_tarball=$(get_package_tarball_name "binutils")
wrt_remove_existing_dirs "$pkg_tarball" gcc_core_tarball=$(get_package_tarball_name "gcc-core")
pkg_tarball=$(get_package_tarball_name "gcc-core") (
wrt_remove_existing_dirs "$pkg_tarball" cat << EOF
@\$(call remove_existing_dirs,$binutil_tarball)
@\$(call remove_existing_dirs,$gcc_core_tarball)
EOF
) >> $MKFILE.tmp
# #
# Manually remove the toolchain directories.. # Manually remove the toolchain directories..
tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'` tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'`
@ -53,11 +60,13 @@ EOF
;; ;;
esac esac
# #
# Safe method to remove packages unpacked while inside the toolchain script (
pkg_tarball=$(get_package_tarball_name "binutils") cat << EOF
wrt_remove_existing_dirs "$pkg_tarball" @\$(call remove_existing_dirs,$binutil_tarball)
pkg_tarball=$(get_package_tarball_name "gcc-core") @\$(call remove_existing_dirs,$gcc_core_tarball)
wrt_remove_existing_dirs "$pkg_tarball" EOF
) >> $MKFILE.tmp
# #
# Manually remove the toolchain directories.. # Manually remove the toolchain directories..
tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'` tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'`
@ -166,7 +175,7 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
# Nothing interestin in this script # Nothing interestin in this script
*introduction* ) continue ;; *introduction* ) continue ;;
# Test if the stripping phase must be skipped # Test if the stripping phase must be skipped
*stripping* ) [[ "$STRIP" = "0" ]] && continue ;; *stripping* ) [[ "$STRIP" = "n" ]] && continue ;;
*) ;; *) ;;
esac esac
@ -278,7 +287,7 @@ chapter6_Makefiles() { # sysroot or chroot build phase
# dependencies and target creation. # dependencies and target creation.
*chroot* ) continue ;; *chroot* ) continue ;;
# Test if the stripping phase must be skipped # Test if the stripping phase must be skipped
*-stripping* ) [[ "$STRIP" = "0" ]] && continue ;; *-stripping* ) [[ "$STRIP" = "n" ]] && continue ;;
esac esac
# Grab the name of the target # Grab the name of the target
@ -456,7 +465,7 @@ EOF
done # for file in chapter07/* done # for file in chapter07/*
# Add SBU-disk_usage report target if required # Add SBU-disk_usage report target if required
if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi if [[ "$REPORT" = "y" ]] ; then wrt_report ; fi
} }
@ -473,7 +482,7 @@ build_Makefile() { # Construct a Makefile from the book scripts
chapter5_Makefiles chapter5_Makefiles
chapter6_Makefiles chapter6_Makefiles
# Add the iterations targets, if needed # Add the iterations targets, if needed
[[ "$COMPARE" != "0" ]] && wrt_compare_targets [[ "$COMPARE" = "y" ]] && wrt_compare_targets
chapter7_Makefiles chapter7_Makefiles
# Add a header, some variables and include the function file # Add a header, some variables and include the function file
@ -482,11 +491,28 @@ build_Makefile() { # Construct a Makefile from the book scripts
cat << EOF cat << EOF
$HEADER $HEADER
SRC= /sources SRC = /sources
MOUNT_PT= $BUILDDIR MOUNT_PT = $BUILDDIR
PKG_LST= $PKG_LST PKG_LST = $PKG_LST
LUSER= $LUSER LUSER = $LUSER
LGROUP= $LGROUP 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) \$(MOUNT_PT)\`\n"
include makefile-functions include makefile-functions

View file

@ -18,8 +18,8 @@ FSTAB=
CONFIG= CONFIG=
# Get the kernel package and patches even if no configuration file # Get the kernel package and patches even if no configuration file
# has been supplied? 0(no)/1(yes) # has been supplied? n(no)/y(yes)
GETKERNEL=0 GETKERNEL=n
#--- Book's sources directory #--- Book's sources directory
# If you have previously checked out the book from the repository # If you have previously checked out the book from the repository

View file

@ -22,13 +22,13 @@
<xsl:param name="testsuite" select="1"/> <xsl:param name="testsuite" select="1"/>
<!-- Bomb on test suites failures? <!-- Bomb on test suites failures?
0 = no, I want to build the full system and review the logs n = no, I want to build the full system and review the logs
1 = yes, bomb at the first test suite failure to can review the build dir y = yes, bomb at the first test suite failure to can review the build dir
--> -->
<xsl:param name="bomb-testsuite" select="0"/> <xsl:param name="bomb-testsuite" select="n"/>
<!-- Install vim-lang package? --> <!-- Install vim-lang package? -->
<xsl:param name="vim-lang" select="1"/> <xsl:param name="vim-lang" select="y"/>
<!-- Time zone --> <!-- Time zone -->
<xsl:param name="timezone" select="GMT"/> <xsl:param name="timezone" select="GMT"/>
@ -90,7 +90,7 @@
</xsl:choose> </xsl:choose>
<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 = '1'"> <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>
@ -117,7 +117,7 @@
ancestor::chapter[@id='chapter-building-system']) or ancestor::chapter[@id='chapter-building-system']) or
$testsuite = '3')"> $testsuite = '3')">
<xsl:choose> <xsl:choose>
<xsl:when test="$bomb-testsuite = '0'"> <xsl:when test="$bomb-testsuite = 'n'">
<xsl:value-of select="substring-before(string(),'make')"/> <xsl:value-of select="substring-before(string(),'make')"/>
<xsl:text>make -k</xsl:text> <xsl:text>make -k</xsl:text>
<xsl:value-of select="substring-after(string(),'make')"/> <xsl:value-of select="substring-after(string(),'make')"/>
@ -185,7 +185,7 @@
</xsl:if> </xsl:if>
<xsl:if test="contains(string(),'check')"> <xsl:if test="contains(string(),'check')">
<xsl:choose> <xsl:choose>
<xsl:when test="$bomb-testsuite = '0'"> <xsl:when test="$bomb-testsuite = 'n'">
<xsl:value-of select="substring-before(string(),'check')"/> <xsl:value-of select="substring-before(string(),'check')"/>
<xsl:text>-k check</xsl:text> <xsl:text>-k check</xsl:text>
<xsl:value-of select="substring-after(string(),'check')"/> <xsl:value-of select="substring-after(string(),'check')"/>
@ -212,7 +212,7 @@
ancestor::chapter[@id='chapter-building-system']) or ancestor::chapter[@id='chapter-building-system']) or
$testsuite = '3'"> $testsuite = '3'">
<xsl:choose> <xsl:choose>
<xsl:when test="$bomb-testsuite = '0'"> <xsl:when test="$bomb-testsuite = 'n'">
<xsl:text>make -k check &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>

View file

@ -7,7 +7,6 @@
################################### ###################################
#----------------------------# #----------------------------#
chapter4_Makefiles() { chapter4_Makefiles() {
#----------------------------# #----------------------------#
@ -80,7 +79,7 @@ chapter5_Makefiles() {
*tcl) [[ "${TEST}" = "0" ]] && continue ;; *tcl) [[ "${TEST}" = "0" ]] && continue ;;
*expect) [[ "${TEST}" = "0" ]] && continue ;; *expect) [[ "${TEST}" = "0" ]] && continue ;;
*dejagnu) [[ "${TEST}" = "0" ]] && continue ;; *dejagnu) [[ "${TEST}" = "0" ]] && continue ;;
*stripping) [[ "${STRIP}" = "0" ]] && continue ;; *stripping) [[ "${STRIP}" = "n" ]] && continue ;;
*glibc) [[ "${TEST}" = "3" ]] && \ *glibc) [[ "${TEST}" = "3" ]] && \
sed -i 's@/usr/lib/locale@/tools/lib/locale@' $file ;; sed -i 's@/usr/lib/locale@/tools/lib/locale@' $file ;;
esac esac
@ -177,7 +176,7 @@ chapter6_Makefiles() {
# dependencies and target creation. # dependencies and target creation.
case "${this_script}" in case "${this_script}" in
*chroot) continue ;; *chroot) continue ;;
*stripping*) [[ "${STRIP}" = "0" ]] && continue ;; *stripping*) [[ "${STRIP}" = "n" ]] && continue ;;
esac esac
# Grab the name of the target # Grab the name of the target
@ -335,7 +334,7 @@ chapter789_Makefiles() {
done # for file in chapter0{7,8,9}/* done # for file in chapter0{7,8,9}/*
# Add SBU-disk_usage report target if required # Add SBU-disk_usage report target if required
if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi if [[ "$REPORT" = "y" ]] ; then wrt_report ; fi
} }
@ -352,7 +351,7 @@ build_Makefile() {
chapter5_Makefiles chapter5_Makefiles
chapter6_Makefiles chapter6_Makefiles
# Add the iterations targets, if needed # Add the iterations targets, if needed
[[ "$COMPARE" != "0" ]] && wrt_compare_targets [[ "$COMPARE" = "y" ]] && wrt_compare_targets
chapter789_Makefiles chapter789_Makefiles
@ -362,11 +361,29 @@ build_Makefile() {
cat << EOF cat << EOF
$HEADER $HEADER
SRC= /sources SRC = /sources
MOUNT_PT= $BUILDDIR MOUNT_PT = $BUILDDIR
PKG_LST= $PKG_LST PKG_LST = $PKG_LST
LUSER= $LUSER LUSER = $LUSER
LGROUP= $LGROUP 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) \$(MOUNT_PT)\`\n"
include makefile-functions include makefile-functions

View file

@ -7,6 +7,7 @@ CONFIG_CONFIG_IN = Config.in
CONFIG = menu CONFIG = menu
all: menuconfig all: menuconfig
@clear
@touch using_menuconfig @touch using_menuconfig
@`grep RUN_ME configuration | sed -e 's@RUN_ME=\"@@' -e 's@\"@@' ` || rm -f using_menuconfig @`grep RUN_ME configuration | sed -e 's@RUN_ME=\"@@' -e 's@\"@@' ` || rm -f using_menuconfig
@rm -f using_menuconfig @rm -f using_menuconfig

View file

@ -260,98 +260,6 @@ get_package_tarball_name() { #
} }
#----------------------------------#
wrt_remove_existing_dirs() { #
#----------------------------------#
local PKG_NAME=$1
(
cat << EOF
@PKG_PATH=\`ls -t \$(MOUNT_PT)\$(SRC)/${PKG_NAME} | head -n1\` && \\
ROOT=\`tar -tf \$\$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'\` && \\
[[ -n \$\$ROOT ]] && \\
rm -rf \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
if [ -e \$(MOUNT_PT)\$(SRC)/${PKG_NAME%-*}-build ]; then \\
rm -rf \$(MOUNT_PT)\$(SRC)/${PKG_NAME%-*}-build; \\
fi;
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_remove_existing_dirs2() { #
#----------------------------------#
local PKG_NAME=$1
(
cat << EOF
@PKG_PATH=\`ls -t \$(SRC)/${PKG_NAME} | head -n1\` && \\
ROOT=\`tar -tf \$\$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'\` && \\
[[ -n \$\$ROOT ]] && \\
rm -rf \$(SRC)/\$\$ROOT && \\
if [ -e \$(SRC)/${PKG_NAME%-*}-build ]; then \\
rm -rf \$(SRC)/${PKG_NAME%-*}-build; \\
fi;
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_unpack() { # Unpack and set 'ROOT' var
#----------------------------------#
local FILE=$1
local optSAVE_PREVIOUS=$2
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
wrt_remove_existing_dirs "$FILE"
fi
(
cat << EOF
@\$(call unpack,$FILE)
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
chown -R \$(LUSER) \$(MOUNT_PT)\$(SRC)/\$\$ROOT
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_unpack2() { #
#----------------------------------#
local FILE=$1
local optSAVE_PREVIOUS=$2
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
wrt_remove_existing_dirs "$FILE"
fi
(
cat << EOF
@\$(call unpack2,$FILE)
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_unpack3() { #
#----------------------------------#
local FILE=$1
local optSAVE_PREVIOUS=$2
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
wrt_remove_existing_dirs2 "$FILE"
fi
(
cat << EOF
@\$(call unpack3,$FILE)
@ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars
EOF
) >> $MKFILE.tmp
}
#----------------------------------# #----------------------------------#
wrt_test_log() { # Initialize testsuite log file wrt_test_log() { # Initialize testsuite log file
@ -390,15 +298,162 @@ EOF
} }
#----------------------------------#
wrt_copy_fstab() { #
#----------------------------------#
local i=$1
(
cat << EOF
@cp -v $FSTAB \$(MOUNT_PT)/etc/fstab >>logs/$i 2>&1
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_copy_fstab2() { #
#----------------------------------#
local i=$1
(
cat << EOF
@cp -v /sources/fstab /etc/fstab >>logs/$i 2>&1
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_report() { #
#----------------------------------#
(
cat << EOF
create-sbu_du-report: $PREV
@\$(call echo_message, Building)
@./create-sbu_du-report.sh logs $VERSION
@\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report)
@touch \$@
EOF
) >> $MKFILE.tmp
chapter789="$chapter789 create-sbu_du-report"
}
unset wrt_unpack
#----------------------------------#
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)
EOF
) >> $MKFILE.tmp
}
unset wrt_unpack2
#----------------------------------#
wrt_unpack2() { #
#----------------------------------#
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 unpack2,$FILE)
@\$(call get_pkg_root,nouser)
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_unpack3() { #
#----------------------------------#
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
}
unset wrt_remove_build_dirs
#----------------------------------#
wrt_remove_build_dirs() { #
#----------------------------------#
local name=$1
(
cat << EOF
@\$(call remove_build_dirs,$name)
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_remove_build_dirs2() { #
#----------------------------------#
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
}
unset wrt_RunAsUser
#----------------------------------# #----------------------------------#
wrt_RunAsUser() { # Execute script inside time { }, footer to log file wrt_RunAsUser() { # Execute script inside time { }, footer to log file
#----------------------------------# #----------------------------------#
local this_script=$1 local this_script=$1
local file=$2 local file=$2
( (
cat << EOF cat << EOF
@( time { su - \$(LUSER) -c "source /home/\$(LUSER)/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\ @( time { \$(SU_LUSER) "source \$(LUSER_HOME)/.bashrc && \$(CMDSDIR)/`dirname $file`/\$@" >> logs/\$@ 2>&1; } ) 2>> logs/\$@ && \\
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script \$(PRT_DU) >> logs/\$@
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
@ -422,13 +477,12 @@ wrt_RunAsRoot() { # Some scripts must be run as root..
( (
cat << EOF cat << EOF
@( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\ @( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ && \\
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script \$(PRT_DU_CR) >>logs/\$@
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
#----------------------------------# #----------------------------------#
wrt_run_as_root2() { # wrt_run_as_root2() { #
#----------------------------------# #----------------------------------#
@ -436,27 +490,28 @@ wrt_run_as_root2() { #
local file=$2 local file=$2
( (
cat << EOF cat << EOF
@( time { source envars && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\ @( time { source envars && ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ && \\
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \`\n" >>logs/$this_script echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \`\n" >>logs/\$@
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
unset wrt_run_as_chroot1
#----------------------------------# #----------------------------------#
wrt_run_as_chroot1() { # wrt_run_as_chroot1() { #
#----------------------------------# #----------------------------------#
local this_script=$1 local this_script=$1
local file=$2 local file=$2
( (
cat << EOF cat << EOF
@( time { \$(CHROOT1) 'cd /${SCRIPT_ROOT} && source envars && /${SCRIPT_ROOT}/${PROGNAME}-commands/$file >>/${SCRIPT_ROOT}/logs/${this_script} 2>&1' ; } ) 2>>logs/$this_script && \\ @( time { \$(CHROOT1) 'cd \$(SCRIPT_ROOT) && source envars && \$(crCMDSDIR)/`dirname $file`/\$@ >>logs/\$@ 2>&1' ; } ) 2>>logs/\$@ && \\
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/${this_script} \$(PRT_DU_CR) >> logs/\$@
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
unset wrt_run_as_chroot2
#----------------------------------# #----------------------------------#
wrt_run_as_chroot2() { # wrt_run_as_chroot2() { #
#----------------------------------# #----------------------------------#
@ -464,105 +519,60 @@ wrt_run_as_chroot2() { #
local file=$2 local file=$2
( (
cat << EOF cat << EOF
@( time { \$(CHROOT2) 'cd /${SCRIPT_ROOT} && source envars && /${SCRIPT_ROOT}/${PROGNAME}-commands/$file >>/${SCRIPT_ROOT}/logs/${this_script} 2>&1' ; } ) 2>>logs/$this_script && \\ @( time { \$(CHROOT2) 'cd \$(SCRIPT_ROOT) && source envars && \$(crCMDSDIR)/`dirname $file`/\$@ >>logs/\@ 2>&1' ; } ) 2>>logs/\@ && \\
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/${this_script} \$(PRT_DU_CR) >> logs/\$@
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
unset wrt_target
#----------------------------------# #----------------------------------#
wrt_copy_fstab() { # wrt_target() { # Create target and initialize log file
#----------------------------------# #----------------------------------#
local i=$1 local i=$1
( local PREV=$2
cat << EOF case $i in
@cp -v $FSTAB \$(MOUNT_PT)/etc/fstab >>logs/$i 2>&1 iteration* ) local LOGFILE="\$@.log" ;;
EOF * ) local LOGFILE="\$@" ;;
) >> $MKFILE.tmp esac
}
#----------------------------------#
wrt_copy_fstab2() { #
#----------------------------------#
local i=$1
(
cat << EOF
@cp -v /sources/fstab /etc/fstab >>logs/$i 2>&1
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_remove_build_dirs() { #
#----------------------------------#
local name=$1
(
cat << EOF
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
rm -rf \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
if [ -e \$(MOUNT_PT)\$(SRC)/$name-build ]; then \\
rm -rf \$(MOUNT_PT)\$(SRC)/$name-build; \\
fi;
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_remove_build_dirs2() { #
#----------------------------------#
local name=$1
(
cat << EOF
@ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
rm -rf \$(SRC)/\$\$ROOT && \\
if [ -e \$(SRC)/$name-build ]; then \\
rm -rf \$(SRC)/$name-build; \\
fi;
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_touch() { #
#----------------------------------#
(
cat << EOF
@touch \$@ && \\
sleep .25 && \\
echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_report() { #
#----------------------------------#
( (
cat << EOF cat << EOF
create-sbu_du-report: $PREV $i: $PREV
@\$(call echo_message, Building) @\$(call echo_message, Building)
@./create-sbu_du-report.sh logs $VERSION @./progress_bar.sh \$@ &
@\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report) @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >logs/$LOGFILE
@touch \$@
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
chapter789="$chapter789 create-sbu_du-report"
} }
#----------------------------------#
wrt_target_boot() { # Create target and initialize log file
#----------------------------------#
local i=$1
local PREV=$2
case $i in
iteration* ) local LOGFILE="\$@.log" ;;
* ) local LOGFILE="\$@" ;;
esac
(
cat << EOF
$i: $PREV
@\$(call echo_message, Building)
@./progress_bar.sh \$@ &
@echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT}\`\n" >logs/$LOGFILE
EOF
) >> $MKFILE.tmp
}
#----------------------------# #----------------------------#
run_make() { # run_make() { #
#----------------------------# #----------------------------#
# Test if make must be run. # Test if make must be run.
if [ "$RUNMAKE" = "1" ] ; then if [ "$RUNMAKE" = "y" ] ; then
# Test to make sure we're running the build as root # Test to make sure we're running the build as root
if [ "$UID" != "0" ] ; then if [ "$UID" != "0" ] ; then
echo "You must be logged in as root to successfully build the system." echo "You must be logged in as root to successfully build the system."
@ -582,7 +592,7 @@ run_make() { #
clean_builddir() { # clean_builddir() { #
#----------------------------# #----------------------------#
# Test if the clean must be done. # Test if the clean must be done.
if [ "$CLEAN" = "1" ] ; then if [ "${CLEAN}" = "y" ]; then
# Test to make sure we're running the clean as root # Test to make sure we're running the clean as root
if [ "$UID" != "0" ] ; then if [ "$UID" != "0" ] ; then
echo "You must be logged in as root to clean the build directory." echo "You must be logged in as root to clean the build directory."
@ -695,7 +705,7 @@ extract_commands() { #
--stringparam timezone $TIMEZONE \ --stringparam timezone $TIMEZONE \
--stringparam page $PAGE \ --stringparam page $PAGE \
--stringparam lang $LANG \ --stringparam lang $LANG \
--stringparam keymap ${KEYMAP:-"none"} \ --stringparam keymap $KEYMAP \
-o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
;; ;;
@ -707,7 +717,7 @@ extract_commands() { #
--stringparam timezone $TIMEZONE \ --stringparam timezone $TIMEZONE \
--stringparam page $PAGE \ --stringparam page $PAGE \
--stringparam lang $LANG \ --stringparam lang $LANG \
--stringparam keymap ${KEYMAP:-"none"} \ --stringparam keymap $KEYMAP \
-o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
;; ;;
hlfs) hlfs)
@ -721,7 +731,7 @@ extract_commands() { #
--stringparam page $PAGE \ --stringparam page $PAGE \
--stringparam lang $LANG \ --stringparam lang $LANG \
--stringparam lc_all $LC_ALL \ --stringparam lc_all $LC_ALL \
--stringparam keymap ${KEYMAP:-"none"} \ --stringparam keymap $KEYMAP \
--stringparam grsecurity_host $GRSECURITY_HOST \ --stringparam grsecurity_host $GRSECURITY_HOST \
-o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
;; ;;
@ -785,7 +795,7 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE
# Test if the packages must be downloaded # Test if the packages must be downloaded
[ ! "$GETPKG" = "1" ] && return [ ! "$GETPKG" = "y" ] && return
gs_wrt_message(){ gs_wrt_message(){
echo "${RED}$1${OFF}" echo "${RED}$1${OFF}"
@ -815,7 +825,7 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
;; ;;
*linux/linux-* ) *linux/linux-* )
[[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] && \ [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] && \
[[ "$GETKERNEL" = "0" ]] && continue [[ "$GETKERNEL" = "n" ]] && continue
;; ;;
esac esac
@ -897,7 +907,7 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
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" 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. # 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_}" echo "${tab_}${BOLD}${RED}*** ${YELLOW}Automatic execution of the generated makefile has been inhibited. ${RED}***${OFF}${nl_}"
RUNMAKE=0 RUNMAKE="n"
fi fi
} }

View file

@ -11,18 +11,18 @@ declare -r LOG=000-masterscript.log
#--- Mount point for the build #--- Mount point for the build
BUILDDIR=/mnt/build_dir BUILDDIR=/mnt/build_dir
# Create SBU and disk usage report 0(no)/1(yes) # Create SBU and disk usage report n(no)/y(yes)
# NOTE: requires to have bc installed on the host # NOTE: requires to have bc installed on the host
REPORT=1 REPORT=y
#=== Getting packages === #=== Getting packages ===
# Files will be retrieved from the local archive SRC_ARCHIVE # Files will be retrieved from the local archive SRC_ARCHIVE
# (if defined) or the 'net and will be stored in $BUILDDIR/sources # (if defined) or the 'net and will be stored in $BUILDDIR/sources
#--- Download the source packages 0(no)/1(yes) #--- Download the source packages n(no)/y(yes)
GETPKG=0 GETPKG=n
#--- The local repository for packages/file #--- The local repository for packages/file
# Used only if GETPKG = 1 # Used only if GETPKG = y
# 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.
SRC_ARCHIVE=$SRC_ARCHIVE SRC_ARCHIVE=$SRC_ARCHIVE
@ -32,8 +32,8 @@ SRC_ARCHIVE=$SRC_ARCHIVE
SERVER=ftp://ftp.lfs-matrix.net SERVER=ftp://ftp.lfs-matrix.net
#=== Build options === #=== Build options ===
#--- Automatically run the makefile once it has been created 0(no)/1(yes) #--- Automatically run the makefile once it has been created n(no)/y(yes)
RUNMAKE=0 RUNMAKE=n
#--- Optimize the build [0-2] #--- Optimize the build [0-2]
# 0 = no optimization # 0 = no optimization
@ -52,12 +52,12 @@ OPTIMIZE=0
TEST=1 TEST=1
#--- Bomb on test suites failures? #--- Bomb on test suites failures?
# 0 = no, I want to build the full system and review the logs # n = no, I want to build the full system and review the logs
# 1 = yes, bomb at the first test suite failure to can review the build dir # y = yes, bomb at the first test suite failure to can review the build dir
BOMB_TEST=0 BOMB_TEST=n
#--- Run the stripping phases 0(no)/1(yes) #--- Run the stripping phases n(no)/y(yes)
STRIP=1 STRIP=y
#--- page definition for groff letter/A4 #--- page definition for groff letter/A4
PAGE=letter PAGE=letter
@ -65,8 +65,8 @@ PAGE=letter
#--- set default timezone. #--- set default timezone.
TIMEZONE=${TZ:-GMT} TIMEZONE=${TZ:-GMT}
#--- install the optional vim-lang package 0(no)/1(yes) #--- install the optional vim-lang package n(no)/y(yes)
VIMLANG=1 VIMLANG=y
#--- Language information in /etc/profile See <locale -a> for values #--- Language information in /etc/profile See <locale -a> for values
LANG=$LANG LANG=$LANG
@ -79,17 +79,17 @@ LC_ALL=$LC_ALL # (not used in LFS)
KEYMAP=none KEYMAP=none
#=== Variables needed by iterative comparison analysis === #=== Variables needed by iterative comparison analysis ===
#--- Should some iterative comparison analysis by made? 0(no)/1(yes) #--- Should some iterative comparison analysis by made? n(no)/y(yes)
COMPARE=0 COMPARE=n
#--- The number of final stage builds to create and compare, min. 2, max. 5 #--- The number of final stage builds to create and compare, min. 2, max. 5
ITERATIONS=3 ITERATIONS=3
#--- Run ICA testing 0(no)/1(yes) #--- Run ICA testing n(no)/y(yes)
RUN_ICA=0 RUN_ICA=n
#--- Run farce testing 0(no)/1(yes) #--- Run farce testing n(no)/y(yes)
RUN_FARCE=0 RUN_FARCE=n
#==== INTERNAL VARIABLES ==== #==== INTERNAL VARIABLES ====
# Don't edit it unless you know what you are doing # Don't edit it unless you know what you are doing

View file

@ -54,7 +54,7 @@ wrt_compare_work() { #
local DEST_TOPDIR=$BUILDDIR/${SCRIPT_ROOT} local DEST_TOPDIR=$BUILDDIR/${SCRIPT_ROOT}
fi fi
if [[ "$RUN_ICA" = "1" ]] ; then if [[ "$RUN_ICA" = "y" ]] ; then
local DEST_ICA=$DEST_TOPDIR/ICA && \ local DEST_ICA=$DEST_TOPDIR/ICA && \
( (
cat << EOF cat << EOF
@ -67,7 +67,7 @@ EOF
fi fi
fi fi
if [[ "$RUN_FARCE" = "1" ]] ; then if [[ "$RUN_FARCE" = "y" ]] ; then
local DEST_FARCE=$DEST_TOPDIR/farce && \ local DEST_FARCE=$DEST_TOPDIR/farce && \
( (
cat << EOF cat << EOF

View file

@ -177,26 +177,26 @@ inline_doc
TIMEZONE) echo -e "`eval echo $PARAM_VALS`" ;; TIMEZONE) echo -e "`eval echo $PARAM_VALS`" ;;
# Validate general parameters.. # Validate general parameters..
GETPKG) validate_against_str "x0x x1x" ;; GETPKG) validate_against_str "xnx xyx" ;;
GETKERNEL ) if [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] ; then GETKERNEL ) if [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] ; then
[[ "$GETPKG" = "1" ]] && validate_against_str "x0x x1x" [[ "$GETPKG" = "y" ]] && validate_against_str "xnx xyx"
fi ;; fi ;;
RUNMAKE) validate_against_str "x0x x1x" ;; RUNMAKE) validate_against_str "xnx xyx" ;;
REPORT) validate_against_str "x0x x1x" REPORT) validate_against_str "xnx xyx"
if [[ "${!config_param}" = "1" ]]; then if [[ "${!config_param}" = "y" ]]; then
if [[ `type -p bc` ]]; then if [[ `type -p bc` ]]; then
continue continue
else else
echo -e " ${BOLD}The bc binary was not found${OFF}" echo -e " ${BOLD}The bc binary was not found${OFF}"
echo -e " The SBU and disk usage report creation will be skiped" echo -e " The SBU and disk usage report creation will be skiped"
REPORT=0 REPORT=n
continue continue
fi fi
fi ;; fi ;;
COMPARE) if [[ ! "$COMPARE" = "1" ]]; then COMPARE) if [[ ! "$COMPARE" = "y" ]]; then
validate_against_str "x0x x1x" validate_against_str "xnx xyx"
else else
if [[ ! "${RUN_ICA}" = "1" ]] && [[ ! "${RUN_FARCE}" = "1" ]]; then if [[ ! "${RUN_ICA}" = "y" ]] && [[ ! "${RUN_FARCE}" = "y" ]]; then
echo "${nl_}${DD_BORDER}" echo "${nl_}${DD_BORDER}"
echo "You have elected to analyse your build but have failed to select a tool." >&2 echo "You have elected to analyse your build but have failed to select a tool." >&2
echo "Edit /common/config and set ${L_arrow}${BOLD}RUN_ICA${R_arrow} and/or ${L_arrow}${BOLD}RUN_FARCE${R_arrow} to the required values" >&2 echo "Edit /common/config and set ${L_arrow}${BOLD}RUN_ICA${R_arrow} and/or ${L_arrow}${BOLD}RUN_FARCE${R_arrow} to the required values" >&2
@ -204,14 +204,14 @@ inline_doc
exit 1 exit 1
fi fi
fi ;; fi ;;
RUN_ICA) [[ "$COMPARE" = "1" ]] && validate_against_str "x0x x1x" ;; RUN_ICA) [[ "$COMPARE" = "y" ]] && validate_against_str "xnx xyx" ;;
RUN_FARCE) [[ "$COMPARE" = "1" ]] && validate_against_str "x0x x1x" ;; RUN_FARCE) [[ "$COMPARE" = "y" ]] && validate_against_str "xnx xyx" ;;
ITERATIONS) [[ "$COMPARE" = "1" ]] && validate_against_str "x2x x3x x4x x5x" ;; ITERATIONS) [[ "$COMPARE" = "y" ]] && validate_against_str "x2x x3x x4x x5x" ;;
TEST) validate_against_str "x0x x1x x2x x3x" ;; TEST) validate_against_str "x0x x1x x2x x3x" ;;
BOMB_TEST) [[ ! "$TEST" = "0" ]] && validate_against_str "x0x x1x" ;; BOMB_TEST) [[ ! "$TEST" = "0" ]] && validate_against_str "xnx xyx" ;;
OPTIMIZE) validate_against_str "x0x x1x x2x" ;; OPTIMIZE) validate_against_str "x0x x1x x2x" ;;
STRIP) validate_against_str "x0x x1x" ;; STRIP) validate_against_str "xnx xyx" ;;
VIMLANG) validate_against_str "x0x x1x" ;; VIMLANG) validate_against_str "xnx xyx" ;;
MODEL) validate_against_str "xglibcx xuclibcx" ;; MODEL) validate_against_str "xglibcx xuclibcx" ;;
PAGE) validate_against_str "xletterx xA4x" ;; PAGE) validate_against_str "xletterx xA4x" ;;
METHOD) validate_against_str "xchrootx xbootx" ;; METHOD) validate_against_str "xchrootx xbootx" ;;
@ -223,7 +223,7 @@ 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
;; ;;
GRSECURITY_HOST) validate_against_str "x0x x1x" ;; GRSECURITY_HOST) validate_against_str "xnx xyx" ;;
# BOOK validation. Very ugly, need be fixed # BOOK validation. Very ugly, need be fixed
BOOK) if [[ "${WC}" = "1" ]] ; then BOOK) if [[ "${WC}" = "1" ]] ; then
@ -235,7 +235,7 @@ inline_doc
# 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" = "1" ]] && validate_dir -z+ -d -w+ ;; SRC_ARCHIVE) [[ "$GETPKG" = "y" ]] && validate_dir -z+ -d -w+ ;;
BUILDDIR) # The build directory/partition MUST exist and be writable by the user BUILDDIR) # The build directory/partition MUST exist and be writable by the user
validate_dir -z -d -w validate_dir -z -d -w
[[ "xx x/x" =~ "x${!config_param}x" ]] && [[ "xx x/x" =~ "x${!config_param}x" ]] &&

View file

@ -15,13 +15,62 @@ define echo_message
@echo $(WHITE) @echo $(WHITE)
endef endef
define remove_existing_dirs
@PKG_PATH=`ls -t $(SRCSDIR)/$(1) | head -n1` && \
ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
rm -rf $(SRCSDIR)/$$ROOT && \
rm -rf $(SRCSDIR)/$${ROOT%-*}-build
endef
define remove_existing_dirs2
@PKG_PATH=\`ls -t $(SRC)/$(1) | head -n1\` && \
ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
rm -rf $(SRC)/$$ROOT && \
rm -rf $(SRC)/$${ROOT-*}-build
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\n "$(BOLD)Target $(BLUE)$@ $(BOLD)OK && \
echo --------------------------------------------------------------------------------$(WHITE)
endef
define get_pkg_root
@ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
if [ "$(1)" != "nouser" ]; then \
echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars; \
chown -R $(LUSER) $(SRCSDIR)/$$ROOT; \
else \
echo "export PKGDIR=$(crSRCSDIR)/$$ROOT" > envars; \
fi;
endef
define get_pkg_root2
@ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
echo "export PKGDIR=$(SRC)/$$ROOT" > envars
endef
define unpack define unpack
@cd $(MOUNT_PT)$(SRC) && \ @cd $(SRCSDIR) && \
tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST) tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
endef endef
define unpack2 define unpack2
@cd $(MOUNT_PT)$(SRC) && \ @cd $(SRCSDIR) && \
/tools/bin/tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST) /tools/bin/tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
endef endef

220
master.sh
View file

@ -46,27 +46,6 @@ fi
MODULE_CONFIG=$PACKAGE_DIR/config MODULE_CONFIG=$PACKAGE_DIR/config
VERBOSITY=0 VERBOSITY=0
[[ $VERBOSITY > 0 ]] && echo -n "Loading common-functions module..."
source $COMMON_DIR/common-functions
[[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit
[[ $VERBOSITY > 0 ]] && echo "OK"
#
[[ $VERBOSITY > 0 ]] && echo -n "Loading masterscript conf..."
source $COMMON_DIR/config
[[ $? > 0 ]] && echo "$COMMON_DIR/conf did not load.." && exit
[[ $VERBOSITY > 0 ]] && echo "OK"
#
[[ $VERBOSITY > 0 ]] && echo -n "Loading config module <$MODULE_CONFIG>..."
source $MODULE_CONFIG
[[ $? > 0 ]] && echo "$MODULE_CONFIG did not load.." && exit 1
[[ $VERBOSITY > 0 ]] && echo "OK"
#
[[ $VERBOSITY > 0 ]] && echo -n "Loading code module <$MODULE>..."
source $MODULE
[[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2
[[ $VERBOSITY > 0 ]] && echo "OK"
#
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
if [[ -e using_menuconfig ]]; then if [[ -e using_menuconfig ]]; then
[[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..." [[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
@ -84,6 +63,12 @@ if [[ -e using_menuconfig ]]; then
ICALOGDIR=$LOGDIR/ICA ICALOGDIR=$LOGDIR/ICA
#--- farce report log directory #--- farce report log directory
FARCELOGDIR=$LOGDIR/farce FARCELOGDIR=$LOGDIR/farce
XSL=$PROGNAME.xsl
case $PROGNAME in
clfs2) LFSVRS=development; TREE=branches/clfs-2.0/BOOK ;;
*) LFSVRS=development; TREE=trunk/BOOK ;;
esac
if [[ ! -z ${BRANCH_ID} ]]; then if [[ ! -z ${BRANCH_ID} ]]; then
case $BRANCH_ID in case $BRANCH_ID in
@ -112,8 +97,52 @@ if [[ -e using_menuconfig ]]; then
;; ;;
esac esac
fi fi
# These are boolean vars generated from Config.in.
# ISSUE: If a boolean parameter is not set <true> that
# variable is not defined by the menu app. This can
# cause a headache if you are not careful.
# The following parameters MUST be created and have a
# default value.
RUNMAKE=${RUNMAKE:-n}
GETPKG=${GETPKG:-n}
GETKERNEL=${GETKERNEL:-n}
COMPARE=${COMPARE:-n}
RUN_FARCE=${RUN_FARCE:-n}
RUN_ICA=${RUN_ICA:-n}
BOMB_TEST=${BOMB_TEST:-n}
STRIP=${STRIP:=n}
REPORT=${REPORT:=n}
VIMLANG=${VIMLANG:-n}
KEYMAP=${KEYMAP:=none}
GRSECURITY_HOST=${GRSECURITY_HOST:-n}
else
#
[[ $VERBOSITY > 0 ]] && echo -n "Loading masterscript conf..."
source $COMMON_DIR/config
[[ $? > 0 ]] && echo "$COMMON_DIR/conf did not load.." && exit
[[ $VERBOSITY > 0 ]] && echo "OK"
#
[[ $VERBOSITY > 0 ]] && echo -n "Loading config module <$MODULE_CONFIG>..."
source $MODULE_CONFIG
[[ $? > 0 ]] && echo "$MODULE_CONFIG did not load.." && exit 1
[[ $VERBOSITY > 0 ]] && echo "OK"
#
fi fi
[[ $VERBOSITY > 0 ]] && echo -n "Loading common-functions module..."
source $COMMON_DIR/common-functions
[[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit
[[ $VERBOSITY > 0 ]] && echo "OK"
[[ $VERBOSITY > 0 ]] && echo -n "Loading code module <$MODULE>..."
source $MODULE
[[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2
[[ $VERBOSITY > 0 ]] && echo "OK"
#
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
#=========================================================== #===========================================================
# If the var BOOK contains something then, maybe, it points # If the var BOOK contains something then, maybe, it points
# to a working doc.. set WC=1, else 'null' # to a working doc.. set WC=1, else 'null'
@ -190,7 +219,7 @@ while test $# -gt 0 ; do
esac esac
;; ;;
--get-packages | -G ) GETPKG=1 ;; --get-packages | -G ) GETPKG=y ;;
--help | -h ) usage | more && exit ;; --help | -h ) usage | more && exit ;;
@ -267,18 +296,9 @@ while test $# -gt 0 ; do
test $# = 1 && eval "$exit_missing_arg" test $# = 1 && eval "$exit_missing_arg"
shift shift
case $1 in case $1 in
ICA) RUN_ICA=1 ICA) RUN_ICA=y; RUN_FARCE=n; COMPARE=y ;;
RUN_FARCE=0 farce) RUN_ICA=n; RUN_FARCE=y; COMPARE=y ;;
COMPARE=1 both) RUN_ICA=y; RUN_FARCE=y; COMPARE=y ;;
;;
farce) RUN_ICA=0
RUN_FARCE=1
COMPARE=1
;;
both) RUN_ICA=1
RUN_FARCE=1
COMPARE=1
;;
*) *)
echo -e "\n$1 is an unknown analysis method." echo -e "\n$1 is an unknown analysis method."
exit 1 exit 1
@ -308,96 +328,48 @@ while test $# -gt 0 ; do
fi fi
;; ;;
--run-make | -M ) RUNMAKE=1 ;; --run-make | -M ) RUNMAKE=y ;;
--rebuild | -R ) CLEAN=1 ;; --rebuild | -R ) CLEAN=y ;;
# CLFS options # CLFS options
--arch | -A ) --arch | -A )
test $# = 1 && eval "$exit_missing_arg" test $# = 1 && eval "$exit_missing_arg"
shift shift
case $1 in case $PROGNAME in
arm ) CLFS2)
ARCH=arm case $1 in
TARGET="arm-unknown-linux-gnu" arm) ARCH=arm; TARGET="arm-unknown-linux-gnu" ;;
;; x86) ARCH=x86; TARGET="i686-pc-linux-gnu" ;;
x86 ) *) echo -e "\n$1 is an unknown or unsupported arch."; exit 1
ARCH=x86 esac
TARGET="i686-pc-linux-gnu" ;;
;; CLFS)
i486 ) case $1 in
ARCH=x86 arm ) ARCH=arm; TARGET="arm-unknown-linux-gnu" ;;
TARGET="i486-pc-linux-gnu" x86 ) ARCH=x86; TARGET="i686-pc-linux-gnu" ;;
;; i486 ) ARCH=x86; TARGET="i486-pc-linux-gnu" ;;
i586 ) i586 ) ARCH=x86; TARGET="i586-pc-linux-gnu" ;;
ARCH=x86 ppc ) ARCH=ppc; TARGET="powerpc-unknown-linux-gnu" ;;
TARGET="i586-pc-linux-gnu" mips ) ARCH=mips; TARGET="mips-unknown-linux-gnu" ;;
;; mipsel ) ARCH=mips; TARGET="mipsel-unknown-linux-gnu" ;;
ppc ) sparc ) ARCH=sparc; TARGET="sparcv9-unknown-linux-gnu" ;;
ARCH=ppc
TARGET="powerpc-unknown-linux-gnu" x86_64-64 ) ARCH=x86_64-64; TARGET="x86_64-unknown-linux-gnu" ;;
;; mips64-64 ) ARCH=mips64-64; TARGET="mips-unknown-linux-gnu" ;;
mips ) mipsel64-64 ) ARCH=mips64-64; TARGET="mipsel-unknown-linux-gnu" ;;
ARCH=mips sparc64-64 ) ARCH=sparc64-64; TARGET="sparc64-unknown-linux-gnu" ;;
TARGET="mips-unknown-linux-gnu" alpha ) ARCH=alpha; TARGET="alpha-unknown-linux-gnu" ;;
;;
mipsel ) x86_64 ) ARCH=x86_64; TARGET="x86_64-unknown-linux-gnu"; TARGET32="i686-pc-linux-gnu" ;;
ARCH=mips mips64 ) ARCH=mips64; TARGET="mips-unknown-linux-gnu"; TARGET32="mips-unknown-linux-gnu" ;;
TARGET="mipsel-unknown-linux-gnu" mipsel64 ) ARCH=mips64; TARGET="mipsel-unknown-linux-gnu"; TARGET32="mipsel-unknown-linux-gnu" ;;
;; sparc64 ) ARCH=sparc64; TARGET="sparc64-unknown-linux-gnu"; TARGET32="sparcv9-unknown-linux-gnu" ;;
sparc ) ppc64 ) ARCH=ppc64; TARGET="powerpc64-unknown-linux-gnu"; TARGET32="powerpc-unknown-linux-gnu" ;;
ARCH=sparc
TARGET="sparcv9-unknown-linux-gnu" * ) echo -e "\n$1 is an unknown or unsupported arch."; exit 1 ;;
;; esac
x86_64-64 ) ;;
ARCH=x86_64-64
TARGET="x86_64-unknown-linux-gnu"
;;
mips64-64 )
ARCH=mips64-64
TARGET="mips-unknown-linux-gnu"
;;
mipsel64-64 )
ARCH=mips64-64
TARGET="mipsel-unknown-linux-gnu"
;;
sparc64-64 )
ARCH=sparc64-64
TARGET="sparc64-unknown-linux-gnu"
;;
alpha )
ARCH=alpha
TARGET="alpha-unknown-linux-gnu"
;;
x86_64 )
ARCH=x86_64
TARGET="x86_64-unknown-linux-gnu"
TARGET32="i686-pc-linux-gnu"
;;
mips64 )
ARCH=mips64
TARGET="mips-unknown-linux-gnu"
TARGET32="mips-unknown-linux-gnu"
;;
mipsel64 )
ARCH=mips64
TARGET="mipsel-unknown-linux-gnu"
TARGET32="mipsel-unknown-linux-gnu"
;;
sparc64 )
ARCH=sparc64
TARGET="sparc64-unknown-linux-gnu"
TARGET32="sparcv9-unknown-linux-gnu"
;;
ppc64 )
ARCH=ppc64
TARGET="powerpc64-unknown-linux-gnu"
TARGET32="powerpc-unknown-linux-gnu"
;;
* )
echo -e "\n$1 is an unknown or unsupported arch."
exit 1
;;
esac esac
;; ;;
@ -447,6 +419,7 @@ while test $# -gt 0 ; do
shift shift
done done
#=================================================== #===================================================
# Set the document location... # Set the document location...
# BOOK is either defined in # BOOK is either defined in
@ -460,8 +433,7 @@ BOOK=${BOOK:=$PROGNAME-$LFSVRS}
#=================================================== #===================================================
# Check for minimum gcc and kernel versions # Check for minimum bash,tar,gcc and kernel versions
#check_requirements 1 # 0/1 0-do not display values.
echo echo
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 "3.0" "$BASH_VERSION" "BASH"
@ -482,7 +454,7 @@ echo "${nl_}${SD_BORDER}${nl_}"
# Load additional modules or configuration files based on global settings # Load additional modules or configuration files based on global settings
# compare module # compare module
if [[ "$COMPARE" = "1" ]]; 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/func_compare.sh
[[ $? > 0 ]] && echo "$COMMON_DIR/func_compare.sh did not load.." && exit [[ $? > 0 ]] && echo "$COMMON_DIR/func_compare.sh did not load.." && exit
@ -537,7 +509,7 @@ if [[ "$PWD" != "$JHALFSDIR" ]]; then
# #
[[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/ [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
# #
if [[ "$COMPARE" != "0" ]] ; then if [[ "$COMPARE" = "y" ]]; then
mkdir -p $JHALFSDIR/extras mkdir -p $JHALFSDIR/extras
cp extras/* $JHALFSDIR/extras cp extras/* $JHALFSDIR/extras
fi fi
@ -549,14 +521,14 @@ if [[ "$PWD" != "$JHALFSDIR" ]]; then
popd 1> /dev/null popd 1> /dev/null
fi fi
# #
if [[ "$REPORT" = "1" ]]; then if [[ "$REPORT" = "y" ]]; then
cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/ cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/
# After being sure that all looks sane, dump the settings to a file # After being sure that all looks sane, dump the settings to a file
# This file will be used to create the REPORT header # This file will be used to create the REPORT header
validate_config > $JHALFSDIR/jhalfs.config validate_config > $JHALFSDIR/jhalfs.config
fi fi
# #
[[ "$GETPKG" = "1" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/ [[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
# #
cp $COMMON_DIR/packages.xsl $JHALFSDIR/ cp $COMMON_DIR/packages.xsl $JHALFSDIR/
# #