git.iko.soy/typeable/pandoc
on master help sign in
Improved linux tar.gz creation and added Dockerfile to repository.
commit74fd00b5f6a776df0fd10d3f4bea58d10ae3a2a3 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 19 Mar 2017, 16:24 (10 years ago) parent6756e23
4 files changed+111
linux/Dockerfile+31 linux/Makefile+14 linux/make_deb.sh+51 linux/make_tarball.sh+15
linux/Dockerfilenew file+31
@@ -0,0 +1,31 @@
1+# USE ALPINE LINUX
2+FROM alpine:edge
3+RUN echo "https://s3-us-west-2.amazonaws.com/alpine-ghc/8.0" >> /etc/apk/repositories
4+ADD https://raw.githubusercontent.com/mitchty/alpine-ghc/master/mitch.tishmack%40gmail.com-55881c97.rsa.pub \
5+ /etc/apk/keys/mitch.tishmack@gmail.com-55881c97.rsa.pub
6+RUN apk update
7+RUN apk add alpine-sdk git ca-certificates ghc cabal stack zlib-dev \
8+ dpkg fakeroot sed gawk grep
9+RUN stack update
10+RUN stack config set system-ghc --global true
11+RUN mkdir -p /etc/stack
12+RUN echo "build: { split-objs: true }" > /etc/stack/config.yaml
13+RUN mkdir -p /usr/src/
14+WORKDIR /usr/src/
15+RUN git clone https://github.com/jgm/pandoc
16+WORKDIR /usr/src/pandoc
17+RUN stack install --local-bin-path /usr/bin hsb2hs
18+RUN stack install --stack-yaml stack.pkg.yaml --only-dependencies \
19+ --flag 'pandoc:embed_data_files' \
20+ --test --ghc-options '-O2 -optc-Os -optl-static -fPIC' \
21+ pandoc pandoc-citeproc
22+COPY make_deb.sh .
23+COPY make_tarball.sh .
24+CMD git pull && \
25+ git checkout -b work $TREE && \
26+ stack install --stack-yaml stack.pkg.yaml \
27+ --local-bin-path /artifacts --flag 'pandoc:embed_data_files' \
28+ --test --ghc-options '-O2 -optc-Os -optl-static -fPIC' \
29+ pandoc pandoc-citeproc && \
30+ bash make_deb.sh && \
31+ bash make_tarball.sh
linux/Makefilenew file+14
@@ -0,0 +1,14 @@
1+TREE?=HEAD
2+ARTIFACTS=`pwd`/artifacts
3+REVISION?=1
4+
5+build:
6+ mkdir -p $(ARTIFACTS)
7+ docker build -t alpine-pandoc .
8+ docker run --env TREE=$(TREE) --env REVISION=$(REVISION) \
9+ -v $(ARTIFACTS):/artifacts alpine-pandoc
10+
11+setup:
12+ docker pull alpine:edge
13+
14+.PHONY: build setup
linux/make_deb.shnew file+51
@@ -0,0 +1,51 @@
1+set -e
2+
3+MACHINE=$(uname -m)
4+case "$MACHINE" in
5+ x86_64) ARCHITECTURE=amd64;;
6+ i686) ARCHITECTURE=i386;;
7+ i386) ARCHITECTURE=i386;;
8+esac
9+
10+ARTIFACTS=/artifacts
11+
12+VERSION=$(grep -e '^Version' pandoc.cabal | awk '{print $2}')
13+REVISION=${REVISION:-1}
14+DEBVER=$VERSION-$REVISION
15+BASE=pandoc-$DEBVER-$ARCHITECTURE
16+DIST=`pwd`/$BASE
17+DEST=$DIST/usr
18+COPYRIGHT=$DEST/share/doc/pandoc/copyright
19+
20+PANDOC_CITEPROC_VERSION=`$ARTIFACTS/pandoc-citeproc --version | awk '{print $2;}'`
21+
22+mkdir -p $DEST/bin
23+mkdir -p $DEST/share/man/man1
24+mkdir -p $DEST/share/doc/pandoc
25+
26+make man/pandoc.1
27+
28+mkdir -p $DEST/share/doc/pandoc-citeproc
29+find $DIST -type d | xargs chmod 755
30+cp $ARTIFACTS/pandoc $DEST/bin/
31+cp $ARTIFACTS/pandoc-citeproc $DEST/bin/
32+cp man/pandoc.1 $DEST/share/man/man1/pandoc.1
33+/artifacts/pandoc-citeproc --man > $DEST/share/man/man1/pandoc-citeproc.1
34+gzip -9 $DEST/share/man/man1/pandoc.1
35+gzip -9 $DEST/share/man/man1/pandoc-citeproc.1
36+
37+cp COPYRIGHT $COPYRIGHT
38+echo "" >> $COPYRIGHT
39+echo "pandoc-citeproc" >> $COPYRIGHT
40+/artifacts/pandoc-citeproc --license >> $COPYRIGHT
41+
42+INSTALLED_SIZE=$(du -k -s $DEST | awk '{print $1}')
43+mkdir $DIST/DEBIAN
44+perl -pe "s/VERSION/$DEBVER/" deb/control.in | \
45+ perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \
46+ perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \
47+ > $DIST/DEBIAN/control
48+
49+fakeroot dpkg-deb --build $DIST
50+rm -rf $DIST
51+cp $BASE.deb /artifacts/
linux/make_tarball.shnew file+15
@@ -0,0 +1,15 @@
1+set -e
2+
3+VERSION=$(grep -e '^Version' pandoc.cabal | awk '{print $2}')
4+TARGET=pandoc-$VERSION
5+
6+cd /artifacts
7+mkdir $TARGET
8+mkdir $TARGET/bin $TARGET/man $TARGET/man/man1
9+./pandoc-citeproc --man > $TARGET/man/man1/pandoc-citeproc.1
10+cp /usr/src/pandoc/man/pandoc.1 $TARGET/man/man1
11+mv pandoc pandoc-citeproc $TARGET/bin
12+gzip -9 $TARGET/man/man1/pandoc.1
13+gzip -9 $TARGET/man/man1/pandoc-citeproc.1
14+tar cvzf $TARGET.tar.gz $TARGET
15+rm -r $TARGET