-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall
executable file
·61 lines (55 loc) · 1.89 KB
/
install
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
#!/bin/bash
display_help() {
echo "`basename $0` [--help] [--build-mex] [--skip-matlab-check]"
echo "The following environment variables may be set to influence"
echo "the behavior of the install procedure:"
echo " PREFIX install location"
echo " CC C compiler executable"
echo " FC Fortran compiler executable"
echo " CFLAGS C compiler flags"
echo " FFLAGS Fortran compiler flags"
echo " MATLABDIR Path to Matlab's bin and extern subdirs"
}
top=$PWD
((build_mex = 0))
((skip_matlab_check = 0))
for opt in "$@"
do
case $opt in
--build-mex)
((build_mex = 1))
;;
--skip-matlab-check)
((skip_matlab_check = 1))
;;
-h|--help)
display_help
exit 0
;;
esac
done
# Compiler settings.
[[ ${PREFIX+set} == 'set' ]] || export PREFIX=$top
[[ ${ARCH+set} == 'set' ]] || export ARCH=osx
[[ ${CC+set} == 'set' ]] || CC=gcc
[[ ${CFLAGS+set} == 'set' ]] || CFLAGS='-g -fPIC -fno-second-underscore -flat_namespace'
[[ ${FC+set} == 'set' ]] || FC=gfortran
[[ ${FFLAGS+set} == 'set' ]] || FFLAGS='-g -fPIC -fno-second-underscore -flat_namespace -ffixed-form -pedantic -Wall'
# Build main library.
make clean install PREFIX="$PREFIX" CC="$CC" FC="$FC" CFLAGS="$CFLAGS" FFLAGS="$FFLAGS"
[[ $? != 0 ]] && exit $?
# Build Matlab interface. MEX requires gcc/gfortran 4.3
if (( $build_mex != 0 )); then
if (( $skip_matlab_check != 0 )); then
CCVER=`$CC --version | head -1 | awk '{print $NF}' | cut -c 1-3`
FCVER=`$FC --version | head -1 | awk '{print $NF}' | cut -c 1-3`
if [[ $CCVER != '4.3' || $FCVER != '4.3' ]]; then
echo "Matlab requires gcc/gfortran 4.3"
exit 1
fi
fi
cd $top/matlab
[[ ${MATLABDIR+set} == 'set' ]] || MATLABDIR='/Applications/Matlab/MATLAB_R2013b.app'
CC="$CC" FC="$CC" MATLABDIR="$MATLABDIR" make matlab
cd $top
fi