Difference between revisions of "Build Scripts and Makefiles"

From GlueXWiki
Jump to: navigation, search
m
m (Contents of the directory)
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
I've written a set of scripts that will retrieve and build various components of the Hall-D/GlueX software infrastructure. The scripts can serve as examples of the steps involved.
+
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=
 
=Get the scripts=
Line 6: Line 6:
  
 
  svn checkout https://halldsvn.jlab.org/repos/trunk/scripts/build_scripts
 
  svn checkout https://halldsvn.jlab.org/repos/trunk/scripts/build_scripts
 
This will create the directory build_scripts in your current working directory. Alternately to can get a tarball at:
 
 
http://www.jlab.org/~marki/halld/build_scripts_2008-06-18.tar
 
  
 
=Contents of the directory=
 
=Contents of the directory=
  
* '''cernlib_build.sh''' Bourne shell script 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%2Fbuild.csh build.csh]''' Example C-shell script to build everything from scratch.
* '''clhep_install.sh''' Bourne shell script to build the CLHEP package from source. 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%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'''.
* '''geant4.8.1.p01.tcl''' Expect script used by '''geant4_install.sh'''. Expect is used to answer questions asked by the GEANT4 installation script.
+
* '''[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'''.
* '''geant4_install.sh''' Bourne shell script to build GEANT4 from source. Uses '''geant4.8.1.p01.tcl''' to handle the interactive dialog in the installation script.
+
* '''[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'''.
* '''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%2Fgluex_env.csh gluex_env.csh]''' Sets up the environment in the C shell for building JANA and Hall-D packages.
* '''halld_build.csh''' C shell script 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%2Fgsl_env.csh 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.
+
* '''[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.
* '''jana_build.csh''' Bourne shell script for building the JANA package.
+
* '''[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.
* '''Makefile_root''' GNU makefile for building ROOT from source.
+
* '''[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.
* '''patches''' Directory containing various patches needed to build some of the packages.
+
* '''[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.
* '''xerces-c_install.sh''' Bourne shell script build the XERCES-C++ package from Apache from source.
+
* '''[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.
 
Note: GEANT4 is not currently used by GlueX/Hall-D software.
Line 31: Line 34:
 
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.
 
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.
  
N. B. (June 2008): Until recently these were all private scripts that used on Linux boxes under my direct control. There are still a few "Mark's-isms" in the scripts. If there is demand, they can be polished for general use. In the mean time if you have questions or need interpretations, do not hesitate to contact [[User:Marki|me]].
+
==Do-It-All Example==
 +
 
 +
Follow example in build.csh:
 +
 
 +
<pre>
 +
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
 +
</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.
  
--[[User:Marki|Marki]] 15:24, 18 June 2008 (EDT)
+
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.