#!/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" < CFBundleDevelopmentRegion en CFBundleIdentifier net.johnmacfarlane.pandoc CFBundleInfoDictionaryVersion 6.0 CFBundleName pandoc CFBundlePackageType APPL CFBundleShortVersionString $VERSION CFBundleVersion $VERSION 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