-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathget_externals.sh
executable file
·87 lines (68 loc) · 2.25 KB
/
get_externals.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/sh
CURDIR=`pwd`
# CFITSIO_VERSION=3006
CFITSIO_VERSION=3300
#CLHEP_VERSION=2.0.1.1
CLHEP_VERSION=2.0.4.3
#CFITSIO_SRC=http://apcauger.in2p3.fr/CRPropa/cfitsio$CFITSIO_VERSION.tar.gz
#CLHEP_SRC=http://apcauger.in2p3.fr/CRPropa/clhep-$CLHEP_VERSION.tgz
# CFITSIO_SRC=http://astro.uni-wuppertal.de/~nils/cfitsio$CFITSIO_VERSION.tar
CFITSIO_SRC=ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio$CFITSIO_VERSION.tar.gz
#CLHEP_SRC=http://astro.uni-wuppertal.de/~nils/clhep-$CLHEP_VERSION.tar
CLHEP_SRC=http://proj-clhep.web.cern.ch/proj-clhep/DISTRIBUTION/tarFiles/clhep-$CLHEP_VERSION.tgz
WGET_OK=0
test -n "`which curl 2> /dev/null`" && WGET_OK=1 && WGET="curl -O"
test -n "`which wget 2> /dev/null`" && WGET_OK=1 && WGET="wget"
cd External
if test $WGET_OK -eq 1
then
$WGET $CLHEP_SRC
$WGET $CFITSIO_SRC
# echo
else
echo "Nor wget neither curl was found on this system. Cannot get automatically external program tar balls. Sorry, exiting." >&2 && exit 1;
fi
GCC_OK=0
test -n "`which g++ 2> /dev/null`" && GCC_OK=1
if test $GCC_OK -ne 1
then
echo "No Gnu compiler (gcc) found on the system. Exiting." >&2 && exit 2;
fi
GCC_VERSION=`gcc -dumpversion | awk -F"." '{print $1}'`
if test $GCC_VERSION -lt 3
then
echo "GCC version is lower than 3. Cannot continue. Exiting." >&2 && exit 3;
fi
CC=gcc
export CC
CXX=g++
export CXX
gzip -d `basename $CFITSIO_SRC`
tar xvf `basename $CFITSIO_SRC | sed 's/\.gz//' `
gzip -d `basename $CLHEP_SRC`
tar xvf `basename $CLHEP_SRC | sed 's/\.tgz/\.tar/' `
# -- how many procs
NB_PROC=1
if test `uname` = "Linux"
then
NB_PROC=`grep processor < /proc/cpuinfo | wc -l | awk '{print $1}'`
fi
if test `uname` = "Darwin"
then
NB_PROC=`sysctl hw.ncpu | awk '{print $2}'`
fi
test $NB_PROC -ge 2 && MAKE_OPT="-j $NB_PROC"
# -- cfits io compil
cd cfitsio
./configure --prefix=`pwd` && make $MAKE_OPT && make install
cd $CURDIR/External
cd $CLHEP_VERSION/CLHEP
./configure --prefix=$CURDIR/External/ && make $MAKE_OPT && make install
cd $CURDIR
#echo
#echo "####################################################"
#echo "Now you should set CLHEP_DIR=$CURDIR/External/ and "
#echo "CFITSIO_DIR=$CURDIR/External/cfitsio to continue the "
#echo "installation of CRPropa..."
#echo "####################################################"
#echo