aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux/Dockerfile30
-rwxr-xr-xlinux/make_deb.sh12
-rw-r--r--linux/make_linux.sh80
-rw-r--r--linux/make_tarball.sh5
-rw-r--r--stack.pkg.yaml2
-rw-r--r--stack.yaml2
6 files changed, 31 insertions, 100 deletions
diff --git a/linux/Dockerfile b/linux/Dockerfile
index 40e229705..d2348b11d 100644
--- a/linux/Dockerfile
+++ b/linux/Dockerfile
@@ -1,19 +1,31 @@
-FROM debian:jessie-slim
-RUN apt-get update
-RUN apt-get -y install git ca-certificates zlib1g-dev curl \
- dpkg fakeroot sed gawk grep bash xz-utils make build-essential clang \
- libgmp-dev
-RUN curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C /usr/bin '*/stack'
-RUN mkdir -p /etc/stack
+# USE ALPINE LINUX
+FROM alpine:edge
+RUN echo "https://s3-us-west-2.amazonaws.com/alpine-ghc/8.0" >> /etc/apk/repositories
+ADD https://raw.githubusercontent.com/mitchty/alpine-ghc/master/mitch.tishmack%40gmail.com-55881c97.rsa.pub \
+ /etc/apk/keys/mitch.tishmack@gmail.com-55881c97.rsa.pub
+RUN apk update
+RUN apk add alpine-sdk git ca-certificates ghc cabal stack zlib-dev \
+ dpkg fakeroot sed gawk grep bash linux-headers
+RUN stack update
+RUN stack config set system-ghc --global true
+#RUN mkdir -p /etc/stack
#RUN echo "build: { split-objs: true }" > /etc/stack/config.yaml
RUN mkdir -p /usr/src/
WORKDIR /usr/src/
RUN git clone https://github.com/jgm/pandoc
WORKDIR /usr/src/pandoc
-RUN stack setup
RUN stack install --stack-yaml stack.pkg.yaml --only-dependencies \
--flag 'pandoc:embed_data_files' \
+ --ghc-options '-O2 -optc-Os -optl=-pthread -optl=-static -fPIC' \
pandoc pandoc-citeproc
CMD git pull && \
git checkout -b work $TREE && \
- ARTIFACTS=/artifacts sh linux/make_linux.sh
+ stack install --stack-yaml stack.pkg.yaml \
+ --flag 'pandoc:static' \
+ --flag 'pandoc:embed_data_files' \
+ --flag 'hslua:-export-dynamic' \
+ --ghc-options '-O2 -optc-Os -optl=-pthread -optl=-static -fPIC' \
+ --local-bin-path /artifacts \
+ pandoc pandoc-citeproc && \
+ bash linux/make_deb.sh && \
+ bash linux/make_tarball.sh
diff --git a/linux/make_deb.sh b/linux/make_deb.sh
index 9ef191ad4..5df1f2381 100755
--- a/linux/make_deb.sh
+++ b/linux/make_deb.sh
@@ -7,9 +7,9 @@ case "$MACHINE" in
i386) ARCHITECTURE=i386;;
esac
-ARTIFACTS=/artifacts
+ARTIFACTS=?/artifacts
-VERSION=$(grep -e '^Version' pandoc.cabal | awk '{print $2}')
+VERSION=`$ARTIFACTS/pandoc --version | awk '{print $2; exit;}'`
REVISION=${REVISION:-1}
DEBVER=$VERSION-$REVISION
BASE=pandoc-$DEBVER-$ARCHITECTURE
@@ -23,8 +23,6 @@ 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/
@@ -32,14 +30,14 @@ cp $ARTIFACTS/pandoc-citeproc $DEST/bin/
strip $DEST/bin/pandoc
strip $DEST/bin/pandoc-citeproc
cp man/pandoc.1 $DEST/share/man/man1/pandoc.1
-/artifacts/pandoc-citeproc --man > $DEST/share/man/man1/pandoc-citeproc.1
+$ARTIFACTS/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
-/artifacts/pandoc-citeproc --license >> $COPYRIGHT
+$ARTIFACTS/pandoc-citeproc --license >> $COPYRIGHT
INSTALLED_SIZE=$(du -k -s $DEST | awk '{print $1}')
mkdir $DIST/DEBIAN
@@ -50,4 +48,4 @@ perl -pe "s/VERSION/$DEBVER/" linux/control.in | \
fakeroot dpkg-deb --build $DIST
rm -rf $DIST
-cp $BASE.deb /artifacts/
+cp $BASE.deb $ARTIFACTS/
diff --git a/linux/make_linux.sh b/linux/make_linux.sh
deleted file mode 100644
index c86e5f8b2..000000000
--- a/linux/make_linux.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/bash -e
-
-ARTIFACTS=?`pwd`/linux/artifacts
-
-mkdir -p $ARTIFACTS
-stack clean
-stack install --stack-yaml stack.pkg.yaml \
- --flag 'pandoc:embed_data_files' \
- --local-bin-path $ARTIFACTS \
- pandoc pandoc-citeproc
-
-# Make deb
-
-MACHINE=$(uname -m)
-case "$MACHINE" in
- x86_64) ARCHITECTURE=amd64;;
- i686) ARCHITECTURE=i386;;
- i386) ARCHITECTURE=i386;;
-esac
-
-VERSION=`$ARTIFACTS/pandoc --version | awk '{print $2; exit;}'`
-PANDOC_CITEPROC_VERSION=`$ARTIFACTS/pandoc-citeproc --version | awk '{print $2; exit;}'`
-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
-
-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/
-strip $DEST/bin/pandoc
-strip $DEST/bin/pandoc-citeproc
-cp man/pandoc.1 $DEST/share/man/man1/pandoc.1
-$ARTIFACTS/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
-$ARTIFACTS/pandoc-citeproc --license >> $COPYRIGHT
-
-INSTALLED_SIZE=$(du -k -s $DEST | awk '{print $1}')
-mkdir $DIST/DEBIAN
-perl -pe "s/VERSION/$DEBVER/" linux/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/
-
-# Create tarball
-
-TARGET=$ARTIFACTS/pandoc-$VERSION
-
-rm -rf $TARGET
-mkdir $TARGET
-mkdir $TARGET/bin $TARGET/share $TARGET/share/man $TARGET/share/man/man1
-$ARTIFACTS/pandoc-citeproc --man > $TARGET/share/man/man1/pandoc-citeproc.1
-cp man/pandoc.1 $TARGET/share/man/man1
-mv $ARTIFACTS/pandoc $ARTIFACTS/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
-cd $ARTIFACTS
-tar cvzf pandoc-$VERSION.tar.gz pandoc-$VERSION
-rm -r $TARGET
diff --git a/linux/make_tarball.sh b/linux/make_tarball.sh
index 28c0b9b7f..7d465e06e 100644
--- a/linux/make_tarball.sh
+++ b/linux/make_tarball.sh
@@ -1,9 +1,10 @@
set -e
-VERSION=$(grep -e '^Version' pandoc.cabal | awk '{print $2}')
TARGET=pandoc-$VERSION
+ARTIFACTS=?/artifacts
+VERSION=`$ARTIFACTS/pandoc --version | awk '{print $2; exit;}'`
-cd /artifacts
+cd $ARTIFACTS
rm -rf $TARGET
mkdir $TARGET
mkdir $TARGET/bin $TARGET/share $TARGET/share/man $TARGET/share/man/man1
diff --git a/stack.pkg.yaml b/stack.pkg.yaml
index b7cf8436f..bcf173d19 100644
--- a/stack.pkg.yaml
+++ b/stack.pkg.yaml
@@ -18,7 +18,7 @@ packages:
extra-dep: false
extra-deps:
- pandoc-types-1.17.2
-- hslua-0.9.0
+- hslua-0.9.2
- skylighting-0.4.1
- cmark-gfm-0.1.1
- QuickCheck-2.10.0.1
diff --git a/stack.yaml b/stack.yaml
index 035173389..4b820c764 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -8,7 +8,7 @@ packages:
- '.'
extra-deps:
- pandoc-types-1.17.2
-- hslua-0.9.0
+- hslua-0.9.2
- skylighting-0.4.1
- cmark-gfm-0.1.1
- QuickCheck-2.10.0.1