DRC | 1a18407 | 2011-06-24 06:55:18 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -u |
| 4 | set -e |
| 5 | trap onexit INT |
| 6 | trap onexit TERM |
| 7 | trap onexit EXIT |
| 8 | |
| 9 | TMPDIR= |
| 10 | |
| 11 | onexit() |
| 12 | { |
| 13 | if [ ! "$TMPDIR" = "" ]; then |
| 14 | rm -rf $TMPDIR |
| 15 | fi |
| 16 | } |
| 17 | |
| 18 | usage() |
| 19 | { |
| 20 | echo "$0 [universal]" |
| 21 | exit 1 |
| 22 | } |
| 23 | |
| 24 | UNIVERSAL=0 |
| 25 | |
| 26 | PACKAGE_NAME=TigerVNC |
| 27 | VERSION=@VERSION@ |
| 28 | BUILD=@BUILD@ |
| 29 | SRCDIR=@CMAKE_SOURCE_DIR@ |
| 30 | BUILDDIR32=@OSX_X86_BUILD@ |
| 31 | if [ $# -gt 0 ]; then |
| 32 | if [ "$1" = "universal" ]; then |
| 33 | UNIVERSAL=1 |
| 34 | fi |
| 35 | fi |
| 36 | |
| 37 | if [ -f $PACKAGE_NAME.dmg ]; then |
| 38 | rm -f $PACKAGE_NAME.dmg |
| 39 | fi |
| 40 | |
| 41 | umask 022 |
| 42 | TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX` |
| 43 | APPROOT="$TMPDIR/dmg/TigerVNC Viewer $VERSION.app" |
| 44 | mkdir -p "$APPROOT/Contents/MacOS" |
| 45 | mkdir -p "$APPROOT/Contents/Resources" |
| 46 | |
| 47 | install -m 755 vncviewer/vncviewer "$APPROOT/Contents/MacOS/TigerVNC Viewer" |
| 48 | if [ $UNIVERSAL = 1 ]; then |
| 49 | if [ ! -d $BUILDDIR32 ]; then |
| 50 | echo ERROR: 32-bit build directory $BUILDDIR32 does not exist |
| 51 | exit 1 |
| 52 | fi |
| 53 | if [ ! -f $BUILDDIR32/Makefile ]; then |
| 54 | echo ERROR: 32-bit build directory $BUILDDIR32 is not configured |
| 55 | exit 1 |
| 56 | fi |
| 57 | pushd $BUILDDIR32 |
| 58 | make |
| 59 | popd |
| 60 | lipo -create -arch i386 $BUILDDIR32/vncviewer/vncviewer -arch x86_64 \ |
| 61 | "$APPROOT/Contents/MacOS/TigerVNC Viewer" \ |
| 62 | -output "$APPROOT/Contents/MacOS/TigerVNC Viewer" |
| 63 | fi |
| 64 | install -m 644 $SRCDIR/release/tigervnc.icns "$APPROOT/Contents/Resources/" |
| 65 | install -m 644 release/Info.plist "$APPROOT/Contents/" |
| 66 | |
| 67 | install -m 644 $SRCDIR/LICENCE.txt $TMPDIR/dmg/ |
| 68 | install -m 644 $SRCDIR/release/README.txt $TMPDIR/dmg/ |
| 69 | |
| 70 | hdiutil create -fs HFS+ -volname $PACKAGE_NAME-$VERSION \ |
| 71 | -srcfolder "$TMPDIR/dmg" \ |
| 72 | $TMPDIR/$PACKAGE_NAME-$VERSION.dmg |
| 73 | cp $TMPDIR/$PACKAGE_NAME-$VERSION.dmg . |
| 74 | |
| 75 | exit |