blob: e70c3cadc595fe3bbecade9fc876afcd30dcbabb [file] [log] [blame]
Christian Egli1fa59f12020-08-25 17:21:53 +02001FROM debian:latest AS builder
Christian Eglic47733a2019-09-24 08:46:50 +02002
3LABEL maintainer="Liblouis Maintainers <liblouis-liblouisxml@freelists.org>"
4
Christian Egli02936582019-11-21 14:10:10 +01005# Fetch build dependencies
6RUN 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 Egliac7500c2020-08-25 17:14:15 +020015 patch \
Christian Egli02936582019-11-21 14:10:10 +010016 && rm -rf /var/lib/apt/lists/*
17
Christian Eglic47733a2019-09-24 08:46:50 +020018# install wine for 32-bit architecture
19RUN apt-get update && dpkg --add-architecture i386 && apt-get update && apt-get install -y \
20 fonts-wine \
Christian Eglibc58f452019-11-21 14:16:18 +010021 libc6-dev-i386-x32-cross \
Christian Egli02936582019-11-21 14:10:10 +010022 mingw-w64 \
23 mingw-w64-i686-dev \
Christian Eglic47733a2019-09-24 08:46:50 +020024 wine \
25 wine32 \
26 && rm -rf /var/lib/apt/lists/*
27
Christian Egliac7500c2020-08-25 17:14:15 +020028ARG LIBYAML_VERSION=0.1.4
Christian Eglic47733a2019-09-24 08:46:50 +020029ENV HOST=i686-w64-mingw32 PREFIX=/usr/build/win32 SRCDIR=/usr/src/
30
31# Build and install libyaml
32WORKDIR ${SRCDIR}
Christian Egli02936582019-11-21 14:10:10 +010033RUN curl -L https://github.com/yaml/libyaml/archive/${LIBYAML_VERSION}.tar.gz | tar zx
Christian Eglic47733a2019-09-24 08:46:50 +020034WORKDIR ${SRCDIR}/libyaml-${LIBYAML_VERSION}
Christian Egli49c585c2020-08-26 11:11:04 +020035# 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 Egliac7500c2020-08-25 17:14:15 +020038ADD libyaml_mingw.patch .
39RUN patch -p1 <libyaml_mingw.patch
Christian Eglic47733a2019-09-24 08:46:50 +020040RUN ./bootstrap && \
41 ./configure --host ${HOST} --prefix=${PREFIX}/libyaml && \
42 make && \
43 make install
44
45# Build release artifact, i.e. liblouis zip
46ADD . ${SRCDIR}/liblouis
47WORKDIR ${SRCDIR}/liblouis
48RUN ./autogen.sh && \
49 ./configure --host ${HOST} --enable-ucs4 \
Christian Egli7ffe1c02019-11-21 14:13:27 +010050 --prefix=${PREFIX}/liblouis \
51 CFLAGS='-O0' \
Christian Eglic47733a2019-09-24 08:46:50 +020052 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 Egli1fa59f12020-08-25 17:21:53 +020058
Christian Eglie77264a2020-08-25 17:39:43 +020059# Now we have all we really need namely the cross-compiled liblouis
Christian Egli1fa59f12020-08-25 17:21:53 +020060# 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
62FROM debian:latest
63
64# install wine for 32-bit architecture
65RUN 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
75ENV SRCDIR=/usr/src/liblouis
76WORKDIR ${SRCDIR}
77COPY --from=builder ${SRCDIR}/liblouis.zip .
78RUN unzip liblouis.zip
79
80# just run any old self-contained yaml test that doesn't need any env setup
81ADD tests/yaml/letterDefTest_harness.yaml .
82RUN wine bin/lou_checkyaml.exe letterDefTest_harness.yaml