2017-03-19 16:24:52 +01:00
|
|
|
set -e
|
|
|
|
|
|
|
|
MACHINE=$(uname -m)
|
|
|
|
case "$MACHINE" in
|
|
|
|
x86_64) ARCHITECTURE=amd64;;
|
|
|
|
i686) ARCHITECTURE=i386;;
|
|
|
|
i386) ARCHITECTURE=i386;;
|
|
|
|
esac
|
|
|
|
|
2017-10-23 06:19:17 +02:00
|
|
|
ARTIFACTS="${ARTIFACTS:-/artifacts}"
|
2017-03-19 16:24:52 +01:00
|
|
|
|
2020-07-24 18:57:27 +02:00
|
|
|
# build binaries
|
|
|
|
|
|
|
|
cabal --version
|
|
|
|
ghc --version
|
|
|
|
|
|
|
|
cabal v2-update
|
|
|
|
cabal v2-clean
|
|
|
|
cabal 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
|
|
|
|
cabal v2-build . pandoc-citeproc
|
|
|
|
cabal v2-test -j1 . pandoc-citeproc
|
|
|
|
for f in $(find dist-newstyle -name 'pandoc*' -type f -perm /400); do cp $f /artifacts/; done
|
|
|
|
|
|
|
|
# make deb
|
|
|
|
|
2017-10-23 00:04:49 +02:00
|
|
|
VERSION=`$ARTIFACTS/pandoc --version | awk '{print $2; exit;}'`
|
2017-03-19 16:24:52 +01:00
|
|
|
REVISION=${REVISION:-1}
|
|
|
|
DEBVER=$VERSION-$REVISION
|
|
|
|
BASE=pandoc-$DEBVER-$ARCHITECTURE
|
|
|
|
DIST=`pwd`/$BASE
|
|
|
|
DEST=$DIST/usr
|
|
|
|
COPYRIGHT=$DEST/share/doc/pandoc/copyright
|
|
|
|
|
|
|
|
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 $ARTIFACTS/pandoc $DEST/bin/
|
|
|
|
cp $ARTIFACTS/pandoc-citeproc $DEST/bin/
|
2017-08-18 23:37:17 +02:00
|
|
|
strip $DEST/bin/pandoc
|
|
|
|
strip $DEST/bin/pandoc-citeproc
|
2020-07-24 18:57:27 +02:00
|
|
|
cp /mnt/man/pandoc.1 $DEST/share/man/man1/pandoc.1
|
2017-10-23 00:04:49 +02:00
|
|
|
$ARTIFACTS/pandoc-citeproc --man > $DEST/share/man/man1/pandoc-citeproc.1
|
2017-03-19 16:24:52 +01:00
|
|
|
gzip -9 $DEST/share/man/man1/pandoc.1
|
|
|
|
gzip -9 $DEST/share/man/man1/pandoc-citeproc.1
|
|
|
|
|
2020-07-24 18:57:27 +02:00
|
|
|
cp /mnt/COPYRIGHT $COPYRIGHT
|
2017-03-19 16:24:52 +01:00
|
|
|
echo "" >> $COPYRIGHT
|
|
|
|
echo "pandoc-citeproc" >> $COPYRIGHT
|
2017-10-23 00:04:49 +02:00
|
|
|
$ARTIFACTS/pandoc-citeproc --license >> $COPYRIGHT
|
2017-03-19 16:24:52 +01:00
|
|
|
|
|
|
|
INSTALLED_SIZE=$(du -k -s $DEST | awk '{print $1}')
|
|
|
|
mkdir $DIST/DEBIAN
|
2017-03-19 17:35:19 +01:00
|
|
|
perl -pe "s/VERSION/$DEBVER/" linux/control.in | \
|
2017-03-19 16:24:52 +01:00
|
|
|
perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \
|
|
|
|
perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \
|
|
|
|
> $DIST/DEBIAN/control
|
|
|
|
|
2020-07-24 18:57:27 +02:00
|
|
|
# we limit compression to avoid OOM error
|
|
|
|
fakeroot dpkg-deb -Zgzip -z9 --build $DIST
|
2017-03-19 16:24:52 +01:00
|
|
|
rm -rf $DIST
|
2017-10-23 00:04:49 +02:00
|
|
|
cp $BASE.deb $ARTIFACTS/
|
2020-07-24 18:57:27 +02:00
|
|
|
|
|
|
|
# Make tarball
|
|
|
|
|
|
|
|
TARGET=pandoc-$VERSION
|
|
|
|
cd $ARTIFACTS
|
|
|
|
rm -rf $TARGET
|
|
|
|
mkdir $TARGET
|
|
|
|
mkdir $TARGET/bin $TARGET/share $TARGET/share/man $TARGET/share/man/man1
|
|
|
|
./pandoc-citeproc --man > $TARGET/share/man/man1/pandoc-citeproc.1
|
|
|
|
cp /mnt/man/pandoc.1 $TARGET/share/man/man1
|
|
|
|
mv pandoc pandoc-citeproc $TARGET/bin
|
|
|
|
strip $TARGET/bin/pandoc
|
|
|
|
strip $TARGET/bin/pandoc-citeproc
|
|
|
|
gzip -9 $TARGET/share/man/man1/pandoc.1
|
|
|
|
gzip -9 $TARGET/share/man/man1/pandoc-citeproc.1
|
|
|
|
|
|
|
|
tar cvzf $TARGET-linux-amd64.tar.gz $TARGET
|
|
|
|
rm -r $TARGET
|