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.
This commit is contained in:
John MacFarlane 2020-07-24 09:57:27 -07:00
parent 5d4932d7ef
commit c990027832
6 changed files with 43 additions and 75 deletions

View file

@ -138,4 +138,3 @@ jobs:
with:
name: macos-release-candidate
path: macos-release-candidate

View file

@ -5,6 +5,7 @@ BRANCH?=master
RESOLVER?=lts-13
GHCOPTS=-fdiagnostics-color=always
WEBSITE=../../web/pandoc.org
REVISION?=1
quick:
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
! grep -n -e "\t" MANUAL.txt changelog
debpkg: man/pandoc.1
make -C linux && \
cp linux/artifacts/pandoc-$(version)-*.* .
docker run -v `pwd`:/mnt \
-v `pwd`/linux/artifacts:/artifacts \
-e REVISION=$(REVISION) \
-w /mnt \
utdemir/ghc-musl:v12-libgmp-ghc8101 bash \
/mnt/linux/make_artifacts.sh
macospkg: man/pandoc.1
./macos/make_macos_package.sh

View file

@ -1,30 +0,0 @@
# USE ALPINE LINUX
FROM alpine:3.11
RUN apk --no-cache add \
alpine-sdk \
bash \
ca-certificates \
cabal \
dpkg \
fakeroot \
ghc \
git \
gmp-dev \
xz \
zlib-dev \
zlib-static
RUN mkdir -p /usr/src/ && \
git clone https://github.com/jgm/pandoc /usr/src/pandoc
WORKDIR /usr/src/pandoc
CMD cabal --version && \
ghc --version && \
git pull && \
git checkout -b work $TREE && \
cabal new-update && \
cabal new-clean && \
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 && \
cabal new-build . pandoc-citeproc && \
cabal new-test -j1 . pandoc-citeproc && \
for f in $(find dist-newstyle -name 'pandoc*' -type f -perm +400); do cp $f /artifacts/; done && \
bash linux/make_deb.sh && \
bash linux/make_tarball.sh

View file

@ -1,18 +0,0 @@
TREE?=HEAD
ARTIFACTS=`pwd`/artifacts
REVISION?=1
build:
mkdir -p $(ARTIFACTS)
docker build -t alpine-pandoc .
docker run --env TREE=$(TREE) --env REVISION=$(REVISION) \
-v $(ARTIFACTS):/artifacts alpine-pandoc
interact:
docker run --env TREE=$(TREE) --env REVISION=$(REVISION) \
-v $(ARTIFACTS):/artifacts -it alpine-pandoc bash
setup:
docker pull alpine:edge
.PHONY: build setup interact

41
linux/make_deb.sh → linux/make_artifacts.sh Executable file → Normal file
View file

@ -9,6 +9,20 @@ esac
ARTIFACTS="${ARTIFACTS:-/artifacts}"
# build binaries
cabal --version
ghc --version
cabal v2-update
cabal v2-clean
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
cabal v2-build . pandoc-citeproc
cabal v2-test -j1 . pandoc-citeproc
for f in $(find dist-newstyle -name 'pandoc*' -type f -perm /400); do cp $f /artifacts/; done
# make deb
VERSION=`$ARTIFACTS/pandoc --version | awk '{print $2; exit;}'`
REVISION=${REVISION:-1}
DEBVER=$VERSION-$REVISION
@ -17,8 +31,6 @@ DIST=`pwd`/$BASE
DEST=$DIST/usr
COPYRIGHT=$DEST/share/doc/pandoc/copyright
PANDOC_CITEPROC_VERSION=`$ARTIFACTS/pandoc-citeproc --version | awk '{print $2;}'`
mkdir -p $DEST/bin
mkdir -p $DEST/share/man/man1
mkdir -p $DEST/share/doc/pandoc
@ -29,12 +41,12 @@ 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
cp /mnt/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
cp /mnt/COPYRIGHT $COPYRIGHT
echo "" >> $COPYRIGHT
echo "pandoc-citeproc" >> $COPYRIGHT
$ARTIFACTS/pandoc-citeproc --license >> $COPYRIGHT
@ -46,6 +58,25 @@ perl -pe "s/VERSION/$DEBVER/" linux/control.in | \
perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \
> $DIST/DEBIAN/control
fakeroot dpkg-deb --build $DIST
# we limit compression to avoid OOM error
fakeroot dpkg-deb -Zgzip -z9 --build $DIST
rm -rf $DIST
cp $BASE.deb $ARTIFACTS/
# Make tarball
TARGET=pandoc-$VERSION
cd $ARTIFACTS
rm -rf $TARGET
mkdir $TARGET
mkdir $TARGET/bin $TARGET/share $TARGET/share/man $TARGET/share/man/man1
./pandoc-citeproc --man > $TARGET/share/man/man1/pandoc-citeproc.1
cp /mnt/man/pandoc.1 $TARGET/share/man/man1
mv pandoc 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
tar cvzf $TARGET-linux-amd64.tar.gz $TARGET
rm -r $TARGET

View file

@ -1,19 +0,0 @@
set -e
ARTIFACTS="${ARTIFACTS:-/artifacts}"
VERSION=`$ARTIFACTS/pandoc --version | awk '{print $2; exit;}'`
TARGET=pandoc-$VERSION
cd $ARTIFACTS
rm -rf $TARGET
mkdir $TARGET
mkdir $TARGET/bin $TARGET/share $TARGET/share/man $TARGET/share/man/man1
./pandoc-citeproc --man > $TARGET/share/man/man1/pandoc-citeproc.1
cp /usr/src/pandoc/man/pandoc.1 $TARGET/share/man/man1
mv pandoc 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
tar cvzf $TARGET-linux-amd64.tar.gz $TARGET
rm -r $TARGET