4 # A script to build log4cpp (adapted from R.Hatcher's build_pythia6.sh)
6 # Usage: ./build_log4cpp.sh [version] [--refetch]
8 # Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
17 if [ "$2" == "clean" ] ; then
21 major=`awk -v str=$version 'BEGIN {split(str, tk, "."); print tk[1]}'`
22 minor=`awk -v str=$version 'BEGIN {split(str, tk, "."); print tk[2]}'`
24 topdir=`pwd`/v${major}_${minor}
26 echo version $version major $major minor $minor
29 if [ ! -d ${topdir} ] ; then
33 for subdir in stage download ; do
34 if [ ! -d ${subdir} ] ; then
42 # wget or curl for retreiving remote files?
43 # (OS X doesn't generally have wget on it, so fall back on curl in that case)
45 whichfetchit=`which wget | grep -v "no wget in"`
46 if [ ! -z "${whichfetchit}" ] ; then
47 echo use \"wget\" for fetching files
50 whichfetchit=`which curl | grep -v "no curl in"`
51 if [ ! -z "${whichfetchit}" ] ; then
52 # -f = fail without creating dummy, -O output local named like remoteza
53 echo use \"curl -f -O\" for fetching files
56 echo "Neither wget nor curl available -- can't download files"
61 echo "$fetchit http://downloads.sourceforge.net/project/log4cpp/log4cpp-${major}.${minor}.x%20%28current%29/log4cpp-${major}.${minor}/log4cpp-${major}.${minor}.tar.gz"
62 $fetchit http://downloads.sourceforge.net/project/log4cpp/log4cpp-${major}.${minor}.x%20%28current%29/log4cpp-${major}.${minor}/log4cpp-${major}.${minor}.tar.gz
64 tar xzvf log4cpp-${major}.${minor}.tar.gz
65 mv log4cpp-${major}.${minor} ${topdir}/src
68 ./configure --prefix=${topdir}/stage/