The CERNLIB build procedure uses Imake, makedepend, gmake and cpp to define and make the different versions. It is not necessary to use these tools but some knowledge of cpp will be useful to understand the code or to recompile it.
Typically, the top of the source tree is the directory /cern/LEVEL/src or, from the ftp server asisftp, cernlib/share/LEVEL/src. LEVEL is the release version, e.g. pro, old, new, 99, etc. The file Imakefile is the Imake description of the build procedure, which also gives the other important directories at this level, e.g.
Imakefile config include packlib pawlib graflib mathlib geant321 mclibs phtoolsThese are the different major parts which together make up CERNLIB.
Config contains the Imake rules and is somewhat complicated if you are not familiar with Imake. It also contains the system configuration files (like linux.cf) which contain the description of the system components and the compiler options. These are the files that will need to be modified when starting with a new system or compilers.
In every directory, there is an Imakefile which defines the directories and/or files to make the next level. Even if you are not using Imake, they contain useful information about the different versions.
The include subdirectory is needed at this level to allow cross referencing of certain include files between packages; the simplest way is to make a copy of the complete include directory from the sources or a symbolic link to its normal location (e.g. /cern/new/include).
Beneath this level comes the individual packages and libraries. E.g for mathlib:
Imakefile bvsl genwhere gen is the general section containing directories of source files.
#include "minuit/d506dp.inc"For the selection of different code versions, cpp flags starting with CERNLIB_ are used. For each system, the compiler is called with system specific cpp flags which are described in the appropriate tar/README file. Typically (but geant321 has also -DCERNLIB_BLDLIB),
g77 -DCERNLIB_UNIX -DCERNLIB_LINUX -I/cern/new/include file.FEach package has its own steering header file pilot.h which expands these cpp flags into package specific flags. For a new system it will probably be necessary to understand what functionality is required and modify these header files.
All the source compressed tar files for the version you want should be downloaded into any suitable directory, e.g. /tmp/cernlib, $HOME/cernlib or /cern. Typically, this would be the latest version. Only files with names like src_*.tar.gz are used in the build. By running this shell script the files will be unpacked, the directory structure created and, provided that the system options are compatible with those in the distribution, the libraries will be installed. This also defines the environment variables which will need to be set to run the tests, use the cernlib command, rebuild modified libraries or binaries like pawX11.
Variable | Meaning | Example |
CERN | Cernlib base directory | /tmp/cernlib |
CERN_LEVEL | Cernlib version | 2004 |
CERN_ROOT | Cernlib build directory | /tmp/cernlib/2004 |
CVSCOSRC | Cernlib SOURCE directory | /tmp/cernlib/2004/src |
PATH | Search path | /tmp/cernlib/2004/src:$PATH |
If successful, the libraries will be in $CERN_ROOT/lib. Failure is usually indicated in the end of the log files in $CERN_ROOT/build/log. Pawlib and some parts of mathlib depend on Lapack3, which can now be built as described here.
However, if the build is to be done for a new system or compiler options, then the relevant configuration file (e.g. config/linux.cf) and the Lapack make files will need to be modified. Then, at least the build directory should have all its makefiles removed and the gmake commands repeated. This simple script cleans up the previous build, builds the libraries, the Paw and packlib executables, and runs some tests.
It can sometimes be useful to run the tests without building the libraries or to specify a particular library for testing. One technique is to change the PACKAGE_LIB gmake variable and use the cernlib command in your search path to locate other required libraries. Try the following procedure to test the production libraries in /cern/pro/lib:
mkdir test cd test setenv CVSCOSRC /cern/pro/src $CVSCOSRC/config/imake_boot gmake packlib/Makefile cd packlib gmake test PACKAGE_LIB=/cern/pro/lib/libpacklib.a
cd $CERN_ROOT/build/pawlib gmake install.bin ... this should install pawX11 and paw++.
cd $CERN_ROOT/build/packlib gmake install.bin ... this should install cdbackup, cdmake, cdmove, cdserv, fatback, fatmen, fatnew, fatsend, fatsrv, hepdb, kuesvr, kxterm, pawserv, zftp and zserv.
gmake phtools/Makefile cd phtools gmake install.lib
gmake packlib/Makefile cd packlib gmake kernlib/Makefile cd kernlib gmake install.libThis procedure can be repeated for geant, mathlib, graflib, etc.
gmake pawlib/Makefile cd pawlib gmake install.lib gmake install.bin
CERN Program Library | Home | Last modified: 10-May-2005 |