2013-02-17 05:52:34 +04:00
|
|
|
#!/bin/sh -e
|
2012-08-04 05:11:13 +04:00
|
|
|
|
2012-12-05 08:18:12 +04:00
|
|
|
# uni-build-dependencies by don bright 2012. copyright assigned to
|
2012-12-03 11:59:57 +04:00
|
|
|
# Marius Kintel and Clifford Wolf, 2012. released under the GPL 2, or
|
2012-08-04 05:11:13 +04:00
|
|
|
# later, as described in the file named 'COPYING' in OpenSCAD's project root.
|
|
|
|
|
2012-12-30 03:41:13 +04:00
|
|
|
# This script builds most dependencies, both libraries and binary tools,
|
2012-12-30 04:07:57 +04:00
|
|
|
# of OpenSCAD for Linux/BSD. It is based on macosx-build-dependencies.sh
|
2012-05-29 03:25:43 +04:00
|
|
|
#
|
2012-12-30 03:41:13 +04:00
|
|
|
# By default it builds under $HOME/openscad_deps. You can alter this by
|
|
|
|
# setting the BASEDIR environment variable or with the 'out of tree'
|
|
|
|
# feature
|
2012-05-29 03:25:43 +04:00
|
|
|
#
|
2012-12-30 03:41:13 +04:00
|
|
|
# Usage:
|
2012-12-21 06:24:43 +04:00
|
|
|
# cd openscad
|
|
|
|
# . ./scripts/setenv-unibuild.sh
|
|
|
|
# ./scripts/uni-build-dependencies.sh
|
2012-12-25 05:21:22 +04:00
|
|
|
#
|
2012-12-30 03:41:13 +04:00
|
|
|
# Out-of-tree usage:
|
2012-12-21 06:24:43 +04:00
|
|
|
#
|
|
|
|
# cd somepath
|
|
|
|
# . /path/to/openscad/scripts/setenv-unibuild.sh
|
2012-12-25 05:21:22 +04:00
|
|
|
# /path/to/openscad/scripts/uni-build-dependencies.sh
|
2012-05-29 03:25:43 +04:00
|
|
|
#
|
|
|
|
# Prerequisites:
|
2012-07-04 09:31:22 +04:00
|
|
|
# - wget or curl
|
2013-02-02 23:28:12 +04:00
|
|
|
# - OpenGL (GL/gl.h)
|
|
|
|
# - GLU (GL/glu.h)
|
2012-12-30 03:41:13 +04:00
|
|
|
# - gcc
|
2013-02-02 23:28:12 +04:00
|
|
|
# - Qt4
|
2012-12-30 03:41:13 +04:00
|
|
|
#
|
2013-02-02 23:17:36 +04:00
|
|
|
# If your system lacks qt4, build like this:
|
|
|
|
#
|
|
|
|
# ./scripts/uni-build-dependencies.sh qt4
|
|
|
|
# . ./scripts/setenv-unibuild.sh
|
|
|
|
#
|
2013-02-02 23:28:12 +04:00
|
|
|
# If your system lacks glu, try to build like this:
|
|
|
|
#
|
|
|
|
# ./scripts/uni-build-dependencies.sh glu
|
|
|
|
#
|
2013-02-02 23:17:36 +04:00
|
|
|
# If you want to try Clang compiler (experimental, only works on linux):
|
2012-12-30 03:41:13 +04:00
|
|
|
#
|
|
|
|
# . ./scripts/setenv-unibuild.sh clang
|
2012-05-29 03:25:43 +04:00
|
|
|
#
|
2013-02-02 23:17:36 +04:00
|
|
|
# If you want to try Qt5 (experimental)
|
2013-01-08 07:48:26 +04:00
|
|
|
#
|
|
|
|
# . ./scripts/setenv-unibuild.sh qt5
|
|
|
|
#
|
2012-05-29 03:25:43 +04:00
|
|
|
|
|
|
|
printUsage()
|
|
|
|
{
|
|
|
|
echo "Usage: $0"
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
2013-09-23 01:35:29 +04:00
|
|
|
detect_glu()
|
|
|
|
{
|
|
|
|
detect_glu_result=
|
|
|
|
if [ -e $DEPLOYDIR/include/GL/glu.h ]; then detect_glu_result=1; fi
|
|
|
|
if [ -e /usr/include/GL/glu.h ]; then detect_glu_result=1; fi
|
|
|
|
if [ -e /usr/local/include/GL/glu.h ]; then detect_glu_result=1; fi
|
|
|
|
if [ -e /usr/pkg/X11R7/include/GL/glu.h ]; then detect_glu_result=1; fi
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2013-02-01 08:16:28 +04:00
|
|
|
build_glu()
|
|
|
|
{
|
|
|
|
version=$1
|
|
|
|
if [ -e $DEPLOYDIR/lib/libGLU.so ]; then
|
|
|
|
echo "GLU already installed. not building"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
echo "Building GLU" $version "..."
|
|
|
|
cd $BASEDIR/src
|
|
|
|
rm -rf glu-$version
|
|
|
|
if [ ! -f glu-$version.tar.gz ]; then
|
|
|
|
curl -O http://cgit.freedesktop.org/mesa/glu/snapshot/glu-$version.tar.gz
|
|
|
|
fi
|
|
|
|
tar xzf glu-$version.tar.gz
|
|
|
|
cd glu-$version
|
|
|
|
./autogen.sh --prefix=$DEPLOYDIR
|
|
|
|
make -j$NUMCPU
|
|
|
|
make install
|
|
|
|
}
|
|
|
|
|
2013-02-01 06:37:08 +04:00
|
|
|
build_qt4()
|
|
|
|
{
|
|
|
|
version=$1
|
|
|
|
if [ -e $DEPLOYDIR/include/Qt ]; then
|
|
|
|
echo "qt already installed. not building"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
echo "Building Qt" $version "..."
|
|
|
|
cd $BASEDIR/src
|
|
|
|
rm -rf qt-everywhere-opensource-src-$version
|
|
|
|
if [ ! -f qt-everywhere-opensource-src-$version.tar.gz ]; then
|
|
|
|
curl -O http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-$version.tar.gz
|
|
|
|
fi
|
|
|
|
tar xzf qt-everywhere-opensource-src-$version.tar.gz
|
|
|
|
cd qt-everywhere-opensource-src-$version
|
|
|
|
./configure -prefix $DEPLOYDIR -opensource -confirm-license -fast -no-qt3support -no-svg -no-phonon -no-audio-backend -no-multimedia -no-javascript-jit -no-script -no-scripttools -no-declarative -no-xmlpatterns -nomake demos -nomake examples -nomake docs -nomake translations -no-webkit
|
2013-02-01 08:16:28 +04:00
|
|
|
make -j$NUMCPU
|
2013-02-01 06:37:08 +04:00
|
|
|
make install
|
|
|
|
QTDIR=$DEPLOYDIR
|
|
|
|
export QTDIR
|
|
|
|
echo "----------"
|
2013-02-01 06:47:02 +04:00
|
|
|
echo " Please set QTDIR to $DEPLOYDIR ( or run '. scripts/setenv-unibuild.sh' )"
|
2013-02-01 06:37:08 +04:00
|
|
|
echo "----------"
|
|
|
|
}
|
|
|
|
|
2012-12-21 05:18:21 +04:00
|
|
|
build_bison()
|
|
|
|
{
|
|
|
|
version=$1
|
|
|
|
echo "Building bison" $version
|
|
|
|
cd $BASEDIR/src
|
|
|
|
rm -rf bison-$version
|
|
|
|
if [ ! -f bison-$version.tar.gz ]; then
|
|
|
|
curl --insecure -O http://ftp.gnu.org/gnu/bison/bison-$version.tar.gz
|
|
|
|
fi
|
|
|
|
tar zxf bison-$version.tar.gz
|
|
|
|
cd bison-$version
|
|
|
|
./configure --prefix=$DEPLOYDIR
|
|
|
|
make -j$NUMCPU
|
|
|
|
make install
|
|
|
|
}
|
|
|
|
|
2012-07-13 06:31:28 +04:00
|
|
|
build_git()
|
|
|
|
{
|
|
|
|
version=$1
|
|
|
|
echo "Building git" $version "..."
|
|
|
|
cd $BASEDIR/src
|
|
|
|
rm -rf git-$version
|
|
|
|
if [ ! -f git-$version.tar.gz ]; then
|
2012-12-21 03:35:16 +04:00
|
|
|
curl --insecure -O http://git-core.googlecode.com/files/git-$version.tar.gz
|
2012-07-13 06:31:28 +04:00
|
|
|
fi
|
|
|
|
tar zxf git-$version.tar.gz
|
|
|
|
cd git-$version
|
|
|
|
./configure --prefix=$DEPLOYDIR
|
|
|
|
make -j$NUMCPU
|
|
|
|
make install
|
|
|
|
}
|
|
|
|
|
2012-06-02 20:58:08 +04:00
|
|
|
build_cmake()
|
|
|
|
{
|
|
|
|
version=$1
|
|
|
|
echo "Building cmake" $version "..."
|
|
|
|
cd $BASEDIR/src
|
|
|
|
rm -rf cmake-$version
|
|
|
|
if [ ! -f cmake-$version.tar.gz ]; then
|
2012-12-21 03:35:16 +04:00
|
|
|
curl --insecure -O http://www.cmake.org/files/v2.8/cmake-$version.tar.gz
|
2012-06-02 20:58:08 +04:00
|
|
|
fi
|
|
|
|
tar zxf cmake-$version.tar.gz
|
|
|
|
cd cmake-$version
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
../configure --prefix=$DEPLOYDIR
|
|
|
|
make -j$NUMCPU
|
|
|
|
make install
|
|
|
|
}
|
|
|
|
|
2012-05-29 03:25:43 +04:00
|
|
|
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
|
2012-06-02 20:26:44 +04:00
|
|
|
make -j$NUMCPU
|
|
|
|
make install
|
2012-05-29 03:25:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
build_gmp()
|
|
|
|
{
|
|
|
|
version=$1
|
2012-12-21 05:30:05 +04:00
|
|
|
if [ -e $DEPLOYDIR/include/gmp.h ]; then
|
|
|
|
echo "gmp already installed. not building"
|
|
|
|
return
|
|
|
|
fi
|
2012-05-29 03:25:43 +04:00
|
|
|
echo "Building gmp" $version "..."
|
|
|
|
cd $BASEDIR/src
|
|
|
|
rm -rf gmp-$version
|
|
|
|
if [ ! -f gmp-$version.tar.bz2 ]; then
|
2012-12-21 03:35:16 +04:00
|
|
|
curl --insecure -O ftp://ftp.gmplib.org/pub/gmp-$version/gmp-$version.tar.bz2
|
2012-05-29 03:25:43 +04:00
|
|
|
fi
|
|
|
|
tar xjf gmp-$version.tar.bz2
|
|
|
|
cd gmp-$version
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
../configure --prefix=$DEPLOYDIR --enable-cxx
|
2013-02-17 05:52:34 +04:00
|
|
|
make -j$NUMCPU
|
2012-05-29 03:25:43 +04:00
|
|
|
make install
|
|
|
|
}
|
|
|
|
|
|
|
|
build_mpfr()
|
|
|
|
{
|
|
|
|
version=$1
|
2012-12-21 05:30:05 +04:00
|
|
|
if [ -e $DEPLOYDIR/include/mpfr.h ]; then
|
|
|
|
echo "mpfr already installed. not building"
|
|
|
|
return
|
|
|
|
fi
|
2012-05-29 03:25:43 +04:00
|
|
|
echo "Building mpfr" $version "..."
|
|
|
|
cd $BASEDIR/src
|
|
|
|
rm -rf mpfr-$version
|
|
|
|
if [ ! -f mpfr-$version.tar.bz2 ]; then
|
2012-12-21 03:35:16 +04:00
|
|
|
curl --insecure -O http://www.mpfr.org/mpfr-$version/mpfr-$version.tar.bz2
|
2012-05-29 03:25:43 +04:00
|
|
|
fi
|
|
|
|
tar xjf mpfr-$version.tar.bz2
|
|
|
|
cd mpfr-$version
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
../configure --prefix=$DEPLOYDIR --with-gmp=$DEPLOYDIR
|
2013-02-17 05:52:34 +04:00
|
|
|
make -j$NUMCPU
|
2012-05-29 03:25:43 +04:00
|
|
|
make install
|
|
|
|
cd ..
|
|
|
|
}
|
|
|
|
|
|
|
|
build_boost()
|
|
|
|
{
|
2012-12-21 05:30:05 +04:00
|
|
|
if [ -e $DEPLOYDIR/include/boost ]; then
|
|
|
|
echo "boost already installed. not building"
|
|
|
|
return
|
|
|
|
fi
|
2012-05-29 03:25:43 +04:00
|
|
|
version=$1
|
|
|
|
bversion=`echo $version | tr "." "_"`
|
|
|
|
echo "Building boost" $version "..."
|
|
|
|
cd $BASEDIR/src
|
|
|
|
rm -rf boost_$bversion
|
|
|
|
if [ ! -f boost_$bversion.tar.bz2 ]; then
|
2012-12-21 03:35:16 +04:00
|
|
|
curl --insecure -LO http://downloads.sourceforge.net/project/boost/boost/$version/boost_$bversion.tar.bz2
|
2012-05-29 03:25:43 +04:00
|
|
|
fi
|
2013-02-17 05:52:34 +04:00
|
|
|
if [ ! $? -eq 0 ]; then
|
|
|
|
echo download failed.
|
|
|
|
exit 1
|
|
|
|
fi
|
2012-05-29 03:25:43 +04:00
|
|
|
tar xjf boost_$bversion.tar.bz2
|
|
|
|
cd boost_$bversion
|
2012-12-20 22:35:44 +04:00
|
|
|
if [ "`gcc --version|grep 4.7`" ]; then
|
|
|
|
if [ "`echo $version | grep 1.47`" ]; then
|
|
|
|
echo gcc 4.7 incompatible with boost 1.47. edit boost version in $0
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
2012-05-29 03:25:43 +04:00
|
|
|
# We only need certain portions of boost
|
2013-01-30 10:06:54 +04:00
|
|
|
if [ -e ./bootstrap.sh ]; then
|
|
|
|
BSTRAPBIN=./bootstrap.sh
|
|
|
|
else
|
|
|
|
BSTRAPBIN=./configure
|
|
|
|
fi
|
|
|
|
$BSTRAPBIN --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,system,regex
|
|
|
|
if [ -e ./b2 ]; then
|
2013-01-31 05:04:00 +04:00
|
|
|
BJAMBIN=./b2;
|
2013-01-30 10:06:54 +04:00
|
|
|
elif [ -e ./bjam ]; then
|
|
|
|
BJAMBIN=./bjam
|
|
|
|
elif [ -e ./Makefile ]; then
|
|
|
|
BJAMBIN=make
|
|
|
|
fi
|
2012-12-20 23:52:14 +04:00
|
|
|
if [ $CXX ]; then
|
|
|
|
if [ $CXX = "clang++" ]; then
|
2013-02-17 05:52:34 +04:00
|
|
|
$BJAMBIN -j$NUMCPU toolset=clang
|
2012-12-20 23:52:14 +04:00
|
|
|
fi
|
|
|
|
else
|
2013-01-30 10:06:54 +04:00
|
|
|
$BJAMBIN -j$NUMCPU
|
2013-02-17 05:52:34 +04:00
|
|
|
fi
|
|
|
|
if [ $? = 0 ]; then
|
|
|
|
$BJAMBIN install
|
|
|
|
else
|
|
|
|
echo boost build failed
|
|
|
|
exit 1
|
2012-12-20 23:52:14 +04:00
|
|
|
fi
|
2013-03-21 07:29:54 +04:00
|
|
|
if [ "`ls $DEPLOYDIR/include/ | grep boost.[0-9]`" ]; then
|
|
|
|
if [ ! -e $DEPLOYDIR/include/boost ]; then
|
|
|
|
echo "boost is old, make a symlink to $DEPLOYDIR/include/boost & rerun"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2012-05-29 03:25:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
build_cgal()
|
|
|
|
{
|
2012-12-21 05:30:05 +04:00
|
|
|
if [ -e $DEPLOYDIR/include/CGAL/version.h ]; then
|
|
|
|
echo "CGAL already installed. not building"
|
|
|
|
return
|
|
|
|
fi
|
2012-05-29 03:25:43 +04:00
|
|
|
version=$1
|
|
|
|
echo "Building CGAL" $version "..."
|
|
|
|
cd $BASEDIR/src
|
|
|
|
rm -rf CGAL-$version
|
2013-09-21 09:12:42 +04:00
|
|
|
ver4_2="curl --insecure -O https://gforge.inria.fr/frs/download.php/32360/CGAL-4.2.tar.bz2"
|
2013-03-21 07:29:54 +04:00
|
|
|
ver4_1="curl --insecure -O https://gforge.inria.fr/frs/download.php/31640/CGAL-4.1.tar.bz2"
|
|
|
|
ver4_0_2="curl --insecure -O https://gforge.inria.fr/frs/download.php/31174/CGAL-4.0.2.tar.bz2"
|
|
|
|
ver4_0="curl --insecure -O https://gforge.inria.fr/frs/download.php/30387/CGAL-4.0.tar.gz"
|
|
|
|
ver3_9="curl --insecure -O https://gforge.inria.fr/frs/download.php/29125/CGAL-3.9.tar.gz"
|
|
|
|
ver3_8="curl --insecure -O https://gforge.inria.fr/frs/download.php/28500/CGAL-3.8.tar.gz"
|
|
|
|
ver3_7="curl --insecure -O https://gforge.inria.fr/frs/download.php/27641/CGAL-3.7.tar.gz"
|
|
|
|
vernull="echo already downloaded..skipping"
|
2013-09-21 09:12:42 +04:00
|
|
|
download_cmd=ver`echo $version | sed s/"\."/"_"/ | sed s/"\."/"_"/`
|
2013-06-09 08:49:21 +04:00
|
|
|
|
|
|
|
if [ -e CGAL-$version.tar.gz ]; then
|
|
|
|
download_cmd=vernull;
|
|
|
|
fi
|
|
|
|
if [ -e CGAL-$version.tar.bz2 ]; then
|
|
|
|
download_cmd=vernull;
|
|
|
|
fi
|
|
|
|
|
2013-09-21 09:12:42 +04:00
|
|
|
eval echo "$"$download_cmd
|
2013-03-21 07:29:54 +04:00
|
|
|
`eval echo "$"$download_cmd`
|
2013-06-09 08:49:21 +04:00
|
|
|
|
|
|
|
zipper=gzip
|
|
|
|
suffix=gz
|
|
|
|
if [ -e CGAL-$version.tar.bz2 ]; then
|
|
|
|
zipper=bzip2
|
|
|
|
suffix=bz2
|
|
|
|
fi
|
|
|
|
|
|
|
|
$zipper -f -d CGAL-$version.tar.$suffix;
|
|
|
|
tar xf CGAL-$version.tar
|
|
|
|
|
2012-05-29 03:25:43 +04:00
|
|
|
cd CGAL-$version
|
2013-03-21 07:29:54 +04:00
|
|
|
|
|
|
|
# older cmakes have buggy FindBoost that can result in
|
|
|
|
# finding the system libraries but OPENSCAD_LIBRARIES include paths
|
|
|
|
FINDBOOST_CMAKE=$OPENSCAD_SCRIPTDIR/../tests/FindBoost.cmake
|
|
|
|
cp $FINDBOOST_CMAKE ./cmake/modules/
|
|
|
|
|
2013-02-02 03:36:16 +04:00
|
|
|
mkdir bin
|
|
|
|
cd bin
|
|
|
|
rm -rf ./*
|
|
|
|
if [ "`uname -a| grep ppc64`" ]; then
|
|
|
|
CGAL_BUILDTYPE="Release" # avoid assertion violation
|
|
|
|
else
|
|
|
|
CGAL_BUILDTYPE="Debug"
|
|
|
|
fi
|
2013-03-21 07:29:54 +04:00
|
|
|
|
|
|
|
DEBUGBOOSTFIND=0 # for debugging FindBoost.cmake (not for debugging boost)
|
|
|
|
Boost_NO_SYSTEM_PATHS=1
|
2012-12-21 19:31:01 +04:00
|
|
|
if [ "`echo $2 | grep use-sys-libs`" ]; then
|
2013-03-21 07:29:54 +04:00
|
|
|
cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DCMAKE_BUILD_TYPE=$CGAL_BUILDTYPE -DBoost_DEBUG=$DEBUGBOOSTFIND ..
|
2012-07-11 07:52:05 +04:00
|
|
|
else
|
2013-10-31 22:41:02 +04:00
|
|
|
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_LIBRARYDIR=$DEPLOYDIR/lib -DBOOST_INCLUDEDIR=$DEPLOYDIR/include -DCMAKE_BUILD_TYPE=$CGAL_BUILDTYPE -DBoost_DEBUG=$DEBUGBOOSTFIND -DBoost_NO_SYSTEM_PATHS=1 ..
|
2012-07-11 07:52:05 +04:00
|
|
|
fi
|
2012-05-29 03:25:43 +04:00
|
|
|
make -j$NUMCPU
|
|
|
|
make install
|
|
|
|
}
|
|
|
|
|
|
|
|
build_glew()
|
|
|
|
{
|
2013-02-19 05:45:37 +04:00
|
|
|
GLEW_INSTALLED=
|
|
|
|
if [ -e $DEPLOYDIR/lib64/libGLEW.so ]; then
|
|
|
|
GLEW_INSTALLED=1
|
|
|
|
fi
|
|
|
|
if [ -e $DEPLOYDIR/lib/libGLEW.so ]; then
|
|
|
|
GLEW_INSTALLED=1
|
|
|
|
fi
|
|
|
|
if [ $GLEW_INSTALLED ]; then
|
2012-12-21 05:30:05 +04:00
|
|
|
echo "glew already installed. not building"
|
|
|
|
return
|
|
|
|
fi
|
2012-05-29 03:25:43 +04:00
|
|
|
version=$1
|
|
|
|
echo "Building GLEW" $version "..."
|
|
|
|
cd $BASEDIR/src
|
|
|
|
rm -rf glew-$version
|
|
|
|
if [ ! -f glew-$version.tgz ]; then
|
2012-12-21 03:35:16 +04:00
|
|
|
curl --insecure -LO http://downloads.sourceforge.net/project/glew/glew/$version/glew-$version.tgz
|
2012-05-29 03:25:43 +04:00
|
|
|
fi
|
|
|
|
tar xzf glew-$version.tgz
|
|
|
|
cd glew-$version
|
|
|
|
mkdir -p $DEPLOYDIR/lib/pkgconfig
|
2012-07-04 09:27:31 +04:00
|
|
|
|
2012-12-30 03:41:13 +04:00
|
|
|
# Glew's makefile is not built for Linux Multiarch. We aren't trying
|
2012-12-21 06:16:22 +04:00
|
|
|
# to fix everything here, just the test machines OScad normally runs on
|
|
|
|
|
2012-07-16 02:46:38 +04:00
|
|
|
# Fedora 64-bit
|
2012-12-21 06:16:22 +04:00
|
|
|
if [ "`uname -m | grep 64`" ]; then
|
|
|
|
if [ -e /usr/lib64/libXmu.so.6 ]; then
|
2012-12-20 23:52:14 +04:00
|
|
|
sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ config/Makefile.linux
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2012-12-21 06:16:22 +04:00
|
|
|
# debian hurd i386
|
|
|
|
if [ "`uname -m | grep 386`" ]; then
|
|
|
|
if [ -e /usr/lib/i386-gnu/libXi.so.6 ]; then
|
|
|
|
sed -ibak s/"-lXi"/"\-L\/usr\/lib\/i386-gnu\/libXi.so.6"/ config/Makefile.gnu
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# clang linux
|
|
|
|
if [ $CC ]; then
|
2012-12-25 05:44:43 +04:00
|
|
|
sed -ibak s/"CC = cc"/"# CC = cc"/ config/Makefile.linux
|
2012-12-21 06:16:22 +04:00
|
|
|
fi
|
|
|
|
|
2012-12-20 23:52:14 +04:00
|
|
|
MAKER=make
|
|
|
|
if [ "`uname | grep BSD`" ]; then
|
|
|
|
if [ "`command -v gmake`" ]; then
|
|
|
|
MAKER=gmake
|
|
|
|
else
|
|
|
|
echo "building glew on BSD requires gmake (gnu make)"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2012-12-21 06:16:22 +04:00
|
|
|
GLEW_DEST=$DEPLOYDIR $MAKER -j$NUMCPU
|
|
|
|
GLEW_DEST=$DEPLOYDIR $MAKER install
|
2012-05-29 03:25:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
build_opencsg()
|
|
|
|
{
|
2013-02-01 08:16:28 +04:00
|
|
|
if [ -e $DEPLOYDIR/lib/libopencsg.so ]; then
|
2012-12-21 05:30:05 +04:00
|
|
|
echo "OpenCSG already installed. not building"
|
|
|
|
return
|
|
|
|
fi
|
2012-05-29 03:25:43 +04:00
|
|
|
version=$1
|
|
|
|
echo "Building OpenCSG" $version "..."
|
|
|
|
cd $BASEDIR/src
|
|
|
|
rm -rf OpenCSG-$version
|
|
|
|
if [ ! -f OpenCSG-$version.tar.gz ]; then
|
2012-12-21 03:35:16 +04:00
|
|
|
curl --insecure -O http://www.opencsg.org/OpenCSG-$version.tar.gz
|
2012-05-29 03:25:43 +04:00
|
|
|
fi
|
|
|
|
tar xzf OpenCSG-$version.tar.gz
|
|
|
|
cd OpenCSG-$version
|
2012-07-04 09:27:31 +04:00
|
|
|
|
2012-12-21 01:14:54 +04:00
|
|
|
# modify the .pro file for qmake, then use qmake to
|
|
|
|
# manually rebuild the src/Makefile (some systems don't auto-rebuild it)
|
2012-07-04 09:27:31 +04:00
|
|
|
|
2012-12-21 01:14:54 +04:00
|
|
|
cp opencsg.pro opencsg.pro.bak
|
|
|
|
cat opencsg.pro.bak | sed s/example// > opencsg.pro
|
2012-07-18 11:23:37 +04:00
|
|
|
|
2012-07-11 07:52:05 +04:00
|
|
|
if [ "`command -v qmake-qt4`" ]; then
|
2012-07-21 02:01:17 +04:00
|
|
|
OPENCSG_QMAKE=qmake-qt4
|
2012-12-21 01:14:54 +04:00
|
|
|
elif [ "`command -v qmake4`" ]; then
|
|
|
|
OPENCSG_QMAKE=qmake4
|
2013-05-24 06:16:04 +04:00
|
|
|
elif [ "`command -v qmake`" ]; then
|
2012-07-21 02:01:17 +04:00
|
|
|
OPENCSG_QMAKE=qmake
|
2013-05-24 06:16:04 +04:00
|
|
|
else
|
|
|
|
echo qmake not found... using standard OpenCSG makefiles
|
|
|
|
OPENCSG_QMAKE=make
|
|
|
|
cp Makefile Makefile.bak
|
|
|
|
cp src/Makefile src/Makefile.bak
|
|
|
|
|
|
|
|
cat Makefile.bak | sed s/example// |sed s/glew// > Makefile
|
|
|
|
cat src/Makefile.bak | sed s@^INCPATH.*@INCPATH\ =\ -I$BASEDIR/include\ -I../include\ -I..\ -I.@ > src/Makefile
|
|
|
|
cp src/Makefile src/Makefile.bak2
|
|
|
|
cat src/Makefile.bak2 | sed s@^LIBS.*@LIBS\ =\ -L$BASEDIR/lib\ -L/usr/X11R6/lib\ -lGLU\ -lGL@ > src/Makefile
|
|
|
|
tmp=$version
|
2013-09-23 01:35:29 +04:00
|
|
|
detect_glu
|
|
|
|
if [ ! $detect_glu_result ]; then build_glu 9.0.0 ; fi
|
2013-05-24 06:16:04 +04:00
|
|
|
version=$tmp
|
2012-07-11 07:52:05 +04:00
|
|
|
fi
|
2012-07-21 00:51:40 +04:00
|
|
|
|
2012-12-21 01:14:54 +04:00
|
|
|
cd $BASEDIR/src/OpenCSG-$version/src
|
|
|
|
$OPENCSG_QMAKE
|
|
|
|
|
|
|
|
cd $BASEDIR/src/OpenCSG-$version
|
|
|
|
$OPENCSG_QMAKE
|
2012-07-21 00:51:40 +04:00
|
|
|
|
2012-05-29 04:15:49 +04:00
|
|
|
make
|
2012-07-18 11:23:37 +04:00
|
|
|
|
2012-12-21 18:30:27 +04:00
|
|
|
ls lib/* include/*
|
|
|
|
if [ -e lib/.libs ]; then ls lib/.libs/*; fi # netbsd
|
2012-12-21 01:14:54 +04:00
|
|
|
echo "installing to -->" $DEPLOYDIR
|
|
|
|
mkdir -p $DEPLOYDIR/lib
|
|
|
|
mkdir -p $DEPLOYDIR/include
|
|
|
|
install lib/* $DEPLOYDIR/lib
|
|
|
|
install include/* $DEPLOYDIR/include
|
2012-12-21 18:30:27 +04:00
|
|
|
if [ -e lib/.libs ]; then install lib/.libs/* $DEPLOYDIR/lib; fi #netbsd
|
2012-12-21 01:14:54 +04:00
|
|
|
|
2012-12-20 21:55:13 +04:00
|
|
|
cd $BASEDIR
|
2012-05-29 03:25:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
build_eigen()
|
|
|
|
{
|
|
|
|
version=$1
|
2012-12-21 05:30:05 +04:00
|
|
|
if [ -e $DEPLOYDIR/include/eigen3 ]; then
|
|
|
|
if [ `echo $version | grep 3....` ]; then
|
|
|
|
echo "Eigen3 already installed. not building"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
2012-05-29 03:25:43 +04:00
|
|
|
echo "Building eigen" $version "..."
|
|
|
|
cd $BASEDIR/src
|
|
|
|
rm -rf eigen-$version
|
2012-08-19 02:14:17 +04:00
|
|
|
EIGENDIR="none"
|
|
|
|
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
|
2012-05-29 03:25:43 +04:00
|
|
|
if [ ! -f eigen-$version.tar.bz2 ]; then
|
2012-12-21 03:35:16 +04:00
|
|
|
curl --insecure -LO http://bitbucket.org/eigen/eigen/get/$version.tar.bz2
|
2012-05-29 03:25:43 +04:00
|
|
|
mv $version.tar.bz2 eigen-$version.tar.bz2
|
|
|
|
fi
|
|
|
|
tar xjf eigen-$version.tar.bz2
|
2012-08-19 02:14:17 +04:00
|
|
|
ln -s ./$EIGENDIR eigen-$version
|
2012-05-29 03:25:43 +04:00
|
|
|
cd eigen-$version
|
2012-08-19 00:28:36 +04:00
|
|
|
mkdir build
|
|
|
|
cd build
|
2012-12-21 00:46:25 +04:00
|
|
|
cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DEIGEN_TEST_NO_OPENGL=1 ..
|
2012-05-29 03:25:43 +04:00
|
|
|
make -j$NUMCPU
|
|
|
|
make install
|
|
|
|
}
|
|
|
|
|
2012-08-19 16:58:30 +04:00
|
|
|
|
2012-12-25 05:44:43 +04:00
|
|
|
# this section allows 'out of tree' builds, as long as the system has
|
|
|
|
# the 'dirname' command installed
|
|
|
|
|
2012-12-20 21:55:13 +04:00
|
|
|
if [ "`command -v dirname`" ]; then
|
2013-03-21 07:29:54 +04:00
|
|
|
RUNDIR=$PWD
|
2013-02-17 05:52:34 +04:00
|
|
|
OPENSCAD_SCRIPTDIR=`dirname $0`
|
2013-03-21 07:29:54 +04:00
|
|
|
cd $OPENSCAD_SCRIPTDIR
|
|
|
|
OPENSCAD_SCRIPTDIR=$PWD
|
|
|
|
cd $RUNDIR
|
2012-12-20 21:55:13 +04:00
|
|
|
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
|
2012-05-29 03:25:43 +04:00
|
|
|
fi
|
|
|
|
|
2012-12-20 21:55:13 +04:00
|
|
|
. $OPENSCAD_SCRIPTDIR/setenv-unibuild.sh # '.' is equivalent to 'source'
|
2012-07-11 07:52:05 +04:00
|
|
|
SRCDIR=$BASEDIR/src
|
2012-07-15 23:29:14 +04:00
|
|
|
|
2012-07-11 07:52:05 +04:00
|
|
|
if [ ! $NUMCPU ]; then
|
2012-12-20 23:52:14 +04:00
|
|
|
echo "Note: The NUMCPU environment variable can be set for paralell builds"
|
2012-12-30 03:41:13 +04:00
|
|
|
NUMCPU=1
|
2012-07-11 07:52:05 +04:00
|
|
|
fi
|
|
|
|
|
2012-05-29 03:25:43 +04:00
|
|
|
if [ ! -d $BASEDIR/bin ]; then
|
2012-07-18 11:23:37 +04:00
|
|
|
mkdir -p $BASEDIR/bin
|
2012-05-29 03:25:43 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Using basedir:" $BASEDIR
|
2012-06-02 20:26:44 +04:00
|
|
|
echo "Using deploydir:" $DEPLOYDIR
|
|
|
|
echo "Using srcdir:" $SRCDIR
|
2012-07-15 23:29:14 +04:00
|
|
|
echo "Number of CPUs for parallel builds:" $NUMCPU
|
2012-05-29 03:25:43 +04:00
|
|
|
mkdir -p $SRCDIR $DEPLOYDIR
|
2012-06-02 20:58:08 +04:00
|
|
|
|
2012-12-25 05:44:43 +04:00
|
|
|
# this section builds some basic tools, if they are missing or outdated
|
|
|
|
# they are installed under $BASEDIR/bin which we have added to our PATH
|
|
|
|
|
2012-07-04 06:34:00 +04:00
|
|
|
if [ ! "`command -v curl`" ]; then
|
2012-12-20 23:52:14 +04:00
|
|
|
build_curl 7.26.0
|
2012-07-04 06:34:00 +04:00
|
|
|
fi
|
|
|
|
|
2012-12-21 05:18:21 +04:00
|
|
|
if [ ! "`command -v bison`" ]; then
|
|
|
|
build_bison 2.6.1
|
|
|
|
fi
|
|
|
|
|
2012-06-02 20:58:08 +04:00
|
|
|
# NB! For cmake, also update the actual download URL in the function
|
2012-07-04 06:34:00 +04:00
|
|
|
if [ ! "`command -v cmake`" ]; then
|
2012-12-20 23:52:14 +04:00
|
|
|
build_cmake 2.8.8
|
2012-07-04 06:34:00 +04:00
|
|
|
fi
|
2012-07-13 06:31:28 +04:00
|
|
|
if [ "`cmake --version | grep 'version 2.[1-6][^0-9]'`" ]; then
|
2012-12-20 23:52:14 +04:00
|
|
|
build_cmake 2.8.8
|
2012-07-13 06:31:28 +04:00
|
|
|
fi
|
|
|
|
|
2013-02-19 05:45:37 +04:00
|
|
|
# Singly build certain tools or libraries
|
2012-07-11 08:48:29 +04:00
|
|
|
if [ $1 ]; then
|
2013-03-04 03:58:25 +04:00
|
|
|
if [ $1 = "git" ]; then
|
2013-02-19 05:45:37 +04:00
|
|
|
build_git 1.7.10.3
|
|
|
|
exit $?
|
|
|
|
fi
|
2012-12-20 21:55:13 +04:00
|
|
|
if [ $1 = "cgal" ]; then
|
2013-09-21 09:12:42 +04:00
|
|
|
build_cgal 4.0.2 use-sys-libs
|
2013-02-19 05:45:37 +04:00
|
|
|
exit $?
|
2012-07-11 08:48:29 +04:00
|
|
|
fi
|
|
|
|
if [ $1 = "opencsg" ]; then
|
|
|
|
build_opencsg 1.3.2
|
2013-02-19 05:45:37 +04:00
|
|
|
exit $?
|
2012-07-11 08:48:29 +04:00
|
|
|
fi
|
2013-03-04 03:58:25 +04:00
|
|
|
if [ $1 = "qt4" ]; then
|
2013-02-01 06:37:08 +04:00
|
|
|
# such a huge build, put here by itself
|
|
|
|
build_qt4 4.8.4
|
2013-02-19 05:45:37 +04:00
|
|
|
exit $?
|
2013-02-01 06:37:08 +04:00
|
|
|
fi
|
2013-03-04 03:58:25 +04:00
|
|
|
if [ $1 = "glu" ]; then
|
2013-02-01 08:16:28 +04:00
|
|
|
# Mesa and GLU split in late 2012, so it's not on some systems
|
|
|
|
build_glu 9.0.0
|
2013-02-19 05:45:37 +04:00
|
|
|
exit $?
|
2013-02-01 08:16:28 +04:00
|
|
|
fi
|
2012-07-11 07:52:05 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2013-09-23 01:35:29 +04:00
|
|
|
# todo - cgal 4.02 for gcc<4.7, gcc 4.2 for above
|
|
|
|
|
2012-07-11 07:52:05 +04:00
|
|
|
#
|
|
|
|
# Main build of libraries
|
|
|
|
# edit version numbers here as needed.
|
|
|
|
#
|
2012-08-19 16:17:06 +04:00
|
|
|
build_eigen 3.1.1
|
|
|
|
build_gmp 5.0.5
|
|
|
|
build_mpfr 3.1.1
|
2013-05-24 06:16:04 +04:00
|
|
|
build_boost 1.53.0
|
2012-05-29 03:25:43 +04:00
|
|
|
# NB! For CGAL, also update the actual download URL in the function
|
2013-09-21 09:12:42 +04:00
|
|
|
build_cgal 4.0.2
|
2012-12-21 05:30:05 +04:00
|
|
|
build_glew 1.9.0
|
2012-08-19 02:30:47 +04:00
|
|
|
build_opencsg 1.3.2
|
2012-05-29 03:50:31 +04:00
|
|
|
|
2012-07-11 07:52:05 +04:00
|
|
|
echo "OpenSCAD dependencies built and installed to " $BASEDIR
|