Difference between revisions of "Build Scripts and Makefiles"

From GlueXWiki
Jump to: navigation, search
m (Contents of the directory)
 
(22 intermediate revisions by the same user not shown)
Line 1: Line 1:
The following steps will build JANA and the Hall D software tree in the directores "jana" and "gluex" respectively, creating them in the current working directory. It is assumed that the support packages (xerces, cernlib, root, etc.) have all been installed previoiusly. All necessary environment variables are set explicitly here; they will likely not be appropriate for your machine and must be modified to fit your particular environment. This worked for me from a Fedora 7 box.
+
The <code>scripts/build_scripts</code> 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=
 +
 
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2Fbuild.csh build.csh]''' Example C-shell script to build everything from scratch.
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2Fdelpath.pl delpath.pl]''' Perl script to remove specified directories from the PATH environment variable (works for C shell only). Used by '''gluex_env_clean.csh'''.
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2Fg4_responses.txt g4_responses.txt]''' Questions and answers to GEANT4 configuration script. Used by '''make_g4_build_tcl.pl'''.
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2Fgluex_env_clean.csh gluex_env_clean.csh]''' Un-does the actions of '''gluex_env.csh'''.
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2Fgluex_env.csh gluex_env.csh]''' Sets up the environment in the C shell for building JANA and Hall-D packages.
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2Fgsl_env.csh gsl_env.csh]''' C-shell script to set-up the GNU Scientific Library software.
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2Fhdds_install.sh hdds_install.sh]''' Bourne shell script to install a stand-alone version of the HDDS package. Not necessary for Hall D users.
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2Fmake_g4_build_tcl.pl make_g4_build_tcl.pl]''' Writes an expect script that interacts with the GEANT4 configuration/build script to initiate an from-scratch GEANT4 build.
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2FMakefile_all Makefile_all]''' Makefile that builds everything. Invokes all of the other makefiles in this directory in a sensible order.
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2FMakefile_cernlib 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.
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2FMakefile_clhep Makefile_clhep]''' Makefile to build clhep. CLHEP is used as a sort of C++ CERNLIB-replacement by GEANT4.
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2FMakefile_geant4 Makefile_geant4]''' Makefile to build GEANT4. Does configuration using a script produced by '''make_g4_build_tcl.pl'''.
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2FMakefile_gsl Makefile_gsl]''' Makefile to build the GNU Scientific Library.
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2FMakefile_halld Makefile_halld]''' Makefile to build the Hall-D/GlueX software packages. Relies on JANA having been built.
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2FMakefile_jana Makefile_jana]''' Makefile for building the JANA package.
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2FMakefile_root Makefile_root]''' Makefile for building ROOT from source.
 +
* '''[http://clasweb.jlab.org/websvn/prod/filedetails.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2FMakefile_xerces Makefile_xerces]''' Makefile that builds the XERCES-C++ package from Apache from source.
 +
* '''[http://clasweb.jlab.org/websvn/prod/listing.php?repname=GlueX&path=%2Ftrunk%2Fscripts%2Fbuild_scripts%2Fpatches%2F#_trunk_scripts_build_scripts_patches_ 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:
  
 
<pre>
 
<pre>
mkdir jana
+
setenv GLUEX_TOP /scratch/gluex
cd jana
+
mkdir -p $GLUEX_TOP
wget http://www.jlab.org/JANA/releases/jana_svn_daily_linux.tgz
+
cd $GLUEX_TOP
tar zxvf jana_svn_daily_linux.tgz
+
svn co https://halldsvn.jlab.org/repos/trunk/scripts/build_scripts
cd jana_svn_daily_linux
+
source build_scripts/gluex_env.csh
setenv JANA_HOME $cwd
+
make -f $BUILD_SCRIPTS/Makefile_all
rm -rf bin lib include
+
cd src/JANA
+
setenv OS `/bin/uname -s`
+
setenv ARCH `/bin/uname -p`
+
setenv OSNAME ${OS}-${ARCH}
+
make clean
+
make
+
make install
+
cd ../../../..
+
mkdir halld
+
cd halld
+
svn checkout https://halldsvn.jlab.org/repos/trunk/src
+
setenv HALLD_HOME $cwd
+
cd src
+
setenv ROOTSYS /usr/local/src/root/prod
+
setenv XERCESCROOT /usr/local/xerces-c/prod
+
setenv XERCES_INCLUDE $XERCESCROOT/include
+
setenv LD_LIBRARY_PATH  $ROOTSYS/lib:$XERCESCROOT/lib
+
setenv CERN /usr/local/cernlib
+
setenv CERN_LEVEL 2006
+
eval `addpath.pl $ROOTSYS/bin $CERN/$CERN_LEVEL/bin`
+
make FC=gfortran DFC=gfortran
+
cd ../..
+
 
</pre>
 
</pre>
 +
 +
==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:
 +
<pre>
 +
mkdir /home/user
 +
cd /home/user
 +
make -f /home/user/build_scripts/Makefile_hdds
 +
</pre>
 +
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|Hall D Subversion repository]] under repos/tags.

Latest revision as of 11:29, 27 March 2012

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.