git.iko.soy/typeable/pandoc
on sable help sign in
typeable/pandoc/make_osx_package.sh
76 lines 1.9 kB history raw
1#!/bin/sh -e
3DIST=`pwd`/osx_package
4SANDBOX=`pwd`/.cabal-sandbox
5VERSION=$(grep -e '^Version' pandoc.cabal | awk '{print $2}')
6RESOURCES=$DIST/Resources
7ROOT=$DIST/pandoc
8DEST=$ROOT/usr/local
9SCRIPTS=osx-resources
10BASE=pandoc-$VERSION
11ME=jgm
12CODESIGNID="Developer ID Application: John Macfarlane"
13PACKAGEMAKER=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
14EXES="pandoc pandoc-citeproc biblio2yaml"
16echo Removing old files...
17rm -rf $DIST
18mkdir -p $RESOURCES
20echo Updating database
21cabal update
23echo Building pandoc...
24cabal sandbox init
25cabal install --reinstall --flags="embed_data_files" pandoc-citeproc
26cabal install --reinstall --flags="embed_data_files"
28mkdir -p $DEST/bin
29mkdir -p $DEST/share/man/man1
30mkdir -p $DEST/share/man/man5
31for f in $EXES; do
32 cp $SANDBOX/bin/$f $DEST/bin/;
33 cp $SANDBOX/share/man/man1/$f.1 $DEST/share/man/man1/
34done
35cp $SANDBOX/share/man/man5/pandoc_markdown.5 $DEST/share/man/man5/
37chown -R $ME:staff $DIST
38# gzip $DEST/share/man/man?/*.*
39# cabal gives man pages the wrong permissions
40chmod +r $DEST/share/man/man?/*.*
42echo Copying license...
43$SANDBOX/bin/pandoc --data data -t rtf -s COPYING -o $RESOURCES/License.rtf
45echo Signing pandoc executable...
47codesign --force --sign "$CODESIGNID" $DEST/bin/pandoc
48# make sure it's valid... returns nonzero exit code if it isn't:
49spctl --assess --type execute $DEST/bin/pandoc
51echo Creating OSX package...
53sudo $PACKAGEMAKER \
54 --root $ROOT \
55 --id net.johnmacfarlane.pandoc \
56 --resources $RESOURCES \
57 --version $VERSION \
58 --scripts $SCRIPTS \
59 --out $BASE.pkg
61 # --no-relocate
63echo Signing package...
65sudo codesign --force --sign "$CODESIGNID" $BASE.pkg
66# make sure it's valid...
67spctl --assess --type install $BASE.pkg
69echo Creating disk image...
71sudo hdiutil create "$BASE.dmg" \
72 -format UDZO -ov \
73 -volname "pandoc $VERSION" \
74 -srcfolder $BASE.pkg
75sudo hdiutil internet-enable "$BASE.dmg"