git.iko.soy/typeable/pandoc
on 4eff607 help sign in
typeable/pandoc/deb/make_deb.sh
56 lines 1.8 kB history raw
1MACHINE=$(uname -m)
2case "$MACHINE" in
3 x86_64) ARCHITECTURE=amd64;;
4 i686) ARCHITECTURE=i386;;
5 i386) ARCHITECTURE=i386;;
6esac
8LOCAL=$HOME/.local
9VERSION=$(grep -e '^Version' pandoc.cabal | awk '{print $2}')
10DEBPKGVER=${DEBPKGVER:-1}
11DEBVER=$VERSION-$DEBPKGVER
12BASE=pandoc-$DEBVER-$ARCHITECTURE
13DIST=`pwd`/$BASE
14DEST=$DIST/usr
15ME=$(whoami)
16COPYRIGHT=$DEST/share/doc/pandoc/copyright
18# We need this for hsb2hs:
19PATH=$LOCAL/bin:$PATH
21mkdir -p $DEST/bin
22mkdir -p $DEST/share/man/man1
23mkdir -p $DEST/share/doc/pandoc
25stack install --install-ghc --stack-yaml deb/stack.yaml --local-bin-path . hsb2hs
26stack install --install-ghc --stack-yaml deb/stack.yaml --local-bin-path . pandoc pandoc-citeproc
28make man/pandoc.1
29# get pandoc-citeproc man page:
30PANDOC_CITEPROC_VERSION=`pandoc-citeproc --version | awk '{print $2;}'`
31curl https://raw.githubusercontent.com/jgm/pandoc-citeproc/${PANDOC_CITEPROC_VERSION}/man/man1/pandoc-citeproc.1 > $DEST/share/man/man1/pandoc-citeproc.1
33strip deb/pandoc
34strip deb/pandoc-citeproc
36mkdir -p $DEST/share/doc/pandoc-citeproc
37find $DIST -type d | xargs chmod 755
38cp deb/pandoc $DEST/bin/
39cp deb/pandoc-citeproc $DEST/bin/
40cp man/pandoc.1 $DEST/share/man/man1/pandoc.1
41gzip -9 $DEST/share/man/man1/pandoc.1
42gzip -9 $DEST/share/man/man1/pandoc-citeproc.1
43cp COPYRIGHT $COPYRIGHT
44echo "" >> $COPYRIGHT
45echo "pandoc-citeproc" >> $COPYRIGHT
46curl https://raw.githubusercontent.com/jgm/pandoc-citeproc/${PANDOC_CITEPROC_VERSION}/LICENSE >> $COPYRIGHT
48INSTALLED_SIZE=$(du -B 1024 -s $DEST | awk '{print $1}')
49mkdir $DIST/DEBIAN
50perl -pe "s/VERSION/$DEBVER/" deb/control.in | \
51 perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \
52 perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \
53 > $DIST/DEBIAN/control
55fakeroot dpkg-deb --build $DIST
56rm -rf $DIST