aboutsummaryrefslogtreecommitdiff
path: root/macos
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2023-03-10 09:23:16 -0800
committerJohn MacFarlane <[email protected]>2023-03-10 09:23:16 -0800
commit1cd5829a0cf825b73d28cf8f7cf916a8443a54dd (patch)
tree51a303aad20acdebb12ad743646486cd87ee3870 /macos
parent9c39a66c384df649ff4088cb0cf7a0ffd5082062 (diff)
Factor out make_macos_release.sh from the release candidate workflow.
Also use cabal instead of stack to build the macos binary.
Diffstat (limited to 'macos')
-rw-r--r--macos/make_macos_release.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/macos/make_macos_release.sh b/macos/make_macos_release.sh
new file mode 100644
index 000000000..c08a737a5
--- /dev/null
+++ b/macos/make_macos_release.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+VERSION=$(grep '^[Vv]ersion:' pandoc.cabal | awk '{print $2;}')
+ARTIFACTS=macos-release-candidate
+RESOURCES=${ARTIFACTS}/Resources
+ROOT=${ARTIFACTS}/pandoc
+DEST=${ROOT}/usr/local
+ME=$(whoami)
+
+# Build the pandoc binary and put it in .
+cabal update
+cabal install pandoc-cli -fembed_data_files -fserver -flua --installdir=. \
+ --install-method=copy --overwrite-policy=always
+
+# Create directories
+mkdir -p ${ARTIFACTS}
+mkdir -p ${RESOURCES}
+mkdir -p ${DEST}/bin
+mkdir -p ${DEST}/share/man/man1
+
+# Copy binary and strip it
+cp ./pandoc ${DEST}/bin/
+strip ${DEST}/bin/pandoc
+
+# Copy man pages and license
+cp man/pandoc.1 ${DEST}/share/man/man1/pandoc.1
+cp man/pandoc-server.1 ${DEST}/share/man/man1/pandoc-server.1
+cp man/pandoc-lua.1 ${DEST}/share/man/man1/pandoc-lua.1
+./pandoc -s COPYING.md -Vpagetitle=License -o ${RESOURCES}/license.html
+
+# Prepare distribution directory; after downloading, run 'make' to notarize
+chown -R "$ME:staff" "${ROOT}"
+sed -e "s/PANDOCVERSION/${VERSION}/" macos/distribution.xml.in > ${ARTIFACTS}/distribution.xml
+cp macos/Makefile ${ARTIFACTS}/
+echo "${VERSION}" > "${ARTIFACTS}/version.txt"