pandoc/make_osx_package.sh

72 lines
1.9 KiB
Bash
Raw Normal View History

2011-07-28 20:41:00 +02:00
#!/bin/sh -e
DIST=`pwd`/osx_package
2011-07-28 20:41:00 +02:00
VERSION=$(grep -e '^Version' pandoc.cabal | awk '{print $2}')
RESOURCES=$DIST/Resources
ROOT=$DIST/pandoc
SCRIPTS=osx-resources
2011-07-28 20:41:00 +02:00
BASE=pandoc-$VERSION
ICU=/usr/local/Cellar/icu4c/51.1
ME=jgm
CODESIGNID="Developer ID Application: John Macfarlane"
PACKAGEMAKER=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
2011-07-28 20:41:00 +02:00
echo Removing old files...
rm -rf $DIST
mkdir -p $RESOURCES
# echo Updating database
# cabal update
2011-07-28 20:41:00 +02:00
echo Building pandoc...
cabal-dev install hsb2hs
2013-09-02 19:41:52 +02:00
cabal-dev install --reinstall -v1 --prefix $ROOT/tmp --flags="embed_data_files unicode_collation" --extra-lib-dirs=$ICU/lib --extra-include-dirs=$ICU/include pandoc-citeproc
cabal-dev install -v1 --prefix $ROOT/tmp --flags="embed_data_files"
mkdir -p $ROOT/usr/local/share
cp -r $ROOT/tmp/bin $ROOT/usr/local/
cp -r $ROOT/tmp/share/man $ROOT/usr/local/share/
rm -rf $ROOT/tmp
2013-09-02 19:41:52 +02:00
chown -R $ME:staff $DIST
# gzip $ROOT/usr/local/share/man/man?/*.*
# cabal gives man pages the wrong permissions
chmod +r $ROOT/usr/local/share/man/man?/*.*
2011-07-28 20:41:00 +02:00
echo Copying license...
dist/build/pandoc/pandoc --data data -t rtf -s COPYING -o $RESOURCES/License.rtf
2011-07-28 20:41:00 +02:00
echo Signing pandoc executable...
codesign --force --sign "$CODESIGNID" $ROOT/usr/local/bin/pandoc
# make sure it's valid... returns nonzero exit code if it isn't:
spctl --assess --type execute $ROOT/usr/local/bin/pandoc
2011-07-28 20:41:00 +02:00
echo Creating OSX package...
2013-01-19 20:11:34 +01:00
sudo $PACKAGEMAKER \
--root $ROOT \
--id net.johnmacfarlane.pandoc \
--resources $RESOURCES \
--version $VERSION \
--scripts $SCRIPTS \
2011-07-28 20:41:00 +02:00
--out $BASE.pkg
2013-09-02 19:41:52 +02:00
# --no-relocate
echo Signing package...
sudo codesign --force --sign "$CODESIGNID" $BASE.pkg
# make sure it's valid...
spctl --assess --type install $BASE.pkg
2011-07-28 20:41:00 +02:00
echo Creating disk image...
2013-01-19 20:11:34 +01:00
sudo hdiutil create "$BASE.dmg" \
2011-07-28 20:41:00 +02:00
-format UDZO -ov \
-volname "pandoc $VERSION" \
-srcfolder $BASE.pkg
2013-01-19 20:11:34 +01:00
sudo hdiutil internet-enable "$BASE.dmg"
2011-07-28 20:41:00 +02:00