aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--static-linux/Dockerfile2
-rwxr-xr-xstatic-linux/make_deb.sh50
2 files changed, 52 insertions, 0 deletions
diff --git a/static-linux/Dockerfile b/static-linux/Dockerfile
index cf44d9472..c73b17622 100644
--- a/static-linux/Dockerfile
+++ b/static-linux/Dockerfile
@@ -19,6 +19,7 @@ RUN stack install --stack-yaml stack.pkg.yaml --only-dependencies \
--flag 'pandoc:embed_data_files' \
--test --ghc-options '-O2 -optc-Os -optl-static -fPIC' \
pandoc pandoc-citeproc
+COPY make_deb.sh .
CMD git pull && \
git checkout -b work $TREE && \
export VERSION=`grep '^Version:' pandoc.cabal | awk '{print $$2;}'` && \
@@ -26,6 +27,7 @@ CMD git pull && \
--local-bin-path /artifacts --flag 'pandoc:embed_data_files' \
--test --ghc-options '-O2 -optc-Os -optl-static -fPIC' \
pandoc pandoc-citeproc && \
+ bash make_deb.sh && \
cd /artifacts && \
mkdir pandoc-$VERSION && \
mv pandoc pandoc-citeproc pandoc-$VERSION/ && \
diff --git a/static-linux/make_deb.sh b/static-linux/make_deb.sh
new file mode 100755
index 000000000..f6abece68
--- /dev/null
+++ b/static-linux/make_deb.sh
@@ -0,0 +1,50 @@
+MACHINE=$(uname -m)
+case "$MACHINE" in
+ x86_64) ARCHITECTURE=amd64;;
+ i686) ARCHITECTURE=i386;;
+ i386) ARCHITECTURE=i386;;
+esac
+
+ARTIFACTS=/artifacts
+
+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
+COPYRIGHT=$DEST/share/doc/pandoc/copyright
+
+PATH=$ARTIFACTS:$PATH
+PANDOC_CITEPROC_VERSION=`pandoc-citeproc --version | awk '{print $2;}'`
+
+mkdir -p $DEST/bin
+mkdir -p $DEST/share/man/man1
+mkdir -p $DEST/share/doc/pandoc
+
+make man/pandoc.1
+
+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/
+cp man/pandoc.1 $DEST/share/man/man1/pandoc.1
+pandoc-citeproc --man > $DEST/share/man/man1/pandoc-citeproc.1
+gzip -9 $DEST/share/man/man1/pandoc.1
+gzip -9 $DEST/share/man/man1/pandoc-citeproc.1
+
+cp COPYRIGHT $COPYRIGHT
+echo "" >> $COPYRIGHT
+echo "pandoc-citeproc" >> $COPYRIGHT
+pandoc-citeproc --license >> $COPYRIGHT
+
+INSTALLED_SIZE=$(du -k -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
+cp $BASE.deb /artifacts/