OSX installer improvements.

* Use new pkgbuild, productbuild instead of deprecated PackageMaker.
* Removed scripts, which are no longer needed.
* Added distribution.xml.
This commit is contained in:
John MacFarlane 2014-08-15 00:46:01 -07:00
parent a44650bf97
commit 2b6e8f4c83
4 changed files with 44 additions and 51 deletions

View file

@ -11,21 +11,17 @@ OSX=osx
SCRIPTS=$OSX/osx-resources
BASE=pandoc-$VERSION
ME=$(whoami)
CODESIGNID="3rd Party Mac Developer Application: John Macfarlane"
PACKAGEMAKER=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
EXES="pandoc pandoc-citeproc"
CPPHS=$SANDBOX/bin/cpphs
read -s -p "sudo password: " PASSWORD
echo $PASSWORD | sudo -S echo "Password valid, continuing."
echo Removing old files...
# echo Removing old files...
rm -rf $DIST
mkdir -p $RESOURCES
cabal sandbox init
# echo Updating database
# cabal update
echo Updating database
cabal update
echo Building pandoc...
cabal clean
@ -35,6 +31,9 @@ cabal install --ghc-options="-optl-mmacosx-version-min=10.6" --reinstall --flags
cabal install --ghc-options="-optl-mmacosx-version-min=10.6" --reinstall --flags="embed_data_files" pandoc-citeproc --ghc-options "-pgmP$CPPHS -optP--cpp"
make man
# get pandoc-citeproc man page:
PANDOC_CITEPROC_PATH=`cabal unpack -d $DIST pandoc-citeproc | awk '{print $3;}'`
cp $PANDOC_CITEPROC_PATH/man/man1/pandoc-citeproc.1 $MANDIR/man1/
mkdir -p $DEST/bin
mkdir -p $DEST/share/man/man1
@ -48,42 +47,23 @@ cp $MANDIR/man5/pandoc_markdown.5 $DEST/share/man/man5/
chown -R $ME:staff $DIST
echo Copying license...
$SANDBOX/bin/pandoc --data data -t rtf -s COPYING -o $RESOURCES/License.rtf
$SANDBOX/bin/pandoc --data data -t html5 -s COPYING -o $RESOURCES/license.html
echo Signing pandoc executable...
codesign --force --sign "$CODESIGNID" $DEST/bin/pandoc
codesign --force --sign "Developer ID Application: John Macfarlane" $DEST/bin/pandoc
# make sure it's valid... returns nonzero exit code if it isn't:
spctl --assess --type execute $DEST/bin/pandoc
echo Creating OSX package...
# remove old package first
echo $PASSWORD | sudo -S rm -rf $BASE.pkg $BASE.dmg
rm -rf $BASE.pkg
sudo $PACKAGEMAKER \
--root $ROOT \
--id net.johnmacfarlane.pandoc \
--resources $RESOURCES \
--version $VERSION \
--scripts $SCRIPTS \
--out $BASE.pkg
pkgbuild --root $DIST/pandoc --identifier net.johnmacfarlane.pandoc --version 1.13 --ownership recommended $DIST/pandoc.pkg
productbuild --distribution osx/distribution.xml --resources $DIST/Resources --package-path $DIST --version 1.13 --sign "Developer ID Installer: John Macfarlane" $BASE.pkg
# --no-relocate
echo Signing package...
sudo codesign --force --sign "$CODESIGNID" $BASE.pkg
# make sure it's valid...
# verify signature
spctl --assess --type install $BASE.pkg
echo Creating zip...
zip -9 -r $BASE-osx.zip $BASE.pkg
zip -9 -j -r $BASE-osx.zip $OSX/uninstall-pandoc.pl
# echo Creating disk image...
# sudo hdiutil create "$BASE.dmg" \
# -format UDZO -ov \
# -volname "pandoc $VERSION" \
# -srcfolder $BASE.pkg
# sudo hdiutil internet-enable "$BASE.dmg"
# cleanup
rm -r $DIST

30
osx/distribution.xml Normal file
View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-gui-script minSpecVersion="1">
<title>pandoc</title>
<organization>net.johnmacfarlane.pandoc</organization>
<domains enable_localSystem="true"/>
<options customize="never" require-scripts="true" rootVolumeOnly="true" />
<!-- Define documents displayed at various steps -->
<!-- <welcome file="welcome.html" mime-type="text/html" /> -->
<license file="license.html" mime-type="text/html" />
<!-- <conclusion file="conclusion.html" mime-type="text/html" /> -->
<options hostArchitectures="x86_64" />
<!-- List all component packages -->
<pkg-ref id="net.johnmacfarlane.pandoc"
version="1.13"
auth="root">pandoc.pkg</pkg-ref>
<!-- List them again here. They can now be organized
as a hierarchy if you want. -->
<choices-outline>
<line choice="net.johnmacfarlane.pandoc"/>
</choices-outline>
<!-- Define each choice above -->
<choice
id="net.johnmacfarlane.pandoc"
visible="false"
title="pandoc"
description="pandoc - universal text converter"
start_selected="true">
<pkg-ref id="net.johnmacfarlane.pandoc"/>
</choice>
</installer-gui-script>

View file

@ -1,14 +0,0 @@
#!/bin/sh
cputype=`/usr/sbin/sysctl -n hw.cputype`
sixtyfourbit=`/usr/sbin/sysctl -n hw.cpu64bit_capable`
if [ "x$cputype" != "x7" ] # x86
then
exit 112
fi
if [ "x$sixtyfourbit" != "x1" ] # 64 bit
then
exit 113
fi

View file

@ -1,3 +0,0 @@
"16" = "This installer works only on Intel Macs.";
"17" = "This installer requires a 64-bit processor.";