4 # A script to build LHAPDF (adapted from R.Hatcher's build_pythia6.sh)
6 # Usage: ./build_lhapdf.sh [version] [--refetch]
8 # Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
14 while [ $# -gt 0 ] ; do
26 major=`awk -v str=$version 'BEGIN {split(str, tk, "."); print tk[1]}'`
27 minor=`awk -v str=$version 'BEGIN {split(str, tk, "."); print tk[2]}'`
28 revis=`awk -v str=$version 'BEGIN {split(str, tk, "."); print tk[3]}'`
30 topdir=`pwd`/v${major}_${minor}_${revis}
32 echo version $version major $major minor $minor revision $revis
35 if [ ! -d ${topdir} ] ; then
39 for subdir in stage download ; do
40 if [ ! -d ${subdir} ] ; then
48 # wget or curl for retreiving remote files?
49 # (OS X doesn't generally have wget on it, so fall back on curl in that case)
51 whichfetchit=`which wget | grep -v "no wget in"`
52 if [ ! -z "${whichfetchit}" ] ; then
53 echo use \"wget\" for fetching files
56 whichfetchit=`which curl | grep -v "no curl in"`
57 if [ ! -z "${whichfetchit}" ] ; then
58 # -f = fail without creating dummy, -O output local named like remoteza
59 echo use \"curl -f -O\" for fetching files
62 echo "Neither wget nor curl available -- can't download files"
67 echo "$fetchit http://www.hepforge.org/archive/lhapdf/lhapdf-${major}.${minor}.${revis}.tar.gz"
68 $fetchit http://www.hepforge.org/archive/lhapdf/lhapdf-${major}.${minor}.${revis}.tar.gz
70 tar xzvf lhapdf-${major}.${minor}.${revis}.tar.gz
71 mv lhapdf-${major}.${minor}.${revis} ${topdir}/src
73 ./configure --prefix=${topdir}/stage/