-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_sofa.sh
More file actions
executable file
·92 lines (77 loc) · 1.83 KB
/
Copy pathinstall_sofa.sh
File metadata and controls
executable file
·92 lines (77 loc) · 1.83 KB
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
87
88
89
90
91
92
#!/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="20231011"
SOFA="sofa_c-${SOFAD}.tar.gz"
# Determine download URL
if [[ $DOWNL == "CI" ]]; then
URL="https://syncandshare.desy.de/index.php/s/RamRFYJtZjDGsfL/download"
else
URL="https://www.iausofa.org/2021_0512_C/${SOFA}"
fi
echo "Downloading ${SOFA} from ${URL}"
# Prefer curl; fallback to wget
if command -v curl >/dev/null 2>&1; then
if [[ $DOWNL == "CI" ]]; then
curl -L "${URL}" -o "${SOFA}"
else
curl -L "${URL}" -o "${SOFA}"
fi
elif command -v wget >/dev/null 2>&1; then
if [[ $DOWNL == "CI" ]]; then
wget "${URL}" -O "${SOFA}"
else
wget --no-check-certificate "${URL}" -O "${SOFA}"
fi
else
echo "Error: neither curl nor wget is installed."
exit 1
fi
if [ ! -e "${SOFA}" ]; then
echo "error in downloading sofa package"
exit 1
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"