-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall-gsl.sh
More file actions
executable file
·68 lines (63 loc) · 1.49 KB
/
install-gsl.sh
File metadata and controls
executable file
·68 lines (63 loc) · 1.49 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
#!/bin/bash
CMD=$(command -v gsl-config)
if [ -n "$CMD" ]; then
echo "GSL found."
exit 0
fi
for g in gsl-*; do
if [ ! -d $g ]; then
GSL_DIRECTORY=$g
break
fi
done
if [ -z "$GSL_DIRECOTRY" ]; then
wget ftp://ftp.gnu.org/gnu/gsl/gsl-latest.tar.gz
if [ ! -s gsl-latest.tar.gz ]; then
echo "ERROR DOWNLOADING GSL!"
exit 255
fi
tar -xzf gsl-latest.tar.gz
rm -f gsl-latest.tar.gz
GSL_DIRECTORY=$(ls -d gsl*)
fi
while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in
--version )
echo ${GSL_DIRECTORY:4:4}
exit
;;
--prefix )
shift; PREFIX=$1
;;
--coptions )
shift; COPTIONS=$1
;;
-v | --verbose )
verbose=1
;;
esac; shift; done
if [[ "$1" == '--' ]]; then shift; fi
NCPUS=$(grep -c proc /proc/cpuinfo)
if [ "$verbose" -eq "1" ]; then
echo "I'm running $NCPUS procs"
fi
(
cd $GSL_DIRECTORY
if [ -z $PREFIX ]; then
./configure "${COPTIONS}"
make -j${NCPUS}
sudo make install
ISINBASHRC=$(sudo grep '/usr/local/lib' /etc/bash.bashrc)
if [ -z "$ISINBASHRC" ]; then
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/lib" | sudo tee -a /etc/bash.bashrc > /dev/null
fi
else
./configure --prefix=${PREFIX} "${COPTIONS}"
make -j${NCPUS}
make install
ISINBASHRC=$(grep "${PREFIX}/lib" >> ${HOME}/.bashrc)
if [ -z "$ISINBASHRC" ]; then
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${PREFIX}/lib" >> ${HOME}/.bashrc
fi
fi
make clean
)