From 7b6ecc5b8e605925c1afe2ca362a100a1a42e83f Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Wed, 18 Oct 2006 19:28:47 +0000 Subject: [PATCH] Started support to customize de base system build allowing Makefile regeneration. --- Config.in | 13 ++++ README.CUSTOM | 41 +++++++++-- TODO | 5 +- jhalfs | 195 ++++++++++++++++++++++++++------------------------ 4 files changed, 152 insertions(+), 102 deletions(-) diff --git a/Config.in b/Config.in index f7ffa0a..248384a 100644 --- a/Config.in +++ b/Config.in @@ -823,3 +823,16 @@ endif #--- End Advanced Features endmenu + +config RE_MAKE + bool "Rebuild the Makefile (see help)" + default n + depends on !BOOK_BLFS + help + #-- Rebuild the Makefile + # + # This option alow to rebuild the Makefile after + # customizing the base system build scripts. + # + # See README.CUSTOM for more info about this feature. + diff --git a/README.CUSTOM b/README.CUSTOM index 85a5fe1..a0bc90d 100644 --- a/README.CUSTOM +++ b/README.CUSTOM @@ -10,6 +10,39 @@ needs of every individual and requests are made "Can you add xxxx package". Rather than adding numerous package scripts and switches for each request it was easier to add a tool for the user(s) to code their own package needs. + There is two areas that can be customized: how the base system is build +and what additional configurations and packages requires your hardware to can +boot and work with. Each one of this areas is handled in a diferent way. + + BASE SYSTEM CUSTOMIZATION + + There is two ways to alter how the base system will be built: + + - Using a working copy of the book sources and editing the XML files. + This is the way used by book editors to test packages upgrades, + command changes, build order changes. etc. + + This method requires you know very well the book sources and what + files need be edited. It will not be discussed here. + + - Editing the generated build scripts to make any change you would. + This is the method discussed below. + +(TO BE WRITTEN) + + + ADDING POST-SYSTEM BUILD CONFIGURATION FILES AND EXTRA PACKAGES + + The installation of BLFS packages is handled via blfs-tool and activated +when you select the appropiate menu option. See README and README.BLFS for +more info. + + The feature descrbed below was added so users could install remaining +configuration files, build the packages necessary to access the internet +or to support specific hardware, or to install basic utilities that need +have availables from the beginning, and was not intended to replace the BLFS +install system. + LAYOUT A new directory has been added to JHALFS tree which will contain the @@ -63,10 +96,6 @@ configuration file which enables/disables the inclusion of personal scripts. the cmd make mk_CUSTOM_TOOLS - :::FINAL COMMENT::: - This feature was added so users could build the packages necessary to access - the internet and was not intended to replace the BLFS install system. - #--------- GLIB example ----------- @@ -113,7 +142,7 @@ PKG_FILE="gmp-1.20.1.tar.bz2" URL="ftp://arcana.linux.it/pub/gpm/gpm-1.20.1.tar.bz2" MD5="2c63e827d755527950d9d13fe3d87692" - # MD5SUM is not absolutely necessary but JHALFS whines and complains + # MD5SUM is not absolutely necessary but JHALFS whines and complains # Add the MD5SUM if you can PATCH1=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-segfault-1.patch" PATCH2=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-silent-1.patch" @@ -153,7 +182,7 @@ xEOFx # There are no referenced to a package or package dir. # This method is useful for creating user files/profiles/etc # at build time. - + PKG="" PKG_VERSION="" diff --git a/TODO b/TODO index 65e7177..9968a78 100644 --- a/TODO +++ b/TODO @@ -17,7 +17,8 @@ xLFS MODULES - To develop a new "restart" Makefile target code. - To add support for copying to the final system pre-generated - configuration files created by the user, if that can be implemented. + configuration files created by the user. + Work in progress via CUSTOM_TOOLS BLFS MODULE (See BLFS/TODO) @@ -34,3 +35,5 @@ OTHERS That requires a way to can regenerate the Makefile if additional scripts are manually added to the *-commands/*/ dirs. + Work in progress via RE_MAKE + diff --git a/jhalfs b/jhalfs index 23f2922..37f9b2b 100755 --- a/jhalfs +++ b/jhalfs @@ -108,6 +108,7 @@ REPORT=${REPORT:=n} VIMLANG=${VIMLANG:-n} GRSECURITY_HOST=${GRSECURITY_HOST:-n} CUSTOM_TOOLS=${CUSTOM_TOOLS:-n} +RE_MAKE=${RE_MAKE:-n} # Book surces envars BRANCH_ID=${BRANCH_ID:=development} @@ -316,108 +317,112 @@ if [[ "$OPTIMIZE" != "0" ]]; then fi # -# If $BUILDDIR has subdirectories like tools/ or bin/, stop the run -# and notify the user about that. -if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] && [ -z $CLEAN ] ; then - eval "$no_empty_builddir" -fi +if [[ "$RE_MAKE" = "n" ]] ; then -# If requested, clean the build directory -clean_builddir - -if [[ ! -d $JHALFSDIR ]]; then - mkdir -p $JHALFSDIR -fi -# -# Create $BUILDDIR/sources even though it could be created by get_sources() -if [[ ! -d $BUILDDIR/sources ]]; then - mkdir -p $BUILDDIR/sources -fi -# -# Create the log directory -if [[ ! -d $LOGDIR ]]; then - mkdir $LOGDIR -fi ->$LOGDIR/$LOG -# -[[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR -# -cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/ -# -[[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/ -# -if [[ "$COMPARE" = "y" ]]; then - mkdir -p $JHALFSDIR/extras - cp extras/* $JHALFSDIR/extras -fi -# -if [[ -n "$FILES" ]]; then - # pushd/popd necessary to deal with multiple files - pushd $PACKAGE_DIR 1> /dev/null - cp $FILES $JHALFSDIR/ - popd 1> /dev/null -fi -# -if [[ "${PROGNAME}" = "lfs" ]]; then - if [[ "${CUSTOM_TOOLS}" = "y" ]]; then - echo "Copying custom tool scripts to $JHALFSDIR" - mkdir -p $JHALFSDIR/custom-commands/config - mkdir -p $JHALFSDIR/custom-commands/scripts - cp -Rf custom/* $JHALFSDIR/custom-commands + # If $BUILDDIR has subdirectories like tools/ or bin/, stop the run + # and notify the user about that. + if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] && [ -z $CLEAN ] ; then + eval "$no_empty_builddir" fi -fi -# -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" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/ -# -cp $COMMON_DIR/packages.xsl $JHALFSDIR/ -# -sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL} -export XSL=$JHALFSDIR/${XSL} + # If requested, clean the build directory + clean_builddir -# Install blfs-tool, if requested. -if [[ "${BLFS_TOOL}" = "y" ]] ; then - # Install the files - [[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -p ${BUILDDIR}${BLFS_ROOT} - cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT} - cp -r menu ${BUILDDIR}${BLFS_ROOT} - cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT} - cp README.BLFS ${BUILDDIR}${BLFS_ROOT} - # Clean-up - rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn - rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn - rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn - # Set some harcoded envars to their proper values - sed -i 's,blfs-xml,'$BLFS_XML',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,libs/book.xsl} - sed -i 's,tracking-dir,'$TRACKING_DIR',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,gen-makefile.sh} - # Copy the dependencies build scripts - cp -r $COMMON_DIR/blfs-tool-deps $JHALFSDIR/ - rm -rf $JHALFSDIR/blfs-tool-deps/.svn -fi - -get_book -echo "${SD_BORDER}${nl_}" - -# Get the BLFS book, if requested. -if [[ "${BLFS_TOOL}" = "y" ]] ; then - echo -n "Downloading the BLFS document, $BLFS_BRANCH_ID version... " - if [[ ! -d ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} ]] ; then - mkdir -p ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} - svn co $SVN_2/BLFS/$BLFS_TREE ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} >>$LOGDIR/$LOG 2>&1 - else - pushd ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} 1> /dev/null - svn up >>$LOGDIR/$LOG 2>&1 + if [[ ! -d $JHALFSDIR ]]; then + mkdir -p $JHALFSDIR + fi + # + # Create $BUILDDIR/sources even though it could be created by get_sources() + if [[ ! -d $BUILDDIR/sources ]]; then + mkdir -p $BUILDDIR/sources + fi + # + # Create the log directory + if [[ ! -d $LOGDIR ]]; then + mkdir $LOGDIR + fi + >$LOGDIR/$LOG + # + [[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR + # + cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/ + # + [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/ + # + if [[ "$COMPARE" = "y" ]]; then + mkdir -p $JHALFSDIR/extras + cp extras/* $JHALFSDIR/extras + fi + # + if [[ -n "$FILES" ]]; then + # pushd/popd necessary to deal with multiple files + pushd $PACKAGE_DIR 1> /dev/null + cp $FILES $JHALFSDIR/ popd 1> /dev/null fi - echo -ne "done\n" + # + if [[ "${PROGNAME}" = "lfs" ]]; then + if [[ "${CUSTOM_TOOLS}" = "y" ]]; then + echo "Copying custom tool scripts to $JHALFSDIR" + mkdir -p $JHALFSDIR/custom-commands/config + mkdir -p $JHALFSDIR/custom-commands/scripts + cp -Rf custom/* $JHALFSDIR/custom-commands + fi + fi + + # + 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" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/ + # + cp $COMMON_DIR/packages.xsl $JHALFSDIR/ + # + sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL} + export XSL=$JHALFSDIR/${XSL} + + # Install blfs-tool, if requested. + if [[ "${BLFS_TOOL}" = "y" ]] ; then + # Install the files + [[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -p ${BUILDDIR}${BLFS_ROOT} + cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT} + cp -r menu ${BUILDDIR}${BLFS_ROOT} + cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT} + cp README.BLFS ${BUILDDIR}${BLFS_ROOT} + # Clean-up + rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn + rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn + rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn + # Set some harcoded envars to their proper values + sed -i 's,blfs-xml,'$BLFS_XML',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,libs/book.xsl} + sed -i 's,tracking-dir,'$TRACKING_DIR',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,gen-makefile.sh} + # Copy the dependencies build scripts + cp -r $COMMON_DIR/blfs-tool-deps $JHALFSDIR/ + rm -rf $JHALFSDIR/blfs-tool-deps/.svn + fi + + get_book echo "${SD_BORDER}${nl_}" + + # Get the BLFS book, if requested. + if [[ "${BLFS_TOOL}" = "y" ]] ; then + echo -n "Downloading the BLFS document, $BLFS_BRANCH_ID version... " + if [[ ! -d ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} ]] ; then + mkdir -p ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} + svn co $SVN_2/BLFS/$BLFS_TREE ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} >>$LOGDIR/$LOG 2>&1 + else + pushd ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} 1> /dev/null + svn up >>$LOGDIR/$LOG 2>&1 + popd 1> /dev/null + fi + echo -ne "done\n" + echo "${SD_BORDER}${nl_}" + fi + fi build_Makefile