source: README.BLFS@ 4c36783

ablfs-more trunk
Last change on this file since 4c36783 was 0495e57e, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Update README.BLFS for envars.conf removal

And try to clarify... Also remove references to books other than
LFS.

  • Property mode set to 100644
File size: 18.5 KB
Line 
11. INTRODUCTION::
2
3 To automate package builds from the BLFS book instructions is a huge
4 task. Some of the issues are: the BLFS book isn't linear; some package
5 pages use a custom layout; there are circular dependencies; several
6 packages can be installed on a non-default prefix; build commands can
7 change based on what dependencies will be used, etc.
8
9 That being said, the goal of the blfs-tool is to help you solve package
10 dependencies, create build scripts and a Makefile. Not all the auto-generated
11 build scripts and Makefile will work "as is", thus, as a general rule,
12 you will need to review and edit the scripts while reading the book.
13
14 The blfs tools allow also to update packages from the LFS book. LFS
15 packages which may be updated appear in the menu interface. When selected,
16 their scriptlet is generated in the same manner as for BLFS packages.
17 (TODO: presently, when an LFS package needs a patch, you'll have to
18 donwload it manually to your $SRC_ARCHIVE directory (usually /sources)).
19
202. PREREQUISITES::
21
22 In addition to a full LFS system, the following packages and their
23 dependencies are needed by this tool:
24 - required: libxml2, libxslt, DocBook XML DTD
25 - recommended: wget (to download the package tarballs) and sudo (to build
26 as a user)
27 - optional: lynx (allows to read the generated linearized book), GPM (to
28 cut and paste commands from the book), git (to update the book
29 sources)
30 Note that the optional dependencies are recommended for ease of use of the
31 tool.
32
33 You should also have the following personal skills:
34 - Ability to write and debug shell scripts: as said in the introduction,
35 not all the generated scripts can be used directly. They need to be
36 edited to produce an error free build.
37 - Ability to debug build failures, like missing dependencies or
38 installation directories not known to the system (when you install in
39 /opt for example).
40 - Ability to choose the tools you need to configure and administrate
41 your system: in the BLFS book, nothing is mandatory, nothing is
42 useless. You are on your own in choosing what to build, but wrong
43 decisions may lead to a non functional system...
44
453. INSTALL::
46
47 There are two ways to install the BLFS tools on an LFS system, described
48 in paragraphs 3.1 and 3.2, respectively:
49
50 3.1 INSTALLATION ON A RUNNING SYSTEM
51
52 Select "Use Book --> Beyond Linux From Scratch" in the jhalfs menu:
53 The tools are installed in $HOME$BLFS_ROOT (the default for $BLFS_ROOT
54 is /blfs_root). The BLFS book is downloaded or copied to its directory.
55 The tracking directory (see below) is created (if it does not already
56 exist) and initialized. Before running "make", you should ensure the
57 tracking directory (default location /var/lib/jhalfs/BLFS) can be:
58 - either created by the user running "make", if it does not exist
59 - or that it is writable by the user running "make", if it exists.
60
61 After the intallation, you should perform the following additional steps:
62 - Configure sudo, adding the needed privileges for the user.
63 - Although it is not strictly necessary, it is recommended to install
64 the bash shell startup files (as per `3. After LFS Configuration
65 Issues' of the BLFS book), as some instructions in BLFS rely on
66 their being present.
67 - At this point, the tool has no way to know which versions of LFS packages
68 are installed, so that the menu interface will show all the LFS packages,
69 as if they were not installed. If you have a released version of LFS, or
70 the date of your GIT version of LFS is known, you should run the
71 update-lfs.sh script. If you have updated some
72 LFS packages since first installation, or have been using a custom
73 working copy of the LFS book, the only (tedious) way is to create
74 empty files with names <package>-<installed-version> in the tracking
75 directory, and run the tool.
76
77 - If you have also installed some BLFS packages, they are not in the
78 tracking file. The only way is to create empty files with names
79 <package>-<installed-version> in the tracking directory, and run the tool.
80
81 3.2 INSTALLATION ON A JUST BUILT LFS SYSTEM
82
83 For books that support it (only LFS),
84 there is an option to install the BLFS tools right after building
85 the LFS system: just tick `BOOK Settings/Add blfs-tool support' in
86 jhalfs configuration menu. The tools are installed in $BLFS_ROOT
87 (default /blfs_root) on the LFS system, and the dependencies are built
88 at the end of the jhalfs run, before the custom tools.
89
90 After booting the new LFS system some steps are needed to finish
91 the installation of the automated tools:
92
93 - A user account must be created. You must be logged on that user
94 account to use blfs-tool. This is not strictly necessary,
95 since the packages can be built as root, too, but it is
96 never a good idea to build packages as root.
97
98 - Move /blfs-root to that user's home and change ownership of the
99 directory and files to the user.
100
101 - Give the user read and write privileges over the $TRACKING_DIR
102 directory and the files that it contains.
103
104 - Configure sudo and add the bash shell startup files, as described
105 above
106
107 - Note that the versions of LFS packages are automatically known to
108 the tool in this case, and there is no need to run the update-lfs.sh
109 script.
110
111 We assume that the BLFS tools will be used on a booted LFS system.
112 Using them to build BLFS packages in a chroot jail is also possible,
113 but not supported.
114
115 3.3 DIRECTORY LAYOUT IN THE $BLFS_ROOT DIRECTORY
116
117 blfs-xml/* GIT tree of the selected BLFS book version
118 lfs-xml/* GIT tree of the selected LFS book version
119 lib/constants.inc functions libraries
120 /func_dependencies for building the dependency tree
121 menu/* menuconfig source code
122 xsl/gen_pkg_list.xsl XSL stylesheet to generate the package database
123 /gen_config.xsl XSL stylesheet to generate the Config.in file
124 for use in the menuconfig system
125 /dependencies.xsl XSL stylesheet to generate the dependency list
126 of a package
127 /make_book.xsl XSL stylesheet to generate the linear book.xml
128 /lfs_make_book.xsl XSL stylesheet to incoporate LFS pages into the
129 linear book.xml
130 /scripts.xsl XSL stylesheet to generate the scriptlets from
131 book.xml
132 /bump.xsl XSL stylesheet to update the tracking file
133 /process-install.xsl XSL stylesheet included by scripts.xsl, for
134 outputting cleanly install instructions
135 /process-replaceable.xsl XSL stylesheet included by scripts.xsl, for
136 generating correct instructions when a
137 <replaceable> tag is encountered.
138 README.BLFS this file
139 TODO developers notes (well, not updated often)
140 gen_pkg_book.sh resolves dependencies, generates a linear BLFS
141 book, and finally generates build scripts
142 gen-makefile.sh generates the target Makefile
143 progress_bar.sh the target Makefile progress bar
144 gen-special.sh Helper script for generating the package
145 database
146 Makefile Used by make to update the package database
147 from the GIT tree, then launch the menuconfig
148 interface, and run gen_pkg_book.sh based on
149 configuration settings
150 packdesc.dtd a simple DTD describing the format of the
151 package database and the tracking file.
152
153 Working files: several files are generated when first running the tool:
154
155 packages.xml auto-generated package database
156 Config.in input file for the menu driven choices
157 configuration file generated by the menuconfig process
158 dependencies/* files recording the dependency tree
159 book.xml the linearized book
160 book-html/* the linearized book rendered in html
161 scripts/* the scriptlets
162
163 3.4 INSTALLED PACKAGES TRACKING SYSTEM:
164
165 This tool includes a very simple tracking system to log which packages
166 have been installed using the tool. It is used to skip installed packages
167 from target selection menu and to test if an installed package has been
168 updated in the BLFS book. Do not rely on this feature as a package
169 management tool.
170
171 The tracking system itself is an XML file: instpkg.xml. It is
172 initialized when <make> is first run in blfs_root. It resides in a
173 directory, which is created when needed during the process of building
174 custom tools or blfs dependencies, right after LFS. You can specify
175 that directory location in the blfs-tools sub-menu of jhalfs. You may
176 need to update permissions and/or ownership of this directory before
177 using the blfs tool (see README in jhalfs).
178
179 The default location of the tracking directory is /var/lib/jhalfs/BLFS.
180 NB : after the initial build, that directory is only used to contain
181 instpkg.xml, unless custom tools have been built. In the latter case,
182 it also contains empty files whose name are "$PKG-$VERSION" for each
183 versionned package built. The information about those packages is
184 included into instpkg.xml the next time the tool is run.
185
1864. USAGE::
187
188 From now on, all the work must be done from inside the installation
189 root directory.
190
191 Due to the complexity of the BLFS book, the scripts and Makefile
192 generation is done in several steps:
193
194 4.1 UPDATING BOOK SOURCES::
195
196 If you are using the development book version and you want to update
197 installed packages to the latest version found in that book, you need to
198 update the XML sources and packages database. To do that, run
199 "make update". This is not necessary if you just built LFS, and you
200 can skip to step 4.2.
201
202 On the next configuration run, packages already installed but listed
203 with a new version in the book will be available for target selection
204 and used to solve dependencies.
205
206 4.2 CONFIGURING AND PARSING THE BOOK::
207
208 The next step is to create a book and build scripts in dependency
209 build order for one or several packages.
210
211 Run <make> to launch the configuration interface. The main menu contains
212 four blocks: individual package selection, Build settings, Build layout,
213 and Optimization.
214
215 In the package selection block, menus and submenus are organized
216 as the book's parts, chapters and sections. You can navigate those menus
217 and select as many targets as you want. But we suggest to not select
218 too many at a time to be able to sort issues!
219
220 In the "Build settings" submenu, the dependency level and default
221 packages used to solve alternatives are set (currently, only for the MTA).
222 You can also select whether the build will be made as a normal user or as
223 root, whether to use "porg style" package management, whether to remove
224 ".la" files, and wheter statistics for the package are generated (build
225 time, memory footprint and "DESTDIR" install). If you use package
226 management, you have to enter the path to the packInstall.sh script too.
227
228 In the "Build layout" submenu, you can select where the source tarballs
229 reside and are downloaded, where the packages are built, and whether to
230 keep the build tree after installation.
231
232 In the "Optimization" submenu, you can select the number of parallel
233 jobs, and set the usual CFLAGS, CXXFLAGS, and LDFLAGS. the special
234 keyword "EMPTY" can be used for those flags to ensure they are unset.
235
236 Note that there are help strings associated to those menus. Please
237 read them for details!
238
239 Those settings are saved to be reused in future configuration runs.
240
241 When you are done with the menu, a few checks occur, and the dependency
242 chain is generated. Each dependency appears with its priority (required,
243 recommended, optional, or external), and it's level. There is a root level
244 1. The selected packages have level 2. The dependencies of selected packages
245 have level 3, the dependencies of the dependencies have level 4, and so on.
246 When circular dependencies are found, they appear with a priority of
247 "circular". This means that two (or more) dependency chains arrive at the
248 same package. The algorithm chooses the chain with the highest priority and
249 reorders dependencies to remove the other chain(s). This is not always the
250 solution an user would prefer, but we have found no way to do it better.
251
252 You end up with a book.xml file which contains the linearized book,
253 and a rendered HTML, in the directory book-html, which you can browse with
254 "lynx book-html/index.html" (or with any other browser).
255
256 Furthermore, there is a directory "scripts", which contains the generated
257 scriptlets.
258
259 There is yet another directory, "dependencies" that contains files
260 generated while resolving dependencies.
261
262 4.3 EDITING BUILD SCRIPTS::
263
264 Now it is time to review the generated book and scripts, making any
265 changes to the scripts necessary to fix generation bugs or to suit your
266 needs.
267
268 Scripts for additional packages (i.e., for non-BLFS packages) can be
269 easily inserted. For example, if you want to install the external dependency
270 "bar" before "foo" package and the "foo" script is named "064-z-foo", you
271 just need to create a "064-y-bar" build script.
272
273 Remember, the package tracking system isn't a package management tool
274 and knows nothing about packages not in the BLFS book.
275
276 4.4 CREATING THE MAKEFILE::
277
278 When the build scripts are ready to be run, the Makefile can be
279 created. Create an empty subdirectory (for example "mkdir work") and cd
280 to that directory. Then run ../gen-makefile.sh. Note that the directory
281 is completely emptied before generating the Makefile, so to prevent
282 erasing useful data, the script ensures that the name of the current
283 working directory starts with "work".
284
285 Review the Makefile, and, if all looks sane, start the build by running
286 "make".
287
2885. GENERATED BUILD SCRIPTS ISSUES::
289
290 In this section, known issues with the generated build scripts are
291 discussed. They are due to build procedures and/or BLFS layout
292 particularities that we can't handle. In several cases, editing the
293 build scripts is mandatory.
294 You may also need to insert some build scripts created by you to resolve
295 unhandled dependencies and/or to remove some script installing an unneeded
296 package (unneeded packages may be pulled in the dependency chain, if
297 they occur as an "or" with another package).
298 When there are circular dependencies (only one known in BLFS 8.0 for
299 recommended dependencies), you may need to move around scripts so that they
300 run in the order script-A script-B script-A. This involves copying script-A
301 to another name (using the xxx-a- fields), and possibly renaming the xxx-a-
302 fields of each involved script.
303
304 5.1 BLFS BOOTSCRIPTS::
305
306 Normally, bootscript installation should work. On the other hand, the
307 book does not give instruction for running them, so you might have to
308 manually insert "/etc/init.d/rc.d/<initscript> start" at some place during
309 the build.
310
311 5.2 PACKAGE CONFIGURATION::
312
313 For those packages that have a "Configuration" section, you should
314 edit the build script to fit the needs of your system. Sometimes, the
315 bash startup files are modified. The generated scripts contain a
316 line 'source /etc/profile', which ensures that the proper environment
317 variables are used.
318
319 5.3 PAGES WITH TWO OR MORE PACKAGES::
320
321 For example: sane, poppler, audacious, freetts, which, etc.
322
323 On the pages for those packages, the BLFS book actually has instructions
324 to download and install two or more packages. You must edit the scripts to
325 fix this. A common pitfall is that the variable PACKAGE may be used for
326 several tarballs. Be sure to save the PACKAGE variable to some other
327 name (for example PKG1, PKG2, etc) after each download. The unpacking
328 instructions may need to be repeated for each tarball in turn.
329
330 5.4 XORG7
331
332 The book has special page layouts for the Xorg7 packages. The tool
333 breaks those pages into individual pages for each packages in the linear
334 book. Also, the menu gives the choice to select each package individually.
335
336 To build the whole Xorg7 chapter, select xinit. The (recommended)
337 dependency chain brings in the whole set of Xorg packages.
338
339 5.5 PATCHES
340
341 Please, make sure that all scripts have the commands to download/apply
342 the required patches. Due to book layout issues, some patches may be
343 missing (as of BLFS 8.0, all the patches seem to be downloaded).
344
345 5.6 ROOT COMMANDS
346
347 If building as a normal user (the default setting), be sure that all
348 commands that require root privileges are run using sudo. Also make sure
349 necessary root privilege commands are visible in your PATH. The scripts
350 ensure that /usr/sbin is appended to the user's PATH when running
351 privileged commands.
352
353 For commands necessitating root privileges, the generated scripts wrap
354 them with the construct:
355 sudo -E sh -e << ROOT_EOF
356 <commands to be executed as root with `$', ``', and `\' escaped>
357 ROOT_EOF
358 The "-e" switch to sh ensures the command block exits with error if an
359 error occurs. The "-E" switch to sudo ensures the whole environment is
360 passed to the commands to be run with root privileges. It is effective
361 only if the /etc/sudoers file contains `Defaults setenv', or SETENV in
362 the user attributes (this is implicit if the command the user is allowed
363 to run is `ALL'). If you think it is a security issue, you may forbid
364 this flag in /etc/sudoers, but then, you have to un-escape `$' for
365 variables coming from the environment in the instructions. Although this
366 construct is rather strong, it can fail in some corner cases, so
367 carefully review those instructions.
368
369 Due to book layout issues, some sudo commands may be missing.
370
371 5.7 OTHERS
372
373 There may be other issues that we are not aware of. If you find
374 any, please report it to <alfs-discuss@linuxfromscratch.org>.
375
Note: See TracBrowser for help on using the repository browser.