From 646ef17e557de57c7a8c80ad0bff04b32eb9113e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 7 Jan 2016 11:24:51 -0800 Subject: deb pkg generation improvements. Allow setting DEBPKGVER. Bump to stack lts-4.0. Make output verbose. --- deb/Makefile | 3 ++- deb/make_deb.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ deb/stack.yaml | 4 ++-- 3 files changed, 70 insertions(+), 3 deletions(-) create mode 100755 deb/make_deb.sh (limited to 'deb') diff --git a/deb/Makefile b/deb/Makefile index c947d5d75..cd198ee7b 100644 --- a/deb/Makefile +++ b/deb/Makefile @@ -1,11 +1,12 @@ TREE?=HEAD +DEBPKGVER?=1 VAGRANTBOX?=debian/wheezy64 .PHONY: package clean package: VAGRANTBOX=$(VAGRANTBOX) vagrant up - vagrant ssh -c 'rm -rf pandoc && git clone https://github.com/jgm/pandoc && cd pandoc && git checkout -b work $(TREE) && git submodule update --init && ./make_deb.sh && cp *.deb /vagrant_data/' + vagrant ssh -c 'DEBPKGVER=$(DEBPKGVER) rm -rf pandoc && git clone https://github.com/jgm/pandoc && cd pandoc && git checkout -b work $(TREE) && git submodule update --init && sh -v ./deb/make_deb.sh && cp *.deb /vagrant_data/' vagrant halt clean: diff --git a/deb/make_deb.sh b/deb/make_deb.sh new file mode 100755 index 000000000..e01acbf45 --- /dev/null +++ b/deb/make_deb.sh @@ -0,0 +1,66 @@ +#!/bin/bash -e + +MACHINE=$(uname -m) +case "$MACHINE" in + x86_64) ARCHITECTURE=amd64;; + i686) ARCHITECTURE=i386;; + i386) ARCHITECTURE=i386;; +esac + +LOCAL=$HOME/.local +VERSION=$(grep -e '^Version' pandoc.cabal | awk '{print $2}') +DEBPKGVER=${DEBPKGVER:-1} +DEBVER=$VERSION-$DEBPKGVER +BASE=pandoc-$DEBVER-$ARCHITECTURE +DIST=`pwd`/$BASE +DEST=$DIST/usr +ME=$(whoami) +COPYRIGHT=$DEST/share/doc/pandoc/copyright +TEMPDIR=make_binary_package.tmp.$$ + +# We need this for hsb2hs: +PATH=$LOCAL/bin:$PATH + +stack setup --stack-setup-yaml deb/stack.yaml +stack clean +which hsb2hs || stack install --stack-yaml stack.hsb2hs.yaml + +stack install --stack-yaml deb/stack.yaml + +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 +mkdir $TEMPDIR +curl ${PANDOC_CITEPROC_TARBALL} | tar xzC $TEMPDIR +PANDOC_CITEPROC_PATH=$TEMPDIR/pandoc-citeproc-${PANDOC_CITEPROC_VERSION} + +strip $LOCAL/bin/pandoc +strip $LOCAL/bin/pandoc-citeproc +mkdir -p $DEST/bin +mkdir -p $DEST/share/man/man1 +mkdir -p $DEST/share/doc/pandoc + +mkdir -p $DEST/share/doc/pandoc-citeproc +find $DIST -type d | xargs chmod 755 +cp $LOCAL/bin/pandoc $DEST/bin/ +cp $LOCAL/bin/pandoc-citeproc $DEST/bin/ +cp man/pandoc.1 $DEST/share/man/man1/pandoc.1 +gzip -9 $DEST/share/man/man1/pandoc.1 +cp ${PANDOC_CITEPROC_PATH}/man/man1/pandoc-citeproc.1 $DEST/share/man/man1/ +gzip -9 $DEST/share/man/man1/pandoc-citeproc.1 +cp COPYRIGHT $COPYRIGHT +echo "" >> $COPYRIGHT +echo "pandoc-citeproc" >> $COPYRIGHT +cat $PANDOC_CITEPROC_PATH/LICENSE >> $COPYRIGHT +rm -rf $TEMPDIR + +INSTALLED_SIZE=$(du -B 1024 -s $DEST | awk '{print $1}') +mkdir $DIST/DEBIAN +perl -pe "s/VERSION/$DEBVER/" deb/control.in | \ + perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \ + perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \ + > $DIST/DEBIAN/control + +fakeroot dpkg-deb --build $DIST +rm -rf $DIST diff --git a/deb/stack.yaml b/deb/stack.yaml index 3fd5581f2..3dcf97979 100644 --- a/deb/stack.yaml +++ b/deb/stack.yaml @@ -16,5 +16,5 @@ packages: - 'https://hackage.haskell.org/package/pandoc-citeproc-0.9/pandoc-citeproc-0.9.tar.gz' extra-deps: - 'cmark-0.5.0' -- 'pandoc-types-1.16' -resolver: lts-3.20 +- 'pandoc-types-1.16.0.1' +resolver: lts-4.0 -- cgit v1.2.3