blob: da6a21c22b614cc52001d165373fcd1afa9913ed (
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
97
98
|
#!/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 <package name> <version> <build> <source dir.> [universal]"
exit 1
}
UNIVERSAL=0
if [ $# -lt 4 ]; then usage $0; fi
PACKAGE_NAME=$1
VERSION=$2
BUILD=$3
SRCDIR=$4
if [ $# -gt 4 ]; then
if [ "$5" = "universal" ]; then UNIVERSAL=1; 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 $SRCDIR/osxx86 ]; then
mkdir -p $SRCDIR/osxx86
fi
pushd $SRCDIR/osxx86
sh $SRCDIR/configure \
CC=gcc-4.0 CXX=g++-4.0 \
CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -O3 -m32' \
CXXFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -O3 -m32' \
LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -m32'
make
popd
lipo -create -arch i386 $SRCDIR/osxx86/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
|