diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50e3f91..5180c51 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,8 +8,8 @@ build linux x64: - docker:dind script: - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin - - docker build -f Dockerfile-linux -t ${CI_REGISTRY_IMAGE}:linux-x86 . - - docker push ${CI_REGISTRY_IMAGE}:linux-x86 + - docker build -f Dockerfile-linux -t ${CI_REGISTRY_IMAGE}:linux-x64 . + - docker push ${CI_REGISTRY_IMAGE}:linux-x64 build windows x64: stage: build @@ -18,5 +18,5 @@ build windows x64: - docker:dind script: - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin - - docker build -f Dockerfile-windows -t ${CI_REGISTRY_IMAGE}:windows-x86 . - - docker push ${CI_REGISTRY_IMAGE}:windows-x86 + - docker build -f Dockerfile-windows -t ${CI_REGISTRY_IMAGE}:windows-x64 . + - docker push ${CI_REGISTRY_IMAGE}:windows-x64 diff --git a/Dockerfile-windows b/Dockerfile-windows index 3b7c520..25179f6 100644 --- a/Dockerfile-windows +++ b/Dockerfile-windows @@ -1,11 +1,16 @@ FROM debian:trixie +COPY windows.sh /tmp/setup.sh +COPY windows.reg /tmp/setup.reg RUN apt-get update --yes \ - && apt-get -y install wget \ + && apt-get -y install wget unzip xvfb \ && dpkg --add-architecture i386 \ && mkdir -pm755 /etc/apt/keyrings \ && wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key \ && wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/debian/dists/trixie/winehq-trixie.sources \ && apt-get update \ - && apt-get -y install winehq-stable \ + && apt-get -y install winehq-devel \ && apt-get clean \ - && wine winecfg + && export WINEDEBUG=-all \ + && wine winecfg \ + && /tmp/setup.sh \ + && wineserver -k diff --git a/test.bat b/test.bat new file mode 100644 index 0000000..58df926 --- /dev/null +++ b/test.bat @@ -0,0 +1 @@ +set 1=hello diff --git a/windows.reg b/windows.reg new file mode 100644 index 0000000..e96131a Binary files /dev/null and b/windows.reg differ diff --git a/windows.sh b/windows.sh new file mode 100755 index 0000000..740cf4e --- /dev/null +++ b/windows.sh @@ -0,0 +1,74 @@ +#! /bin/bash +echo + +# Exit on error, rather than continuing with the rest of the script +set -e + +# Utility functions +function min { + echo $(( $1 > $2 ? $2 : $1 )) +} + +# Leave wineserver running in the background +setsid wineserver -p -f & + +# Install tools +echo " --- Installing tools" +cd ~/.wine/drive_c/Program\ Files/ + +# Install CMake +echo " -- Installing CMake" +wget -q https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-windows-x86_64.zip +unzip -q *.zip +rm *.zip +mv cmake-*-windows-x86_64 cmake + +# Install ccache +echo " -- Installing ccache" +wget -q https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1-windows-x86_64.zip +unzip -q *.zip +rm *.zip +mv ccache-*-windows-x86_64 ccache + +# Install Ninja +echo " -- Installing Ninja" +wget -q https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip +mkdir ninja +pushd ninja/ > /dev/null +unzip -q ../ninja-win.zip +popd > /dev/null +rm *.zip + +# Install LLVM toolchain +echo " -- Installing LLVM toolchain" +wget -q https://github.com/mstorsjo/llvm-mingw/releases/download/20240308/llvm-mingw-20240308-msvcrt-x86_64.zip +unzip -q *.zip +rm *.zip +mv llvm-mingw-*-x86_64 llvm + +# Install registry file +echo " -- Updating PATH environment variable" +wine regedit 'Z:\tmp\setup.reg' + +# Print versions +echo " -- Tools installed:" +echo -n " - " ; wine cmake.exe --version | head -1 +echo -n " - " ; wine ccache.exe --version | head -1 +echo -n " - Ninja " ; wine ninja.exe --version +echo -n " - " ; wine clang.exe --version | head -1 + +# Download and compile out-of-tree dependencies +echo " --- Installing out-of-tree dependencies" +cd ~/.wine/drive_c/ + +# Download and compile Boost +echo " -- Downloading Boost" +wget -q https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.zip +unzip -q *.zip +rm *.zip +mv boost_* boost +cd boost +echo " -- Bootstrapping Boost (no output due to Wine workarounds)" +xvfb-run wineconsole ./bootstrap.bat clang &> /dev/null +echo " -- Compiling boost" +wine ./b2.exe -j$(min $(nproc) 4) core context # Limiting to 2 to avoid "Too many open files"