Skip to content

Commit

Permalink
Update windows build.
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Nov 30, 2024
1 parent 52441af commit d48f4f1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 100 deletions.
43 changes: 24 additions & 19 deletions docker/Dockerfile.win32
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
ARG IMAGE
FROM $IMAGE
FROM $IMAGE AS base

ARG RELEASE=master
ARG BUILD
ARG HOST
USER opam

WORKDIR /tmp
ENV OPAM_MXE_DEPS=ao-windows,ffmpeg-windows,portaudio-windows,samplerate-windows,ssl-windows,srt-windows,winsvc-windows

USER opam
RUN eval `opam config env` && opam repository remove windows --all && \
cd /home/opam/ && rm -rf opam-cross-windows && \
git clone https://github.com/ocaml-cross/opam-cross-windows.git && \
cd /home/opam/opam-cross-windows/ && \
opam repository add windows . && \
opam list --short --recursive --external --vars os-distribution=mxe,os-family=mingw --required-by=$OPAM_MXE_DEPS > /home/opam/mxe-deps

ENV CC ""
USER root

RUN eval `opam config env` && opam update && opam reinstall -y pandoc `echo $OPAM_DEPS | sed -e 's#,# #g'`
# We had pick our own HEAD for mxe
RUN cd /usr/src/mxe/ && \
git remote add savonet https://github.com/savonet/mxe.git && \
git fetch savonet && \
git reset --hard 5b255aa669ac479aebfd00377eb5ef95c1c6622f

RUN git clone --recursive https://github.com/savonet/liquidsoap.git && \
cd liquidsoap && git checkout $RELEASE && ./bootstrap
RUN cd /usr/src/mxe/ && \
cat /home/opam/mxe-deps | xargs make curl fdk-aac

RUN eval `opam config env` && cd /tmp/liquidsoap && \
./configure --enable-custom-path --host=$HOST OCAMLFIND_TOOLCHAIN=windows && \
env OCAMLFIND_TOOLCHAIN=windows make
FROM base AS build

RUN mkdir /tmp/win32
USER opam

ENV PKG_CONFIG_PATH /usr/src/mxe/usr/x86_64-w64-mingw32.static/lib/pkgconfig

COPY --chown=opam:root win32 /tmp/win32
RUN export OPAMSOLVERTIMEOUT=320 && eval `opam config env` && opam update && opam reinstall -y --verbose pandoc `echo $OPAM_MXE_DEPS | sed -e 's#,# #g'`

RUN eval `opam config env` && mv /tmp/win32 /tmp/liquidsoap-$BUILD && \
cd /tmp/liquidsoap-$BUILD && cp /tmp/liquidsoap/src/liquidsoap.exe . && cp /tmp/liquidsoap/libs/*.liq libs && \
cp -rf `ocamlfind -toolchain windows ocamlc -where`/../../share/camomile . && \
cd .. && zip -r liquidsoap-$BUILD.zip liquidsoap-$BUILD
FROM $IMAGE
COPY --from=build / /
46 changes: 0 additions & 46 deletions docker/Dockerfile.win32-deps

This file was deleted.

48 changes: 13 additions & 35 deletions docker/build-win32.sh
Original file line number Diff line number Diff line change
@@ -1,39 +1,17 @@
#!/bin/sh

BUILD=$1
RELEASE=$2
SYSTEM=$3
OCAML_VERSION=$4

if [ -z "${RELEASE}" ]; then
RELEASE="main"
fi

if [ -z "${SYSTEM}" ]; then
SYSTEM="x64"
fi

if [ -z "${OCAML_VERSION}" ]; then
OCAML_VERSION=4.12.0
fi

SYSTEM="x64"
OCAML_VERSION=4.14.1
BASE_IMAGE="ocamlcross/windows-${SYSTEM}-base:${OCAML_VERSION}"
DEPS_IMAGE="savonet/liquidsoap-win32-deps-${SYSTEM}"
IMAGE="savonet/liquidsoap-win32-${SYSTEM}"

if [ "${SYSTEM}" = "x64" ]; then
HOST="x86_64-w64-mingw32.static"
else
HOST="i686-w64-mingw32.static"
fi

echo docker build -f Dockerfile.win32-deps -t ${DEPS_IMAGE} \
--build-arg IMAGE=${BASE_IMAGE} .

exit 0

docker build -f Dockerfile.win32 -t ${IMAGE} --no-cache --build-arg RELEASE=${RELEASE} \
--build-arg IMAGE=${DEPS_IMAGE} --build-arg HOST=${HOST} --build-arg BUILD=${BUILD} .
id=$(docker create ${IMAGE})
docker cp ${id}:/tmp/liquidsoap-${BUILD}.zip .
docker rm -v ${id}
HOST="x86_64-w64-mingw32.static"

depot build \
-f Dockerfile.win32 \
-t ${IMAGE} \
--platform linux/amd64 \
--build-arg RELEASE=${RELEASE} \
--build-arg IMAGE=${BASE_IMAGE} \
--build-arg HOST=${HOST} \
--build-arg BUILD=${BUILD} \
.

0 comments on commit d48f4f1

Please sign in to comment.