aboutsummaryrefslogtreecommitdiff
path: root/make_osx_package.sh
blob: fd31c2ecbae04b59ad25cf5da25a208fa8776d28 (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
#!/bin/sh -e

DIST=`pwd`/osx
VERSION=$(grep -e '^Version' pandoc.cabal | awk '{print $2}')
RESOURCES=$DIST/Resources
ROOT=$DIST/Package_Root
BASE=pandoc-$VERSION
PREFIX=$ROOT/usr/local

echo Removing old files...
rm -rf $DIST
mkdir -p $RESOURCES

echo Creating Info.plist...

cat > "$DIST/Info.plist" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<pkg-info version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleIdentifier</key>
    <string>net.johnmacfarlane.pandoc</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>pandoc</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$VERSION</string>
    <key>CFBundleVersion</key>
    <string>$VERSION</string>
</dict>
</pkg-info>
EOF

echo Building pandoc...
runghc Setup.hs configure --user --prefix=/usr/local --flags="executable -library highlighting"
runghc Setup.hs build
runghc Setup.hs copy --destdir=$ROOT

cp COPYING $RESOURCES/License.txt

PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker

echo Creating OSX package...

$PACKAGEMAKER \
    --title "pandoc" \
    --info "$DIST/Info.plist" \
    --root "$ROOT" \
    --resources "$RESOURCES" \
    --target "10.5" \
    --version "$VERSION" \
    --no-relocate \
    --out $BASE.pkg

echo Creating disk image...

hdiutil create "$BASE.dmg" \
    -format UDZO -ov \
    -volname "pandoc $VERSION" \
    -srcfolder $BASE.pkg