diff options
Diffstat (limited to 'release/makemacpkg.in')
-rw-r--r-- | release/makemacpkg.in | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/release/makemacpkg.in b/release/makemacpkg.in new file mode 100644 index 00000000..7b806f26 --- /dev/null +++ b/release/makemacpkg.in @@ -0,0 +1,101 @@ +#!/bin/sh + +set -u +set -e +trap onexit INT +trap onexit TERM +trap onexit EXIT + +TMPDIR= + +onexit() +{ + if [ ! "$TMPDIR" = "" ]; then + sudo rm -rf $TMPDIR + fi +} + +usage() +{ + echo "$0 [universal [32-bit build dir]]" + exit 1 +} + +UNIVERSAL=0 + +PACKAGE_NAME=@PACKAGE_NAME@ +VERSION=@VERSION@ +BUILD=@BUILD@ +SRCDIR=@srcdir@ +BUILDDIR32=@srcdir@/osxx86 +if [ $# -gt 0 ]; then + if [ "$1" = "universal" ]; then + UNIVERSAL=1 + if [ $# -gt 1 ]; then BUILDDIR32=$2; fi + fi +fi +PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker + +if [ -f $PACKAGE_NAME.dmg ]; then + rm -f $PACKAGE_NAME.dmg +fi + +umask 022 +TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX` +PKGROOT=$TMPDIR/pkg/Package_Root +mkdir -p $PKGROOT/opt/$PACKAGE_NAME/bin +mkdir -p $PKGROOT/opt/$PACKAGE_NAME/man/man1 + +install -m 755 unix/vncviewer/vncviewer $PKGROOT/opt/$PACKAGE_NAME/bin/ + +if [ $UNIVERSAL = 1 ]; then + if [ ! -d $BUILDDIR32 ]; then + echo ERROR: 32-bit build directory $BUILDDIR32 does not exist + exit 1 + fi + if [ ! -f $BUILDDIR32/Makefile ]; then + echo ERROR: 32-bit build directory $BUILDDIR32 is not configured + exit 1 + fi + pushd $BUILDDIR32 + make + popd + lipo -create -arch i386 $BUILDDIR32/unix/vncviewer/vncviewer -arch x86_64 \ + $PKGROOT/opt/$PACKAGE_NAME/bin/vncviewer \ + -output $PKGROOT/opt/$PACKAGE_NAME/bin/vncviewer +fi + +mkdir -p $PKGROOT/Library/Documentation/$PACKAGE_NAME +chmod 1775 $PKGROOT/Library +chmod 775 $PKGROOT/Library/Documentation +mkdir -p $TMPDIR/pkg/Resources + +(cat $SRCDIR/release/Description.plist.tmpl | sed s/{__VERSION}/$VERSION/g \ + | sed s/{__APPNAME}/$PACKAGE_NAME/g \ + > $TMPDIR/pkg/Description.plist) +(cat $SRCDIR/release/Info.plist.tmpl | sed s/{__VERSION}/$VERSION/g \ + | sed s/{__BUILD}/$BUILD/g > $TMPDIR/pkg/Info.plist) +(cat $SRCDIR/release/uninstall.sh.tmpl \ + | sed s/{__APPNAME}/$PACKAGE_NAME/g \ + > $PKGROOT/opt/$PACKAGE_NAME/bin/uninstall) +chmod 755 $PKGROOT/opt/$PACKAGE_NAME/bin/uninstall + +install -m 644 $SRCDIR/unix/vncviewer/vncviewer.man $PKGROOT/opt/$PACKAGE_NAME/man/man1/vncviewer.1 +install -m 644 $SRCDIR/LICENCE.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/ + +sudo chown -R root:admin $PKGROOT +cp $SRCDIR/release/License.rtf $SRCDIR/release/Welcome.rtf $SRCDIR/release/ReadMe.rtf $TMPDIR/pkg/Resources/ + +mkdir $TMPDIR/dmg +$PACKAGEMAKER -build -v -p $TMPDIR/dmg/$PACKAGE_NAME.pkg \ + -f $PKGROOT -r $TMPDIR/pkg/Resources \ + -i $TMPDIR/pkg/Info.plist -d $TMPDIR/pkg/Description.plist +install -m 644 $SRCDIR/release/uninstall.applescript $TMPDIR +sudo osacompile -t APPL -o "$TMPDIR/dmg/Uninstall.app" $TMPDIR/uninstall.applescript +sudo chown -R $USER "$TMPDIR/dmg/Uninstall.app" +hdiutil create -fs HFS+ -volname $PACKAGE_NAME-$VERSION \ + -srcfolder "$TMPDIR/dmg" \ + $TMPDIR/$PACKAGE_NAME.dmg +cp $TMPDIR/$PACKAGE_NAME.dmg . + +exit |