summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-12-16 17:58:31 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-12-16 17:58:31 -0800
commita4193a619aff32de9ceff3b2abd67ae6d3e572eb (patch)
tree140f4323dcd95cb39a71f3416206e68352a47dff
parentbbb8bfab295c29a87b815076826d89411a33e606 (diff)
Added make_binary_package.sh.
This script creates a generic binary package in a tarball. Intended mostly for use with linux.
-rw-r--r--Makefile14
-rwxr-xr-xmake_binary_package.sh49
2 files changed, 51 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 36597fe34..ec5e31eb7 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,6 @@ endif
setup=dist/setup/setup
MANPAGES=man/man1/pandoc.1 man/man5/pandoc_markdown.5
PREFIX ?= /usr/local
-BINDIST ?= pandoc-$(version)-$(shell uname -m)
quick:
cabal configure --enable-tests --disable-optimization
@@ -41,17 +40,8 @@ dist: man
cd pandoc-${version}
cabal configure ${CABALARGS} && cabal build && cabal test && cd .. && rm -rf "pandoc-${version}"
-bindist: $(MANPAGES)
- cabal install --only-dependencies -fembed_data_files
- cabal configure --prefix=/usr/local --datadir=share/data --enable-tests -fembed_data_files
- cabal build
- cabal test
- cabal copy --destdir=$(BINDIST)
- mkdir -p $(BINDIST)$(PREFIX)/share/man/man1 $(BINDIST)$(PREFIX)/share/man/man5
- for x in $(MANPAGES); do cp $$x $(BINDIST)$(PREFIX)/share/$$x; done
- mkdir -p $(BINDIST)$(PREFIX)/share/doc/pandoc
- cp COPYING $(BINDIST)$(PREFIX)/share/doc/pandoc/
- tar cvzf $(BINDIST).tar.gz $(BINDIST)$(PREFIX)/bin $(BINDIST)$(PREFIX)/share
+bindist:
+ ./make_binary_package.sh
man: $(MANPAGES)
diff --git a/make_binary_package.sh b/make_binary_package.sh
new file mode 100755
index 000000000..c2b051232
--- /dev/null
+++ b/make_binary_package.sh
@@ -0,0 +1,49 @@
+#!/bin/bash -e
+
+SANDBOX=`pwd`/.cabal-sandbox
+VERSION=$(grep -e '^Version' pandoc.cabal | awk '{print $2}')
+BASE=pandoc-$VERSION-$(uname -s)-$(uname -m)
+DIST=`pwd`/$BASE
+MANDIR=`pwd`/man
+DEST=$DIST
+ME=$(whoami)
+
+# echo Removing old files...
+rm -rf $DIST
+
+cabal sandbox init
+echo Updating database
+cabal update
+
+echo Building pandoc...
+cabal clean
+cabal install --reinstall --flags="embed_data_files make-pandoc-man-pages" . pandoc-citeproc
+
+make man
+# get pandoc-citeproc man page:
+PANDOC_CITEPROC_PATH=`cabal unpack -d make_binary_package.tmp.$$ pandoc-citeproc | awk '{print $3;}'`
+strip $SANDBOX/bin/pandoc
+strip $SANDBOX/bin/pandoc-citeproc
+install -d $DEST/bin
+install -d $DEST/share/man/man1
+install -d $DEST/share/man/man5
+install -d $DEST/share/doc/pandoc
+install -d $DEST/share/doc/pandoc-citeproc
+install $SANDBOX/bin/pandoc $DEST/bin/
+install $SANDBOX/bin/pandoc-citeproc $DEST/bin/
+install $MANDIR/man1/pandoc.1 $DEST/share/man/man1/
+install $MANDIR/man5/pandoc_markdown.5 $DEST/share/man/man5/
+install $PANDOC_CITEPROC_PATH/man/man1/pandoc-citeproc.1 $DEST/share/man/man1/
+install COPYING $DEST/share/doc/pandoc/COPYING
+install $PANDOC_CITEPROC_PATH/LICENSE $DEST/share/doc/pandoc-citeproc/LICENSE
+
+rm -rf $PANDOC_CITEPROC_PATH
+
+echo Creating tarball...
+# remove old package first
+rm -rf $BASE.tar.gz
+
+tar cvzf $BASE.tar.gz $BASE
+# cleanup
+rm -r $DIST
+echo "Created $BASE.tar.gz"