Bering-uClibc 5.x - Developer Guide - Compiling Source Code
|Compiling Source Code|
|Prev||Bering-uClibc 5.x - Developer Guide||Next|
- 1 Introduction
- 2 Buildtool usage
What is buildtool?
Buildtool is a set of Perl scripts and Perl modules to build LRP files (LEAF Packages) from source. Everything in the build process is automated, from extracting the sources and applying patches to configuring and building the source and creating the LRP Package.
In very early LEAF releases it was usual to compile the sources and build the Packages manually. This could be error-prone, and where upstream source upgrades happened regularly it was tedious to have to repeat builds for new versions manually.
The current practice is for every Package to be generated automatically according to simple configuration definitions. This means that no special knowledge is required to re-build a particular Package, because all of the steps are captured in the configuration files. Some effort is required to prepare the initial buildtool configuration but many Packages are fairly "standard" and it is often possible to adapt the configuration from a similar package quite quickly.
usage: ./buildtool.pl [option] command [pkgname|srcname] [...] commands: describe [pkgname|srcname] shows descriptionlines of package list [sourced|built] shows a list of built/sourced packages and sources dumpenv [pkgname|srcname] dump the environment of buildtool and package source [pkgname|srcname] downloads, unpacks and patches the wanted package/source build [pkgname|srcname] the same as source, but builds and installs sources/packages also pkglist [pkgname|srcname] create a list with all dependencies for the package given or all if no name given buildclean [pkgname|srcname] removes everything that is outside the source dir srcclean [pkgname|srcname] same as buildclean + call make srcclean remove [pkgname|srcname] same as buildclean + remove everything from dldir distclean remove everything maketar make a tar for distribution options: -v just print version and exit -f allows you to force the command even if the internal state of buildtool states it has nothing to do -O Do not override default Server entries with the ones found in package/source buildtool config -D Download nothing, use files in Source dir (useful for devel) -d Only to be used in conjunction with the "source" target. Only download files, don't invoke the source action on buildtool.mk -t toolchain Build using the specified toolchain (or actually build that toolchain if srcname = "toolchain") Value of "toolchain" is e.g. i486-unknown-linux-uclibc
Getting information about the sources that can be built
Buildtool can only build sources/packages that it has a configuration for (see the next section on how to create such a configuration). To get a listing of the sources that are configured for buildtool type:
This will give you a list (and a short description) of all sources/packages that can be built. An example output looks like this:
./buildtool.pl describe The following packages and sources are available: Sources: --------------------------------------------------------- openssh openssh tcp_wrappers Wietse Venema's TCP wrappers library helloworld classical example openssl Secure Sockets Layer and cryptography libraries and tools zlib zLib shared libraries linux kernel source only package Packages: --------------------------------------------------------- toolchain this holds everything to build cross build env kernel kernel pseudo package
The difference between sources and packages
You might be a bit confused why in the above output there are Sources and Packages. The main reason for having sources and packages separately is that there are some sources out there that produce programs used in several packages. Or in other words, it sometimes makes sense to just build the sources (like util-linux for example) only once and create several packages out of the resulting binaries. (Although the developer team did not strictly obey this idea in the past.)
Getting information about sources and packages that already has been built
shows a list of already build packages/sources.
Downloading the sources for a package
./buildtool.pl source somepackageName
will cause the sources of somepackageName to be "downloaded" (and before that, all its dependencies, if there are any that haven't been downloaded yet).
Upstream sources are now copied into the Bering-uClibc 5.x Git repository, since this avoids problems when upstream download sites go off-line and makes it easier to distribute copies of all the source code as required for compliance with some Open Source licenses.
As a result, these sources are "downloaded" (from the Internet) when the Sourceforge-hosted Git repository is "cloned", but an important further step is to create symbolic links to the "local repository" (directory
repo/) from the
source/ directory, so this is what now happens when sources are "downloaded".
After that, the makefile
buildtool.mk for this source is executed for target source. This has the effect that the sources will be extracted, and patches (if there are any) are applied.
If all this is completed without error, the sources of somepackageName are ready to be compiled.