Build Scripts and Makefiles

From GlueXWiki
Revision as of 11:29, 27 March 2012 by Marki (Talk | contribs) (Contents of the directory)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The scripts/build_scripts directory contains a set of scripts that will retrieve and build various components of the GlueX software infrastructure. The scripts can be used directly or serve as examples of the steps involved. They are used in the Quick Start Guide to building GlueX Software.

Get the scripts

They are stored in the Hall D Subversion repository. To check them out:

svn checkout https://halldsvn.jlab.org/repos/trunk/scripts/build_scripts

Contents of the directory

  • build.csh Example C-shell script to build everything from scratch.
  • delpath.pl Perl script to remove specified directories from the PATH environment variable (works for C shell only). Used by gluex_env_clean.csh.
  • g4_responses.txt Questions and answers to GEANT4 configuration script. Used by make_g4_build_tcl.pl.
  • gluex_env_clean.csh Un-does the actions of gluex_env.csh.
  • gluex_env.csh Sets up the environment in the C shell for building JANA and Hall-D packages.
  • gsl_env.csh C-shell script to set-up the GNU Scientific Library software.
  • hdds_install.sh Bourne shell script to install a stand-alone version of the HDDS package. Not necessary for Hall D users.
  • make_g4_build_tcl.pl Writes an expect script that interacts with the GEANT4 configuration/build script to initiate an from-scratch GEANT4 build.
  • Makefile_all Makefile that builds everything. Invokes all of the other makefiles in this directory in a sensible order.
  • Makefile_cernlib Makefile that builds CERNLIB from source. This may be necessary if a compatible binary version does not exist at CERN and/or if the RedHat rpm is missing certain key packages due to license issues.
  • Makefile_clhep Makefile to build clhep. CLHEP is used as a sort of C++ CERNLIB-replacement by GEANT4.
  • Makefile_geant4 Makefile to build GEANT4. Does configuration using a script produced by make_g4_build_tcl.pl.
  • Makefile_gsl Makefile to build the GNU Scientific Library.
  • Makefile_halld Makefile to build the Hall-D/GlueX software packages. Relies on JANA having been built.
  • Makefile_jana Makefile for building the JANA package.
  • Makefile_root Makefile for building ROOT from source.
  • Makefile_xerces Makefile that builds the XERCES-C++ package from Apache from source.
  • patches Directory containing various patches needed to build some of the packages.

Note: GEANT4 is not currently used by GlueX/Hall-D software.

Using the scripts

Generally one should follow the relevant instructions on the Hall D wiki pages. These scripts give concrete examples of how one might structure a build session. In most cases the retrieval of the source code from web or subversion servers is scripted.

Do-It-All Example

Follow example in build.csh:

setenv GLUEX_TOP /scratch/gluex
mkdir -p $GLUEX_TOP
cd $GLUEX_TOP
svn co https://halldsvn.jlab.org/repos/trunk/scripts/build_scripts
source build_scripts/gluex_env.csh
make -f $BUILD_SCRIPTS/Makefile_all

Partial Builds

If you are interested in only one package, say the HallD stuff you can replace the "make" step with

 make -f $BUILD_SCRIPTS/Makefile_all halld_build

The choices are listed in the "all" target of Makefile_all:

 all: env xerces_build cernlib_build root_build clhep_build jana_build halld_build

How the Makefiles Work

Assume build scripts are checked out into /home/user/build_scripts.

Makefile_hdds

By default the makefile will checkout the latest version of hdds and build it in the current working directory. It requires that the XERCESCROOT (???) variable is set (???perhaps others). Using the gluex_env.csh script is sufficient. For example:

mkdir /home/user
cd /home/user
make -f /home/user/build_scripts/Makefile_hdds

will create a directory /home/user/hdds that contains a complete build of HDDS. To use this build you should set your HDDS_HOME variable to point to /home/user/hdds.

If you want a tagged version then you have to define the HDDS_VERSION variable, either by specifying it to the make command or by setting it in the environment. The value of HDDS_VERSION should be the name of the desired directory in the Hall D Subversion repository under repos/tags.