-
Notifications
You must be signed in to change notification settings - Fork 1
/
install_sofa.sh
executable file
·73 lines (62 loc) · 1.42 KB
/
install_sofa.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
#!/bin/bash
#
# install the sofa package into the $EVNDISPSYS directory
#
# see https://www.iausofa.org for a description
#
#
set -e
echo "Installation of sofa into $EVNDISPSYS "
[[ "$1" ]] && DOWNL=$1 || DOWNL=""
CURDIR=`pwd`
cd "$EVNDISPSYS"
echo "Checking for existing sofa installation "
if [ -d "sofa" ] && [ -d "sofa/lib" ]
then
echo "Error, sofa directory exists. Please remove."
cd "$CURDIR"
exit
fi
mkdir -p sofa
cd sofa
# get sofa package from the web page and install
SOFAD="20210512"
SOFA="sofa_c-${SOFAD}.tar.gz"
if [[ -e sofa.tar.gz ]]; then
mv -f sofa.tar.gz ${SOFA}
elif [[ $DOWNL == "CI" ]]; then
wget https://syncandshare.desy.de/index.php/s/jr9NrbWFR5MLaDf/download
mv -f download ${SOFA}
else
wget --no-check-certificate https://www.iausofa.org/2021_0512_C/${SOFA}
fi
if [ ! -e ${SOFA} ]
then
echo "error in downloading sofa package"
exit
fi
tar -xzf ${SOFA}
rm -f ${SOFA}
##########################
# prepare make file
cd sofa/${SOFAD}/c/src/
sed -i -- "s/\$(HOME)/\$(EVNDISPSYS)\/sofa/" makefile
# use clang on OSX
OS=`uname -s`
echo "$OS"
if [ "$OS" = "Darwin" ]
then
sed -i -- 's/gcc/clang/' makefile
else
sed -i -- 's/pedantic/pedantic -fPIC/' makefile
fi
# make and install
make
make install
make clean
cd ../../../../
rm -rf sofa
echo "Installation completed"
echo "Please set the following environmental variable: "
echo "export SOFASYS=$EVNDISPSYS/sofa"
cd "$CURDIR"