blob: d8470860778d3ee6e3e11c659ff2ce5550fb5aba [file] [log] [blame]
DRC1a184072011-06-24 06:55:18 +00001#!/bin/sh
2
3set -u
4set -e
5trap onexit INT
6trap onexit TERM
7trap onexit EXIT
8
9TMPDIR=
10
11onexit()
12{
13 if [ ! "$TMPDIR" = "" ]; then
14 rm -rf $TMPDIR
15 fi
16}
17
18usage()
19{
20 echo "$0 [universal]"
21 exit 1
22}
23
24UNIVERSAL=0
25
26PACKAGE_NAME=TigerVNC
27VERSION=@VERSION@
28BUILD=@BUILD@
29SRCDIR=@CMAKE_SOURCE_DIR@
30BUILDDIR32=@OSX_X86_BUILD@
31if [ $# -gt 0 ]; then
32 if [ "$1" = "universal" ]; then
33 UNIVERSAL=1
34 fi
35fi
36
37if [ -f $PACKAGE_NAME.dmg ]; then
38 rm -f $PACKAGE_NAME.dmg
39fi
40
41umask 022
42TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX`
43APPROOT="$TMPDIR/dmg/TigerVNC Viewer $VERSION.app"
44mkdir -p "$APPROOT/Contents/MacOS"
45mkdir -p "$APPROOT/Contents/Resources"
46
47install -m 755 vncviewer/vncviewer "$APPROOT/Contents/MacOS/TigerVNC Viewer"
48if [ $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"
63fi
64install -m 644 $SRCDIR/release/tigervnc.icns "$APPROOT/Contents/Resources/"
65install -m 644 release/Info.plist "$APPROOT/Contents/"
66
67install -m 644 $SRCDIR/LICENCE.txt $TMPDIR/dmg/
68install -m 644 $SRCDIR/release/README.txt $TMPDIR/dmg/
69
70hdiutil create -fs HFS+ -volname $PACKAGE_NAME-$VERSION \
71 -srcfolder "$TMPDIR/dmg" \
72 $TMPDIR/$PACKAGE_NAME-$VERSION.dmg
73cp $TMPDIR/$PACKAGE_NAME-$VERSION.dmg .
74
75exit