4 HOW TO ADD CUSTOM SCRIPTS TO THE JHALFS MAKEFILE
7 Normally JHALFS creates a Makefile containing only those scripts found in
8 the {,B,C,H}LFS books. An automated construction tool cannot predict the
9 needs of every individual and requests are made "Can you add xxxx package".
10 Rather than adding numerous package scripts and switches for each request it
11 was easier to add a tool for the user(s) to code their own package needs.
13 There are two areas that can be customized: how the base system is built
14 and what additional configurations and packages your hardware requires to be
15 able to boot and run. Each of those areas are handled in a different way.
19 BASE SYSTEM CUSTOMIZATION
21 There are two ways to alter how the base system will be built:
23 - Using a working copy of the book sources and editing the XML files.
24 This is the way used by book editors to test packages upgrades,
25 command changes, build order changes. etc.
27 This method requires you know very well the book sources and what
28 files need be edited. It will not be discussed here.
30 - Editing the generated build scripts to make any change you want.
31 This is the method discussed below.
34 EDITING THE BASE SCRIPTS
36 To begin with, the build scripts should be generated with book defaults. To
37 do that, configure jhalfs activating any option you want included, but do not
38 select "Run the Makefile" option.
40 Under the ${BUILD_DIR}/${SCRIPT_ROOT}/${PROGNAME}-commands directory
41 (using the defaults values to do an LFS build, that directory name is
42 /mnt/build_dir/jhalfs/lfs-commands) you will find the default build scripts.
44 If all you want is modify, add, or remove some command from a package
45 installation, for example to change its ./configure line, just edit the related
46 script. If changing or adding a patch, be sure to copy the new patch to the
47 ${BUILD_DIR}/sources directory. When done, run 'make' from inside the
48 ${BUILD_DIR}/${SCRIPT_ROOT} directory.
51 REPLACING OR INSERTING PACKAGES AND CHANGING BUILD ORDER
53 To remove a package from the system, just remove its script(s).
55 To change the version of some package, or to build a newer or older version
56 than that in the book, edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to
57 change its tarball name and place the new tarball in the ${BUILD_DIR}/sources
60 To replace a package by an equivalent one, rename the replaced package script
61 to reflect the new package name (for example, 102-man-db -> 102-man), edit the
62 script to made the required commands changes, place the new tarball in the
63 ${BUILD_DIR}/sources directory, and edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list
64 file to replace the removed package tarball name by the new package tarball
67 To change the build order, rename the scripts changing the first 3-digits
68 string until they are sorted in the way you want.
70 To insert a new package, for example to build Cracklib in order to build
71 Shadow with Cracklib support, you should first decide before what package it
72 needs to be installed, in this example 107-shadow. Then create a new script
73 containing the needed commands, using an existing one as template, and name it
74 with the same 3-digits string used for that mentioned default package, but
75 adding another 1-digit string. In our example, the new script to build Cracklib
76 before Shadow will be named 107-1-cracklib. This naming scheme allows inserting
77 up to 10 scripts before each of the existing scripts. Place the tarball for
78 the new package and required patches, if any, in ${BUILD_DIR}/sources and edit
79 ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to add the tarball name for that
82 When ready, launch again the jhalfs configuration interface. Make sure that
83 exactly the same options are selected as when generating the default build
84 scripts. Be sure that "Rebuild files" is unselected and select "Run the
85 Makefile" if you want. Then select "Rebuild the Makefile". This will create a
86 new Makefile based on the changes you made to the build scripts.
89 ADDING POST-SYSTEM BUILD CONFIGURATION FILES AND EXTRA PACKAGES
91 The installation of BLFS packages is handled via blfs-tool and activated
92 when you select the appropriate menu option. See README and README.BLFS for
95 The feature described below was added so users could install remaining
96 configuration files, build the packages necessary to access the Internet
97 or to support specific hardware, or to install basic utilities that are
98 needed from the beginning, and was not intended to replace the BLFS
102 The following examples are for use with LFS and are not applicable to any
103 of the CLFS-sysroot or CLFS-Embedded books. The directory examples_CLFS-E
104 contains code extracted from Beyond CLFS-embedded. Any packages you chose to
105 add should honour the DESTDIR=${CLFS} switch or equivalent.
109 A new directory has been added to JHALFS tree which contains the
110 configuration scripts and a few examples. A switch has been added to the
111 configuration file which enables/disables the inclusion of custom scripts.
114 /config <-- where to put your scripts.
115 /examples <-- a few example scripts
116 /examples_CLFS-E <-- example scripts for CLFS-Embedded
117 template <-- ALL scripts MUST look like this
121 NOTE::: You are responsible for including all dependencies and ensuring they
122 are built in the right order.
124 1. To add a package to the final JHALFS Makefile you must first create a file
125 in the custom/config directory.
126 **All config files MUST follow the naming convention, xxx-PKG, where xxx
127 is the order number and PKG is the name of the package. The file naming
128 format is important as it defines the build order. The example shown
129 below has an order number 950 and log files will list in alphabetical
130 order in the /logs directory after blfs-tools scripts.
131 The simplest method is to copy the template file into the config directory
134 2. Populate the variables with the necessary values.
135 Variable function is self explanatory except for the inclusion of the
136 build cmds. If the package you want to include is found in the BLFS
137 book then you only need to copy/paste the cmd strings between the xEOFx
138 pairs, otherwise you will need to define the build cmds yourself.
139 NOTE::: This script you just created is not usable directly but contains
140 all the information necessary for jhalfs to create a build script
141 and an entry in the jhalfs Makefile.
143 3. As mentioned previously the build order is dictated by the 3 digit number
144 in the file name. If a package has dependencies it must be numerically
145 larger than the dependency files.
146 i.e. The package mc has glib as a dependency and build order is
150 4. A config file for BLFS-bootscripts is already created as 999-blfs_bootscripts.
151 If a package requires a bootscript to be installed add the cmd to this
152 file and NOT in the package script. The gpm script is included as an
153 example of multiple patch files and the need for a blfs bootscript.
156 #--------- GLIB example -----------
159 # Filename syntax xxx-PKG ie. 950-glibc
160 # Create a file in the custom/config directory
161 # Populate the file using the following script as an example
166 PKG_FILE="glib-1.2.10.tar.gz"
167 URL="http://gd.tuwien.ac.at/graphics/gimp/gtk/v1.2/${PKG_FILE}"
168 MD5="6fe30dad87c77b91b632def29dd69ef9"
170 # The following code removes previously defined PATCHx variables
171 for i in PATCH{1..10}; do
174 # Patches are named PATCH[1..10]
175 # This information is used to download the patch only
176 # If you do not have the MD5SUM the download will proceed with a warning.
177 PATCH1="http://www.linuxfromscratch.org/patches/blfs/svn/glib-1.2.10-gcc34-1.patch 0077a1cce5e8a2231ac5a9b08c6263ba"
181 # The convoluted scheme used to write out a temporary file is
182 # a work-around for embedded single and double quotes.
186 patch -Np1 -i ../glib-1.2.10-gcc34-1.patch &&
187 ./configure --prefix=/usr &&
190 chmod -v 755 /usr/lib/libgmodule-1.2.so.0.0.10
196 #--------- GPM example -----------
201 PKG_FILE="gpm-1.20.1.tar.bz2"
202 URL="ftp://arcana.linux.it/pub/gpm/gpm-1.20.1.tar.bz2"
203 MD5="2c63e827d755527950d9d13fe3d87692"
204 for i in PATCH{1..10}; do
207 # MD5SUM is not absolutely necessary but JHALFS whines and complains
208 # Add the MD5SUM if you can
209 PATCH1=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-segfault-1.patch"
210 PATCH2=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-silent-1.patch"
215 patch -Np1 -i ../gpm-1.20.1-segfault-1.patch &&
216 patch -Np1 -i ../gpm-1.20.1-silent-1.patch &&
217 ./configure --prefix=/usr --sysconfdir=/etc &&
221 cp -v conf/gpm-root.conf /etc &&
224 # The normal cmd to install the boot script for gpm
225 # --- PUT THIS CMD INSIDE 999-blfs_bootscripts
228 cat > /etc/sysconfig/mouse << "EOF"
229 # Begin /etc/sysconfig/mouse
235 # End /etc/sysconfig/mouse
242 #--------- CMDS ONLY example -----------
243 # This is an example of a self contained cmd script
244 # There are no referenced to a package or package dir.
245 # This method is useful for creating user files/profiles/etc
254 for i in PATCH{1..10}; do
262 echo "JUST A USELESS TRACE"