blob: 4f5ab0f8cfb311152b4c8081685f9049b7ea0d34 [file] [log] [blame]
Christian Egli1c5fc9c2020-08-25 17:39:16 +02001FROM debian:latest AS builder
Christian Egli735caea2019-09-13 17:08:49 +02002
3LABEL maintainer="Liblouis Maintainers <liblouis-liblouisxml@freelists.org>"
4
5# Fetch build dependencies
6RUN apt-get update && apt-get install -y \
7 autoconf \
8 automake \
9 curl \
10 libtool \
11 make \
12 mingw-w64 \
13 pkg-config \
14 texinfo \
15 wine64 \
16 zip \
Christian Egli2c2e5e72020-08-25 17:38:16 +020017 patch \
Christian Egli735caea2019-09-13 17:08:49 +020018 && rm -rf /var/lib/apt/lists/*
19
Christian Egli2c2e5e72020-08-25 17:38:16 +020020ARG LIBYAML_VERSION=0.1.4
Christian Egli735caea2019-09-13 17:08:49 +020021ENV HOST=x86_64-w64-mingw32 PREFIX=/usr/build/win64 SRCDIR=/usr/src/
22
23# Build and install libyaml
24WORKDIR ${SRCDIR}
25RUN curl -L https://github.com/yaml/libyaml/archive/${LIBYAML_VERSION}.tar.gz | tar zx
26WORKDIR ${SRCDIR}/libyaml-${LIBYAML_VERSION}
Christian Egli49c585c2020-08-26 11:11:04 +020027# Unfortunately we need to apply a patch to version 0.1.4 of libyaml. But regretfully we
28# depend on 0.1.4 to have a statically linked version of libyaml. With newer versions of
29# liblouis we haven't managed to produce a self-contained lou_checkyaml.exe so far.
Christian Egli2c2e5e72020-08-25 17:38:16 +020030ADD libyaml_mingw.patch .
31RUN patch -p1 <libyaml_mingw.patch
Christian Egli735caea2019-09-13 17:08:49 +020032RUN ./bootstrap && \
33 ./configure --host ${HOST} --prefix=${PREFIX}/libyaml && \
34 make && \
35 make install
36
37# Build release artifact, i.e. liblouis zip
38ADD . ${SRCDIR}/liblouis
39WORKDIR ${SRCDIR}/liblouis
40RUN ./autogen.sh && \
41 ./configure --host ${HOST} --enable-ucs4 \
42 --prefix=${PREFIX}/liblouis \
43 CPPFLAGS="-I${PREFIX}/libyaml/include/" LDFLAGS="-L${PREFIX}/libyaml/lib/" && \
44 make LDFLAGS="-L${PREFIX}/libyaml/lib/ -avoid-version -Xcompiler -static-libgcc" && \
45 make check WINE=wine64 || cat tests/test-suite.log && \
46 make install && \
47 cd ${PREFIX}/liblouis && \
48 zip -r ${SRCDIR}/liblouis/liblouis.zip *
Christian Egli1c5fc9c2020-08-25 17:39:16 +020049
50# Now we have all we really need namely the cross-compiled liblouis
51# packaged neatly in a zip. But just to be extra sure we test the
52# cross-compiled liblouis in a separate docker image with wine
53FROM debian:latest
54
55# install wine
56RUN apt-get update && apt-get install -y \
57 mingw-w64 \
58 wine64 \
59 unzip \
60 && rm -rf /var/lib/apt/lists/*
61
62ENV SRCDIR=/usr/src/liblouis
63WORKDIR ${SRCDIR}
64COPY --from=builder ${SRCDIR}/liblouis.zip .
65RUN unzip liblouis.zip
66
67# just run any old self-contained yaml test that doesn't need any env setup
68ADD tests/yaml/letterDefTest_harness.yaml .
69RUN wine64 bin/lou_checkyaml.exe letterDefTest_harness.yaml