build_ext.sh
Go to the documentation of this file.
1 #!/usr/bin/env bash
2 
3 #
4 # A script to build the external GENIE dependencies
5 #
6 # Usage: ./build_ext.sh
7 # [--log4cpp-version=...]
8 # [--gsl-version=...]
9 # [--pythia6-version=...]
10 # [--lhapdf-version=...]
11 # [--root-version=...]
12 # [--topdir=...]
13 # [--arch=linux|linuxx8664gcc|macosx|...]
14 #
15 #
16 
17 script_location="http://hepunx.rl.ac.uk/~candreop/generators/GENIE/devel/src/scripts/build/ext/"
18 
19 log4cpp_version=1.0
20 gsl_version=1.8
21 pythia6_version=6.4.12
22 lhapdf_version=5.7.0
23 root_version=5.24.00
24 arch=linuxx8664gcc
25 topdir=`pwd`
26 
27 while [ $# -gt 0 ] ; do
28  case $1 in
29  *log4cpp*)
30  log4cpp_version=$1 ;;
31  *gsl*)
32  gsl_version=$1 ;;
33  *pythia6*)
34  pythia6_version=$1 ;;
35  *lhapdf*)
36  lhapdf_version=$1 ;;
37  *root*)
38  root_version=$1 ;;
39  *arch*)
40  arch=$1 ;;
41  *topdir*)
42  topdir=$1 ;;
43  esac
44  shift
45 done
46 
47 echo topdir $topdir
48 if [ ! -d ${topdir} ] ; then
49  mkdir $topdir
50 fi
51 cd $topdir
52 
53 for subdir in pythia6 lhapdf gsl root log4cpp; do
54  if [ ! -d ${subdir} ] ; then
55  mkdir ${subdir}
56  fi
57 done
58 
59 #
60 # wget or curl for retreiving remote files?
61 # (OS X doesn't generally have wget on it, so fall back on curl in that case)
62 #
63 whichfetchit=`which wget | grep -v "no wget in"`
64 if [ ! -z "${whichfetchit}" ] ; then
65  echo use \"wget\" for fetching files
66  fetchit='wget '
67 else
68  whichfetchit=`which curl | grep -v "no curl in"`
69  if [ ! -z "${whichfetchit}" ] ; then
70  # -f = fail without creating dummy, -O output local named like remoteza
71  echo use \"curl -f -O\" for fetching files
72  fetchit='curl -f -O '
73  else
74  echo "Neither wget nor curl available -- can't download files"
75  exit 1
76  fi
77 fi
78 
79 #
80 # build pythia6
81 #
82 cd $topdir/pythia6
83 $fetchit $script_location/build_pythia6.sh
84 source build_pythia6.sh $pythia6_version
85 
86 #
87 # build lhapdf
88 #
89 cd $topdir/lhapdf
90 $fetchit $script_location/build_lhapdf.sh
91 source build_lhapdf.sh $lhapdf_version
92 
93 #
94 # build GSL
95 #
96 cd $topdir/gsl
97 $fetchit $script_location/build_gsl.sh
98 source build_gsl.sh $gsl_version
99 
100 #
101 # build ROOT
102 #
103 cd $topdir/root
104 $fetchit $script_location/build_root.sh
105 source build_root.sh $root_version --arch=$arch
106 
107 #
108 # build log4cpp
109 #
110 cd $topdir/log4cpp
111 $fetchit $script_location/build_log4cpp.sh
112 source build_log4cpp.sh $log4cpp_version
113