-
Notifications
You must be signed in to change notification settings - Fork 3
/
createOSX.sh
executable file
·270 lines (242 loc) · 7.69 KB
/
createOSX.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
#!/usr/bin/env bash
#
DIRECTORY=$(cd `dirname $0` && pwd)
# Build Directory
BUILD_DIR=${BUILD_DIR:=${DIRECTORY}/tmp}
[ -d "${BUILD_DIR}" ] || mkdir -p "${BUILD_DIR}"
# Install Directory
INSTALL_DIR=${INSTALL_DIR:=${DIRECTORY}/bin}
[ -d ${INSTALL_DIR} ] || mkdir -p ${INSTALL_DIR}
[ -d ${INSTALL_DIR}/include ] || mkdir ${INSTALL_DIR}/include
[ -d ${INSTALL_DIR}/lib ] || mkdir ${INSTALL_DIR}/lib
if [ $# = 0 ]; then
ToBeBuild="expat raptor crossguid clapack SBW libSBML libnuml libSEDML zlib zipper libCombine MML qwt qwt-6 qwtplot3d"
elif [ _${1} = _--rebuild -a -e "${BUILD_DIR}/.packages" ]; then
. "${BUILD_DIR}/.packages"
else
while [ _${1} != _ ]; do
ToBeBuild="$ToBeBuild ${1}"
shift
done;
fi
echo ToBeBuild=\"${ToBeBuild}\" > "${BUILD_DIR}/.packages"
#Default Values:
BUILD_TYPE=${BUILD_TYPE:="Release"}
SELECT_QT=${SELECT_QT:="Any"}
CMAKE=${CMAKE:="cmake"}
MAKE=${MAKE:="gmake"}
command -v $MAKE >/dev/null 2>&1 || { MAKE=make; }
COPASI_CMAKE_OPTIONS="${COPASI_CMAKE_OPTIONS} -DCMAKE_BUILD_TYPE=${BUILD_TYPE}"
COPASI_CMAKE_OPTIONS="${COPASI_CMAKE_OPTIONS} -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}"
COPASI_CMAKE_OPTIONS="${COPASI_CMAKE_OPTIONS} -DEXTRA_INCLUDE_DIRS=${INSTALL_DIR}/include"
COPASI_CMAKE_OPTIONS="${COPASI_CMAKE_OPTIONS} -DENABLE_UNIVERSAL=OFF"
COPASI_CMAKE_OPTIONS="${COPASI_CMAKE_OPTIONS} -DCMAKE_OSX_ARCHITECTURES=x86_64"
#use the one below to link against libstd++ instead of libc++
#COPASI_CMAKE_OPTIONS="${COPASI_CMAKE_OPTIONS} -DCLANG_USE_STDLIB=ON"
COPASI_CXXFLAGS="${COPASI_CXXFLAGS} -gdwarf-2 -O2 -I${INSTALL_DIR}/include"
COPASI_CFLAGS="${COPASI_CFLAGS} -gdwarf-2 -O2 -I${INSTALL_DIR}/include"
COPASI_LDFLAGS="${COPASI_LDFLAGS} -L${INSTALL_DIR}/lib"
function build () {
case $1 in
cppunit)
# Build cppunit
cd $DIRECTORY/src/cppunit
chmod +x configure
CXXFLAGS="${COPASI_CXXFLAGS}" CFLAGS="${COPASI_CFLAGS}" LDFLAGS="${COPASI_LDFLAGS}" ./configure \
--disable-dependency-tracking \
--enable-html-docs=no \
--enable-doxygen=no \
--enable-dot=no \
--enable-shared=no \
--prefix=${INSTALL_DIR}
CXXFLAGS="${COPASI_CXXFLAGS}" CFLAGS="${COPASI_CFLAGS}" LDFLAGS="${COPASI_LDFLAGS}" make
CXXFLAGS="${COPASI_CXXFLAGS}" CFLAGS="${COPASI_CFLAGS}" LDFLAGS="${COPASI_LDFLAGS}" make install
;;
expat)
# build expat
[ -e ${BUILD_DIR}/expat ] || mkdir -p ${BUILD_DIR}/expat
cd ${BUILD_DIR}/expat
$CMAKE ${COPASI_CMAKE_OPTIONS} \
-DBUILD_shared=OFF \
$DIRECTORY/src/expat
$MAKE -j 4
$MAKE install
# delete shared library just in case
[ -e ${INSTALL_DIR}/lib/libexpat*dylib ] && rm ${INSTALL_DIR}/lib/libexpat*dylib
;;
raptor)
# build raptor
[ -e ${BUILD_DIR}/raptor ] || mkdir -p ${BUILD_DIR}/raptor
cd ${BUILD_DIR}/raptor
$CMAKE ${COPASI_CMAKE_OPTIONS} \
-DBUILD_shared=OFF \
-DEXPAT_INCLUDE_DIR=${INSTALL_DIR}/include \
-DEXPAT_LIBRARY=${INSTALL_DIR}/lib/libexpat.a \
$DIRECTORY/src/raptor
$MAKE -j 4
$MAKE install
;;
crossguid)
# build crossguid
[ -e ${BUILD_DIR}/crossguid ] || mkdir -p ${BUILD_DIR}/crossguid
cd ${BUILD_DIR}/crossguid
$CMAKE ${COPASI_CMAKE_OPTIONS} \
-DBUILD_shared=OFF \
$DIRECTORY/src/crossguid
$MAKE -j 4
$MAKE install
;;
MML)
#build MML
[ -e ${BUILD_DIR}/MML ] || mkdir -p ${BUILD_DIR}/MML
cd ${BUILD_DIR}/MML
$CMAKE ${COPASI_CMAKE_OPTIONS} \
$DIRECTORY/src/mml
make -j 4
make install
;;
qwt)
if [ _${SELECT_QT} == _Qt5 ]; then
QWT=qwt-6
else
QWT=qwt
fi
#build qwt
[ -e ${BUILD_DIR}/${QWT} ] || mkdir "${BUILD_DIR}/${QWT}"
cd "${BUILD_DIR}/${QWT}"
$CMAKE ${COPASI_CMAKE_OPTIONS} \
"$DIRECTORY/src/${QWT}"
make -j 4
make install
;;
qwt-6)
#build qwt
[ -e ${BUILD_DIR}/qwt-6 ] || mkdir ${BUILD_DIR}/qwt-6
cd ${BUILD_DIR}/qwt-6
$CMAKE ${COPASI_CMAKE_OPTIONS} \
$DIRECTORY/src/qwt-6
make -j 4
make install
;;
qwtplot3d)
#build qwtplot3d
[ -e ${BUILD_DIR}/qwtplot3d ] || mkdir ${BUILD_DIR}/qwtplot3d
cd ${BUILD_DIR}/qwtplot3d
$CMAKE ${COPASI_CMAKE_OPTIONS} \
$DIRECTORY/src/qwtplot3d-qt4
make -j 4
make install
;;
SBW)
#Build SBW
[ -e ${BUILD_DIR}/SBW ] || mkdir -p ${BUILD_DIR}/SBW
cd ${BUILD_DIR}/SBW
$CMAKE ${COPASI_CMAKE_OPTIONS} \
-DWITH_BUILD_BROKER=OFF \
-DWITH_BUILD_SHARED=OFF \
$DIRECTORY/src/core
make
make install
;;
libSBML)
# build libSBML
[ -e ${BUILD_DIR}/libSBML ] || mkdir -p ${BUILD_DIR}/libSBML
cd ${BUILD_DIR}/libSBML
$CMAKE ${COPASI_CMAKE_OPTIONS} \
-DENABLE_LAYOUT=ON \
-DENABLE_REQUIREDELEMENTS=OFF \
-DENABLE_RENDER=ON \
-DENABLE_COMP=ON \
-DENABLE_FBC=OFF \
-DENABLE_SPATIAL=OFF \
-DENABLE_GROUPS=OFF \
-DWITH_EXPAT=ON \
-DWITH_LIBXML=OFF \
-DLIBSBML_USE_LEGACY_MATH=ON \
-DLIBSBML_DEPENDENCY_DIR=${INSTALL_DIR} \
-DLIBSBML_SKIP_SHARED_LIBRARY=ON \
-DWITH_BZIP2=OFF \
-DWITH_ZLIB=OFF \
-DLIBEXPAT_INCLUDE_DIR=${INSTALL_DIR}/include \
-DLIBEXPAT_LIBRARY=${INSTALL_DIR}/lib/libexpat.a \
$DIRECTORY/src/libSBML
make -j 4
make install
;;
libnuml)
# build libnuml
[ -e ${BUILD_DIR}/libnuml ] || mkdir -p ${BUILD_DIR}/libnuml
cd ${BUILD_DIR}/libnuml
$CMAKE ${COPASI_CMAKE_OPTIONS} \
-DLIBSBML_STATIC=ON \
-DLIBNUML_SHARED_VERSION=OFF \
-DLIBNUML_SKIP_SHARED_LIBRARY=ON \
-DLIBNUML_DEPENDENCY_DIR=${INSTALL_DIR} \
-DLIBSBML_INCLUDE_DIR=${INSTALL_DIR}/include \
-DLIBSBML_LIBRARY=${INSTALL_DIR}/lib/libsbml-static.a \
-DEXTRA_LIBS=${INSTALL_DIR}/lib/libexpat.a \
-DWITH_ZLIB=OFF \
$DIRECTORY/src/libnuml
make -j
make install
[ -e ${INSTALL_DIR}/lib/libnuml*.dylib ] && rm ${INSTALL_DIR}/lib/libnuml*.dylib
;;
libSEDML)
# build libSEDML
[ -e ${BUILD_DIR}/libSEDML ] || mkdir -p ${BUILD_DIR}/libSEDML
cd ${BUILD_DIR}/libSEDML
$CMAKE ${COPASI_CMAKE_OPTIONS} \
-DLIBSBML_STATIC=ON \
-DLIBSEDML_SHARED_VERSION=OFF \
-DLIBSEDML_SKIP_SHARED_LIBRARY=ON \
-DLIBSEDML_DEPENDENCY_DIR=${INSTALL_DIR} \
-DLIBSBML_INCLUDE_DIR=${INSTALL_DIR}/include \
-DLIBSBML_LIBRARY=${INSTALL_DIR}/lib/libsbml-static.a \
-DEXTRA_LIBS=${INSTALL_DIR}/lib/libexpat.a \
-DWITH_ZLIB=OFF \
$DIRECTORY/src/libSEDML
make -j
make install
[ -e ${INSTALL_DIR}/lib/libsedml.dylib ] && rm ${INSTALL_DIR}/lib/libsedml*.dylib
;;
zlib)
# build zlib
[ -e ${BUILD_DIR}/zlib ] || mkdir -p ${BUILD_DIR}/zlib
cd ${BUILD_DIR}/zlib
$CMAKE ${COPASI_CMAKE_OPTIONS} \
$DIRECTORY/src/zlib
make -j 4
make install
;;
zipper)
# build zipper
[ -e ${BUILD_DIR}/zipper ] || mkdir -p ${BUILD_DIR}/zipper
cd ${BUILD_DIR}/zipper
$CMAKE ${COPASI_CMAKE_OPTIONS} \
-DWITH_QT_FILESYSTEM=ON \
-DZIPPER_DEPENDENCY_DIR=${INSTALL_DIR} \
$DIRECTORY/src/zipper
make -j 4
make install
;;
libCombine)
# build libCombine
[ -e ${BUILD_DIR}/libCombine ] || mkdir -p ${BUILD_DIR}/libCombine
cd ${BUILD_DIR}/libCombine
$CMAKE ${COPASI_CMAKE_OPTIONS} \
-DCOMBINE_DEPENDENCY_DIR=${INSTALL_DIR} \
-DEXTRA_LIBS=${INSTALL_DIR}/lib/libexpat.a \
-DLIBCOMBINE_SKIP_SHARED_LIBRARY=ON \
-DEXPAT_INCLUDE_DIR=${INSTALL_DIR}/include \
-DEXPAT_LIBRARY=${INSTALL_DIR}/lib/libexpat.a \
$DIRECTORY/src/libCombine
make -j 4
make install
[ -e ${INSTALL_DIR}/lib/libCombine.dylib ] && rm ${INSTALL_DIR}/lib/libCombine*.dylib
;;
esac
}
for b in ${ToBeBuild}; do
build $b
done
# echo ${COPASI_CMAKE_OPTIONS}