source: README.CUSTOM@ 7f25c70

ablfs-more trunk
Last change on this file since 7f25c70 was fd4a798, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Remove $Id$ comments, they are useless with git

  • Property mode set to 100644
File size: 9.7 KB
Line 
1 HOW TO ADD CUSTOM SCRIPTS TO THE JHALFS MAKEFILE
2
3
4 Normally JHALFS creates a Makefile containing only those scripts found in
5the {,B,C,H}LFS books. An automated construction tool cannot predict the
6needs of every individual and requests are made "Can you add xxxx package".
7Rather than adding numerous package scripts and switches for each request it
8was easier to add a tool for the user(s) to code their own package needs.
9
10 There are two areas that can be customized: how the base system is built
11and what additional configurations and packages your hardware requires to be
12able to boot and run. Each of those areas are handled in a different way.
13
14
15
16 BASE SYSTEM CUSTOMIZATION
17
18 There are two ways to alter how the base system will be built:
19
20 - Using a working copy of the book sources and editing the XML files.
21 This is the way used by book editors to test packages upgrades,
22 command changes, build order changes. etc.
23
24 This method requires you know very well the book sources and what
25 files need be edited. It will not be discussed here.
26
27 - Editing the generated build scripts to make any change you want.
28 This is the method discussed below.
29
30
31 EDITING THE BASE SCRIPTS
32
33 To begin with, the build scripts should be generated with book defaults. To
34do that, configure jhalfs activating any option you want included, but do not
35select "Run the Makefile" option.
36
37 Under the ${BUILD_DIR}/${SCRIPT_ROOT}/${PROGNAME}-commands directory
38(using the defaults values to do an LFS build, that directory name is
39/mnt/build_dir/jhalfs/lfs-commands) you will find the default build scripts.
40
41 If all you want is modify, add, or remove some command from a package
42installation, for example to change its ./configure line, just edit the related
43script. If changing or adding a patch, be sure to copy the new patch to the
44${BUILD_DIR}/sources directory. When done, run 'make' from inside the
45${BUILD_DIR}/${SCRIPT_ROOT} directory.
46
47
48 REPLACING OR INSERTING PACKAGES AND CHANGING BUILD ORDER
49
50 To remove a package from the system, just remove its script(s).
51
52 To change the version of some package, or to build a newer or older version
53than that in the book, edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to
54change its tarball name and place the new tarball in the ${BUILD_DIR}/sources
55directory.
56
57 To replace a package by an equivalent one, rename the replaced package script
58to reflect the new package name (for example, 102-man-db -> 102-man), edit the
59script to make the required commands changes, place the new tarball in the
60${BUILD_DIR}/sources directory, and edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list
61file to replace the removed package tarball name by the new package tarball
62name.
63
64 To change the build order, rename the scripts changing the first 3-digits
65string until they are sorted in the way you want.
66
67 To insert a new package, for example to build Cracklib in order to build
68Shadow with Cracklib support, you should first decide before what package it
69needs to be installed, in this example 107-shadow. Then create a new script
70containing the needed commands, using an existing one as template, and name it
71with the same 3-digits string used for that mentioned default package, but
72adding another 1-digit string. In our example, the new script to build Cracklib
73before Shadow will be named 107-1-cracklib. This naming scheme allows inserting
74up to 10 scripts before each of the existing scripts. Place the tarball for
75the new package and required patches, if any, in ${BUILD_DIR}/sources and edit
76${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to add the tarball name for that
77package.
78
79 When ready, launch again the jhalfs configuration interface. Make sure that
80exactly the same options are selected as when generating the default build
81scripts. Be sure that "Rebuild files" is unselected and select "Run the
82Makefile" if you want. Then select "Rebuild the Makefile". This will create a
83new Makefile based on the changes you made to the build scripts.
84
85
86 ADDING POST-SYSTEM BUILD CONFIGURATION FILES AND EXTRA PACKAGES
87
88 The installation of BLFS packages is handled via blfs-tool and activated
89when you select the appropriate menu option. See README and README.BLFS for
90more info.
91
92 The feature described below was added so users could install remaining
93configuration files, build the packages necessary to access the Internet
94or to support specific hardware, or to install basic utilities that are
95needed from the beginning, and was not intended to replace the BLFS
96install system.
97
98 LAYOUT
99 A new directory has been added to JHALFS tree which contains the
100configuration scripts and a few examples. A switch has been added to the
101configuration file which enables/disables the inclusion of custom scripts.
102
103 custom
104 /config <-- where to put your scripts.
105 /examples <-- a few example scripts
106 /examples_CLFS-E <-- example scripts for CLFS-Embedded
107 template <-- ALL scripts MUST look like this
108
109
110
111 NOTE::: You are responsible for including all dependencies and ensuring they
112 are built in the right order.
113
114 1. To add a package to the final JHALFS Makefile you must first create a file
115 in the custom/config directory.
116 **All config files MUST follow the naming convention, xxx-PKG, where xxx
117 is the order number and PKG is the name of the package. The file naming
118 format is important as it defines the build order. The example shown
119 below has an order number 950 and log files will list in alphabetical
120 order in the /logs directory after blfs-tools scripts.
121 The simplest method is to copy the template file into the config directory
122 and rename it.
123
124 2. Populate the variables with the necessary values.
125 Variable function is self explanatory. PATCH variables must be
126 numbered, starting at PATCH1 (up to PATCH10). If the md5 checksum value
127 is known, it can be added after the URL as in (quotes needed):
128 PATCH1="http://patch-host/patch-path xxxxxxx..."
129
130 3. Build commands
131 If the package you want to include is found in the BLFS
132 book then you only need to copy/paste the commands between the xEOFx
133 text, otherwise you will need to define the commands yourself.
134 NOTE::: This script you just created is not usable directly but contains
135 all the information necessary for jhalfs to create a build script
136 and an entry in the jhalfs Makefile.
137
138 4. As mentioned previously the build order is dictated by the 3 digit number
139 in the file name. If a package has dependencies it must be numerically
140 larger than the dependency files.
141 e.g. The package mc has glib as a dependency, so the build order is:
142 950-glib
143 951-mc
144
145 5. A config file for BLFS-bootscripts is already created as 999-blfs_bootscripts.
146 If a package requires a bootscript to be installed add the cmd to this
147 file and NOT in the package script. The gpm script is included as an
148 example of patch file and the need for a blfs bootscript.
149
150
151 EXAMPLES
152
153 Other examples can be found in custom/examples. They are dated and
154 unmaintained, but can be useful for creating your own scripts.
155
156 :::NOTICE:::
157 The following examples are for use with LFS and are not applicable to any
158of the CLFS-sysroot or CLFS-Embedded books. The directory examples_CLFS-E
159contains code extracted from Beyond CLFS-embedded. Any packages you chose to
160add should honour the DESTDIR=${CLFS} switch or equivalent.
161
162
163#--------- GLIB example -----------
164
165 #
166 # Filename syntax xxx-PKG ie. 950-glibc
167 # Create a file in the custom/config directory
168 # Populate the file using the following script as an example
169 #
170
171PKG="glib"
172PKG_VERSION="1.2.10"
173PKG_FILE="glib-1.2.10.tar.gz"
174URL="http://gd.tuwien.ac.at/graphics/gimp/gtk/v1.2/${PKG_FILE}"
175MD5="6fe30dad87c77b91b632def29dd69ef9"
176
177 # The following code removes previously defined PATCHx variables
178for i in PATCH{1..10}; do
179 unset $i
180done
181 # Patches are named PATCH[1..10]
182 # This information is used to download the patch only
183PATCH1="http://www.linuxfromscratch.org/patches/blfs/svn/glib-1.2.10-gcc34-1.patch 0077a1cce5e8a2231ac5a9b08c6263ba"
184
185
186 # NOTE::
187 # The convoluted scheme used to write out a temporary file is
188 # a work-around for embedded single and double quotes.
189
190( cat << "xEOFx"
191
192patch -Np1 -i ../glib-1.2.10-gcc34-1.patch &&
193./configure --prefix=/usr &&
194make
195make install &&
196chmod -v 755 /usr/lib/libgmodule-1.2.so.0.0.10
197
198xEOFx
199) > tmp
200
201
202#--------- GPM example -----------
203
204
205PKG="gpm"
206PKG_VERSION="1.20.1"
207PKG_FILE="gpm-1.20.1.tar.bz2"
208URL="ftp://arcana.linux.it/pub/gpm/gpm-1.20.1.tar.bz2"
209MD5="2c63e827d755527950d9d13fe3d87692"
210for i in PATCH{1..10}; do
211 unset $i
212done
213PATCH1=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-segfault-1.patch"
214PATCH2=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-silent-1.patch"
215
216
217( cat << "xEOFx"
218
219patch -Np1 -i ../gpm-1.20.1-segfault-1.patch &&
220patch -Np1 -i ../gpm-1.20.1-silent-1.patch &&
221./configure --prefix=/usr --sysconfdir=/etc &&
222LDFLAGS="-lm" make
223
224make install &&
225cp -v conf/gpm-root.conf /etc &&
226ldconfig
227
228# The normal cmd to install the boot script for gpm
229# --- PUT THIS CMD INSIDE 999-blfs_bootscripts
230#make install-gpm
231
232cat > /etc/sysconfig/mouse << "EOF"
233# Begin /etc/sysconfig/mouse
234
235MDEVICE="/dev/psaux"
236PROTOCOL="imps2"
237GPMOPTS=""
238
239# End /etc/sysconfig/mouse
240EOF
241
242xEOFx
243) > tmp
244
245
246#--------- CMDS ONLY example -----------
247 # This is an example of a self contained cmd script
248 # There are no referenced to a package or package dir.
249 # This method is useful for creating user files/profiles/etc
250 # at build time.
251
252
253PKG=""
254PKG_VERSION=""
255PKG_FILE=""
256URL=""
257MD5=""
258for i in PATCH{1..10}; do
259 unset $i
260done
261PATCH1=""
262
263
264( cat << "xEOFx"
265
266echo "JUST A USELESS TRACE"
267
268xEOFx
269) > tmp
Note: See TracBrowser for help on using the repository browser.