summaryrefslogtreecommitdiff
path: root/scripts/release-common.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/release-common.sh')
-rwxr-xr-xscripts/release-common.sh134
1 files changed, 115 insertions, 19 deletions
diff --git a/scripts/release-common.sh b/scripts/release-common.sh
index 94a8634..62f8ed8 100755
--- a/scripts/release-common.sh
+++ b/scripts/release-common.sh
@@ -2,11 +2,11 @@
#
# This script creates a binary release of OpenSCAD.
# This should work under Mac OS X, Windows (msys), and Linux cross-compiling
-# for windows using mingw-cross-env (use like: OS=LINXWIN release-common.sh).
+# for windows using mingw-cross-env (use like: OSTYPE=mingw-cross-env release-common.sh).
# Linux support pending.
# The script will create a file called openscad-<versionstring>.zip
-# in the current directory.
-#
+# in the current directory (or in the $DEPLOYDIR of a mingw cross build)
+#
# Usage: release-common.sh [-v <versionstring>] [-c]
# -v Version string (e.g. -v 2010.01)
# -c Build with commit info
@@ -24,6 +24,12 @@ printUsage()
echo " Example: $0 -v 2010.01
}
+OPENSCADDIR=$PWD
+if [ ! -f $OPENSCADDIR/openscad.pro ]; then
+ echo "Must be run from the OpenSCAD source root directory"
+ exit 1
+fi
+
if [[ "$OSTYPE" =~ "darwin" ]]; then
OS=MACOSX
elif [[ $OSTYPE == "msys" ]]; then
@@ -54,6 +60,37 @@ if test -z "$VERSION"; then
VERSION=`date "+%Y.%m.%d"`
fi
+
+echo "Checking pre-requisites..."
+
+case $OS in
+ LINXWIN)
+ MAKENSIS=
+
+ if [ "`command -v makensis`" ]; then
+ MAKENSIS=makensis
+ elif [ "`command -v i686-pc-mingw32-makensis`" ]; then
+ MAKENSIS=i686-pc-mingw32-makensis
+ else
+ echo "makensis not found. please install nsis"
+ exit 1
+ fi
+ echo NSIS makensis found: $MAKENSIS
+ ;;
+esac
+
+if [ ! -e $OPENSCADDIR/libraries/MCAD/__init__.py ]; then
+ echo "Downloading MCAD"
+ git submodule init
+ git submodule update
+else
+ echo "MCAD found:" $OPENSCADDIR/libraries/MCAD
+fi
+
+if [ -d .git ]; then
+ git submodule update
+fi
+
echo "Building openscad-$VERSION $CONFIGURATION..."
case $OS in
@@ -72,22 +109,34 @@ case $OS in
;;
LINXWIN)
unset CONFIG
+ . ./scripts/setenv-mingw-xbuild.sh
TARGET=release
ZIP="zip"
ZIPARGS="-r"
;;
esac
+
case $OS in
LINXWIN)
- i686-pc-mingw32-qmake VERSION=$VERSION OPENSCAD_COMMIT=$OPENSCAD_COMMIT CONFIG+=$CONFIG CONFIG+=mingw-cross-env CONFIG-=debug openscad.pro
+ cd $DEPLOYDIR && i686-pc-mingw32-qmake VERSION=$VERSION OPENSCAD_COMMIT=$OPENSCAD_COMMIT CONFIG+=$CONFIG CONFIG+=mingw-cross-env CONFIG-=debug ../openscad.pro
+ cd $OPENSCADDIR
;;
*)
qmake VERSION=$VERSION OPENSCAD_COMMIT=$OPENSCAD_COMMIT CONFIG+=$CONFIG CONFIG-=debug openscad.pro
;;
esac
-make -s clean
+case $OS in
+ LINXWIN)
+ cd $DEPLOYDIR && make -s clean
+ cd $OPENSCADDIR
+ ;;
+ *)
+ make -s clean
+ ;;
+esac
+
case $OS in
MACOSX)
rm -rf OpenSCAD.app
@@ -98,7 +147,16 @@ case $OS in
;;
esac
-make -j2 $TARGET
+case $OS in
+ LINXWIN)
+ # make -jx sometimes has problems with parser_yacc
+ cd $DEPLOYDIR && make $TARGET
+ cd $OPENSCADDIR
+ ;;
+ *)
+ make -j2 $TARGET
+ ;;
+esac
if [[ $? != 0 ]]; then
echo "Error building OpenSCAD. Aborting."
@@ -112,6 +170,12 @@ case $OS in
EXAMPLESDIR=OpenSCAD.app/Contents/Resources/examples
LIBRARYDIR=OpenSCAD.app/Contents/Resources/libraries
;;
+ LINXWIN)
+ EXAMPLESDIR=$DEPLOYDIR/openscad-$VERSION/examples/
+ LIBRARYDIR=$DEPLOYDIR/openscad-$VERSION/libraries/
+ rm -rf $DEPLOYDIR/openscad-$VERSION
+ mkdir $DEPLOYDIR/openscad-$VERSION
+ ;;
*)
EXAMPLESDIR=openscad-$VERSION/examples/
LIBRARYDIR=openscad-$VERSION/libraries/
@@ -120,10 +184,6 @@ case $OS in
;;
esac
-if [ -d .git ]; then
- git submodule update
-fi
-
if [ -n $EXAMPLESDIR ]; then
echo $EXAMPLESDIR
mkdir -p $EXAMPLESDIR
@@ -133,9 +193,14 @@ fi
if [ -n $LIBRARYDIR ]; then
echo $LIBRARYDIR
mkdir -p $LIBRARYDIR
- cp -R libraries/* $LIBRARYDIR
+ # exclude the .git stuff from MCAD which is a git submodule.
+ # tar is a relatively portable way to do exclusion, without the
+ # risks of rm
+ rm -f libraries.tar
+ tar cf libraries.tar --exclude=.git* libraries
+ cd $LIBRARYDIR/.. && tar xf $OPENSCADDIR/libraries.tar && cd $OPENSCADDIR
+ rm -f libraries.tar
chmod -R u=rwx,go=r,+X $LIBRARYDIR/*
- rm -rf `find $LIBRARYDIR -name ".git"`
fi
echo "Creating archive.."
@@ -158,15 +223,42 @@ case $OS in
;;
LINXWIN)
#package
+ echo "Creating binary package"
+ cd $DEPLOYDIR
cp $TARGET/openscad.exe openscad-$VERSION
rm -f OpenSCAD-$VERSION.zip
"$ZIP" $ZIPARGS OpenSCAD-$VERSION.zip openscad-$VERSION
- cp scripts/installer.nsi openscad-$VERSION/
- cd openscad-$VERSION && makensis installer.nsi && cd ..
- cp openscad-$VERSION/openscad_setup.exe OpenSCAD-$VERSION-Installer.exe
- rm -rf openscad-$VERSION
- echo "Binary created: OpenSCAD-$VERSION.zip"
- echo "Installer created: OpenSCAD-$VERSION-Installer.exe"
+ cd $OPENSCADDIR
+ echo "Binary package created"
+
+ echo "Creating installer"
+ echo "Copying NSIS files to $DEPLOYDIR/openscad-$VERSION"
+ cp ./scripts/installer.nsi $DEPLOYDIR/openscad-$VERSION
+ cp ./scripts/mingw-file-association.nsh $DEPLOYDIR/openscad-$VERSION
+ cd $DEPLOYDIR/openscad-$VERSION
+ NSISDEBUG=-V2
+ # NSISDEBUG= # leave blank for full log
+ echo $MAKENSIS $NSISDEBUG installer.nsi
+ $MAKENSIS $NSISDEBUG installer.nsi
+ cp $DEPLOYDIR/openscad-$VERSION/openscad_setup.exe $DEPLOYDIR/OpenSCAD-$VERSION-Installer.exe
+ cd $OPENSCADDIR
+
+ BINFILE=$DEPLOYDIR/OpenSCAD-$VERSION.zip
+ INSTFILE=$DEPLOYDIR/OpenSCAD-$VERSION-Installer.exe
+ if [ -e $BINFILE ]; then
+ if [ -e $INSTFILE ]; then
+ echo
+ echo "Binary created:" $BINFILE
+ echo "Installer created:" $INSTFILE
+ echo
+ else
+ echo "Build failed. Cannot find" $INSTFILE
+ exit 1
+ fi
+ else
+ echo "Build failed. Cannot find" $BINFILE
+ exit 1
+ fi
;;
LINUX)
# Do stuff from release-linux.sh
@@ -186,6 +278,10 @@ case $OS in
strip openscad-$VERSION/lib/openscad/*
cp scripts/installer-linux.sh openscad-$VERSION/install.sh
chmod 755 -R openscad-$VERSION/
- tar cz openscad-$VERSION > openscad-$VERSION.x86-$ARCH.tar.gz
+ PACKAGEFILE=openscad-$VERSION.x86-$ARCH.tar.gz
+ tar cz openscad-$VERSION > $PACKAGEFILE
+ echo
+ echo "Binary created:" $PACKAGEFILE
+ echo
;;
esac
contact: Jan Huwald // Impressum