blob: e091444c9cb8d1299e542b4ceef27839e0f6ccaf (
plain)
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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
|
#!/bin/sh -e
# uni-build-dependencies by don bright 2012. copyright assigned to
# Marius Kintel and Clifford Wolf, 2012. released under the GPL 2, or
# later, as described in the file named 'COPYING' in OpenSCAD's project root.
#
# This script builds all library dependencies of OpenSCAD for Linux/BSD
#
# Usage: uni-build-dependencies.sh
#
# Prerequisites:
# - wget or curl
# - Qt4
# - other
#
printUsage()
{
echo "Usage: $0"
echo
}
build_git()
{
version=$1
echo "Building git" $version "..."
cd $BASEDIR/src
rm -rf git-$version
if [ ! -f git-$version.tar.gz ]; then
curl -O http://git-core.googlecode.com/files/git-$version.tar.gz
fi
tar zxf git-$version.tar.gz
cd git-$version
./configure --prefix=$DEPLOYDIR
make -j$NUMCPU
make install
}
build_cmake()
{
version=$1
echo "Building cmake" $version "..."
cd $BASEDIR/src
rm -rf cmake-$version
if [ ! -f cmake-$version.tar.gz ]; then
curl -O http://www.cmake.org/files/v2.8/cmake-$version.tar.gz
fi
tar zxf cmake-$version.tar.gz
cd cmake-$version
mkdir build
cd build
../configure --prefix=$DEPLOYDIR
make -j$NUMCPU
make install
}
build_curl()
{
version=$1
echo "Building curl" $version "..."
cd $BASEDIR/src
rm -rf curl-$version
if [ ! -f curl-$version.tar.bz2 ]; then
wget http://curl.haxx.se/download/curl-$version.tar.bz2
fi
tar xjf curl-$version.tar.bz2
cd curl-$version
mkdir build
cd build
../configure --prefix=$DEPLOYDIR
make -j$NUMCPU
make install
}
build_gmp()
{
version=$1
echo "Building gmp" $version "..."
cd $BASEDIR/src
rm -rf gmp-$version
if [ ! -f gmp-$version.tar.bz2 ]; then
curl -O ftp://ftp.gmplib.org/pub/gmp-$version/gmp-$version.tar.bz2
fi
tar xjf gmp-$version.tar.bz2
cd gmp-$version
mkdir build
cd build
../configure --prefix=$DEPLOYDIR --enable-cxx
make install
}
build_mpfr()
{
version=$1
echo "Building mpfr" $version "..."
cd $BASEDIR/src
rm -rf mpfr-$version
if [ ! -f mpfr-$version.tar.bz2 ]; then
curl -O http://www.mpfr.org/mpfr-$version/mpfr-$version.tar.bz2
fi
tar xjf mpfr-$version.tar.bz2
cd mpfr-$version
mkdir build
cd build
../configure --prefix=$DEPLOYDIR --with-gmp=$DEPLOYDIR
make install
cd ..
}
build_boost()
{
version=$1
bversion=`echo $version | tr "." "_"`
echo "Building boost" $version "..."
cd $BASEDIR/src
rm -rf boost_$bversion
if [ ! -f boost_$bversion.tar.bz2 ]; then
curl -LO http://downloads.sourceforge.net/project/boost/boost/$version/boost_$bversion.tar.bz2
fi
tar xjf boost_$bversion.tar.bz2
cd boost_$bversion
# We only need certain portions of boost
./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,system,regex
if [ $CXX ]; then
if [ $CXX = "clang++" ]; then
./b2 -j$NUMCPU toolset=clang install
# ./b2 -j$NUMCPU toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" install
fi
else
./b2 -j$NUMCPU
./b2 install
fi
}
build_cgal()
{
version=$1
echo "Building CGAL" $version "..."
cd $BASEDIR/src
rm -rf CGAL-$version
if [ ! -f CGAL-$version.tar.gz ]; then
#4.0.2
curl -O https://gforge.inria.fr/frs/download.php/31174/CGAL-$version.tar.bz2
# 4.0 curl -O https://gforge.inria.fr/frs/download.php/30387/CGAL-$version.tar.gz
# 3.9 curl -O https://gforge.inria.fr/frs/download.php/29125/CGAL-$version.tar.gz
# 3.8 curl -O https://gforge.inria.fr/frs/download.php/28500/CGAL-$version.tar.gz
# 3.7 curl -O https://gforge.inria.fr/frs/download.php/27641/CGAL-$version.tar.gz
fi
tar jxf CGAL-$version.tar.bz2
cd CGAL-$version
if [ $2 = use-sys-libs ]; then
cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DCMAKE_BUILD_TYPE=Debug
else
cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.so -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.so -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.so -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBOOST_ROOT=$DEPLOYDIR -DCMAKE_BUILD_TYPE=Debug
fi
make -j$NUMCPU
make install
}
build_glew()
{
version=$1
echo "Building GLEW" $version "..."
cd $BASEDIR/src
rm -rf glew-$version
if [ ! -f glew-$version.tgz ]; then
curl -LO http://downloads.sourceforge.net/project/glew/glew/$version/glew-$version.tgz
fi
tar xzf glew-$version.tgz
cd glew-$version
mkdir -p $DEPLOYDIR/lib/pkgconfig
# Fedora 64-bit
if [ -e /usr/lib64 ]; then
if [ "`ls /usr/lib64 | grep Xmu`" ]; then
echo "modifying glew makefile for 64 bit machine"
sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ config/Makefile.linux
fi
fi
if [ $CC ]; then
if [ $CC = "clang" ]; then
echo "modifying glew makefile for clang"
sed -i s/\$\(CC\)/clang/ Makefile
fi
fi
GLEW_DEST=$DEPLOYDIR make -j$NUMCPU
GLEW_DEST=$DEPLOYDIR make install
}
build_opencsg()
{
version=$1
echo "Building OpenCSG" $version "..."
cd $BASEDIR/src
rm -rf OpenCSG-$version
if [ ! -f OpenCSG-$version.tar.gz ]; then
curl -O http://www.opencsg.org/OpenCSG-$version.tar.gz
fi
tar xzf OpenCSG-$version.tar.gz
cd OpenCSG-$version
sed -ibak s/example// opencsg.pro # examples might be broken without GLUT
# Fedora 64-bit
if [ -e /usr/lib64 ]; then
if [ "`ls /usr/lib64 | grep Xmu`" ]; then
echo "modifying opencsg makefile for 64 bit machine"
sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ src/Makefile
fi
fi
if [ `uname | grep FreeBSD` ]; then
sed -ibak s/X11R6/local/g src/Makefile
fi
if [ "`command -v qmake-qt4`" ]; then
OPENCSG_QMAKE=qmake-qt4
else
OPENCSG_QMAKE=qmake
fi
if [ $CXX ]; then
if [ $CXX = "clang++" ]; then
cd $BASEDIR/src/OpenCSG-$version/src
$OPENCSG_QMAKE
cd $BASEDIR/src/OpenCSG-$version
$OPENCSG_QMAKE
fi
else
$OPENCSG_QMAKE
fi
make
cp -av lib/* $DEPLOYDIR/lib
cp -av include/* $DEPLOYDIR/include
cd $BASEDIR
}
build_eigen()
{
version=$1
echo "Building eigen" $version "..."
cd $BASEDIR/src
rm -rf eigen-$version
EIGENDIR="none"
if [ $version = "2.0.17" ]; then EIGENDIR=eigen-eigen-b23437e61a07; fi
if [ $version = "3.1.1" ]; then EIGENDIR=eigen-eigen-43d9075b23ef; fi
if [ $EIGENDIR = "none" ]; then
echo Unknown eigen version. Please edit script.
exit 1
fi
rm -rf ./$EIGENDIR
if [ ! -f eigen-$version.tar.bz2 ]; then
curl -LO http://bitbucket.org/eigen/eigen/get/$version.tar.bz2
mv $version.tar.bz2 eigen-$version.tar.bz2
fi
tar xjf eigen-$version.tar.bz2
ln -s ./$EIGENDIR eigen-$version
cd eigen-$version
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR ..
make -j$NUMCPU
make install
}
if [ "`command -v dirname`" ]; then
OPENSCAD_SCRIPTDIR=`dirname $0`
else
if [ ! -f openscad.pro ]; then
echo "Must be run from the OpenSCAD source root directory (dont have 'dirname')"
exit 1
else
OPENSCAD_SCRIPTDIR=$PWD
fi
fi
. $OPENSCAD_SCRIPTDIR/setenv-unibuild.sh # '.' is equivalent to 'source'
SRCDIR=$BASEDIR/src
if [ ! $NUMCPU ]; then
echo "Note: The NUMCPU environment variable can be set for paralell builds"
NUMCPU=1
fi
if [ ! -d $BASEDIR/bin ]; then
mkdir -p $BASEDIR/bin
fi
echo "Using basedir:" $BASEDIR
echo "Using deploydir:" $DEPLOYDIR
echo "Using srcdir:" $SRCDIR
echo "Number of CPUs for parallel builds:" $NUMCPU
mkdir -p $SRCDIR $DEPLOYDIR
if [ ! "`command -v curl`" ]; then
build_curl 7.26.0
fi
# NB! For cmake, also update the actual download URL in the function
if [ ! "`command -v cmake`" ]; then
build_cmake 2.8.8
fi
if [ "`cmake --version | grep 'version 2.[1-6][^0-9]'`" ]; then
build_cmake 2.8.8
fi
# build_git 1.7.10.3
# Singly build CGAL or OpenCSG
# (Most systems have all libraries available as packages except CGAL/OpenCSG)
# (They can be built singly here by passing a command line arg to the script)
if [ $1 ]; then
if [ $1 = "cgal" ]; then
build_cgal 4.0.2 use-sys-libs
exit
fi
if [ $1 = "opencsg" ]; then
build_opencsg 1.3.2
exit
fi
fi
#
# Main build of libraries
# edit version numbers here as needed.
#
build_eigen 3.1.1
build_gmp 5.0.5
build_mpfr 3.1.1
build_boost 1.47.0
# NB! For CGAL, also update the actual download URL in the function
build_cgal 4.0.2
build_glew 1.7.0
build_opencsg 1.3.2
echo "OpenSCAD dependencies built and installed to " $BASEDIR
|