2012-07-29 19:24:38 +04:00
|
|
|
#!/bin/sh -e
|
|
|
|
#
|
|
|
|
# This script builds a binary install package of OpenSCAD for Windows
|
|
|
|
# using a cross-built mingw OpenSCAD and the NSIS installer system
|
|
|
|
#
|
|
|
|
# This script must be run from the OpenSCAD source root directory
|
|
|
|
#
|
2012-07-29 19:51:31 +04:00
|
|
|
# Usage: ./scripts/mingw-x-build-installer.sh
|
2012-07-29 19:24:38 +04:00
|
|
|
#
|
2012-08-02 05:44:41 +04:00
|
|
|
# Result: binary installer in $DEPLOYDIR directory
|
2012-07-29 19:24:38 +04:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# Prerequisites:
|
|
|
|
#
|
2012-08-02 05:44:41 +04:00
|
|
|
# source ./scripts/setenv-mingw-xbuild.sh
|
|
|
|
# ./scripts/mingw-x-build-dependencues.sh
|
|
|
|
#
|
|
|
|
# and then build openscad before running this script.
|
2012-07-29 19:24:38 +04:00
|
|
|
#
|
|
|
|
# You need MCAD. run 'git submodule init && git submodule update'
|
|
|
|
#
|
|
|
|
# You need the Nullsoft installer system, on ubuntu 'sudo apt-get install nsis'
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
echo "Must be run from the OpenSCAD source root directory"
|
2012-08-05 02:18:36 +04:00
|
|
|
exit 1
|
2012-07-29 19:24:38 +04:00
|
|
|
fi
|
|
|
|
|
2012-08-02 05:44:41 +04:00
|
|
|
. ./scripts/setenv-mingw-xbuild.sh
|
|
|
|
|
2012-08-05 02:18:36 +04:00
|
|
|
if [ ! -e $OPENSCADDIR/libraries/MCAD/__init__.py ]; then
|
2012-08-02 05:44:41 +04:00
|
|
|
echo "Downloading MCAD"
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
2012-07-29 19:24:38 +04:00
|
|
|
fi
|
|
|
|
|
2012-08-02 05:44:41 +04:00
|
|
|
if [ ! -e $DEPLOYDIR ]; then
|
|
|
|
echo $DEPLOYDIR "empty. Please build OpenSCAD for mingw32 first."
|
2012-08-05 02:18:36 +04:00
|
|
|
exit 1
|
2012-07-29 19:24:38 +04:00
|
|
|
fi
|
|
|
|
|
2012-08-02 07:02:45 +04:00
|
|
|
OPENSCAD_EXE=$DEPLOYDIR/release/openscad.exe
|
|
|
|
|
|
|
|
if [ ! -e $OPESCAD_EXE ]; then
|
|
|
|
echo "Can't find" $OPENSCAD_EXE "Please build OpenSCAD for mingw32 first."
|
2012-08-05 02:18:36 +04:00
|
|
|
exit 1
|
2012-07-29 19:24:38 +04:00
|
|
|
fi
|
|
|
|
|
2012-08-05 02:18:36 +04:00
|
|
|
MAKENSIS=
|
|
|
|
|
2012-07-29 19:24:38 +04:00
|
|
|
if [ ! "`command -v makensis`" ]; then
|
2012-08-05 02:18:36 +04:00
|
|
|
MAKENSIS=makensis
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! "`command -v i686-pc-mingw32-makensis`" ]; then
|
|
|
|
MAKENSIS=i686-pc-mingw32-makensis
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! $MAKENSIS ]; then
|
2012-07-29 19:24:38 +04:00
|
|
|
echo "makensis not found. please install nsis"
|
2012-08-05 02:18:36 +04:00
|
|
|
exit 1
|
2012-07-29 19:24:38 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2012-08-02 05:44:41 +04:00
|
|
|
echo "Copying files to" $DEPLOYDIR
|
2012-07-29 19:24:38 +04:00
|
|
|
|
2012-08-02 07:02:45 +04:00
|
|
|
copy_files()
|
|
|
|
{
|
|
|
|
echo "copying" $1
|
|
|
|
cp -a $1 $2
|
|
|
|
}
|
|
|
|
|
|
|
|
copy_files $OPENSCADDIR/libraries $DEPLOYDIR
|
|
|
|
copy_files $OPENSCADDIR/examples $DEPLOYDIR
|
|
|
|
copy_files $OPENSCADDIR/scripts/installer.nsi $DEPLOYDIR
|
|
|
|
copy_files $OPENSCADDIR/scripts/mingw-file-association.nsh $DEPLOYDIR
|
2012-07-29 19:24:38 +04:00
|
|
|
|
2012-08-02 07:02:45 +04:00
|
|
|
echo "running makensis in" $DEPLOYDIR
|
2012-07-29 19:24:38 +04:00
|
|
|
|
2012-08-02 07:02:45 +04:00
|
|
|
cd $DEPLOYDIR && makensis -V2 installer.nsi
|
2012-08-03 06:52:47 +04:00
|
|
|
# cd $DEPLOYDIR && makensis installer.nsi # debug nsis
|
2012-07-29 19:24:38 +04:00
|
|
|
|
|
|
|
cd $OPENSCADDIR
|
|
|
|
|
2012-08-02 05:44:41 +04:00
|
|
|
INSTALLFILE=$DEPLOYDIR/openscad_setup.exe
|
2012-07-29 19:24:38 +04:00
|
|
|
|
|
|
|
if [ -e $INSTALLFILE ]; then
|
2012-08-02 07:02:45 +04:00
|
|
|
echo "Build complete. Install file ready:"
|
|
|
|
echo " " $INSTALLFILE
|
2012-07-29 19:24:38 +04:00
|
|
|
else
|
|
|
|
echo "Build failed. Sorry."
|
|
|
|
fi
|
|
|
|
|