git.iko.soy/typeable/pandoc
on a157e1a help sign in
typeable/pandoc/linux/make_artifacts.sh
82 lines 2.4 kB history raw
1set -e
3MACHINE=$(uname -m)
4case "$MACHINE" in
5 x86_64) ARCHITECTURE=amd64;;
6 i686) ARCHITECTURE=i386;;
7 i386) ARCHITECTURE=i386;;
8esac
10ARTIFACTS="${ARTIFACTS:-/artifacts}"
12# build binaries
14cabal --version
15ghc --version
17cabal v2-update
18cabal v2-clean
19cabal v2-configure --enable-tests -f-export-dynamic -fstatic -fembed_data_files -fbibutils --enable-executable-static --ghc-options '-optc-Os -optl=-pthread -split-sections' . pandoc-citeproc
20cabal v2-build . pandoc-citeproc
21cabal v2-test -j1 . pandoc-citeproc
22for f in $(find dist-newstyle -name 'pandoc*' -type f -perm /400); do cp $f /artifacts/; done
24# make deb
26VERSION=`$ARTIFACTS/pandoc --version | awk '{print $2; exit;}'`
27REVISION=${REVISION:-1}
28DEBVER=$VERSION-$REVISION
29BASE=pandoc-$DEBVER-$ARCHITECTURE
30DIST=`pwd`/$BASE
31DEST=$DIST/usr
32COPYRIGHT=$DEST/share/doc/pandoc/copyright
34mkdir -p $DEST/bin
35mkdir -p $DEST/share/man/man1
36mkdir -p $DEST/share/doc/pandoc
38mkdir -p $DEST/share/doc/pandoc-citeproc
39find $DIST -type d | xargs chmod 755
40cp $ARTIFACTS/pandoc $DEST/bin/
41cp $ARTIFACTS/pandoc-citeproc $DEST/bin/
42strip $DEST/bin/pandoc
43strip $DEST/bin/pandoc-citeproc
44cp /mnt/man/pandoc.1 $DEST/share/man/man1/pandoc.1
45$ARTIFACTS/pandoc-citeproc --man > $DEST/share/man/man1/pandoc-citeproc.1
46gzip -9 $DEST/share/man/man1/pandoc.1
47gzip -9 $DEST/share/man/man1/pandoc-citeproc.1
49cp /mnt/COPYRIGHT $COPYRIGHT
50echo "" >> $COPYRIGHT
51echo "pandoc-citeproc" >> $COPYRIGHT
52$ARTIFACTS/pandoc-citeproc --license >> $COPYRIGHT
54INSTALLED_SIZE=$(du -k -s $DEST | awk '{print $1}')
55mkdir $DIST/DEBIAN
56perl -pe "s/VERSION/$DEBVER/" linux/control.in | \
57 perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \
58 perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \
59 > $DIST/DEBIAN/control
61# we limit compression to avoid OOM error
62fakeroot dpkg-deb -Zgzip -z9 --build $DIST
63rm -rf $DIST
64cp $BASE.deb $ARTIFACTS/
66# Make tarball
68TARGET=pandoc-$VERSION
69cd $ARTIFACTS
70rm -rf $TARGET
71mkdir $TARGET
72mkdir $TARGET/bin $TARGET/share $TARGET/share/man $TARGET/share/man/man1
73./pandoc-citeproc --man > $TARGET/share/man/man1/pandoc-citeproc.1
74cp /mnt/man/pandoc.1 $TARGET/share/man/man1
75mv pandoc pandoc-citeproc $TARGET/bin
76strip $TARGET/bin/pandoc
77strip $TARGET/bin/pandoc-citeproc
78gzip -9 $TARGET/share/man/man1/pandoc.1
79gzip -9 $TARGET/share/man/man1/pandoc-citeproc.1
81tar cvzf $TARGET-linux-amd64.tar.gz $TARGET
82rm -r $TARGET