Debian Codegraph @

Dockerfile.win32

raw
1 FROM debian:bookworm@sha256:8738a0fdc7a61feebbeb625c41b405443639ea0a04ecc0d481d92b4720fd8566 AS builder
2
3 LABEL maintainer="Liblouis Maintainers <[email protected]>"
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 pkg-config \
13 texinfo \
14 zip \
15 patch \
16 && rm -rf /var/lib/apt/lists/*
17
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 \
21 libc6-dev-i386-x32-cross \
22 mingw-w64 \
23 mingw-w64-i686-dev \
24 wine \
25 wine32 \
26 && rm -rf /var/lib/apt/lists/*
27
28 ARG LIBYAML_VERSION=0.1.4
29 ENV HOST=i686-w64-mingw32 PREFIX=/usr/build/win32 SRCDIR=/usr/src/
30
31 # Build and install libyaml
32 WORKDIR ${SRCDIR}
33 RUN curl -L https://github.com/yaml/libyaml/archive/${LIBYAML_VERSION}.tar.gz | tar zx
34 WORKDIR ${SRCDIR}/libyaml-${LIBYAML_VERSION}
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.
38 ADD libyaml_mingw.patch .
39 RUN patch -p1 <libyaml_mingw.patch
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 \
50 --prefix=${PREFIX}/liblouis \
51 CFLAGS='-O0' \
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 *
58
59 # Now we have all we really need namely the cross-compiled liblouis
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:bookworm@sha256:8738a0fdc7a61feebbeb625c41b405443639ea0a04ecc0d481d92b4720fd8566
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