X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=Shared-libraries-%28buildfiles%29.md;h=56053581f0585dcb4936a9e87fa98da3c7d174e4;hb=5f04bc751a076d7027a63fb5cacb9a7114370cce;hp=29a4e39cacafc0cf627ce1eafbf7ffa6ba496628;hpb=5d19e5446e8b1b3407dafe8ada4b4dfa213764cb;p=xonotic%2Fxonotic.wiki.git diff --git a/Shared-libraries-(buildfiles).md b/Shared-libraries-(buildfiles).md index 29a4e39..5605358 100644 --- a/Shared-libraries-(buildfiles).md +++ b/Shared-libraries-(buildfiles).md @@ -20,7 +20,7 @@ d0=$(pwd) rm -rf build mkdir build cd build -cmake -DCMAKE_TOOLCHAIN_FILE="$d0/x86_64-w64-mingw32.cmake" -DCMAKE_INSTALL_PREFIX="$d0/out" "$d0/curl" +cmake -DCMAKE_TOOLCHAIN_FILE="$d0/x86_64-w64-mingw32.cmake" -DCMAKE_INSTALL_PREFIX="$d0/out" -DCURL_USE_SCHANNEL=YES -G"Unix Makefiles" "$d0/curl" make make install cd "$d0" @@ -52,6 +52,40 @@ cp out/bin/libjpeg-62.dll ~/Games/xonotic/misc/buildfiles/win64/libjpeg.dll ### macOS Darkplaces loads `libjpeg.62.dylib` +# zlib +zlib is required to read *.pk3 files. Also it is a dependency of libpng and probably some other libraries. + +### Windows +Darkplaces loads: ifdef ZLIB_USES_WINAPI `zlibwapi.dll` or `zlib.dll` else `zlib1.dll`. We use `zlib1.dll`! + +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 +sed -i '/zlib PROPERTIES SUFFIX/i set_target_properties(zlib PROPERTIES PREFIX "")' "$d0/zlib-$ZLIBVER/CMakeLists.txt" # Remove the "lib" prefix. TODO Do this through the cmake cache? +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/zlib1.dll ~/Games/xonotic/misc/buildfiles/win64/zlib1.dll +``` + +### macOS +Darkplaces loads `libz.dylib` + # libpng libpng is needed to display png images/textures @@ -63,21 +97,28 @@ Obtainment instructions: * download MSYS2 Package [1] in x86 and x64 versions: https://packages.msys2.org/base/mingw-w64-libpng * use dll from `bin` folder -### macOS -Darkplaces loads `libpng16.16.dylib` or `libpng15.15.dylib` or `libpng14.14.dylib` or `libpng12.0.dylib` +Cross-compiling (requires zlib): -# zlib -zlib is required to read *.pk3 files. Also it is a dependency of libpng and probably some other libraries. +``` +d0=$(pwd) +PNGVER="libpng16" +ZLIB_ROOT=$d0/../zlib/out # Location to the zlib compiled library -### Windows -Darkplaces loads: ifdef ZLIB_USES_WINAPI `zlibwapi.dll` or `zlib.dll` else `zlib1.dll`. We use `zlib1.dll`! +git clone -b $PNGVER git://git.code.sf.net/p/libpng/code libpng || true +curl -o x86_64-w64-mingw32.cmake https://raw.githubusercontent.com/zyga/cmake-toolchains/master/Toolchain-Ubuntu-mingw64.cmake -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 +rm -rf build +mkdir build +cd build +cmake -DCMAKE_TOOLCHAIN_FILE="$d0/x86_64-w64-mingw32.cmake" -DPNG_STATIC=false -DPNG_TESTS=false -DPNG_EXECUTABLES=false -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DZLIB_INCLUDE_DIR=$ZLIB_ROOT/include -DZLIB_LIBRARY=$ZLIB_ROOT/lib/libzlib.dll.a -DCMAKE_INSTALL_PREFIX="$d0/out" -G"Unix Makefiles" "$d0/libpng" +make +make install +cd "$d0" +cp out/bin/libpng16.dll ~/Games/xonotic/misc/buildfiles/win64/libpng16.dll +``` ### macOS -Darkplaces loads `libz.dylib` +Darkplaces loads `libpng16.16.dylib` or `libpng15.15.dylib` or `libpng14.14.dylib` or `libpng12.0.dylib` # libfreetype Required for the Xolonium font @@ -85,12 +126,58 @@ Required for the Xolonium font ### Windows Darkplaces loads: `libfreetype-6.dll` or `freetype6.dll` -Obtainment instructions: -* Download x86 and x64 dlls from: https://github.com/ubawurinna/freetype-windows-binaries +``` +FTVER="2.11.1" +curl -L -o freetype-$FTVER.tar.xz https://download.savannah.gnu.org/releases/freetype/freetype-$FTVER.tar.xz || true +tar -xf freetype-$FTVER.tar.xz +rm freetype-$FTVER.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_BUILD_TYPE=Release -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_INSTALL_PREFIX="$d0/out" -G"Unix Makefiles" "$d0/freetype-$FTVER" +make +make install +cd "$d0" +cp out/bin/libfreetype.dll ~/Games/xonotic/misc/buildfiles/win64/libfreetype-6.dll +``` ### macOS Darkplaces loads: `libfreetype.6.dylib` or `libfreetype.dylib` +# libogg +libogg is used for the container in cl_capturevideo + +### Windows +Darkplaces loads `libogg-0.dll` or `libogg.dll` or `ogg.dll` + +Obtainment instructions: +* download MSYS2 Package [1] in x86 and x64 versions: https://packages.msys2.org/base/mingw-w64-libogg +* use dll from `bin` folder + +Cross-compiling: + +``` +d0=$(pwd) +OGGVER="v1.3.5" +git clone -b $OGGVER https://gitlab.xiph.org/xiph/ogg.git +sed -i 's/^LIBRARY ogg$/LIBRARY libogg/' "$d0/ogg/win32/ogg.def" # Call it libogg +curl -o x86_64-w64-mingw32.cmake https://raw.githubusercontent.com/zyga/cmake-toolchains/master/Toolchain-Ubuntu-mingw64.cmake +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/ogg" +make +make install +cd "$d0" +cp out/bin/libogg.dll ~/Games/xonotic/misc/buildfiles/win64/libogg.dll +``` + +### macOS +Darkplaces loads `libogg.dylib` + # libvorbis + libvorbisfile + libvorbisenc libvorbis + libvorbisfile are used to play .ogg audio files while libvorbis + libvorbisenc is used for the audio in video capturing (cl_capturevideo) @@ -101,6 +188,33 @@ Obtainment instructions: * download MSYS2 Package [1] in x86 and x64 versions: https://packages.msys2.org/base/mingw-w64-libvorbis * use dll from `bin` folder +Cross-compiling (requires libogg): + +``` +d0=$(pwd) +VORBISVER="v1.3.7" +OGG_ROOT=$d0/../ogg/out + +git clone -b $VORBISVER https://gitlab.xiph.org/xiph/vorbis.git + +# Fix win32 def files +sed -i 's/^LIBRARY$/LIBRARY libvorbis/' "$d0/vorbis/win32/vorbis.def" +sed -i 's/^LIBRARY$/LIBRARY libvorbisenc/' "$d0/vorbis/win32/vorbisenc.def" +sed -i 's/^LIBRARY$/LIBRARY libvorbisfile/' "$d0/vorbis/win32/vorbisfile.def" + +curl -o x86_64-w64-mingw32.cmake https://raw.githubusercontent.com/zyga/cmake-toolchains/master/Toolchain-Ubuntu-mingw64.cmake +rm -rf build +mkdir build +cd build +cmake -DCMAKE_TOOLCHAIN_FILE="$d0/x86_64-w64-mingw32.cmake" -DBUILD_SHARED_LIBS=true -DOGG_INCLUDE_DIR=$OGG_ROOT/include -DOGG_LIBRARY=$OGG_ROOT/lib/libogg.dll.a -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_INSTALL_PREFIX="$d0/out" -G"Unix Makefiles" "$d0/vorbis" +make +make install +cd "$d0" +cp out/bin/libvorbis.dll ~/Games/xonotic/misc/buildfiles/win64/libvorbis.dll +cp out/bin/libvorbisfile.dll ~/Games/xonotic/misc/buildfiles/win64/libvorbisfile.dll +cp out/bin/libvorbisenc.dll ~/Games/xonotic/misc/buildfiles/win64/libvorbisenc.dll +``` + ### macOS Darkplaces loads `libvorbis.dylib` and `libvorbisfile.dylib` @@ -115,21 +229,69 @@ Obtainment instructions: * download MSYS2 Package [1] in x86 and x64 versions: https://packages.msys2.org/base/mingw-w64-libtheora * use dll from `bin` folder +Cross-compiling (requires libogg and libvorbis): + +``` +d0=$(pwd) +THEORAVER="v1.1.1" +OGG_ROOT="$d0/../ogg/out" +VORBIS_ROOT="$d0/../vorbis/out" + +git clone -b $THEORAVER https://gitlab.xiph.org/xiph/theora.git + +# Fix mingw32 defs +sed -i '1iLIBRARY libtheoradec' "$d0/theora/win32/xmingw32/libtheoradec-all.def" +sed -i '1iLIBRARY libtheoraenc' "$d0/theora/win32/xmingw32/libtheoraenc-all.def" +sed -i '/TH_VP31_QUANT_INFO/d' "$d0/theora/win32/xmingw32/libtheoraenc-all.def" +sed -i '/TH_VP31_HUFF_CODES/d' "$d0/theora/win32/xmingw32/libtheoraenc-all.def" + +# Start build +mkdir out +mkdir build +cd build +$d0/theora/autogen.sh --host=x86_64-w64-mingw32 --prefix="$d0/out" --with-ogg="$OGG_ROOT" --with-vorbis="$VORBIS_ROOT" --enable-shared --disable-examples --disable-sdltest --disable-vorbistest --disable-oggtest +make +make install +cd "$d0" +cp out/bin/libtheora-0.dll ~/Games/xonotic/misc/buildfiles/win64/libtheora-0.dll +``` + ### macOS Darkplaces loads `libtheora.dylib` -# libogg -libogg is used for the container in cl_capturevideo +# libgmp +A dependency of libd0_blind_id-0 + +### Linux + +`./configure --prefix=$HOME/Games/xonotic/misc/builddeps/linux64/gmp --enable-static --disable-shared --with-pic --enable-fat` ### Windows -Darkplaces loads `libogg-0.dll` or `libogg.dll` or `ogg.dll` +libd0_blind_id-0 loads `libgmp-10.dll` Obtainment instructions: -* download MSYS2 Package [1] in x86 and x64 versions: https://packages.msys2.org/base/mingw-w64-libogg +* download as MSYS2 Package [1] in x86 and x64 versions: https://packages.msys2.org/base/mingw-w64-gmp * use dll from `bin` folder -### macOS -Darkplaces loads `libogg.dylib` +Cross-compiling: + +``` +d0=$(pwd) +GMPVER="6.2.1" + +curl -o gmp-$GMPVER.tar.xz https://gmplib.org/download/gmp/gmp-$GMPVER.tar.xz +tar xf gmp-$GMPVER.tar.xz +rm gmp-$GMPVER.tar.xz + +mkdir out +mkdir build +cd build +"$d0/gmp-$GMPVER/configure" --prefix="$d0/out" --host=x86_64-w64-mingw32 --with-pic --enable-fat --disable-static --enable-shared +make +make install +cd "$d0" +cp out/bin/libgmp-10.dll ~/Games/xonotic/misc/buildfiles/win64/libgmp-10.dll +``` # libd0_blind_id-0 & libd0_rijndael-0 Internal project, see https://gitlab.com/xonotic/d0_blind_id @@ -138,19 +300,34 @@ Internal project, see https://gitlab.com/xonotic/d0_blind_id `LDFLAGS='-L$HOME/Games/xonotic/misc/builddeps/linux64/gmp/lib' CPPFLAGS='-I$HOME/Games/xonotic/misc/builddeps/linux64/gmp/include' ./configure --prefix=$HOME/Games/xonotic/misc/builddeps/linux64/d0_blind_id --enable-static --disable-shared --with-pic` -# libgmp -A dependency of libd0_blind_id-0 +### Windows +Cross-compiling (requires libgmp): -### Linux +``` +d0=$(pwd) +GMP_ROOT="$d0/../gmp/out" +export LDFLAGS="-L$GMP_ROOT/lib" +export CPPFLAGS="-I$GMP_ROOT/include" -`./configure --prefix=$HOME/Games/xonotic/misc/builddeps/linux64/gmp --enable-static --disable-shared --with-pic --enable-fat` +git clone https://gitlab.com/xonotic/d0_blind_id.git -### Windows -libd0_blind_id-0 loads `libgmp-10.dll` +cd d0_blind_id +./autogen.sh +sed -i '/libd0_blind_id_la_LDFLAGS/ s/$/ -no-undefined/' Makefile.am +sed -i '/libd0_rijndael_la_LDFLAGS/ s/$/ -no-undefined/' Makefile.am -Obtainment instructions: -* download as MSYS2 Package [1] in x86 and x64 versions: https://packages.msys2.org/base/mingw-w64-gmp -* use dll from `bin` folder +cd "$d0" +mkdir build +mkdir out +cd build +"$d0/d0_blind_id/configure" --with-pic --prefix="$d0/out" --host=x86_64-w64-mingw32 +make +make install + +cd "$d0" +cp out/bin/libd0_blind_id-0.dll ~/Games/xonotic/misc/buildfiles/win64/libd0_blind_id-0.dll +cp out/bin/libd0_rijndael-0.dll ~/Games/xonotic/misc/buildfiles/win64/libd0_rijndael-0.dll +``` # libode Is not loaded under Windows and crashes the game if it is and a map is loaded up.