Bering-uClibc 5.x - Developer Guide - Compiling Source Code

From bering-uClibc
Revision as of 15:02, 4 November 2012 by Kapeka (Talk | contribs) (start documenation for in v5.x)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Compiling Source Code
Prev Bering-uClibc 5.x - Developer Guide Next


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.

Why bother?

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.

Buildtool usage


usage: ./ [option] command [pkgname|srcname] [...]

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
-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
-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:

 ./ describe

This will give you a list (and a short description) of all sources/packages that can be built. An example output looks like this:

 ./ describe

 The following packages and sources are available:

 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

 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.)

Downloading the sources for a package


./ 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".

Prev Up Next