git.iko.soy/typeable/pandoc
on master help sign in
Linux rc build: use ghc-musl container.

This simplifies our build process a bit (over using a customized alpine container). Use new `--enable-executable-static` flag in build. make_artifacts.sh: Fix deprecated find -perm syntax.

commitc9900278321a14071c6721fdfb702e39ca5e2a38 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 24 Jul 2020, 09:57 (6 years ago) parent5d4932d
6 files changed+43−75
.github/workflows/release-candidate.yml−1 Makefile+7−2 linux/Dockerfile−30 linux/Makefile−18 linux/make_deb.sh → linux/make_artifacts.sh+36−5 linux/make_tarball.sh−19
.github/workflows/release-candidate.yml−1
@@ -138,4 +138,3 @@ jobs:
138138 with:
139139 name: macos-release-candidate
140140 path: macos-release-candidate
141−
Makefile+7−2
@@ -5,6 +5,7 @@ BRANCH?=master
55RESOLVER?=lts-13
66GHCOPTS=-fdiagnostics-color=always
77WEBSITE=../../web/pandoc.org
8+REVISION?=1
89
910quick:
1011 stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --ghc-options='-j +RTS -A64m -RTS' --test-arguments='-j4 --hide-successes $(TESTARGS)'
@@ -70,8 +71,12 @@ checkdocs: README.md
7071 ! grep -n -e "\t" MANUAL.txt changelog
7172
7273debpkg: man/pandoc.1
73− make -C linux && \
74− cp linux/artifacts/pandoc-$(version)-*.* .
74+ docker run -v `pwd`:/mnt \
75+ -v `pwd`/linux/artifacts:/artifacts \
76+ -e REVISION=$(REVISION) \
77+ -w /mnt \
78+ utdemir/ghc-musl:v12-libgmp-ghc8101 bash \
79+ /mnt/linux/make_artifacts.sh
7580
7681macospkg: man/pandoc.1
7782 ./macos/make_macos_package.sh
linux/Dockerfiledeleted−30
@@ -1,30 +0,0 @@
1−# USE ALPINE LINUX
2−FROM alpine:3.11
3−RUN apk --no-cache add \
4− alpine-sdk \
5− bash \
6− ca-certificates \
7− cabal \
8− dpkg \
9− fakeroot \
10− ghc \
11− git \
12− gmp-dev \
13− xz \
14− zlib-dev \
15− zlib-static
16−RUN mkdir -p /usr/src/ && \
17− git clone https://github.com/jgm/pandoc /usr/src/pandoc
18−WORKDIR /usr/src/pandoc
19−CMD cabal --version && \
20− ghc --version && \
21− git pull && \
22− git checkout -b work $TREE && \
23− cabal new-update && \
24− cabal new-clean && \
25− cabal new-configure --enable-tests -f-export-dynamic -fstatic -fembed_data_files -fbibutils --ghc-options '-optc-Os -optl=-pthread -optl=-static -fPIC -split-sections' . pandoc-citeproc && \
26− cabal new-build . pandoc-citeproc && \
27− cabal new-test -j1 . pandoc-citeproc && \
28− for f in $(find dist-newstyle -name 'pandoc*' -type f -perm +400); do cp $f /artifacts/; done && \
29− bash linux/make_deb.sh && \
30− bash linux/make_tarball.sh
linux/Makefiledeleted−18
@@ -1,18 +0,0 @@
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−interact:
12− docker run --env TREE=$(TREE) --env REVISION=$(REVISION) \
13− -v $(ARTIFACTS):/artifacts -it alpine-pandoc bash
14−
15−setup:
16− docker pull alpine:edge
17−
18−.PHONY: build setup interact
linux/make_deb.sh → linux/make_artifacts.shrenamed+36−5
@@ -9,6 +9,20 @@ esac
99
1010ARTIFACTS="${ARTIFACTS:-/artifacts}"
1111
12+# build binaries
13+
14+cabal --version
15+ghc --version
16+
17+cabal v2-update
18+cabal v2-clean
19+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
20+cabal v2-build . pandoc-citeproc
21+cabal v2-test -j1 . pandoc-citeproc
22+for f in $(find dist-newstyle -name 'pandoc*' -type f -perm /400); do cp $f /artifacts/; done
23+
24+# make deb
25+
1226VERSION=`$ARTIFACTS/pandoc --version | awk '{print $2; exit;}'`
1327REVISION=${REVISION:-1}
1428DEBVER=$VERSION-$REVISION
@@ -17,8 +31,6 @@ DIST=`pwd`/$BASE
1731DEST=$DIST/usr
1832COPYRIGHT=$DEST/share/doc/pandoc/copyright
1933
20−PANDOC_CITEPROC_VERSION=`$ARTIFACTS/pandoc-citeproc --version | awk '{print $2;}'`
21−
2234mkdir -p $DEST/bin
2335mkdir -p $DEST/share/man/man1
2436mkdir -p $DEST/share/doc/pandoc
@@ -29,12 +41,12 @@ cp $ARTIFACTS/pandoc $DEST/bin/
2941cp $ARTIFACTS/pandoc-citeproc $DEST/bin/
3042strip $DEST/bin/pandoc
3143strip $DEST/bin/pandoc-citeproc
32−cp man/pandoc.1 $DEST/share/man/man1/pandoc.1
44+cp /mnt/man/pandoc.1 $DEST/share/man/man1/pandoc.1
3345$ARTIFACTS/pandoc-citeproc --man > $DEST/share/man/man1/pandoc-citeproc.1
3446gzip -9 $DEST/share/man/man1/pandoc.1
3547gzip -9 $DEST/share/man/man1/pandoc-citeproc.1
3648
37−cp COPYRIGHT $COPYRIGHT
49+cp /mnt/COPYRIGHT $COPYRIGHT
3850echo "" >> $COPYRIGHT
3951echo "pandoc-citeproc" >> $COPYRIGHT
4052$ARTIFACTS/pandoc-citeproc --license >> $COPYRIGHT
@@ -46,6 +58,25 @@ perl -pe "s/VERSION/$DEBVER/" linux/control.in | \
4658 perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \
4759 > $DIST/DEBIAN/control
4860
49−fakeroot dpkg-deb --build $DIST
61+# we limit compression to avoid OOM error
62+fakeroot dpkg-deb -Zgzip -z9 --build $DIST
5063rm -rf $DIST
5164cp $BASE.deb $ARTIFACTS/
65+
66+# Make tarball
67+
68+TARGET=pandoc-$VERSION
69+cd $ARTIFACTS
70+rm -rf $TARGET
71+mkdir $TARGET
72+mkdir $TARGET/bin $TARGET/share $TARGET/share/man $TARGET/share/man/man1
73+./pandoc-citeproc --man > $TARGET/share/man/man1/pandoc-citeproc.1
74+cp /mnt/man/pandoc.1 $TARGET/share/man/man1
75+mv pandoc pandoc-citeproc $TARGET/bin
76+strip $TARGET/bin/pandoc
77+strip $TARGET/bin/pandoc-citeproc
78+gzip -9 $TARGET/share/man/man1/pandoc.1
79+gzip -9 $TARGET/share/man/man1/pandoc-citeproc.1
80+
81+tar cvzf $TARGET-linux-amd64.tar.gz $TARGET
82+rm -r $TARGET
linux/make_tarball.shdeleted−19
@@ -1,19 +0,0 @@
1−set -e
2−
3−ARTIFACTS="${ARTIFACTS:-/artifacts}"
4−VERSION=`$ARTIFACTS/pandoc --version | awk '{print $2; exit;}'`
5−TARGET=pandoc-$VERSION
6−
7−cd $ARTIFACTS
8−rm -rf $TARGET
9−mkdir $TARGET
10−mkdir $TARGET/bin $TARGET/share $TARGET/share/man $TARGET/share/man/man1
11−./pandoc-citeproc --man > $TARGET/share/man/man1/pandoc-citeproc.1
12−cp /usr/src/pandoc/man/pandoc.1 $TARGET/share/man/man1
13−mv pandoc pandoc-citeproc $TARGET/bin
14−strip $TARGET/bin/pandoc
15−strip $TARGET/bin/pandoc-citeproc
16−gzip -9 $TARGET/share/man/man1/pandoc.1
17−gzip -9 $TARGET/share/man/man1/pandoc-citeproc.1
18−tar cvzf $TARGET-linux-amd64.tar.gz $TARGET
19−rm -r $TARGET