Merged cunstomization code from experimental branch.

Let trunk to be broken for a while...
This commit is contained in:
Manuel Canales Esparcia 2006-10-14 17:22:29 +00:00
parent ae158a62bc
commit 9a536f733c
12 changed files with 399 additions and 2 deletions

View file

@ -400,6 +400,17 @@ menu "--- BOOK Settings"
# have read and write privileges on that directory.
#--- End BLFS specific params
#--- Custom Tools support
config CUSTOM_TOOLS
bool "Add custom tool support"
default n
depends on BOOK_LFS
help
#--- Activating this option additional packages you create
# will be installed.
#
#--- End Custom Tools support
#--- End BOOK Settings
endmenu

143
README.CUSTOM Normal file
View file

@ -0,0 +1,143 @@
HOW TO ADD CUSTOM SCRIPTS TO THE JHALFS MAKEFILE
Normally JHALFS creates a Makefile containing only those scripts found in
the {B,C,H}LFS books. An automated construction tool cannot predict the
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.
LAYOUT
A new directory has been added to JHALFS tree which will contain the
configuration scripts and a few examples. A switch has been added to the
configuration file which enables/disables the inclusion of personal scripts.
custom
/config <-- where to put your scripts.
template <-- ALL scripts MUST look like this
NOTE::: You are responsible for including all dependencies and ensuring they
are built in the proper order.
1. To add a package to the final JHALFS Makefile you must first create a file
in the custom/config directory.
**All config files MUST follow the naming convention, xxx-PKG, where xxx
is the order number and PKG is the name of the package. The file naming
format is important as it defines the build order. The example shown
below has an order number 950 and log files will list in alphabetical
order in the /logs directory after blfs-tools scripts.
The simplest method is to copy the template file into the config directory
and rename it.
2. Populate the variables with the necessary values.
Variable function is self explanitory except for the inclusion of the
build cmds. If the package you want to include is found in the BLFS
book then you only need to copy/paste the cmd strings between the xEOFx
pairs, otherwise you will need to define the build cmds yourself.
NOTE::: This script you just created is not usable directly but contains
all the information necessary for jhalfs to create a build script
and an entry in the jhalfs Makefile.
3. As mentioned previously the build order is dictated by the 3 digit number
in the file name. If a package has dependencies it must be numerically
larger than the dependency files.
ie. The package mc has glib as a dependency and build order is
950-glib
951-mc
4. A config file for BLFS-bootscripts is already created as 999-blfs_bootscripts.
If a package requires a bootscript to be installed add the cmd to this
file and NOT in the package script. The gpm script is included as an
example of multiple patch files and the need for a blfs bootscript.
RUNNING:::
Although your scripts are added to the generated makefile they are not
automatically built. You must tell the makefile to build the tools with
the cmd
make mk_CUSTOM_TOOLS
:::FINAL COMMENT:::
This feature was added so users could build the packages necessary to access
the internet and was not intended to replace the BLFS install system.
#--------- GLIB example -----------
#
# Filename syntax xxx-PKG ie. 950-glibc
# Create a file in the custom/config directory
# Populate the file using the following script as an example
#
PKG="glib"
PKG_VERSION="1.2.10"
PKG_FILE="glib-1.2.10.tar.gz"
URL="http://gd.tuwien.ac.at/graphics/gimp/gtk/v1.2/${PKG_FILE}"
MD5="6fe30dad87c77b91b632def29dd69ef9"
# Patches are named PATCH[1..10]
# This information is used to download the patch only
# If you do not have the MD5SUM the download will proceed with a warning.
PATCH1="http://www.linuxfromscratch.org/patches/blfs/svn/glib-1.2.10-gcc34-1.patch 0077a1cce5e8a2231ac5a9b08c6263ba"
# NOTE::
# The convoluted scheme used to write out a temporary file is
# a work-around for embedded single and double quotes.
( cat << "xEOFx"
patch -Np1 -i ../glib-1.2.10-gcc34-1.patch &&
./configure --prefix=/usr &&
make
make install &&
chmod -v 755 /usr/lib/libgmodule-1.2.so.0.0.10
xEOFx
) > tmp
#--------- GPM example -----------
PKG="gpm"
PKG_VERSION="1.20.1"
PKG_FILE="gmp-1.20.1.tar.bz2"
URL="ftp://arcana.linux.it/pub/gpm/gpm-1.20.1.tar.bz2"
MD5="2c63e827d755527950d9d13fe3d87692"
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"
( cat << "xEOFx"
patch -Np1 -i ../gpm-1.20.1-segfault-1.patch &&
patch -Np1 -i ../gpm-1.20.1-silent-1.patch &&
./configure --prefix=/usr --sysconfdir=/etc &&
LDFLAGS="-lm" make
make install &&
cp -v conf/gpm-root.conf /etc &&
ldconfig
# The normal cmd to install the boot script for gpm
# --- PUT THIS CMD INSIDE 999-blfs_bootscripts
#make install-gpm
cat > /etc/sysconfig/mouse << "EOF"
# Begin /etc/sysconfig/mouse
MDEVICE="/dev/psaux"
PROTOCOL="imps2"
GPMOPTS=""
# End /etc/sysconfig/mouse
EOF
xEOFx
) > tmp

