summaryrefslogtreecommitdiff
path: root/release-win32.sh
blob: 540eab9733f14d7fcc4d8ce15f22bbe867cddc54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh
#
# This script creates a binary release of OpenSCAD for Mac OS X.
# The script will create a file called openscad-<versionstring>.zip
# in the current directory.
# 
# Usage: release-win32.sh [-v <versionstring>]
#  -v   Version string (e.g. -v 2010.01)
#
# If no version string is given, todays date will be used (YYYY-MM-DD)
#

#used for windows
ZIP="/c/Program Files/7-Zip/7z.exe"
ZIPARGS="a -tzip"

printUsage()
{
  echo "Usage: $0 -v <versionstring> -t <buildtarget>"
  echo
  echo "  Example: $0 -v 2010.01 -t release"
}

OS=OSX
if test "`uname -o`" == "Msys"; then
    OS=WIN
fi

echo "detected OS= $OS"

while getopts 'v:' c
do
  case $c in
    v) VERSION=$OPTARG;;
    b) TARGET=$OPTARG;;
  esac
done

if test -z "$VERSION"; then
    VERSION=`date "+%Y.%m.%d"`
fi

if test -z "$TARGET"; then
    TARGET=release
fi

echo "Building openscad-$VERSION $CONFIGURATION..."

case $OS in
    OSX) 
        CONFIG = mdi;;
    WIN) 
        unset CONFIG
        export QTDIR=/c/devmingw/qt2009.03
        export QTMAKESPEC=win32-g++
        export PATH=$PATH:/c/devmingw/qt2009.03/bin:/c/devmingw/qt2009.03/qt/bin
        ;;
esac

qmake VERSION=$VERSION CONFIG+=$CONFIG
make clean
if test $OS == WIN; then
    #if the following files are missing their tried removal stops the build process on msys
    touch -t 200012121010 parser_yacc.h parser_yacc.cpp lexer_lex.cpp
fi

make -j2 $TARGET

echo "Preparing executable..."

echo "Creating directory structure..."
rm -rf openscad-$VERSION
rm -f openscad-$VERSION.zip
mkdir -p openscad-$VERSION/examples
cp examples/* openscad-$VERSION/examples/

case $OS in
    OSX) ;;
    WIN)
        #package
        cp win32deps/* openscad-$VERSION
        cp $TARGET/openscad.exe openscad-$VERSION
        ;;
esac

echo "Creating directory structure..."
case $OS in
    OSX) ;;
    WIN)
        "$ZIP" $ZIPARGS openscad-$VERSION.zip openscad-$VERSION
        ;;
esac

rm -rf openscad-$VERSION

echo "binary created: openscad-$VERSION.zip"
contact: Jan Huwald // Impressum