From 401f81e4da7d18f00f44b0bb93d4dbed3c8209b2 Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Wed, 16 Aug 2006 17:42:54 +0000 Subject: [PATCH] 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. --- CLFS/clfs.xsl | 18 +- CLFS/config | 4 +- CLFS/master.sh | 41 +++- CLFS2/clfs2.xsl | 4 +- CLFS2/config | 4 +- CLFS2/master.sh | 25 +- Config.in | 107 ++------- HLFS/config | 8 +- HLFS/hlfs.xsl | 18 +- HLFS/master.sh | 64 ++++-- LFS/config | 4 +- LFS/lfs.xsl | 16 +- LFS/master.sh | 37 ++- Makefile | 1 + common/common-functions | 388 ++++++++++++++++---------------- common/config | 40 ++-- common/func_compare.sh | 4 +- common/func_validate_configs.sh | 34 +-- common/makefile-functions | 53 ++++- master.sh | 220 ++++++++---------- 20 files changed, 568 insertions(+), 522 deletions(-) diff --git a/CLFS/clfs.xsl b/CLFS/clfs.xsl index fb38d47..2f90ebe 100644 --- a/CLFS/clfs.xsl +++ b/CLFS/clfs.xsl @@ -28,13 +28,13 @@ - + - + @@ -102,7 +102,7 @@ cd $PKGDIR - + tar -xvf ../vim-&vim-version;-lang.* --strip-components=1 @@ -125,7 +125,7 @@ contains(string(),'check')) and ($testsuite = '2' or $testsuite = '3')"> - + make -k @@ -197,7 +197,7 @@ - + -k check @@ -222,7 +222,7 @@ - + make -k check >> $TEST_LOG 2>&1 || true @@ -242,7 +242,7 @@ - + >> $TEST_LOG 2>&1 || true diff --git a/CLFS/config b/CLFS/config index 50e618a..7dc9430 100644 --- a/CLFS/config +++ b/CLFS/config @@ -54,8 +54,8 @@ CONFIG= BOOT_CONFIG= # Get the kernel package and patches even if no configutation file -# has been supplied? 0(no)/1(yes) -GETKERNEL=0 +# has been supplied? n(no)/y(yes) +GETKERNEL=n #--- Book's sources directory # If you have previously checked out the book from the repository diff --git a/CLFS/master.sh b/CLFS/master.sh index 10b4fc0..15e15fb 100755 --- a/CLFS/master.sh +++ b/CLFS/master.sh @@ -6,7 +6,6 @@ ################################### - #----------------------------# host_prep_Makefiles() { # Initialization of the system #----------------------------# @@ -498,7 +497,7 @@ final_system_Makefiles() { # # Test if the stripping phase must be skipped. # Skip alsp temp-perl for iterative runs case $this_script in - *stripping*) [[ "$STRIP" = "0" ]] && continue ;; + *stripping*) [[ "$STRIP" = "n" ]] && continue ;; *temp-perl*) [[ -n "$N" ]] && continue ;; esac @@ -608,7 +607,7 @@ bm_final_system_Makefiles() { # # Test if the stripping phase must be skipped # Skip alsp temp-perl for iterative runs case $this_script in - *stripping*) [[ "$STRIP" = "0" ]] && continue ;; + *stripping*) [[ "$STRIP" = "n" ]] && continue ;; *temp-perl*) [[ -n "$N" ]] && continue ;; esac @@ -883,7 +882,7 @@ bootable_Makefiles() { # done # 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 # 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 final_system_Makefiles # $basicsystem # Add the iterations targets, if needed - [[ "$COMPARE" != "0" ]] && wrt_compare_targets + [[ "$COMPARE" = "y" ]] && wrt_compare_targets bootscripts_Makefiles # $bootscripttools bootable_Makefiles # $bootabletools else @@ -996,7 +995,7 @@ build_Makefile() { # Construct a Makefile from the book scripts fi bm_final_system_Makefiles # $basicsystem # Add the iterations targets, if needed - [[ "$COMPARE" != "0" ]] && wrt_compare_targets + [[ "$COMPARE" = "y" ]] && wrt_compare_targets bm_bootscripts_Makefiles # $bootscipttools bm_bootable_Makefiles # $bootabletoosl fi @@ -1009,11 +1008,29 @@ build_Makefile() { # Construct a Makefile from the book scripts cat << EOF $HEADER -SRC= /sources -MOUNT_PT= $BUILDDIR -PKG_LST= $PKG_LST -LUSER= $LUSER -LGROUP= $LGROUP +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) \$(MOUNT_PT)\`\n" + include makefile-functions diff --git a/CLFS2/clfs2.xsl b/CLFS2/clfs2.xsl index 07e158d..a72ed60 100644 --- a/CLFS2/clfs2.xsl +++ b/CLFS2/clfs2.xsl @@ -17,7 +17,7 @@ - + @@ -75,7 +75,7 @@ cd $PKGDIR - + tar -xvf ../vim-&vim-version;-lang.* --strip-components=1 diff --git a/CLFS2/config b/CLFS2/config index c16ff0d..9715548 100644 --- a/CLFS2/config +++ b/CLFS2/config @@ -33,8 +33,8 @@ FSTAB= CONFIG= # Get the kernel package and patches even if no configutation file -# has been supplied? 0(no)/1(yes) -GETKERNEL=0 +# has been supplied? n(no)/y(yes) +GETKERNEL=n #--- Book's sources directory # If you have previously checked out the book from the repository diff --git a/CLFS2/master.sh b/CLFS2/master.sh index 3620f7a..54d5e51 100755 --- a/CLFS2/master.sh +++ b/CLFS2/master.sh @@ -215,7 +215,7 @@ final_system_Makefiles() { # # Test if the stripping phase must be skipped. # Skip alsp temp-perl for iterative runs case $this_script in - *stripping*) [[ "$STRIP" = "0" ]] && continue ;; + *stripping*) [[ "$STRIP" = "n" ]] && continue ;; esac # Grab the name of the target, strip id number, XXX-script @@ -403,7 +403,7 @@ bootable_Makefiles() { # done # 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 $HEADER -SRC= /sources -MOUNT_PT= $BUILDDIR -PKG_LST= $PKG_LST -LUSER= $LUSER -LGROUP= $LGROUP +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) include makefile-functions diff --git a/Config.in b/Config.in index 31f0c4a..e78f789 100644 --- a/Config.in +++ b/Config.in @@ -58,7 +58,7 @@ menu "--- BOOK Settings" endchoice config BRANCH_ID - string "Branch (mandatory)" + string "Book Version (mandatory)" default "**EDIT ME**" depends BRANCH help @@ -250,7 +250,7 @@ menu "--- BOOK Settings" #--- End CLFS specific params #--- HLFS specific params - config CONFIG_GRSECURITY_HOST + config GRSECURITY_HOST bool "Building on grsecurity enabled host?" default n depends on BOOK_HLFS @@ -356,7 +356,7 @@ menu "--- General Settings" help #-- The directory where the created system will be located. - config CONFIG_GETPKG + config GETPKG bool "Retrieve source files" default n help @@ -368,28 +368,28 @@ menu "--- General Settings" config SRC_ARCHIVE string "Package Archive Directory" default "$SRC_ARCHIVE" - depends CONFIG_GETPKG + depends GETPKG help #-- A local archive for packages/file (not $BUILDDIR/sources) # Used only if GETPKG = 1 # Any missing file will be downloaded and archived here, # if the user has the right priviledges. - config CONFIG_GETKERNEL + config GETKERNEL bool "Always retrieve kernel package" default n - depends CONFIG_GETPKG + depends GETPKG help #-- Get the kernel package and patches even if no configuration # file has been supplied. - config CONFIG_RUNMAKE + config RUNMAKE bool "Run the makefile" default n help #-- Automatically run the makefile once it has been created - config CONFIG_REBUILD + config CLEAN bool "Rebuild files" default n help @@ -409,7 +409,7 @@ menu "--- Build Settings" config CONFIG_TESTS bool "Run testsuites" depends !BOOK_CLFS2 - default n + default y help #-- Run test suites # @@ -454,19 +454,20 @@ menu "--- Build Settings" choice prompt "Flavour ->" depends CONFIG_TESTS - default NO_BOMB config NO_BOMB bool "Don't stop on test suite failures" + default n config BOMB bool "Abort the build at the first test suite failure" + default n endchoice config BOMB_TEST - int - default "0" if NO_BOMB - default "1" if BOMB + bool + default BOMB + #--- End Test Suites #--- FSTAB @@ -515,15 +516,15 @@ menu "--- Build Settings" # a keymap included in the kernel #--- End Kernel - config CONFIG_STRIP + config STRIP bool "Strip Installed Binaries/Libraries" default y - config CONFIG_VIMLANG + config VIMLANG bool "Install vim-lang package" default y help - #-- install the optional vim-lang package + #-- Install the optional vim-lang package config TIMEZONE string "TimeZone" @@ -571,12 +572,12 @@ endmenu menu "--- Advanced Features" depends on !BOOK_BLFS - config CONFIG_REPORT + config REPORT bool "Create SBU and disk usage report" default y #--- ICA/farce - config CONFIG_COMPARE + config COMPARE bool "Run comparison analysis on final stage" depends !BOOK_CLFS2 default n @@ -596,21 +597,21 @@ menu "--- Advanced Features" # config ITERATIONS - int "Number of test runs (2,3,4,5)" - depends on CONFIG_COMPARE + int "Number of test runs (2,3,4,5)" if COMPARE + depends on COMPARE range 2 5 default 3 - config CONFIG_ICA + config RUN_ICA bool "ICA testing" - depends on CONFIG_COMPARE + depends on COMPARE default y help #-- Run ICA testing - config CONFIG_FARCE + config RUN_FARCE bool "farce testing" - depends on CONFIG_COMPARE + depends on COMPARE default n help #-- Run farce testing @@ -667,61 +668,3 @@ endmenu # string "BLFS packages" # default "none" # 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 diff --git a/HLFS/config b/HLFS/config index 200aace..e643b0c 100644 --- a/HLFS/config +++ b/HLFS/config @@ -9,8 +9,8 @@ #--- Which library model to use uclibc/glibc MODEL=glibc -#--- The host system has grsecurity options enabled? 0(no)/1(yes) -GRSECURITY_HOST=0 +#--- The host system has grsecurity options enabled? n(no)/y(yes) +GRSECURITY_HOST=n #--- Unprivileged user and group name LUSER=hlfs @@ -24,8 +24,8 @@ FSTAB= CONFIG= # Get the kernel package and patches even if no configutation file -# has been supplied? 0(no)/1(yes) -GETKERNEL=0 +# has been supplied? n(no)/y(yes) +GETKERNEL=n #--- Book's sources directory # If you have previously checked out the book from the repository diff --git a/HLFS/hlfs.xsl b/HLFS/hlfs.xsl index d44e959..a180a33 100644 --- a/HLFS/hlfs.xsl +++ b/HLFS/hlfs.xsl @@ -17,7 +17,7 @@ - + @@ -31,10 +31,10 @@ - + @@ -143,7 +143,7 @@ contains(string(),'check')) and ($testsuite = '2' or $testsuite = '3')"> - + make -k @@ -180,7 +180,7 @@ + and $grsecurity_host ='n'"/> @@ -230,7 +230,7 @@ - + -k check @@ -255,7 +255,7 @@ - + >> $TEST_LOG 2>&1 || true @@ -275,7 +275,7 @@ - + >> $TEST_LOG 2>&1 || true diff --git a/HLFS/master.sh b/HLFS/master.sh index 69db4b7..67f67bd 100755 --- a/HLFS/master.sh +++ b/HLFS/master.sh @@ -13,15 +13,22 @@ process_toolchain() { # embryo,cocoon and butterfly need special handling local toolchain=$1 local this_script=$2 local tc_phase - + local binutil_tarball + local gcc_core_tarball + echo "${tab_}${tab_}${GREEN}toolchain ${L_arrow}${toolchain}${R_arrow}" # # Safe method to remove existing toolchain dirs - pkg_tarball=$(get_package_tarball_name "binutils") - wrt_remove_existing_dirs "$pkg_tarball" - pkg_tarball=$(get_package_tarball_name "gcc-core") - wrt_remove_existing_dirs "$pkg_tarball" + binutil_tarball=$(get_package_tarball_name "binutils") + gcc_core_tarball=$(get_package_tarball_name "gcc-core") +( +cat << EOF + @\$(call remove_existing_dirs,$binutil_tarball) + @\$(call remove_existing_dirs,$gcc_core_tarball) +EOF +) >> $MKFILE.tmp + # # Manually remove the toolchain directories.. tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'` @@ -53,11 +60,13 @@ EOF ;; esac # - # Safe method to remove packages unpacked while inside the toolchain script - pkg_tarball=$(get_package_tarball_name "binutils") - wrt_remove_existing_dirs "$pkg_tarball" - 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.. 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 *introduction* ) continue ;; # Test if the stripping phase must be skipped - *stripping* ) [[ "$STRIP" = "0" ]] && continue ;; + *stripping* ) [[ "$STRIP" = "n" ]] && continue ;; *) ;; esac @@ -278,7 +287,7 @@ chapter6_Makefiles() { # sysroot or chroot build phase # dependencies and target creation. *chroot* ) continue ;; # Test if the stripping phase must be skipped - *-stripping* ) [[ "$STRIP" = "0" ]] && continue ;; + *-stripping* ) [[ "$STRIP" = "n" ]] && continue ;; esac # Grab the name of the target @@ -456,7 +465,7 @@ EOF done # for file in chapter07/* # 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 chapter6_Makefiles # Add the iterations targets, if needed - [[ "$COMPARE" != "0" ]] && wrt_compare_targets + [[ "$COMPARE" = "y" ]] && wrt_compare_targets chapter7_Makefiles # 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 $HEADER -SRC= /sources -MOUNT_PT= $BUILDDIR -PKG_LST= $PKG_LST -LUSER= $LUSER -LGROUP= $LGROUP +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) \$(MOUNT_PT)\`\n" include makefile-functions diff --git a/LFS/config b/LFS/config index 9a75eca..84538be 100644 --- a/LFS/config +++ b/LFS/config @@ -18,8 +18,8 @@ FSTAB= CONFIG= # Get the kernel package and patches even if no configuration file -# has been supplied? 0(no)/1(yes) -GETKERNEL=0 +# has been supplied? n(no)/y(yes) +GETKERNEL=n #--- Book's sources directory # If you have previously checked out the book from the repository diff --git a/LFS/lfs.xsl b/LFS/lfs.xsl index 86de874..1a02e7d 100644 --- a/LFS/lfs.xsl +++ b/LFS/lfs.xsl @@ -22,13 +22,13 @@ - + - + @@ -90,7 +90,7 @@ cd $PKGDIR - + tar -xvf ../vim-&vim-version;-lang.* --strip-components=1 @@ -117,7 +117,7 @@ ancestor::chapter[@id='chapter-building-system']) or $testsuite = '3')"> - + make -k @@ -185,7 +185,7 @@ - + -k check @@ -212,7 +212,7 @@ ancestor::chapter[@id='chapter-building-system']) or $testsuite = '3'"> - + make -k check >> $TEST_LOG 2>&1 || true diff --git a/LFS/master.sh b/LFS/master.sh index 46721ba..9a9d9a7 100755 --- a/LFS/master.sh +++ b/LFS/master.sh @@ -7,7 +7,6 @@ ################################### - #----------------------------# chapter4_Makefiles() { #----------------------------# @@ -80,7 +79,7 @@ chapter5_Makefiles() { *tcl) [[ "${TEST}" = "0" ]] && continue ;; *expect) [[ "${TEST}" = "0" ]] && continue ;; *dejagnu) [[ "${TEST}" = "0" ]] && continue ;; - *stripping) [[ "${STRIP}" = "0" ]] && continue ;; + *stripping) [[ "${STRIP}" = "n" ]] && continue ;; *glibc) [[ "${TEST}" = "3" ]] && \ sed -i 's@/usr/lib/locale@/tools/lib/locale@' $file ;; esac @@ -177,7 +176,7 @@ chapter6_Makefiles() { # dependencies and target creation. case "${this_script}" in *chroot) continue ;; - *stripping*) [[ "${STRIP}" = "0" ]] && continue ;; + *stripping*) [[ "${STRIP}" = "n" ]] && continue ;; esac # Grab the name of the target @@ -335,7 +334,7 @@ chapter789_Makefiles() { done # for file in chapter0{7,8,9}/* # 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 chapter6_Makefiles # Add the iterations targets, if needed - [[ "$COMPARE" != "0" ]] && wrt_compare_targets + [[ "$COMPARE" = "y" ]] && wrt_compare_targets chapter789_Makefiles @@ -362,11 +361,29 @@ build_Makefile() { cat << EOF $HEADER -SRC= /sources -MOUNT_PT= $BUILDDIR -PKG_LST= $PKG_LST -LUSER= $LUSER -LGROUP= $LGROUP +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) \$(MOUNT_PT)\`\n" + include makefile-functions diff --git a/Makefile b/Makefile index 7ccb268..d73426a 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ CONFIG_CONFIG_IN = Config.in CONFIG = menu all: menuconfig + @clear @touch using_menuconfig @`grep RUN_ME configuration | sed -e 's@RUN_ME=\"@@' -e 's@\"@@' ` || rm -f using_menuconfig @rm -f using_menuconfig diff --git a/common/common-functions b/common/common-functions index 4392d6b..2af8988 100644 --- a/common/common-functions +++ b/common/common-functions @@ -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 @@ -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 #----------------------------------# local this_script=$1 local file=$2 + ( cat << EOF - @( time { su - \$(LUSER) -c "source /home/\$(LUSER)/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\ - echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script + @( time { \$(SU_LUSER) "source \$(LUSER_HOME)/.bashrc && \$(CMDSDIR)/`dirname $file`/\$@" >> logs/\$@ 2>&1; } ) 2>> logs/\$@ && \\ + \$(PRT_DU) >> logs/\$@ EOF ) >> $MKFILE.tmp } @@ -422,13 +477,12 @@ wrt_RunAsRoot() { # Some scripts must be run as root.. ( cat << EOF - @( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\ - echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script + @( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ && \\ + \$(PRT_DU_CR) >>logs/\$@ EOF ) >> $MKFILE.tmp } - #----------------------------------# wrt_run_as_root2() { # #----------------------------------# @@ -436,27 +490,28 @@ wrt_run_as_root2() { # local file=$2 ( cat << EOF - @( time { source envars && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\ - echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \`\n" >>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/\$@ EOF ) >> $MKFILE.tmp } +unset wrt_run_as_chroot1 #----------------------------------# wrt_run_as_chroot1() { # #----------------------------------# local this_script=$1 local file=$2 ( - cat << EOF - @( time { \$(CHROOT1) 'cd /${SCRIPT_ROOT} && source envars && /${SCRIPT_ROOT}/${PROGNAME}-commands/$file >>/${SCRIPT_ROOT}/logs/${this_script} 2>&1' ; } ) 2>>logs/$this_script && \\ - echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/${this_script} +cat << EOF + @( time { \$(CHROOT1) 'cd \$(SCRIPT_ROOT) && source envars && \$(crCMDSDIR)/`dirname $file`/\$@ >>logs/\$@ 2>&1' ; } ) 2>>logs/\$@ && \\ + \$(PRT_DU_CR) >> logs/\$@ EOF ) >> $MKFILE.tmp } - +unset wrt_run_as_chroot2 #----------------------------------# wrt_run_as_chroot2() { # #----------------------------------# @@ -464,105 +519,60 @@ wrt_run_as_chroot2() { # local file=$2 ( 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 && \\ - echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/${this_script} + @( time { \$(CHROOT2) 'cd \$(SCRIPT_ROOT) && source envars && \$(crCMDSDIR)/`dirname $file`/\$@ >>logs/\@ 2>&1' ; } ) 2>>logs/\@ && \\ + \$(PRT_DU_CR) >> logs/\$@ EOF ) >> $MKFILE.tmp } - +unset wrt_target #----------------------------------# -wrt_copy_fstab() { # +wrt_target() { # Create target and initialize log file #----------------------------------# 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_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() { # -#----------------------------------# + local PREV=$2 + case $i in + iteration* ) local LOGFILE="\$@.log" ;; + * ) local LOGFILE="\$@" ;; + esac ( cat << EOF -create-sbu_du-report: $PREV +$i: $PREV @\$(call echo_message, Building) - @./create-sbu_du-report.sh logs $VERSION - @\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report) - @touch \$@ + @./progress_bar.sh \$@ & + @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >logs/$LOGFILE EOF ) >> $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() { # #----------------------------# # 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 if [ "$UID" != "0" ] ; then echo "You must be logged in as root to successfully build the system." @@ -582,7 +592,7 @@ run_make() { # clean_builddir() { # #----------------------------# # 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 if [ "$UID" != "0" ] ; then echo "You must be logged in as root to clean the build directory." @@ -695,7 +705,7 @@ extract_commands() { # --stringparam timezone $TIMEZONE \ --stringparam page $PAGE \ --stringparam lang $LANG \ - --stringparam keymap ${KEYMAP:-"none"} \ + --stringparam keymap $KEYMAP \ -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 ;; @@ -707,7 +717,7 @@ extract_commands() { # --stringparam timezone $TIMEZONE \ --stringparam page $PAGE \ --stringparam lang $LANG \ - --stringparam keymap ${KEYMAP:-"none"} \ + --stringparam keymap $KEYMAP \ -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 ;; hlfs) @@ -721,7 +731,7 @@ extract_commands() { # --stringparam page $PAGE \ --stringparam lang $LANG \ --stringparam lc_all $LC_ALL \ - --stringparam keymap ${KEYMAP:-"none"} \ + --stringparam keymap $KEYMAP \ --stringparam grsecurity_host $GRSECURITY_HOST \ -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 # Test if the packages must be downloaded - [ ! "$GETPKG" = "1" ] && return + [ ! "$GETPKG" = "y" ] && return gs_wrt_message(){ echo "${RED}$1${OFF}" @@ -815,7 +825,7 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if ;; *linux/linux-* ) [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] && \ - [[ "$GETKERNEL" = "0" ]] && continue + [[ "$GETKERNEL" = "n" ]] && continue ;; 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" # 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=0 + RUNMAKE="n" fi } diff --git a/common/config b/common/config index 7e55b06..5e0d451 100644 --- a/common/config +++ b/common/config @@ -11,18 +11,18 @@ declare -r LOG=000-masterscript.log #--- Mount point for the build 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 -REPORT=1 +REPORT=y #=== Getting packages === # Files will be retrieved from the local archive SRC_ARCHIVE # (if defined) or the 'net and will be stored in $BUILDDIR/sources -#--- Download the source packages 0(no)/1(yes) -GETPKG=0 +#--- Download the source packages n(no)/y(yes) +GETPKG=n #--- 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, # if the user has the right priviledges. SRC_ARCHIVE=$SRC_ARCHIVE @@ -32,8 +32,8 @@ SRC_ARCHIVE=$SRC_ARCHIVE SERVER=ftp://ftp.lfs-matrix.net #=== Build options === -#--- Automatically run the makefile once it has been created 0(no)/1(yes) -RUNMAKE=0 +#--- Automatically run the makefile once it has been created n(no)/y(yes) +RUNMAKE=n #--- Optimize the build [0-2] # 0 = no optimization @@ -52,12 +52,12 @@ OPTIMIZE=0 TEST=1 #--- Bomb on test suites failures? -# 0 = 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 -BOMB_TEST=0 +# n = no, I want to build the full system and review the logs +# y = yes, bomb at the first test suite failure to can review the build dir +BOMB_TEST=n -#--- Run the stripping phases 0(no)/1(yes) -STRIP=1 +#--- Run the stripping phases n(no)/y(yes) +STRIP=y #--- page definition for groff letter/A4 PAGE=letter @@ -65,8 +65,8 @@ PAGE=letter #--- set default timezone. TIMEZONE=${TZ:-GMT} -#--- install the optional vim-lang package 0(no)/1(yes) -VIMLANG=1 +#--- install the optional vim-lang package n(no)/y(yes) +VIMLANG=y #--- Language information in /etc/profile See for values LANG=$LANG @@ -79,17 +79,17 @@ LC_ALL=$LC_ALL # (not used in LFS) KEYMAP=none #=== Variables needed by iterative comparison analysis === -#--- Should some iterative comparison analysis by made? 0(no)/1(yes) -COMPARE=0 +#--- Should some iterative comparison analysis by made? n(no)/y(yes) +COMPARE=n #--- The number of final stage builds to create and compare, min. 2, max. 5 ITERATIONS=3 -#--- Run ICA testing 0(no)/1(yes) -RUN_ICA=0 +#--- Run ICA testing n(no)/y(yes) +RUN_ICA=n -#--- Run farce testing 0(no)/1(yes) -RUN_FARCE=0 +#--- Run farce testing n(no)/y(yes) +RUN_FARCE=n #==== INTERNAL VARIABLES ==== # Don't edit it unless you know what you are doing diff --git a/common/func_compare.sh b/common/func_compare.sh index 9559dfd..2a5efe3 100644 --- a/common/func_compare.sh +++ b/common/func_compare.sh @@ -54,7 +54,7 @@ wrt_compare_work() { # local DEST_TOPDIR=$BUILDDIR/${SCRIPT_ROOT} fi - if [[ "$RUN_ICA" = "1" ]] ; then + if [[ "$RUN_ICA" = "y" ]] ; then local DEST_ICA=$DEST_TOPDIR/ICA && \ ( cat << EOF @@ -67,7 +67,7 @@ EOF fi fi - if [[ "$RUN_FARCE" = "1" ]] ; then + if [[ "$RUN_FARCE" = "y" ]] ; then local DEST_FARCE=$DEST_TOPDIR/farce && \ ( cat << EOF diff --git a/common/func_validate_configs.sh b/common/func_validate_configs.sh index 6cb440e..f93231d 100644 --- a/common/func_validate_configs.sh +++ b/common/func_validate_configs.sh @@ -177,26 +177,26 @@ inline_doc TIMEZONE) echo -e "`eval echo $PARAM_VALS`" ;; # Validate general parameters.. - GETPKG) validate_against_str "x0x x1x" ;; + GETPKG) validate_against_str "xnx xyx" ;; GETKERNEL ) if [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] ; then - [[ "$GETPKG" = "1" ]] && validate_against_str "x0x x1x" + [[ "$GETPKG" = "y" ]] && validate_against_str "xnx xyx" fi ;; - RUNMAKE) validate_against_str "x0x x1x" ;; - REPORT) validate_against_str "x0x x1x" - if [[ "${!config_param}" = "1" ]]; then + RUNMAKE) validate_against_str "xnx xyx" ;; + REPORT) validate_against_str "xnx xyx" + 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=0 + REPORT=n continue fi fi ;; - COMPARE) if [[ ! "$COMPARE" = "1" ]]; then - validate_against_str "x0x x1x" + COMPARE) if [[ ! "$COMPARE" = "y" ]]; then + validate_against_str "xnx xyx" else - if [[ ! "${RUN_ICA}" = "1" ]] && [[ ! "${RUN_FARCE}" = "1" ]]; then + if [[ ! "${RUN_ICA}" = "y" ]] && [[ ! "${RUN_FARCE}" = "y" ]]; then echo "${nl_}${DD_BORDER}" 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 @@ -204,14 +204,14 @@ inline_doc exit 1 fi fi ;; - RUN_ICA) [[ "$COMPARE" = "1" ]] && validate_against_str "x0x x1x" ;; - RUN_FARCE) [[ "$COMPARE" = "1" ]] && validate_against_str "x0x x1x" ;; - ITERATIONS) [[ "$COMPARE" = "1" ]] && validate_against_str "x2x x3x x4x x5x" ;; + RUN_ICA) [[ "$COMPARE" = "y" ]] && validate_against_str "xnx xyx" ;; + RUN_FARCE) [[ "$COMPARE" = "y" ]] && validate_against_str "xnx xyx" ;; + ITERATIONS) [[ "$COMPARE" = "y" ]] && validate_against_str "x2x x3x x4x x5x" ;; 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" ;; - STRIP) validate_against_str "x0x x1x" ;; - VIMLANG) validate_against_str "x0x x1x" ;; + STRIP) validate_against_str "xnx xyx" ;; + VIMLANG) validate_against_str "xnx xyx" ;; MODEL) validate_against_str "xglibcx xuclibcx" ;; PAGE) validate_against_str "xletterx xA4x" ;; METHOD) validate_against_str "xchrootx xbootx" ;; @@ -223,7 +223,7 @@ inline_doc LGROUP) echo -e "`eval echo $PARAM_VALS`" [[ "${!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) if [[ "${WC}" = "1" ]] ; then @@ -235,7 +235,7 @@ inline_doc # Validate directories, testable states: # fatal -z -d -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 validate_dir -z -d -w [[ "xx x/x" =~ "x${!config_param}x" ]] && diff --git a/common/makefile-functions b/common/makefile-functions index 6649e1b..93fd3b5 100644 --- a/common/makefile-functions +++ b/common/makefile-functions @@ -15,13 +15,62 @@ define echo_message @echo $(WHITE) 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 - @cd $(MOUNT_PT)$(SRC) && \ + @cd $(SRCSDIR) && \ tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST) endef define unpack2 - @cd $(MOUNT_PT)$(SRC) && \ + @cd $(SRCSDIR) && \ /tools/bin/tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST) endef diff --git a/master.sh b/master.sh index a524050..e7a364d 100755 --- a/master.sh +++ b/master.sh @@ -46,27 +46,6 @@ fi MODULE_CONFIG=$PACKAGE_DIR/config 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 [[ $VERBOSITY > 0 ]] && echo -n "Loading config params from ..." @@ -84,6 +63,12 @@ if [[ -e using_menuconfig ]]; then ICALOGDIR=$LOGDIR/ICA #--- farce report log directory 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 case $BRANCH_ID in @@ -112,8 +97,52 @@ if [[ -e using_menuconfig ]]; then ;; esac fi + # These are boolean vars generated from Config.in. + # ISSUE: If a boolean parameter is not set 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 + +[[ $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 # to a working doc.. set WC=1, else 'null' @@ -190,7 +219,7 @@ while test $# -gt 0 ; do esac ;; - --get-packages | -G ) GETPKG=1 ;; + --get-packages | -G ) GETPKG=y ;; --help | -h ) usage | more && exit ;; @@ -267,18 +296,9 @@ while test $# -gt 0 ; do test $# = 1 && eval "$exit_missing_arg" shift case $1 in - ICA) RUN_ICA=1 - RUN_FARCE=0 - COMPARE=1 - ;; - farce) RUN_ICA=0 - RUN_FARCE=1 - COMPARE=1 - ;; - both) RUN_ICA=1 - RUN_FARCE=1 - COMPARE=1 - ;; + ICA) RUN_ICA=y; RUN_FARCE=n; COMPARE=y ;; + farce) RUN_ICA=n; RUN_FARCE=y; COMPARE=y ;; + both) RUN_ICA=y; RUN_FARCE=y; COMPARE=y ;; *) echo -e "\n$1 is an unknown analysis method." exit 1 @@ -308,96 +328,48 @@ while test $# -gt 0 ; do fi ;; - --run-make | -M ) RUNMAKE=1 ;; + --run-make | -M ) RUNMAKE=y ;; - --rebuild | -R ) CLEAN=1 ;; + --rebuild | -R ) CLEAN=y ;; # CLFS options --arch | -A ) test $# = 1 && eval "$exit_missing_arg" shift - case $1 in - arm ) - ARCH=arm - TARGET="arm-unknown-linux-gnu" - ;; - x86 ) - ARCH=x86 - TARGET="i686-pc-linux-gnu" - ;; - i486 ) - ARCH=x86 - TARGET="i486-pc-linux-gnu" - ;; - i586 ) - ARCH=x86 - TARGET="i586-pc-linux-gnu" - ;; - ppc ) - ARCH=ppc - TARGET="powerpc-unknown-linux-gnu" - ;; - mips ) - ARCH=mips - TARGET="mips-unknown-linux-gnu" - ;; - mipsel ) - ARCH=mips - TARGET="mipsel-unknown-linux-gnu" - ;; - sparc ) - ARCH=sparc - TARGET="sparcv9-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" - ;; - 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 - ;; + case $PROGNAME in + CLFS2) + case $1 in + arm) ARCH=arm; TARGET="arm-unknown-linux-gnu" ;; + x86) ARCH=x86; TARGET="i686-pc-linux-gnu" ;; + *) echo -e "\n$1 is an unknown or unsupported arch."; exit 1 + esac + ;; + CLFS) + case $1 in + arm ) ARCH=arm; TARGET="arm-unknown-linux-gnu" ;; + x86 ) ARCH=x86; TARGET="i686-pc-linux-gnu" ;; + i486 ) ARCH=x86; TARGET="i486-pc-linux-gnu" ;; + i586 ) ARCH=x86; TARGET="i586-pc-linux-gnu" ;; + ppc ) ARCH=ppc; TARGET="powerpc-unknown-linux-gnu" ;; + mips ) ARCH=mips; TARGET="mips-unknown-linux-gnu" ;; + mipsel ) ARCH=mips; TARGET="mipsel-unknown-linux-gnu" ;; + sparc ) ARCH=sparc; TARGET="sparcv9-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" ;; + 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 done + #=================================================== # Set the document location... # BOOK is either defined in @@ -460,8 +433,7 @@ BOOK=${BOOK:=$PROGNAME-$LFSVRS} #=================================================== -# Check for minimum gcc and kernel versions -#check_requirements 1 # 0/1 0-do not display values. +# Check for minimum bash,tar,gcc and kernel versions echo check_version "2.6.2" "`uname -r`" "KERNEL" 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 # compare module -if [[ "$COMPARE" = "1" ]]; then +if [[ "$COMPARE" = "y" ]]; then [[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..." source $COMMON_DIR/func_compare.sh [[ $? > 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/ # - if [[ "$COMPARE" != "0" ]] ; then + if [[ "$COMPARE" = "y" ]]; then mkdir -p $JHALFSDIR/extras cp extras/* $JHALFSDIR/extras fi @@ -549,14 +521,14 @@ if [[ "$PWD" != "$JHALFSDIR" ]]; then popd 1> /dev/null fi # - if [[ "$REPORT" = "1" ]]; then + 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 # - [[ "$GETPKG" = "1" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/ + [[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/ # cp $COMMON_DIR/packages.xsl $JHALFSDIR/ #