View file

@ -801,6 +801,10 @@ create_urls() { #
add_blfs_deps_urls
fi
if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
add_CustomToolsURLS
fi
}
#----------------------------# Hardcoded URLs and MD5.

100
common/custom_pkgs Normal file
View file

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

View file

@ -23,7 +23,7 @@ inline_doc
local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL PAGE TIMEZONE LANG LC_ALL LUSER LGROUP BLFS_TOOL"
local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TARGET32 TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL"
local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET OPTIMIZE REPORT STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL"
local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL"
local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL CUSTOM_TOOLS"
local -r blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR"
local -r blfs_tool_PARAM_LIST="BLFS_BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR DEP_LIBXML DEP_LIBXSLT DEP_TIDY DEP_UNZIP DEP_DBXML DEP_DBXSL DEP_LINKS DEP_SUDO DEP_WGET DEP_SVN DEP_GPM"
@ -110,6 +110,7 @@ inline_doc
TARGET | \
GRSECURITY_HOST | \
BLFS_TOOL | \
CUSTOM_TOOLS | \
TIMEZONE | \
PAGE) echo -e "`eval echo $PARAM_VALS`" ;;

16
custom/examples/950-bc Normal file
View file

@ -0,0 +1,16 @@
PKG="bc"
PKG_VERSION="1.06"
PKG_FILE="bc-1.06.tar.gz"
URL="http://ftp.gnu.org/gnu/bc/${PKG_FILE}"
MD5="d44b5dddebd8a7a7309aea6c36fda117"
( cat << "xEOFx"
sed -i '/PROTO.*readline/d' bc/scan.l &&
sed -i '/flex -I8/s/8//' configure &&
sed -i '/stdlib/a #include <string.h>' lib/number.c &&
sed -i 's/program.*save/static &/' bc/load.c &&
./configure --prefix=/usr --with-readline &&
make
make install
xEOFx
) > tmp

16
custom/examples/951-glib Normal file
View file

@ -0,0 +1,16 @@
PKG="glib"
PKG_VERSION="1.2.10"
PKG_FILE="glib-1.2.10.tar.gz"
URL="http://gd.tuwien.ac.at/graphics/gimp/gtk/v1.2/${PKG_FILE}"
MD5="6fe30dad87c77b91b632def29dd69ef9"
PATCH1="http://www.linuxfromscratch.org/patches/blfs/svn/glib-1.2.10-gcc34-1.patch 0077a1cce5e8a2231ac5a9b08c6263ba"
( cat << "xEOFx"
patch -Np1 -i ../glib-1.2.10-gcc34-1.patch &&
./configure --prefix=/usr &&
make
make install &&
chmod -v 755 /usr/lib/libgmodule-1.2.so.0.0.10
xEOFx
) > tmp

