2012-07-15 18:39:20 +04:00
|
|
|
#!/bin/sh -e
|
|
|
|
#
|
|
|
|
# This script builds all library dependencies of OpenSCAD for cross-compilation
|
2013-05-16 15:54:34 +04:00
|
|
|
# from linux to mingw32/64 for windows, using the MXE cross build system.
|
2012-07-15 18:39:20 +04:00
|
|
|
#
|
|
|
|
# This script must be run from the OpenSCAD source root directory
|
|
|
|
#
|
2013-05-16 15:54:34 +04:00
|
|
|
# Usage:
|
2013-11-30 23:42:09 +04:00
|
|
|
# ./scripts/mingw-x-build-dependencies.sh # 32 bit
|
|
|
|
# ./scripts/mingw-x-build-dependencies.sh 64 # 64 bit
|
|
|
|
#
|
|
|
|
# If you just want to download, and build later:
|
|
|
|
#
|
|
|
|
# ./scripts/mingw-x-build-dependencies.sh download # 32 bit download
|
|
|
|
# ./scripts/mingw-x-build-dependencies.sh 64 download # 64 bit download
|
2012-07-15 18:39:20 +04:00
|
|
|
#
|
|
|
|
# Prerequisites:
|
|
|
|
#
|
|
|
|
# Please see http://mxe.cc/#requirements
|
|
|
|
#
|
|
|
|
# Also see http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Cross-compiling_for_Windows_on_Linux_or_Mac_OS_X
|
|
|
|
#
|
2013-05-16 15:54:34 +04:00
|
|
|
# Also note the 64 bit is built on the branch of mxe by Tony Theodore
|
|
|
|
# which hasnt been merged to official mxe as of writing
|
2012-07-15 18:39:20 +04:00
|
|
|
|
|
|
|
OPENSCADDIR=$PWD
|
|
|
|
if [ ! -f $OPENSCADDIR/openscad.pro ]; then
|
2012-07-15 19:25:15 +04:00
|
|
|
echo "Must be run from the OpenSCAD source root directory"
|
|
|
|
exit 0
|
2012-07-15 18:39:20 +04:00
|
|
|
fi
|
2012-08-02 07:02:45 +04:00
|
|
|
echo OPENSCADDIR: $OPENSCADDIR
|
|
|
|
|
|
|
|
if [ ! $NUMCPU ]; then
|
|
|
|
echo "note: you can 'export NUMCPU=x' for multi-core compiles (x=number)";
|
|
|
|
NUMCPU=1
|
|
|
|
fi
|
|
|
|
if [ ! $NUMJOBS ]; then
|
|
|
|
echo "note: you can 'export NUMJOBS=x' for building multiple pkgs at once"
|
|
|
|
if [ $NUMCPU -gt 2 ]; then
|
|
|
|
NUMJOBS=$((NUMCPU/2))
|
|
|
|
else
|
|
|
|
NUMJOBS=1
|
|
|
|
fi
|
|
|
|
fi
|
2012-07-29 19:24:38 +04:00
|
|
|
|
2013-05-16 15:54:34 +04:00
|
|
|
. ./scripts/setenv-mingw-xbuild.sh $*
|
2012-07-15 18:39:20 +04:00
|
|
|
|
2012-08-02 05:35:12 +04:00
|
|
|
if [ ! -e $BASEDIR ]; then
|
|
|
|
mkdir -p $BASEDIR
|
2012-07-15 18:39:20 +04:00
|
|
|
fi
|
|
|
|
|
2012-08-05 02:18:36 +04:00
|
|
|
if [ ! -e $MXEDIR ]; then
|
2012-12-03 08:16:15 +04:00
|
|
|
mkdir -p $MXEDIR
|
2013-05-18 19:49:26 +04:00
|
|
|
cd $MXEDIR/..
|
|
|
|
echo "Downloading MXE into " $PWD
|
2013-11-24 04:38:45 +04:00
|
|
|
git clone git://github.com/mxe/mxe.git $MXEDIR
|
2012-07-15 20:47:18 +04:00
|
|
|
fi
|
2012-07-15 18:39:20 +04:00
|
|
|
|
2012-07-15 21:28:06 +04:00
|
|
|
echo "entering" $MXEDIR
|
2012-07-15 18:39:20 +04:00
|
|
|
cd $MXEDIR
|
2013-05-17 07:59:58 +04:00
|
|
|
if [ "`echo $* | grep 64`" ]; then
|
2013-11-30 23:42:09 +04:00
|
|
|
MXE_TARGETS='x86_64-w64-mingw32'
|
|
|
|
if [ "`echo $* | grep download`" ]; then
|
2013-12-30 03:58:16 +04:00
|
|
|
PACKAGES='download-mpfr download-eigen download-opencsg download-cgal download-qt download-glib'
|
2013-11-30 23:42:09 +04:00
|
|
|
else
|
2013-12-30 03:58:16 +04:00
|
|
|
PACKAGES='mpfr eigen opencsg cgal qt glib'
|
2013-11-30 23:42:09 +04:00
|
|
|
fi
|
2013-05-17 07:59:58 +04:00
|
|
|
else
|
2013-11-30 23:42:09 +04:00
|
|
|
MXE_TARGETS='i686-pc-mingw32' # fixme - does this work? test it.
|
|
|
|
if [ "`echo $* | grep download`" ]; then
|
2013-12-30 03:58:16 +04:00
|
|
|
PACKAGES='download-mpfr download-eigen download-opencsg download-cgal download-qt download-nsis download-glib'
|
2013-11-30 23:42:09 +04:00
|
|
|
else
|
2013-12-30 03:58:16 +04:00
|
|
|
PACKAGES='mpfr eigen opencsg cgal qt nsis glib'
|
2013-11-30 23:42:09 +04:00
|
|
|
fi
|
2013-05-17 07:59:58 +04:00
|
|
|
fi
|
|
|
|
echo make $PACKAGES MXE_TARGETS=$MXE_TARGETS -j $NUMCPU JOBS=$NUMJOBS
|
|
|
|
make $PACKAGES MXE_TARGETS=$MXE_TARGETS -j $NUMCPU JOBS=$NUMJOBS
|
2012-07-15 18:39:20 +04:00
|
|
|
|
|
|
|
echo "leaving" $MXEDIR
|
2012-08-02 05:35:12 +04:00
|
|
|
|
2012-07-15 18:39:20 +04:00
|
|
|
echo "entering $OPENSCADDIR"
|
|
|
|
cd $OPENSCADDIR
|
2012-08-02 05:35:12 +04:00
|
|
|
|