Installation

CVS checkout

You can check out buildtool from the sourceforge CVS Server. If you have a sourceforge user account use:

export CVS_RSH=ssh
cvs -z3 -d:ext:developername@leaf.cvs.sourceforge.net:/cvsroot/leaf \
  co src/bering-uclibc/buildtool

If you don't have an account use anonymous access to the repository:

cvs -d :pserver:anonymous@leaf.cvs.sourceforge.net:/cvsroot/leaf login

Just press return if you see the password prompt. After login checkout with:

cvs -z3 -d :pserver:anonymous@leaf.cvs.sourceforge.net:/cvsroot/leaf \
  co src/bering-uclibc/buildtool

Checking out an older version to build

If you want to use buildtool for compiling sources for an older Bering-uClibc release, you need to check out buildtool and the relevant sources using a release-name or a date, and adjust the buildtool configuration to no longer use cvs to fetch the sources

For example, if you want to check out the buildtool setup and sources that were used to build Bering uclibc 2.4.1, use these commands:

mkdir /PATH/TO/WORKAREA
cd /PATH/TO/WORKAREA
cvs -z3 -d :pserver:anonymous@leaf.cvs.sourceforge.net:/cvsroot/leaf \
 co -r Release-2_4_1 src/bering-uclibc

or (if you have a sourceforge developer account)

export CVS_RSH=ssh
mkdir /PATH/TO/WORKAREA
cd /PATH/TO/WORKAREA
cvs -z3 -d:ext:developername@leaf.cvs.sourceforge.net:/cvsroot/leaf \
 co -r Release-2_4_1 src/bering-uclibc

After the checkout is complete, adjust the server definitions in /PATH/TO/WORKAREA/buildtool/conf/sources.cfg to no longer use CVS for downloading the sources. For example:

<Server cvs-sourceforge>
         Type = file
         Serverpath = /PATH/TO/WORKAREA/src/bering-uclibc/apps
</Server>

<Server cvs-contrib-sourceforge>
         Type = file
        Serverpath = /PATH/TO/WORKAREA/src/bering-uclibc/contrib
</Server>

Perl

Buildtool requires Perl 5.6 (or newer). Additionally, you need the Perl package Config::General. This can either be installed the "traditional" way (download it from CPAN, untar, perl Makefile.PL, make, make test and (as root) make install), or by running (as root) perl -MCPAN -e 'install Config::General'

Initial configuration

Edit the file conf/buildtool.conf (using your favourite text editor). It should look similar to this:

# version number
Version = 0.6

###################################################
# files&directories
# Adjust to your needs
# note that the dir or file entries can be relative 
# (to the dir buildtool.pl resides in) or absolute
#
###################################################
#
# where to log 
Logfile = log/buildtoollog

# name of the conf file with the source/package definitions
GlobalConffile = conf/sources.cfg

# Name of the source Directory
Source_Dir = source

# where to log what we have installed/compiled
InstalledFile = conf/installed

# debugging
DebugToConsole = 0
DebugToLogfile = 1

# good if you want to develop files
# in here and not to overwrite buildtool any files
# this means, if a file exists and its size is > 0,
# it will not be overwritten unless you delete it!
OverwriteFiles = 0

# how the files we use for each package are named:

Buildtool_Makefile = buildtool.mk
Buildtool_Config = buildtool.cfg

# some directories, these will be deleted if you make a 
# 'buildtool.pl distclean'
Buildenv_Dir=log
Buildenv_Dir=staging
Buildenv_Dir=source
Buildenv_Dir=build
Buildenv_Dir=package


# Stuff needed for buildpacket ---
gzip_options=-9

# Name of the packager -  please put your real name in here 
# (so people will know who created the package)
Packager=anonymous

Normally, the defaults in this config file are fine. The only setting that should be changed is the setting for the Packager. Enter your name here (this entry will be shown in the .help-files when creating packages - and I guess it is a good idea to let the user know who assembled the package).

Please see section "buildenv not building with gcc 4.0" at the end of this chapter if you're using a distribution that comes with gcc 4.x as its default compiler.

Toolchain download/build

Note

Unless otherwise noted, you should never run buildtool as root. Errors in the makefile might otherwise screw up your host system (I've done it, trying to build ncurses...).

You will probably want to open a new xterm (or whatever terminal emulator you prefer), go to the buildtool root directory (which is buildtool/ starting from where you made the cvs checkout) and enter tail -f log/buildtoollog in it. Go back to the other xterm, change to the buildtool root dir and enter (hopefully on a fast internet connection - there'll be several large downloads): ./buildtool.pl build buildenv

Finally, (and this must be done as root) create a link /lib/ld-uClibc.so.0 pointing to $(Root_Dir)/staging/lib/ld-uClibc.so.0 (where $(Root_Dir) is what you defined above in buildtool.conf). If you forget that step, you will sooner or later get a configure error (openssh is one of those candidates), claiming that cc cannot create binaries. This happens because configure compiles a test program and tries to execute it. The test program expects the uClibc library to be in /lib, if it is not found the program can not be executed (and this position is hardcoded while compiling the buildenv and cannot be changed with ldconfig).