2014-12-17 02:58:31 +01:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2014-12-18 01:38:11 +01:00
|
|
|
MACHINE=$(uname -m)
|
|
|
|
if [ "$MACHINE" = "x86_64" ]; then
|
|
|
|
ARCHITECTURE=amd64
|
|
|
|
elif [ "$MACHINE" = "i686" ]; then
|
|
|
|
ARCHICTECTURE=i386
|
|
|
|
elif [ "$MACHINE" = "i386" ]; then
|
|
|
|
ARCHICTECTURE=i386
|
|
|
|
fi
|
|
|
|
|
2014-12-17 02:58:31 +01:00
|
|
|
SANDBOX=`pwd`/.cabal-sandbox
|
|
|
|
VERSION=$(grep -e '^Version' pandoc.cabal | awk '{print $2}')
|
2014-12-17 22:53:38 +01:00
|
|
|
DEBPKGVER=1
|
|
|
|
DEBVER=$VERSION-$DEBPKGVER
|
2014-12-18 01:38:11 +01:00
|
|
|
BASE=pandoc-$DEBVER-$ARCHITECTURE
|
2014-12-17 02:58:31 +01:00
|
|
|
DIST=`pwd`/$BASE
|
|
|
|
MANDIR=`pwd`/man
|
2014-12-17 09:16:59 +01:00
|
|
|
DEST=$DIST/usr/local
|
2014-12-17 02:58:31 +01:00
|
|
|
ME=$(whoami)
|
|
|
|
|
|
|
|
# echo Removing old files...
|
|
|
|
rm -rf $DIST
|
|
|
|
|
|
|
|
cabal sandbox init
|
|
|
|
echo Updating database
|
|
|
|
cabal update
|
|
|
|
|
2014-12-17 22:53:38 +01:00
|
|
|
export PATH=`pwd`/.cabal-sandbox/bin:$PATH
|
|
|
|
which hsb2hs || cabal install hsb2hs
|
2014-12-17 02:58:31 +01:00
|
|
|
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
|
2014-12-17 22:53:38 +01:00
|
|
|
rm -rf make_binary_package.tmp.$$
|
2014-12-17 02:58:31 +01:00
|
|
|
|
2014-12-17 09:16:59 +01:00
|
|
|
mkdir $DIST/DEBIAN
|
2014-12-18 01:38:11 +01:00
|
|
|
perl -pe "s/VERSION/$DEBVER/" deb/control.in | \
|
|
|
|
perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" > $DIST/DEBIAN/control
|
2014-12-17 02:58:31 +01:00
|
|
|
|
2014-12-17 09:16:59 +01:00
|
|
|
dpkg-deb --build $DIST
|
2014-12-17 22:53:38 +01:00
|
|
|
rm -rf $DIST
|