Christian Egli | 1c5fc9c | 2020-08-25 17:39:16 +0200 | [diff] [blame] | 1 | FROM debian:latest AS builder |
Christian Egli | 735caea | 2019-09-13 17:08:49 +0200 | [diff] [blame] | 2 | |
| 3 | LABEL maintainer="Liblouis Maintainers <liblouis-liblouisxml@freelists.org>" |
| 4 | |
| 5 | # Fetch build dependencies |
| 6 | RUN 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 Egli | 2c2e5e7 | 2020-08-25 17:38:16 +0200 | [diff] [blame] | 17 | patch \ |
Christian Egli | 735caea | 2019-09-13 17:08:49 +0200 | [diff] [blame] | 18 | && rm -rf /var/lib/apt/lists/* |
| 19 | |
Christian Egli | 2c2e5e7 | 2020-08-25 17:38:16 +0200 | [diff] [blame] | 20 | ARG LIBYAML_VERSION=0.1.4 |
Christian Egli | 735caea | 2019-09-13 17:08:49 +0200 | [diff] [blame] | 21 | ENV HOST=x86_64-w64-mingw32 PREFIX=/usr/build/win64 SRCDIR=/usr/src/ |
| 22 | |
| 23 | # Build and install libyaml |
| 24 | WORKDIR ${SRCDIR} |
| 25 | RUN curl -L https://github.com/yaml/libyaml/archive/${LIBYAML_VERSION}.tar.gz | tar zx |
| 26 | WORKDIR ${SRCDIR}/libyaml-${LIBYAML_VERSION} |
Christian Egli | 49c585c | 2020-08-26 11:11:04 +0200 | [diff] [blame] | 27 | # 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 Egli | 2c2e5e7 | 2020-08-25 17:38:16 +0200 | [diff] [blame] | 30 | ADD libyaml_mingw.patch . |
| 31 | RUN patch -p1 <libyaml_mingw.patch |
Christian Egli | 735caea | 2019-09-13 17:08:49 +0200 | [diff] [blame] | 32 | RUN ./bootstrap && \ |
| 33 | ./configure --host ${HOST} --prefix=${PREFIX}/libyaml && \ |
| 34 | make && \ |
| 35 | make install |
| 36 | |
| 37 | # Build release artifact, i.e. liblouis zip |
| 38 | ADD . ${SRCDIR}/liblouis |
| 39 | WORKDIR ${SRCDIR}/liblouis |
| 40 | RUN ./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 Egli | 1c5fc9c | 2020-08-25 17:39:16 +0200 | [diff] [blame] | 49 | |
| 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 |
| 53 | FROM debian:latest |
| 54 | |
| 55 | # install wine |
| 56 | RUN apt-get update && apt-get install -y \ |
| 57 | mingw-w64 \ |
| 58 | wine64 \ |
| 59 | unzip \ |
| 60 | && rm -rf /var/lib/apt/lists/* |
| 61 | |
| 62 | ENV SRCDIR=/usr/src/liblouis |
| 63 | WORKDIR ${SRCDIR} |
| 64 | COPY --from=builder ${SRCDIR}/liblouis.zip . |
| 65 | RUN unzip liblouis.zip |
| 66 | |
| 67 | # just run any old self-contained yaml test that doesn't need any env setup |
| 68 | ADD tests/yaml/letterDefTest_harness.yaml . |
| 69 | RUN wine64 bin/lou_checkyaml.exe letterDefTest_harness.yaml |