-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild_glm.sh
executable file
·137 lines (116 loc) · 2.85 KB
/
build_glm.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/bash
if [ "$GLM_CONFIGURED" != "true" ] ; then
. ./GLM_CONFIG
export OSTYPE=`uname -s`
if [ "$FORTRAN_COMPILER" = "IFORT" ] ; then
if [ -d /opt/intel/bin ] ; then
. /opt/intel/bin/compilervars.sh intel64
fi
which ifort >& /dev/null
if [ $? != 0 ] ; then
echo ifort compiler requested, but not found
exit 1
fi
fi
if [ "$FORTRAN_COMPILER" = "IFORT" ] ; then
export PATH="/opt/intel/bin:$PATH"
export FC=ifort
export NETCDFHOME=/opt/intel
else
export FC=gfortran
export NETCDFHOME=/usr
if [ "$OSTYPE" == "Darwin" ] ; then
export NETCDFHOME=/opt/local
fi
fi
export F77=$FC
export F90=$FC
export F95=$FC
export MPI=OPENMPI
export NETCDFINC=$NETCDFHOME/include
export NETCDFINCL=${NETCDFINC}
export NETCDFLIBDIR=$NETCDFHOME/lib
export NETCDFLIB=${NETCDFLIBDIR}
export NETCDFLIBNAME="-lnetcdff -lnetcdf"
else
export CURDIR=`pwd`
fi
if [ 1 = 0 ] ; then
if [ "$FABM" = "true" ] ; then
export COMPILATION_MODE=production
if [ ! -d $FABMDIR ] ; then
echo "FABM directory not found"
export FABM=false
else
which cmake >& /dev/null
if [ $? != 0 ] ; then
echo "cmake not found - FABM cannot be built"
export FABM=false
fi
fi
if [ "$FABM" = "false" ] ; then
echo build with FABM requested but FABM cannot be built
exit 1
fi
export FABMHOST=glm
cd ${FABMDIR}
if [ ! -d build ] ; then
mkdir build
fi
cd build
export EXTRA_FFLAGS+=-fPIC
if [ "${USE_DL}" = "true" ] ; then
cmake ${FABMDIR}/src -DBUILD_SHARED_LIBS=1 || exit 1
else
cmake ${FABMDIR}/src || exit 1
fi
make || exit 1
fi
if [ "${AED2}" = "true" ] ; then
cd ${AED2DIR}
make || exit 1
fi
if [ "$WITH_PLOTS" = "true" ] ; then
cd ${PLOTDIR}
make || exit 1
fi
cd ${UTILDIR}
make || exit 1
fi
if [ -f ${CURDIR}/src/glm ] ; then
/bin/rm ${CURDIR}/src/glm
fi
cd ${CURDIR}
make || exit 1
cd ${CURDIR}
if [ "$OSTYPE" = "Linux" ] ; then
VERSION=`grep GLM_VERSION src/glm.h | cut -f2 -d\"`
echo glm version $VERSION
if [ -f /etc/debian_version ] ; then
VERSDEB=`head -1 debian/changelog | cut -f2 -d\( | cut -f1 -d-`
echo debian version $VERSDEB
if [ "$VERSION" != "$VERSDEB" ] ; then
echo updating debian version
dch --newversion ${VERSION}-0 "new version ${VERSION}"
fi
fakeroot make -f debian/rules binary || exit 1
fi
cd ${CURDIR}/win
${CURDIR}/vers.sh $VERSION
cd ${CURDIR}/win-dll
${CURDIR}/vers.sh $VERSION
cd ${CURDIR}
if [ ! -d bin/ubuntu/$(lsb_release -rs) ] ; then
mkdir -p bin/ubuntu/$(lsb_release -rs)/
fi
mv ../glm*.deb bin/ubuntu/$(lsb_release -rs)/
fi
if [ "$OSTYPE" = "Darwin" ] ; then
if [ ! -d ${CURDIR}/bin/macos ] ; then
mkdir -p ${CURDIR}/bin/macos
fi
cd ${CURDIR}/macos
/bin/bash macpkg.sh ${HOMEBREW}
mv ${CURDIR}/macos/glm_*.zip ${CURDIR}/bin/macos/
fi
exit 0