2012-07-15 18:39:20 +04:00
|
|
|
#!/bin/sh -e
|
|
|
|
#
|
|
|
|
# This script builds all library dependencies of OpenSCAD for cross-compilation
|
|
|
|
# from linux to mingw32 for windows, using the MXE cross build system.
|
|
|
|
#
|
|
|
|
# This script must be run from the OpenSCAD source root directory
|
|
|
|
#
|
|
|
|
# Usage: ./scripts/mingw-x-build-dependencies.sh
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
|
|
|
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
|
|
|
|
BASEDIR=$HOME/openscad_deps
|
|
|
|
MXEDIR=$BASEDIR/mxe
|
|
|
|
PATH=$MXEDIR/usr/bin:$PATH
|
|
|
|
|
|
|
|
echo MXEDIR: $MXEDIR
|
|
|
|
echo BASEDIR: $BASEDIR
|
|
|
|
echo OPENSCADDIR: $OPENSCADDIR
|
|
|
|
echo PATH modified with $MXEDIR/usr/bin
|
|
|
|
if [ ! $NUMCPU ]; then
|
2012-07-15 19:25:15 +04:00
|
|
|
echo "note: you can 'export NUMCPU=x' for multi-core compiles (x=number)";
|
2012-07-15 18:39:20 +04:00
|
|
|
NUMCPU=1
|
|
|
|
fi
|
2012-07-15 19:25:15 +04:00
|
|
|
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-15 18:39:20 +04:00
|
|
|
echo NUMCPU: $NUMCPU
|
2012-07-15 19:25:15 +04:00
|
|
|
echo NUMJOBS: $NUMJOBS
|
2012-07-15 18:39:20 +04:00
|
|
|
|
|
|
|
cd $BASEDIR
|
2012-07-15 20:47:18 +04:00
|
|
|
if [ ! -e mxe ]; then
|
2012-07-15 21:28:06 +04:00
|
|
|
echo "Downloading MXE into " $MXEDIR
|
2012-07-15 20:47:18 +04:00
|
|
|
git clone git://github.com/mxe/mxe.git
|
|
|
|
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
|
2012-07-15 20:47:18 +04:00
|
|
|
echo "make mpfr eigen opencsg cgal qt -j $NUMCPU JOBS=$NUMJOBS"
|
2012-07-15 19:25:15 +04:00
|
|
|
make mpfr eigen opencsg cgal qt -j $NUMCPU JOBS=$NUMJOBS
|
|
|
|
#make mpfr -j$NUMCPU JOBS=$NUMJOBS # for testing
|
2012-07-15 18:39:20 +04:00
|
|
|
|
|
|
|
echo "leaving" $MXEDIR
|
|
|
|
echo "entering $OPENSCADDIR"
|
|
|
|
cd $OPENSCADDIR
|
2012-07-15 20:47:18 +04:00
|
|
|
if [ -e mingw-cross-env ]; then
|
|
|
|
rm ./mingw-cross-env
|
2012-07-15 18:39:20 +04:00
|
|
|
fi
|
2012-07-15 20:47:18 +04:00
|
|
|
echo "linking mingw-cross-env directory"
|
|
|
|
ln -s $MXEDIR/usr/i686-pc-mingw32/ ./mingw-cross-env
|
2012-07-15 18:39:20 +04:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "now copy/paste the following to cross-build openscad"
|
|
|
|
echo
|
2012-07-15 20:47:18 +04:00
|
|
|
echo "export PATH=$MXEDIR/usr/bin:\$PATH"
|
2012-07-15 18:39:20 +04:00
|
|
|
echo "i686-pc-mingw32-qmake CONFIG+=mingw-cross-env openscad.pro"
|
2012-07-15 21:33:57 +04:00
|
|
|
#echo "make -j$NUMCPU" # causes parser_yacc.hpp errors
|
|
|
|
echo "make"
|
2012-07-15 18:39:20 +04:00
|
|
|
echo
|