[824b6e4] | 1 | $Id$
|
---|
| 2 |
|
---|
| 3 | 1. INTRODUCTION::
|
---|
| 4 |
|
---|
[e576789] | 5 | If you want to add blfs-tool support into an xLFS base system build,
|
---|
[83ace0a] | 6 | read the "BLFS_TOOL SUPPORT" section found in the README and be sure
|
---|
| 7 | to follow the after-booting installation intructions.
|
---|
[d262d17] | 8 |
|
---|
[392bd25] | 9 | To automate package builds from the BLFS book instructions is a huge
|
---|
| 10 | task. Some of the issues are: the BLFS book isn't linear; some package
|
---|
| 11 | pages use a custom layout; there are circular dependencies; several
|
---|
| 12 | packages can be installed on a non-default prefix; build commands can
|
---|
| 13 | change based on what dependencies will be used, etc.
|
---|
[824b6e4] | 14 |
|
---|
[392bd25] | 15 | That being said, the goal of the blfs-tool is to help you solve package
|
---|
[e576789] | 16 | dependencies, create build scripts and a Makefile. Not all the auto-generated
|
---|
[392bd25] | 17 | build scripts and Makefile will work "as is", thus, as a general rule,
|
---|
| 18 | you will need to review and edit the scripts while reading the book.
|
---|
[824b6e4] | 19 |
|
---|
| 20 |
|
---|
[f4ed135] | 21 | 2. PREREQUISITES::
|
---|
| 22 |
|
---|
[392bd25] | 23 | To use this tool you MUST:
|
---|
[f4ed135] | 24 |
|
---|
| 25 | - have experience building BLFS packages
|
---|
| 26 | - know how to edit and write shell scripts
|
---|
| 27 | - know how a Makefile works
|
---|
| 28 | - be able to trace build failures and to find what is causing it
|
---|
| 29 | (user error, package bug, BLFS command bug, or jhalfs code bug)
|
---|
| 30 |
|
---|
[a54e1f1] | 31 | If you do not have the above skills, please don't use this tool.
|
---|
[f4ed135] | 32 |
|
---|
| 33 |
|
---|
| 34 | 3. USAGE::
|
---|
[824b6e4] | 35 |
|
---|
[e576789] | 36 | Due to the complexity of the BLFS book, the scripts and Makefile
|
---|
| 37 | generation is done in several steps:
|
---|
[824b6e4] | 38 |
|
---|
[e576789] | 39 | 3.1 INSTALLED PACKAGES TRACKING SYSTEM::
|
---|
[a54e1f1] | 40 |
|
---|
[392bd25] | 41 | This tool includes a very simple tracking system to log which packages
|
---|
| 42 | have been installed using the tool. It is used to skip installed packages
|
---|
| 43 | from target selection menu and to test if an installed package has been
|
---|
| 44 | updated in the BLFS book. Do not rely on this feature as a package
|
---|
| 45 | management tool.
|
---|
[a54e1f1] | 46 |
|
---|
[e576789] | 47 | The tracking system itself is an XML file: instpkg.xml. It is
|
---|
| 48 | initialized when <make> is first run in blfs_root. It resides in a
|
---|
| 49 | directory, which is created when needed during the process of building
|
---|
| 50 | custom tools or blfs dependencies, right after xLFS. You can specify
|
---|
| 51 | that directory location in the blfs-tools submenu of jhalfs. You may
|
---|
| 52 | need to update permissions and/or ownership of this directory before
|
---|
| 53 | using the blfs tool (see README in jhalfs).
|
---|
| 54 |
|
---|
| 55 | The default location of the tracking directory is /var/lib/jhalfs/BLFS.
|
---|
| 56 | NB : after the initial build, that directory is only used to contain
|
---|
| 57 | instpkg.xml, unless custom tools have been built. In the latter case,
|
---|
| 58 | it also contains empty files whose name are $PKG-$VERSION for each
|
---|
| 59 | versionned package built. The information about those packages is
|
---|
| 60 | included into instpkg.xml the next time the tool is run.
|
---|
[a54e1f1] | 61 |
|
---|
| 62 | 3.2 BLFS_TOOL INSTALLATION::
|
---|
[f4ed135] | 63 |
|
---|
[e576789] | 64 | 3.2.1 Normal install
|
---|
| 65 | The tools are installed just after the building of xLFS, if the
|
---|
| 66 | appropriate options have been selected in the building menu, as per
|
---|
| 67 | jhalfs README. If you forgot to select the options and xLFS has been
|
---|
| 68 | built, it is possible to go back to selecting the appropriate
|
---|
| 69 | BLFS tools options in the jhalfs menu, then tick `Run makefile'
|
---|
| 70 | and not `Rebuild files'. You obtain a /blfs_root directory in the
|
---|
| 71 | root directory of the new xLFS system, which contains the followings:
|
---|
| 72 |
|
---|
| 73 | blfs-xml/* SVN tree of the selected BLFS book version
|
---|
| 74 | lib/constants.inc functions libraries
|
---|
| 75 | /func_dependencies for building the dependency tree
|
---|
| 76 | menu/* lxdialog and menuconfig source code
|
---|
| 77 | xsl/gen_pkg_list.xsl XSL stylesheet to generate the package database
|
---|
| 78 | /gen_config.xsl XSL stylesheet to generate the Config.in file
|
---|
| 79 | for use in the menuconfig system
|
---|
| 80 | /dependencies.xsl XSL stylesheet to generate the dependency list
|
---|
| 81 | of a package
|
---|
| 82 | /make_book.xsl XSL stylesheet to generate the linear book.xml
|
---|
| 83 | /scripts.xsl XSL stylesheet to generate the scriptlets from
|
---|
| 84 | book.xml
|
---|
| 85 | /bump.xsl XSL stylesheet to generate to update the tracking
|
---|
| 86 | file
|
---|
| 87 | README.BLFS this file
|
---|
| 88 | TODO developers notes (well, not updated often)
|
---|
| 89 | gen_pkg_book.sh resolves dependencies and generates linear BLFS
|
---|
| 90 | books and build scripts
|
---|
| 91 | gen-makefile.sh generates the target Makefile
|
---|
| 92 | progress_bar.sh the target Makefile progress bar
|
---|
| 93 | gen-special.sh Helper script for generating the package database
|
---|
| 94 | Makefile Used by make to update the package database from
|
---|
| 95 | the SVN tree, then launch the menuconfig interface,
|
---|
| 96 | and run gen_pkg_book.sh based on configuration
|
---|
| 97 | settings
|
---|
| 98 | packdesc.dtd a simple DTD describing the format of the package
|
---|
| 99 | database and the tracking file.
|
---|
| 100 | envars.conf envars needed when running the target build scripts
|
---|
| 101 |
|
---|
| 102 | 3.2.2 Install to an already running LFS/BLFS system
|
---|
| 103 | If you forgot to install the tools when building xLFS, or want to try
|
---|
| 104 | the tools, you can just run the install-blfs-tools.sh script. It will
|
---|
| 105 | create the above hierarchy in your home directory and intialize the
|
---|
| 106 | tracking file. You have first to make sure that the tracking dir exists
|
---|
| 107 | and is writable by the user. You may also populate it with (empty) files
|
---|
| 108 | whose names are of the form package-version, for installed packages, so
|
---|
| 109 | that they are included into the tracking file.
|
---|
| 110 | 3.3.3 Working files
|
---|
| 111 | Several files are generated during the process:
|
---|
| 112 |
|
---|
| 113 | packages.xml auto-generated packages database
|
---|
| 114 | Config.in input file for the menu driven choices
|
---|
| 115 | configuration file generated by the menuconfig process
|
---|
| 116 | dependencies/* files recording the dependency tree
|
---|
| 117 | book.xml the linearized book
|
---|
| 118 | book-html/* the linearized book rendered in html
|
---|
| 119 | scripts/* the scriptlets
|
---|
[824b6e4] | 120 |
|
---|
| 121 | From now on, all the work must be done from inside the installation
|
---|
| 122 | root directory.
|
---|
| 123 |
|
---|
[e576789] | 124 | You may move that directory to the $HOME of a non root user, or build
|
---|
| 125 | as root from that directory.
|
---|
[a54e1f1] | 126 |
|
---|
| 127 | 3.3 UPDATING BOOK SOURCES::
|
---|
[f4ed135] | 128 |
|
---|
[392bd25] | 129 | If you are using the development book version and you want to update
|
---|
| 130 | installed packages to the latest version found in that book, you need to
|
---|
[e576789] | 131 | update the XML sources and packages database. This is not necessary if
|
---|
| 132 | you just built xLFS, and you can skip to step 3.4.
|
---|
[f4ed135] | 133 |
|
---|
[e576789] | 134 | To do that, run "make update". It may happen that the subversion
|
---|
| 135 | version of your building host is older than the version you just
|
---|
| 136 | built. This may generate weird errors like "'.' omitted". The easiest
|
---|
| 137 | thing to do in that case, is to completely remove the blfs-xml directory
|
---|
| 138 | and run "make update". With recent versions of subversion, you can also
|
---|
| 139 | run "svn upgrade" from inside the blfs-xml directory.
|
---|
[f4ed135] | 140 |
|
---|
[a54e1f1] | 141 | On the next configuration run, packages already installed but listed
|
---|
[392bd25] | 142 | with a new version in the book will be available for target selection
|
---|
| 143 | and used to solve dependencies.
|
---|
[a54e1f1] | 144 |
|
---|
| 145 | 3.4 CONFIGURING AND PARSING THE BOOK::
|
---|
[824b6e4] | 146 |
|
---|
[392bd25] | 147 | The next step is to create a book and build scripts in dependency
|
---|
[e576789] | 148 | build order for one or several packages.
|
---|
[ab412b4] | 149 |
|
---|
[a54e1f1] | 150 | Run <make> to launch the configuration interface. The main menu contains
|
---|
[e576789] | 151 | two blocks: individual package selection, and build options.
|
---|
[824b6e4] | 152 |
|
---|
[392bd25] | 153 | In the build options section, the dependencies level and default packages
|
---|
[e576789] | 154 | used to solve alternatives are set (currently, only for the MTA). You can
|
---|
| 155 | also select whether the build will be made as a normal user or as root.
|
---|
| 156 | Those settings are saved to be reused in future configuration runs.
|
---|
| 157 |
|
---|
| 158 | Note that you may select as many targets as you want, not just one
|
---|
| 159 | as in the previous version of this tool. But we suggest to not select
|
---|
| 160 | too many at a time to be able to sort issues!
|
---|
| 161 |
|
---|
| 162 | When you are done with the menu, a few checks occur, and the book is
|
---|
| 163 | generated. When circular dependencies are found, a 3 line message is
|
---|
| 164 | printed:
|
---|
| 165 | A is a dependency of B
|
---|
| 166 | C is a dependency of A
|
---|
| 167 | A is a dependency of C
|
---|
| 168 | and a question:
|
---|
| 169 | Do you want to build A first?
|
---|
| 170 | This means that the system has found the dependency chain: B->A->C->A.
|
---|
| 171 | You have therefore to choose whether A is built before C, or
|
---|
| 172 | C before A: the system cannot make that choice (well, maybe in a few
|
---|
| 173 | year, with an AI system able to understand the book). If you answer no,
|
---|
| 174 | C is built first. If you answer yes, C is put in place of A as a dependency
|
---|
| 175 | of B, then the tree dependency restarts from there, that is with the
|
---|
| 176 | layout B->C->... You may then hit the case B->C->A->C, for which you
|
---|
| 177 | should answer no, unless you want to enter an infinite (human driven)
|
---|
| 178 | loop;-)
|
---|
| 179 |
|
---|
| 180 | You end up with a book.xml file which contains the linearized book,
|
---|
| 181 | and a rendered HTML, in the directory book-html, which you can browse with
|
---|
| 182 | "lynx book-html/index.html" (or with any other browser).
|
---|
| 183 |
|
---|
| 184 | Furthermore, there is a directory "scripts", which contains the generated
|
---|
| 185 | scriptlets.
|
---|
| 186 |
|
---|
| 187 | There is also another directory, "dependencies" that contains files
|
---|
| 188 | generated while resolving dependencies.
|
---|
| 189 |
|
---|
| 190 | 3.5 EDITING BUILD SCRIPTS::
|
---|
| 191 |
|
---|
| 192 | Now it is time to review the generated book and scripts, making any
|
---|
| 193 | changes to the scripts necessary to fix generation bugs or to suit your
|
---|
| 194 | needs.
|
---|
[824b6e4] | 195 |
|
---|
[f4ed135] | 196 | Scripts for additional packages (i.e., for non-BLFS packages) can be
|
---|
[392bd25] | 197 | easily inserted. For example, if you want to install the external dependency
|
---|
| 198 | "bar" before "foo" package and the "foo" script is named "064-z-foo", you
|
---|
[e576789] | 199 | just need to create a "064-y-bar" build script.
|
---|
[824b6e4] | 200 |
|
---|
[392bd25] | 201 | Remember, the package tracking system isn't a package management tool
|
---|
| 202 | and knows nothing about packages not in the BLFS book.
|
---|
[f4ed135] | 203 |
|
---|
[392bd25] | 204 | Also, review and edit envars.conf. This file is used to set global envars
|
---|
[a54e1f1] | 205 | needed by the build scripts.
|
---|
| 206 |
|
---|
[e576789] | 207 | 3.6 CREATING THE MAKEFILE::
|
---|
[a54e1f1] | 208 |
|
---|
[4c5274d] | 209 | When the build scripts are ready to be run, the Makefile can be
|
---|
[e576789] | 210 | created. Create an empty directory (for example "mkdir work") and cd
|
---|
| 211 | to that directory. Then run ../gen-makefile.sh
|
---|
[824b6e4] | 212 |
|
---|
[e576789] | 213 | Review the Makefile, and, if all looks sane, start the build by running
|
---|
| 214 | "make".
|
---|
[824b6e4] | 215 |
|
---|
[f4ed135] | 216 | 4. GENERATED BUILD SCRIPTS ISSUES::
|
---|
[1891ac46] | 217 |
|
---|
[392bd25] | 218 | In this section, known issues with the generated build scripts are
|
---|
[e576789] | 219 | discussed. They are due to build procedures and/or BLFS layout
|
---|
| 220 | particularities that we can't handle. In several cases, editing the
|
---|
| 221 | build scripts is mandatory.
|
---|
[392bd25] | 222 | You may also need to insert some build scripts created by you to resolve
|
---|
| 223 | unhandled dependencies and/or to remove some script installing the affected
|
---|
[f4ed135] | 224 | package by hand.
|
---|
[1891ac46] | 225 |
|
---|
[e576789] | 226 | 4.1 BLFS BOOTSCRIPTS::
|
---|
[1891ac46] | 227 |
|
---|
[e576789] | 228 | Normally, bootscript installation should work. On the other hand, the
|
---|
| 229 | book does not give instruction for running them, so you might have to
|
---|
| 230 | manually insert /etc/init.d/rc.d/<initscript> at some place during the build.
|
---|
[1891ac46] | 231 |
|
---|
[e576789] | 232 | 4.2 PACKAGE CONFIGURATION::
|
---|
[1891ac46] | 233 |
|
---|
[e576789] | 234 | For those packages that have a "Configuration" section, you should
|
---|
| 235 | edit the build script to fit the needs of your system. Sometimes, the
|
---|
| 236 | bash startup files are modified (see for example the instructions for
|
---|
| 237 | llvm). The shipped 'envars.conf' contains a line 'source /etc/profile',
|
---|
| 238 | which ensures that the proper environment variables are used.
|
---|
[1891ac46] | 239 |
|
---|
[e576789] | 240 | 4.3 GCC, JDK, Sane, and KDE-multimedia, freetype2, MesaLib and others
|
---|
[9d9a810] | 241 |
|
---|
[e576789] | 242 | On the pages for those packages, the BLFS book actually has instructions
|
---|
[9d9a810] | 243 | to download and install two or more packages. You must edit the scripts to
|
---|
| 244 | fix this.
|
---|
[392bd25] | 245 |
|
---|
| 246 | We will try to fix some of them, but this may not be possible.
|
---|
[1891ac46] | 247 |
|
---|
[e576789] | 248 | 4.4 XORG7
|
---|
[f4ed135] | 249 |
|
---|
[e576789] | 250 | The generated scripts for Xorg7 packages have $SRC_ARCHIVE
|
---|
[a70c289] | 251 | support for individual packages, but not for patches nor *.wget and *.md5
|
---|
| 252 | files.
|
---|
| 253 |
|
---|
| 254 | If you have previously downloaded the patches, you must edit
|
---|
[0efb837] | 255 | the scripts to use your local packages.
|
---|
[f4ed135] | 256 |
|
---|
[a70c289] | 257 | The *.wget and *.md5 files should be downladed always from inside
|
---|
| 258 | the scripts to be sure that the most current individual packages are
|
---|
[e576789] | 259 | used. Thus don't reuse previously existing ones.
|
---|
[a70c289] | 260 |
|
---|
[9d9a810] | 261 | In the script for xorg7-font, be sure to move the fonts directories
|
---|
| 262 | symlinks creation to after the "for ... done" loop.
|
---|
| 263 |
|
---|
[f4ed135] | 264 |
|
---|
[e576789] | 265 | 4.5 PATCHES
|
---|
[f4ed135] | 266 |
|
---|
[e576789] | 267 | Please, make sure that all scripts have the commands to download/apply
|
---|
| 268 | the required patches. Due to book layout issues, some patches may be
|
---|
| 269 | missing.
|
---|
[f4ed135] | 270 |
|
---|
[e576789] | 271 | 4.6 ROOT COMMANDS
|
---|
[f4ed135] | 272 |
|
---|
[392bd25] | 273 | If building as a normal user (the default setting), be sure that all
|
---|
[615ba88] | 274 | commands that require root privileges are run using sudo. Also make sure
|
---|
[e576789] | 275 | necessary root privilege commands are visible in your PATH. Or use
|
---|
| 276 | the `Defaults secure_path=' in /etc/sudoers.
|
---|
| 277 | For commands necessitating root privileges, the generated scripts wrap
|
---|
| 278 | them with the construct:
|
---|
| 279 | sudo -E sh << ROOT_EOF
|
---|
| 280 | <commands to be executed as root with `$', ``', and `\' escaped>
|
---|
| 281 | ROOT_EOF
|
---|
| 282 | The -E switch ensures the whole environment is passed to the
|
---|
| 283 | commands to be run with root privileges. It is effective only if the
|
---|
| 284 | /etc/sudoers file contains `Defaults setenv', or SETENV in the user
|
---|
| 285 | attributes. If you think it is a security issue, you may forbid this
|
---|
| 286 | flag in /etc/sudoers, but then, you have to un-escape `$' for variables
|
---|
| 287 | coming from the environment in the instructions.
|
---|
| 288 | Although this construct is rather strong, it can fail in some corner
|
---|
| 289 | cases, so carefully review those instructions.
|
---|
[f4ed135] | 290 |
|
---|
[392bd25] | 291 | Due to book layout issues, some sudo commands may be missing.
|
---|
[f4ed135] | 292 |
|
---|
[e576789] | 293 | 4.7 OTHERS
|
---|
[1891ac46] | 294 |
|
---|
[392bd25] | 295 | There may be other issues that we are not aware of. If you find
|
---|
| 296 | any, please report it to <alfs-discuss@linuxfromscratch.org>.
|
---|
[1891ac46] | 297 |
|
---|