13
custom/examples/952-mc Normal file
View file

@ -0,0 +1,13 @@
PKG="mc"
PKG_VERSION="4.6.1"
PKG_FILE="mc-4.6.1.tar.gz"
URL="http://www.ibiblio.org/pub/Linux/utils/file/managers/mc/${PKG_FILE}"
MD5="18b20db6e40480a53bac2870c56fc3c4"
PATCH1=""
( cat << "xEOFx"
./configure --prefix=/usr &&
make
make install
xEOFx
) > tmp

38
custom/examples/953-gpm Normal file
View file

@ -0,0 +1,38 @@
PKG="gpm"
PKG_VERSION="1.20.1"
PKG_FILE="gpm-1.20.1.tar.bz2"
URL="ftp://arcana.linux.it/pub/gpm/${PKG_FILE}"
MD5="2c63e827d755527950d9d13fe3d87692"
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"
( cat << "xEOFx"
patch -Np1 -i ../gpm-1.20.1-segfault-1.patch &&
patch -Np1 -i ../gpm-1.20.1-silent-1.patch &&
./configure --prefix=/usr --sysconfdir=/etc &&
LDFLAGS="-lm" make
make install &&
cp -v conf/gpm-root.conf /etc &&
ldconfig
# The normal cmd to install the boot script for gpm
# --- PUT THIS CMD INSIDE 999-blfs_bootscripts
#make install-gpm
cat > /etc/sysconfig/mouse << "EOF"
# Begin /etc/sysconfig/mouse
MDEVICE="/dev/psaux"
PROTOCOL="imps2"
GPMOPTS=""
# End /etc/sysconfig/mouse
EOF
xEOFx
) > tmp

View file

@ -0,0 +1,17 @@
PKG="blfs-bootscripts"
PKG_VERSION="20060910"
PKG_FILE="blfs-bootscripts-${PKG_VERSION}.tar.bz2"
URL="http://www.linuxfromscratch.org/blfs/downloads/svn/${PKG_FILE}"
MD5="e1715c58dc694bf474c4468e6bade3ad"
PATCH1=""
( cat << "xEOFx"
#
# Insert ALL the blfs bootscripts you want to install
# EXAMPLE
#
make install-gpm
xEOFx
) > tmp

15
custom/template Normal file
View file

@ -0,0 +1,15 @@
#
# Any comments you wish to add
#
PKG=""
PKG_VERSION=""
PKG_FILE=""
URL=""
MD5=""
PATCH1=""
( cat << "xEOFx"
xEOFx
) > tmp

23
jhalfs
View file

@ -107,6 +107,7 @@ STRIP=${STRIP:=n}
REPORT=${REPORT:=n}
VIMLANG=${VIMLANG:-n}
GRSECURITY_HOST=${GRSECURITY_HOST:-n}
CUSTOM_TOOLS=${CUSTOM_TOOLS:-n}
# Book surces envars
BRANCH_ID=${BRANCH_ID:=development}
@ -260,6 +261,13 @@ source $COMMON_DIR/func_check_version.sh
source $COMMON_DIR/func_validate_configs.sh
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
[[ $VERBOSITY > 0 ]] && echo "OK"
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <custom_pkgs>..."
source $COMMON_DIR/custom_pkgs
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
[[ $VERBOSITY > 0 ]] && echo "OK"
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
@ -349,6 +357,16 @@ if [[ -n "$FILES" ]]; then
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
fi
fi
#
if [[ "$REPORT" = "y" ]]; then
cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/
@ -403,6 +421,11 @@ if [[ "${BLFS_TOOL}" = "y" ]] ; then
fi
build_Makefile
if [[ "${PROGNAME}" = "lfs" ]]; then
if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
add_CustomTools
fi
fi
echo "${SD_BORDER}${nl_}"
run_make