summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-10-22 15:04:49 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2017-10-22 15:04:49 -0700
commit0463a57a5c85bd44223fd17bd1370cd31cecee03 (patch)
tree52f5d8264dde4467143b9177b1fc5cdbb9b6facb /linux
parent901c68a65fc2e7389927cf8138a08369b2821978 (diff)
Back to using alpine-based Dockerfile for linux build.
Diffstat (limited to 'linux')
-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
4 files changed, 29 insertions, 98 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