266 lines
9.5 KiB
Text
266 lines
9.5 KiB
Text
#
|
|
# $Id$
|
|
#
|
|
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.
|
|
|
|
There are two areas that can be customized: how the base system is built
|
|
and what additional configurations and packages your hardware requires to be
|
|
able to boot and run. Each of those areas are handled in a different way.
|
|
|
|
|
|
|
|
BASE SYSTEM CUSTOMIZATION
|
|
|
|
There are 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 want.
|
|
This is the method discussed below.
|
|
|
|
|
|
EDITING THE BASE SCRIPTS
|
|
|
|
To begin with, the build scripts should be generated with book defaults. To
|
|
do that, configure jhalfs activating any option you want included, but do not
|
|
select "Run the Makefile" option.
|
|
|
|
Under the ${BUILD_DIR}/${SCRIPT_ROOT}/${PROGNAME}-commands directory
|
|
(using the defaults values to do an LFS build, that directory name is
|
|
/mnt/build_dir/jhalfs/lfs-commands) you will find the default build scripts.
|
|
|
|
If all you want is modify, add, or remove some command from a package
|
|
installation, for example to change its ./configure line, just edit the related
|
|
script. If changing or adding a patch, be sure to copy the new patch to the
|
|
${BUILD_DIR}/sources directory. When done, run 'make' from inside the
|
|
${BUILD_DIR}/${SCRIPT_ROOT} directory.
|
|
|
|
|
|
REPLACING OR INSERTING PACKAGES AND CHANGING BUILD ORDER
|
|
|
|
To remove a package from the system, just remove its script(s).
|
|
|
|
To change the version of some package, or to build a newer or older version
|
|
than that in the book, edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to
|
|
change its tarball name and place the new tarball in the ${BUILD_DIR}/sources
|
|
directory.
|
|
|
|
To replace a package by an equivalent one, rename the replaced package script
|
|
to reflect the new package name (for example, 102-man-db -> 102-man), edit the
|
|
script to made the required commands changes, place the new tarball in the
|
|
${BUILD_DIR}/sources directory, and edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list
|
|
file to replace the removed package tarball name by the new package tarball
|
|
name.
|
|
|
|
To change the build order, rename the scripts changing the first 3-digits
|
|
string until they are sorted in the way you want.
|
|
|
|
To insert a new package, for example to build Cracklib in order to build
|
|
Shadow with Cracklib support, you should first decide before what package it
|
|
needs to be installed, in this example 107-shadow. Then create a new script
|
|
containing the needed commands, using an existing one as template, and name it
|
|
with the same 3-digits string used for that mentioned default package, but
|
|
adding another 1-digit string. In our example, the new script to build Cracklib
|
|
before Shadow will be named 107-1-cracklib. This naming scheme allows inserting
|
|
up to 10 scripts before each of the existing scripts. Place the tarball for
|
|
the new package and required patches, if any, in ${BUILD_DIR}/sources and edit
|
|
${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to add the tarball name for that
|
|
package.
|
|
|
|
When ready, launch again the jhalfs configuration interface. Make sure that
|
|
exactly the same options are selected as when generating the default build
|
|
scripts. Be sure that "Rebuild files" is unselected and select "Run the
|
|
Makefile" if you want. Then select "Rebuild the Makefile". This will create a
|
|
new Makefile based on the changes you made to the build scripts.
|
|
|
|
|
|
ADDING POST-SYSTEM BUILD CONFIGURATION FILES AND EXTRA PACKAGES
|
|
|
|
The installation of BLFS packages is handled via blfs-tool and activated
|
|
when you select the appropriate menu option. See README and README.BLFS for
|
|
more info.
|
|
|
|
The feature described below was added so users could install remaining
|
|
configuration files, build the packages necessary to access the Internet
|
|
or to support specific hardware, or to install basic utilities that are
|
|
needed from the beginning, and was not intended to replace the BLFS
|
|
install system.
|
|
|
|
:::NOTICE:::
|
|
The following examples are for use with LFS and are not applicable to any
|
|
of the CLFS-sysroot or CLFS-Embedded books. The directory examples_CLFS-E
|
|
contains code extracted from Beyond CLFS-embedded. Any packages you chose to
|
|
add should honour the DESTDIR=${CLFS} switch or equivalent.
|
|
|
|
|
|
LAYOUT
|
|
A new directory has been added to JHALFS tree which contains the
|
|
configuration scripts and a few examples. A switch has been added to the
|
|
configuration file which enables/disables the inclusion of custom scripts.
|
|
|
|
custom
|
|
/config <-- where to put your scripts.
|
|
/examples <-- a few example scripts
|
|
/examples_CLFS-E <-- example scripts for CLFS-Embedded
|
|
template <-- ALL scripts MUST look like this
|
|
|
|
|
|
|
|
NOTE::: You are responsible for including all dependencies and ensuring they
|
|
are built in the right 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 explanatory 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.
|
|
i.e. 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.
|
|
|
|
|
|
#--------- 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"
|
|
|
|
# The following code removes previously defined PATCHx variables
|
|
for i in PATCH{1..10}; do
|
|
unset $i
|
|
done
|
|
# 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="gpm-1.20.1.tar.bz2"
|
|
URL="ftp://arcana.linux.it/pub/gpm/gpm-1.20.1.tar.bz2"
|
|
MD5="2c63e827d755527950d9d13fe3d87692"
|
|
for i in PATCH{1..10}; do
|
|
unset $i
|
|
done
|
|
# MD5SUM is not absolutely necessary but JHALFS whines and complains
|
|
# Add the MD5SUM if you can
|
|
PATCH1=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-segfault-1.patch"
|
|
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
|
|
|
|
|
|
#--------- CMDS ONLY example -----------
|
|
# This is an example of a self contained cmd script
|
|
# There are no referenced to a package or package dir.
|
|
# This method is useful for creating user files/profiles/etc
|
|
# at build time.
|
|
|
|
|
|
PKG=""
|
|
PKG_VERSION=""
|
|
PKG_FILE=""
|
|
URL=""
|
|
MD5=""
|
|
for i in PATCH{1..10}; do
|
|
unset $i
|
|
done
|
|
PATCH1=""
|
|
|
|
|
|
( cat << "xEOFx"
|
|
|
|
echo "JUST A USELESS TRACE"
|
|
|
|
xEOFx
|
|
) > tmp
|
|
|