Christian Egli | 1fa59f1 | 2020-08-25 17:21:53 +0200 | [diff] [blame] | 1 | FROM debian:latest AS builder |
Christian Egli | c47733a | 2019-09-24 08:46:50 +0200 | [diff] [blame] | 2 | |
| 3 | LABEL maintainer="Liblouis Maintainers <liblouis-liblouisxml@freelists.org>" |
| 4 | |
Christian Egli | 0293658 | 2019-11-21 14:10:10 +0100 | [diff] [blame] | 5 | # Fetch build dependencies |
| 6 | RUN apt-get update && apt-get install -y \ |
| 7 | autoconf \ |
| 8 | automake \ |
| 9 | curl \ |
| 10 | libtool \ |
| 11 | make \ |
| 12 | pkg-config \ |
| 13 | texinfo \ |
| 14 | zip \ |
Christian Egli | ac7500c | 2020-08-25 17:14:15 +0200 | [diff] [blame] | 15 | patch \ |
Christian Egli | 0293658 | 2019-11-21 14:10:10 +0100 | [diff] [blame] | 16 | && rm -rf /var/lib/apt/lists/* |
| 17 | |
Christian Egli | c47733a | 2019-09-24 08:46:50 +0200 | [diff] [blame] | 18 | # install wine for 32-bit architecture |
| 19 | RUN apt-get update && dpkg --add-architecture i386 && apt-get update && apt-get install -y \ |
| 20 | fonts-wine \ |
Christian Egli | bc58f45 | 2019-11-21 14:16:18 +0100 | [diff] [blame] | 21 | libc6-dev-i386-x32-cross \ |
Christian Egli | 0293658 | 2019-11-21 14:10:10 +0100 | [diff] [blame] | 22 | mingw-w64 \ |
| 23 | mingw-w64-i686-dev \ |
Christian Egli | c47733a | 2019-09-24 08:46:50 +0200 | [diff] [blame] | 24 | wine \ |
| 25 | wine32 \ |
| 26 | && rm -rf /var/lib/apt/lists/* |
| 27 | |
Christian Egli | ac7500c | 2020-08-25 17:14:15 +0200 | [diff] [blame] | 28 | ARG LIBYAML_VERSION=0.1.4 |
Christian Egli | c47733a | 2019-09-24 08:46:50 +0200 | [diff] [blame] | 29 | ENV HOST=i686-w64-mingw32 PREFIX=/usr/build/win32 SRCDIR=/usr/src/ |
| 30 | |
| 31 | # Build and install libyaml |
| 32 | WORKDIR ${SRCDIR} |
Christian Egli | 0293658 | 2019-11-21 14:10:10 +0100 | [diff] [blame] | 33 | RUN curl -L https://github.com/yaml/libyaml/archive/${LIBYAML_VERSION}.tar.gz | tar zx |
Christian Egli | c47733a | 2019-09-24 08:46:50 +0200 | [diff] [blame] | 34 | WORKDIR ${SRCDIR}/libyaml-${LIBYAML_VERSION} |
Christian Egli | 49c585c | 2020-08-26 11:11:04 +0200 | [diff] [blame] | 35 | # Unfortunately we need to apply a patch to version 0.1.4 of libyaml. But regretfully we |
| 36 | # depend on 0.1.4 to have a statically linked version of libyaml. With newer versions of |
| 37 | # liblouis we haven't managed to produce a self-contained lou_checkyaml.exe so far. |
Christian Egli | ac7500c | 2020-08-25 17:14:15 +0200 | [diff] [blame] | 38 | ADD libyaml_mingw.patch . |
| 39 | RUN patch -p1 <libyaml_mingw.patch |
Christian Egli | c47733a | 2019-09-24 08:46:50 +0200 | [diff] [blame] | 40 | RUN ./bootstrap && \ |
| 41 | ./configure --host ${HOST} --prefix=${PREFIX}/libyaml && \ |
| 42 | make && \ |
| 43 | make install |
| 44 | |
| 45 | # Build release artifact, i.e. liblouis zip |
| 46 | ADD . ${SRCDIR}/liblouis |
| 47 | WORKDIR ${SRCDIR}/liblouis |
| 48 | RUN ./autogen.sh && \ |
| 49 | ./configure --host ${HOST} --enable-ucs4 \ |
Christian Egli | 7ffe1c0 | 2019-11-21 14:13:27 +0100 | [diff] [blame] | 50 | --prefix=${PREFIX}/liblouis \ |
| 51 | CFLAGS='-O0' \ |
Christian Egli | c47733a | 2019-09-24 08:46:50 +0200 | [diff] [blame] | 52 | CPPFLAGS="-I${PREFIX}/libyaml/include/" LDFLAGS="-L${PREFIX}/libyaml/lib/" && \ |
| 53 | make LDFLAGS="-L${PREFIX}/libyaml/lib/ -avoid-version -Xcompiler -static-libgcc" && \ |
| 54 | make check WINE=wine || cat tests/test-suite.log && \ |
| 55 | make install && \ |
| 56 | cd ${PREFIX}/liblouis && \ |
| 57 | zip -r ${SRCDIR}/liblouis/liblouis.zip * |
Christian Egli | 1fa59f1 | 2020-08-25 17:21:53 +0200 | [diff] [blame] | 58 | |
Christian Egli | e77264a | 2020-08-25 17:39:43 +0200 | [diff] [blame] | 59 | # Now we have all we really need namely the cross-compiled liblouis |
Christian Egli | 1fa59f1 | 2020-08-25 17:21:53 +0200 | [diff] [blame] | 60 | # packaged neatly in a zip. But just to be extra sure we test the |
| 61 | # cross-compiled liblouis in a separate docker image with wine |
| 62 | FROM debian:latest |
| 63 | |
| 64 | # install wine for 32-bit architecture |
| 65 | RUN apt-get update && dpkg --add-architecture i386 && apt-get update && apt-get install -y \ |
| 66 | fonts-wine \ |
| 67 | libc6-dev-i386-x32-cross \ |
| 68 | mingw-w64 \ |
| 69 | mingw-w64-i686-dev \ |
| 70 | wine \ |
| 71 | wine32 \ |
| 72 | unzip \ |
| 73 | && rm -rf /var/lib/apt/lists/* |
| 74 | |
| 75 | ENV SRCDIR=/usr/src/liblouis |
| 76 | WORKDIR ${SRCDIR} |
| 77 | COPY --from=builder ${SRCDIR}/liblouis.zip . |
| 78 | RUN unzip liblouis.zip |
| 79 | |
| 80 | # just run any old self-contained yaml test that doesn't need any env setup |
| 81 | ADD tests/yaml/letterDefTest_harness.yaml . |
| 82 | RUN wine bin/lou_checkyaml.exe letterDefTest_harness.yaml |