From c585d70873425c79ea2a8308e557f8f73622ee2e Mon Sep 17 00:00:00 2001 From: z411 Date: Mon, 13 Dec 2021 18:32:23 +0000 Subject: [PATCH] Added ZLIB cross-compile instructions --- Shared-libraries-(buildfiles).md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Shared-libraries-(buildfiles).md b/Shared-libraries-(buildfiles).md index 5d94e75..a92c71e 100644 --- a/Shared-libraries-(buildfiles).md +++ b/Shared-libraries-(buildfiles).md @@ -76,6 +76,26 @@ Obtainment instructions: * download as MSYS2 Package [1] in x86 and x64 versions: https://packages.msys2.org/base/mingw-w64-zlib * use dll from `bin` folder +Cross-compiling: + +``` +ZLIBVER="1.2.11" +curl -L -o zlib-$ZLIBVER.tar.xz https://zlib.net/zlib-$ZLIBVER.tar.xz || true +tar -xf zlib-$ZLIBVER.tar.xz +rm zlib-$ZLIBVER.tar.xz + +curl -o x86_64-w64-mingw32.cmake https://raw.githubusercontent.com/zyga/cmake-toolchains/master/Toolchain-Ubuntu-mingw64.cmake +d0=$(pwd) +rm -rf build +mkdir build +cd build +cmake -DCMAKE_TOOLCHAIN_FILE="$d0/x86_64-w64-mingw32.cmake" -DBUILD_SHARED_LIBS=true -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_INSTALL_PREFIX="$d0/out" -G"Unix Makefiles" "$d0/zlib-$ZLIBVER" +make +make install +cd "$d0" +cp out/bin/libzlib1.dll ~/Games/xonotic/misc/buildfiles/win64/zlib1.dll +``` + ### macOS Darkplaces loads `libz.dylib` -- 2.39.2