From c96b64e91b54481aa870566dbecae69df711223d Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 31 Jan 2017 15:05:05 +0100 Subject: Name change OSX -> MacOS. Add a -MacOS suffix to mac package rather than -OSX. CHanged local names from osx to macos. --- INSTALL.md | 4 +-- Makefile | 6 ++-- RELEASE-CHECKLIST | 2 +- macos/distribution.xml.in | 30 +++++++++++++++++ macos/make_macos_package.sh | 74 ++++++++++++++++++++++++++++++++++++++++++ macos/stack.yaml | 28 ++++++++++++++++ macos/uninstall-pandoc.pl | 79 +++++++++++++++++++++++++++++++++++++++++++++ osx/distribution.xml.in | 30 ----------------- osx/make_osx_package.sh | 76 ------------------------------------------- osx/stack.yaml | 28 ---------------- osx/uninstall-pandoc.pl | 79 --------------------------------------------- 11 files changed, 217 insertions(+), 219 deletions(-) create mode 100644 macos/distribution.xml.in create mode 100755 macos/make_macos_package.sh create mode 100644 macos/stack.yaml create mode 100755 macos/uninstall-pandoc.pl delete mode 100644 osx/distribution.xml.in delete mode 100755 osx/make_osx_package.sh delete mode 100644 osx/stack.yaml delete mode 100755 osx/uninstall-pandoc.pl diff --git a/INSTALL.md b/INSTALL.md index 631641307..192ae841d 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -19,7 +19,7 @@ copy /y "%TEMP%\pandoc\pandoc-citeproc.exe" C:\Utils\Console\ rmdir /s /q "%TEMP%\pandoc\" -## Mac OS X +## MacOS - There is a package installer at pandoc's [download page]. If you later want to uninstall the package, you can do so @@ -27,7 +27,7 @@ and running it with `perl uninstall-pandoc.pl`. - It is possible to extract the pandoc and pandoc-citeproc - executables from the osx pkg file, if you'd rather not run + executables from the MacOS pkg file, if you'd rather not run the installer. To do this (for the version 1.19.1 package): mkdir pandoc-extract diff --git a/Makefile b/Makefile index 2138ced56..ab7e0fcf8 100644 --- a/Makefile +++ b/Makefile @@ -27,8 +27,8 @@ dist: man/pandoc.1 debpkg: man/pandoc.1 make -C deb -osxpkg: man/pandoc.1 - ./osx/make_osx_package.sh +macospkg: man/pandoc.1 + ./macos/make_macos_package.sh winpkg: pandoc-$(version)-windows.msi @@ -52,4 +52,4 @@ download_stats: clean: stack clean -.PHONY: deps quick full install clean test bench changes_github osxpkg dist prof download_stats +.PHONY: deps quick full install clean test bench changes_github macospkg dist prof download_stats diff --git a/RELEASE-CHECKLIST b/RELEASE-CHECKLIST index ff9d56071..2882965e1 100644 --- a/RELEASE-CHECKLIST +++ b/RELEASE-CHECKLIST @@ -11,7 +11,7 @@ _ Tag templates _ Generate Windows package (make winpkg) -_ Generate Mac OSX package (make osxpkg) +_ Generate MacOS package (make macospkg) _ Generate Ubuntu/Debian deb package (make debpkg) diff --git a/macos/distribution.xml.in b/macos/distribution.xml.in new file mode 100644 index 000000000..145fc0f21 --- /dev/null +++ b/macos/distribution.xml.in @@ -0,0 +1,30 @@ + + + pandoc + net.johnmacfarlane.pandoc + + + + + + + + + pandoc.pkg + + + + + + + + + diff --git a/macos/make_macos_package.sh b/macos/make_macos_package.sh new file mode 100755 index 000000000..d2c4d205b --- /dev/null +++ b/macos/make_macos_package.sh @@ -0,0 +1,74 @@ +#!/bin/bash -e + +LOCALBIN=$HOME/.local/bin +DIST=`pwd`/macos_package +MACOS=`pwd`/macos +VERSION=$(grep -e '^Version' pandoc.cabal | awk '{print $2}') +RESOURCES=$DIST/Resources +ROOT=$DIST/pandoc +DEST=$ROOT/usr/local +SCRIPTS=$MACOS/macos-resources +BASE=pandoc-$VERSION +ME=$(whoami) +PACKAGEMAKER=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker +DEVELOPER_ID_APPLICATION=${DEVELOPER_ID_APPLICATION:-Developer ID Application: John Macfarlane} +DEVELOPER_ID_INSTALLER=${DEVELOPER_ID_INSTALLER:-Developer ID Installer: John Macfarlane} + +# We need this for hsb2hs: +PATH=$LOCALBIN:$PATH +export MACMACOS_DEPLOYMENT_TARGET=10.7 + +# echo Removing old files... +rm -rf $DIST +mkdir -p $DIST +mkdir -p $RESOURCES +stack setup +which hsb2hs || stack install hsb2hs + +echo Building pandoc... +stack clean +stack install --stack-yaml=$MACOS/stack.yaml --local-bin-path . pandoc pandoc-citeproc + +echo Getting man pages... +make man/pandoc.1 + +# get pandoc-citeproc man page: +PANDOC_CITEPROC_VERSION=`pandoc-citeproc --version | awk '{print $2;}'` +PANDOC_CITEPROC_TARBALL=https://hackage.haskell.org/package/pandoc-citeproc-${PANDOC_CITEPROC_VERSION}/pandoc-citeproc-${PANDOC_CITEPROC_VERSION}.tar.gz +curl ${PANDOC_CITEPROC_TARBALL} | tar xzC $DIST +PANDOC_CITEPROC_PATH=$DIST/pandoc-citeproc-${PANDOC_CITEPROC_VERSION} + +mkdir -p $DEST/bin +mkdir -p $DEST/share/man/man1 +for f in pandoc pandoc-citeproc; do + cp $MACOS/$f $DEST/bin/; +done +cp $PANDOC_CITEPROC_PATH/man/man1/pandoc-citeproc.1 $DEST/share/man/man1/ +cp man/pandoc.1 $DEST/share/man/man1/ + +chown -R $ME:staff $DIST + +echo Copying license... +$MACOS/pandoc --data data -t html5 -s COPYING.md -o $RESOURCES/license.html + +# Removing executable signing because of a problem that arose in El Capitan +# "source=obsolete resource envelope" + +#echo Signing pandoc executable... + +#codesign --force --sign "${DEVELOPER_ID_APPLICATION}" $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 MacOS package... + +sed -e "s/PANDOCVERSION/$VERSION/" $MACOS/distribution.xml.in > $MACOS/distribution.xml + +pkgbuild --root $DIST/pandoc --identifier net.johnmacfarlane.pandoc --version 1.13 --ownership recommended $DIST/pandoc.pkg +productbuild --distribution $MACOS/distribution.xml --resources $DIST/Resources --package-path $DIST --version $VERSION --sign "${DEVELOPER_ID_INSTALLER}" $BASE-MacOS.pkg + +# verify signature +spctl --assess --type install $BASE-MacOS.pkg + +# cleanup +rm -r $DIST $MACOS/pandoc $MACOS/pandoc-citeproc diff --git a/macos/stack.yaml b/macos/stack.yaml new file mode 100644 index 000000000..c2062eff8 --- /dev/null +++ b/macos/stack.yaml @@ -0,0 +1,28 @@ +flags: + pandoc: + trypandoc: false + https: true + embed_data_files: true + old-locale: false + network-uri: true + pandoc-citeproc: + bibutils: true + embed_data_files: true + unicode_collation: false + test_citeproc: false + debug: false +ghc-options: + pandoc-citeproc: '-pgmP cpphs -optP--cpp' + highlighting-kate: '-pgmP cpphs -optP--cpp' +packages: +- '..' +- location: + git: https://github.com/jgm/pandoc-citeproc.git + commit: 9c8e86cf16fc3188836a15ee76d5b70c5315bdb8 + extra-dep: true +extra-deps: +- texmath-0.9 +- doctemplates-0.1.0.2 +- pandoc-types-1.17.0.4 +- skylighting-0.1.1.2 +resolver: lts-7.14 diff --git a/macos/uninstall-pandoc.pl b/macos/uninstall-pandoc.pl new file mode 100755 index 000000000..a5194d9bd --- /dev/null +++ b/macos/uninstall-pandoc.pl @@ -0,0 +1,79 @@ +#!/usr/bin/perl + +# Script to remove all files installed by the OSX pandoc installer +# and unregister the package. Modified from a script contributed +# by Daniel T. Staal. + +use warnings; +use strict; + +use File::Spec; + +# The main info: this is the list of files to remove and the pkg_id. +my $pkg_id = 'net.johnmacfarlane.pandoc'; + +# Find which, if any, volume Pandoc is installed on. +my $volume; + +# First check /, then other volumes on the box. +my $cur_test = `pkgutil --pkgs=$pkg_id`; +if ( $cur_test =~ m/$pkg_id/ ) { + $volume = '/'; +} else { + opendir( my $dh, '/Volumes' ) or die "Can't list Volumes: $!\n"; + foreach my $dir ( readdir($dh) ) { + next if $dir =~ m/^\./; # Skip dotfiles. + + my $path = File::Spec->rel2abs( $dir, '/Volumes' ); + next if !( -d $path ); # Skip anything that isn't a directory. + + my $cur_test = `pkgutil --pkgs=$pkg_id --volume '$path'`; + if ( $cur_test =~ m/$pkg_id/ ) { + $volume = $path; + last; + } + } +} + +die "Pandoc not installed.\n" if !( defined($volume) ); + +# Get the list of files to remove. +my @pkg_files = `pkgutil --volume '$volume' --only-files --files '$pkg_id'`; +@pkg_files = map { chomp; File::Spec->rel2abs($_, $volume) } @pkg_files; + +# Confirm uninistall with the user. +print "The following files will be deleted:\n\n"; +print join("\n", @pkg_files); +print "\n\n"; +print "Do you want to proceed and uninstall pandoc (Y/N)?"; +my $input = ; + +if ($input =~ m/^[Yy]/) { + + # Actually remove the files. + foreach my $file (@pkg_files) { + if ( -e $file ) { + if ( system( 'sudo', 'rm', $file ) == 0 ) { + warn "Deleted $file\n"; + } else { + warn "Unable to delete $file: $?\n"; + die "Aborting Uninstall.\n"; + } + } else { + warn "File $file does not exist. Skipping.\n"; + } + } + + # Clean up the install. + if (system('sudo', 'pkgutil', '--forget', $pkg_id, '--volume', $volume) != 0) { + die "Unable to clean up install: $?\n"; + } + +} else { + + print "OK, aborting uninstall.\n"; + exit; +} + +print "Pandoc has been successfully uninstalled.\n"; +exit; diff --git a/osx/distribution.xml.in b/osx/distribution.xml.in deleted file mode 100644 index 145fc0f21..000000000 --- a/osx/distribution.xml.in +++ /dev/null @@ -1,30 +0,0 @@ - - - pandoc - net.johnmacfarlane.pandoc - - - - - - - - - pandoc.pkg - - - - - - - - - diff --git a/osx/make_osx_package.sh b/osx/make_osx_package.sh deleted file mode 100755 index 200702a0a..000000000 --- a/osx/make_osx_package.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -e - -LOCALBIN=$HOME/.local/bin -DIST=`pwd`/osx_package -OSX=`pwd`/osx -VERSION=$(grep -e '^Version' pandoc.cabal | awk '{print $2}') -RESOURCES=$DIST/Resources -ROOT=$DIST/pandoc -DEST=$ROOT/usr/local -SCRIPTS=$OSX/osx-resources -BASE=pandoc-$VERSION -ME=$(whoami) -PACKAGEMAKER=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker -DEVELOPER_ID_APPLICATION=${DEVELOPER_ID_APPLICATION:-Developer ID Application: John Macfarlane} -DEVELOPER_ID_INSTALLER=${DEVELOPER_ID_INSTALLER:-Developer ID Installer: John Macfarlane} - -# We need this for hsb2hs: -PATH=$LOCALBIN:$PATH -export MACOSX_DEPLOYMENT_TARGET=10.7 - -# echo Removing old files... -rm -rf $DIST -mkdir -p $DIST -mkdir -p $RESOURCES -stack setup -which hsb2hs || stack install hsb2hs - -echo Building pandoc... -stack clean -stack install --stack-yaml=$OSX/stack.yaml --local-bin-path . pandoc pandoc-citeproc - -echo Getting man pages... -make man/pandoc.1 - -# get pandoc-citeproc man page: -PANDOC_CITEPROC_VERSION=`pandoc-citeproc --version | awk '{print $2;}'` -PANDOC_CITEPROC_TARBALL=https://hackage.haskell.org/package/pandoc-citeproc-${PANDOC_CITEPROC_VERSION}/pandoc-citeproc-${PANDOC_CITEPROC_VERSION}.tar.gz -curl ${PANDOC_CITEPROC_TARBALL} | tar xzC $DIST -PANDOC_CITEPROC_PATH=$DIST/pandoc-citeproc-${PANDOC_CITEPROC_VERSION} - -mkdir -p $DEST/bin -mkdir -p $DEST/share/man/man1 -for f in pandoc pandoc-citeproc; do - cp $OSX/$f $DEST/bin/; -done -cp $PANDOC_CITEPROC_PATH/man/man1/pandoc-citeproc.1 $DEST/share/man/man1/ -cp man/pandoc.1 $DEST/share/man/man1/ - -chown -R $ME:staff $DIST - -echo Copying license... -$OSX/pandoc --data data -t html5 -s COPYING.md -o $RESOURCES/license.html - -# Removing executable signing because of a problem that arose in El Capitan -# "source=obsolete resource envelope" - -#echo Signing pandoc executable... - -#codesign --force --sign "${DEVELOPER_ID_APPLICATION}" $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 -rm -rf $BASE.pkg - -sed -e "s/PANDOCVERSION/$VERSION/" $OSX/distribution.xml.in > $OSX/distribution.xml - -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 $VERSION --sign "${DEVELOPER_ID_INSTALLER}" $BASE-osx.pkg - -# verify signature -spctl --assess --type install $BASE-osx.pkg - -# cleanup -rm -r $DIST $OSX/pandoc $OSX/pandoc-citeproc diff --git a/osx/stack.yaml b/osx/stack.yaml deleted file mode 100644 index c2062eff8..000000000 --- a/osx/stack.yaml +++ /dev/null @@ -1,28 +0,0 @@ -flags: - pandoc: - trypandoc: false - https: true - embed_data_files: true - old-locale: false - network-uri: true - pandoc-citeproc: - bibutils: true - embed_data_files: true - unicode_collation: false - test_citeproc: false - debug: false -ghc-options: - pandoc-citeproc: '-pgmP cpphs -optP--cpp' - highlighting-kate: '-pgmP cpphs -optP--cpp' -packages: -- '..' -- location: - git: https://github.com/jgm/pandoc-citeproc.git - commit: 9c8e86cf16fc3188836a15ee76d5b70c5315bdb8 - extra-dep: true -extra-deps: -- texmath-0.9 -- doctemplates-0.1.0.2 -- pandoc-types-1.17.0.4 -- skylighting-0.1.1.2 -resolver: lts-7.14 diff --git a/osx/uninstall-pandoc.pl b/osx/uninstall-pandoc.pl deleted file mode 100755 index a5194d9bd..000000000 --- a/osx/uninstall-pandoc.pl +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/perl - -# Script to remove all files installed by the OSX pandoc installer -# and unregister the package. Modified from a script contributed -# by Daniel T. Staal. - -use warnings; -use strict; - -use File::Spec; - -# The main info: this is the list of files to remove and the pkg_id. -my $pkg_id = 'net.johnmacfarlane.pandoc'; - -# Find which, if any, volume Pandoc is installed on. -my $volume; - -# First check /, then other volumes on the box. -my $cur_test = `pkgutil --pkgs=$pkg_id`; -if ( $cur_test =~ m/$pkg_id/ ) { - $volume = '/'; -} else { - opendir( my $dh, '/Volumes' ) or die "Can't list Volumes: $!\n"; - foreach my $dir ( readdir($dh) ) { - next if $dir =~ m/^\./; # Skip dotfiles. - - my $path = File::Spec->rel2abs( $dir, '/Volumes' ); - next if !( -d $path ); # Skip anything that isn't a directory. - - my $cur_test = `pkgutil --pkgs=$pkg_id --volume '$path'`; - if ( $cur_test =~ m/$pkg_id/ ) { - $volume = $path; - last; - } - } -} - -die "Pandoc not installed.\n" if !( defined($volume) ); - -# Get the list of files to remove. -my @pkg_files = `pkgutil --volume '$volume' --only-files --files '$pkg_id'`; -@pkg_files = map { chomp; File::Spec->rel2abs($_, $volume) } @pkg_files; - -# Confirm uninistall with the user. -print "The following files will be deleted:\n\n"; -print join("\n", @pkg_files); -print "\n\n"; -print "Do you want to proceed and uninstall pandoc (Y/N)?"; -my $input = ; - -if ($input =~ m/^[Yy]/) { - - # Actually remove the files. - foreach my $file (@pkg_files) { - if ( -e $file ) { - if ( system( 'sudo', 'rm', $file ) == 0 ) { - warn "Deleted $file\n"; - } else { - warn "Unable to delete $file: $?\n"; - die "Aborting Uninstall.\n"; - } - } else { - warn "File $file does not exist. Skipping.\n"; - } - } - - # Clean up the install. - if (system('sudo', 'pkgutil', '--forget', $pkg_id, '--volume', $volume) != 0) { - die "Unable to clean up install: $?\n"; - } - -} else { - - print "OK, aborting uninstall.\n"; - exit; -} - -print "Pandoc has been successfully uninstalled.\n"; -exit; -- cgit v1.2.3