]> git.xonotic.org Git - xonotic/xonotic.wiki.git/blob - Shared-libraries-(buildfiles).md
Add script to rebuild libjpeg.
[xonotic/xonotic.wiki.git] / Shared-libraries-(buildfiles).md
1 darkplaces/Xonotic on Linux uses system libraries. For Windows and macOS external dlls and dylibs are needed. Those reside in xonotic/misc/buildfiles
2
3 Because at the time of writing there is no automatism to build or update the games dependencies for those 2 platforms and the current dlls/dylibs are VERY outdated and thus also contain vulnerabilities, this page should document on where to obtain or how to build them, retaining API compatibility to darkplaces and also older OS platform versions like Windows XP.
4
5 For Windows, all libraries can/should be obtained from https://packages.msys2.org/ [1] with the exception of an official DLL release from the upstream being available (this is the case for jpeg-turbo and freetype) or if it has to be compiled on under Windows for some reason (eg. libcurl for Schannel (Windows crypto for HTTPS) support).
6
7 A handy tool to check dll deps on Windows is https://github.com/lucasg/Dependencies
8
9 TODO: macOS
10
11 # libcurl
12 libcurl is used for downloading *.pk3 files from servers
13
14 ### Windows
15 Darkplaces loads `libcurl-4.dll` or `libcurl-3.dll`
16
17 Build instructions:
18 * clone https://gitlab.com/incognico/build-libcurl-windows
19 * run `build.bat` in a VS2019 Development Shell
20 * rename the built dlls (x64 & x86) to `libcurl-4.dll`
21
22 ### macOS
23 Darkplaces loads `libcurl.4.dylib` or `libcurl.3.dylib` or `libcurl.2.dylib`
24
25 # libjpeg-turbo
26 libjpeg-turbo is needed to display jpeg images/textures
27
28 ### Windows
29
30 ```
31 set -ex
32 git clone https://github.com/libjpeg-turbo/libjpeg-turbo.git || true
33 curl -o x86_64-w64-mingw32.cmake https://raw.githubusercontent.com/zyga/cmake-toolchains/master/Toolchain-Ubuntu-mingw64.cmake
34 d0=$(pwd)
35 rm -rf build
36 mkdir build
37 cd build
38 cmake -DCMAKE_TOOLCHAIN_FILE="$d0/x86_64-w64-mingw32.cmake" -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_INSTALL_PREFIX="$d0/out" -G"Unix Makefiles" "$d0/libjpeg-turbo"
39 make
40 make install
41 cd "$d0"
42 cp out/bin/libjpeg-62.dll ~/Games/xonotic/misc/buildfiles/win64/libjpeg.dll
43 ```
44
45 ### macOS
46 Darkplaces loads `libjpeg.62.dylib`
47
48 # libpng
49 libpng is needed to display png images/textures
50
51 ### Windows
52 Darkplaces loads `libpng16.dll` or `libpng16-16.dll` or `libpng15-15.dll` or `libpng15.dll` or `libpng14-14.dll` or `libpng14.dll` or `libpng12.dll`
53
54 Obtainment instructions:
55 * be sure to use a 1.16.X release
56 * download MSYS2 Package [1] in x86 and x64 versions: https://packages.msys2.org/base/mingw-w64-libpng
57 * use dll from `bin` folder
58
59 ### macOS
60 Darkplaces loads `libpng16.16.dylib` or `libpng15.15.dylib` or `libpng14.14.dylib` or `libpng12.0.dylib`
61
62 # zlib
63 zlib is required to read *.pk3 files. Also it is a dependency of libpng and probably some other libraries.
64
65 ### Windows
66 Darkplaces loads: ifdef ZLIB_USES_WINAPI `zlibwapi.dll` or `zlib.dll` else `zlib1.dll`. We use `zlib1.dll`!
67
68 Obtainment instructions:
69 * download as MSYS2 Package [1] in x86 and x64 versions: https://packages.msys2.org/base/mingw-w64-zlib
70 * use dll from `bin` folder
71
72 ### macOS
73 Darkplaces loads `libz.dylib`
74
75 # libfreetype
76 Required for the Xolonium font
77
78 ### Windows
79 Darkplaces loads: `libfreetype-6.dll` or `freetype6.dll`
80
81 Obtainment instructions:
82 * Download x86 and x64 dlls from: https://github.com/ubawurinna/freetype-windows-binaries
83
84 ### macOS
85 Darkplaces loads: `libfreetype.6.dylib` or `libfreetype.dylib`
86
87 # libvorbis + libvorbisfile + libvorbisenc
88 libvorbis + libvorbisfile are used to play .ogg audio files while libvorbis + libvorbisenc is used for the audio in video capturing (cl_capturevideo)
89
90 ### Windows
91 Darkplaces loads `libvorbis-0.dll` or `libvorbis.dll` or `vorbis.dll` and `libvorbisfile-3.dll` or `libvorbisfile.dll` or `vorbisfile.dll` and `libvorbisenc-2.dll` or `vorbisenc-2.dll` or `vorbisenc.dll`
92
93 Obtainment instructions:
94 * download MSYS2 Package [1] in x86 and x64 versions: https://packages.msys2.org/base/mingw-w64-libvorbis
95 * use dll from `bin` folder
96
97 ### macOS
98 Darkplaces loads `libvorbis.dylib` and `libvorbisfile.dylib`
99
100 # libtheora
101 libtheora is used for the video in cl_capturevideo
102 libtheoraenc/libtheoradec are not needed, they are the newer API; darkplaces uses the legacy pre 1.0 API (libtheora).
103
104 ### Windows
105 Darkplaces loads `libtheora-0.dll` or `theora-0.dll` or `theora.dll`
106
107 Obtainment instructions:
108 * download MSYS2 Package [1] in x86 and x64 versions: https://packages.msys2.org/base/mingw-w64-libtheora
109 * use dll from `bin` folder
110
111 ### macOS
112 Darkplaces loads `libtheora.dylib`
113
114 # libogg
115 libogg is used for the container in cl_capturevideo
116
117 ### Windows
118 Darkplaces loads `libogg-0.dll` or `libogg.dll` or `ogg.dll`
119
120 Obtainment instructions:
121 * download MSYS2 Package [1] in x86 and x64 versions: https://packages.msys2.org/base/mingw-w64-libogg
122 * use dll from `bin` folder
123
124 ### macOS
125 Darkplaces loads `libogg.dylib`
126
127 # libd0_blind_id-0 & libd0_rijndael-0
128 Internal project, see https://gitlab.com/xonotic/d0_blind_id
129
130 ### Linux
131
132 `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`
133
134 # libgmp
135 A dependency of libd0_blind_id-0
136
137 ### Linux
138
139 `./configure --prefix=$HOME/Games/xonotic/misc/builddeps/linux64/gmp --enable-static --disable-shared --with-pic --enable-fat`
140
141 ### Windows
142 libd0_blind_id-0 loads `libgmp-10.dll`
143
144 Obtainment instructions:
145 * download as MSYS2 Package [1] in x86 and x64 versions: https://packages.msys2.org/base/mingw-w64-gmp
146 * use dll from `bin` folder
147
148 # libode
149 Is not loaded under Windows and crashes the game if it is and a map is loaded up.
150 Also it is not statically linked and thus requires libstdc++-6.dll and libgcc_s_sjlj-1.dll.
151
152 ### Linux:
153
154 `./configure --enable-static --disable-shared --with-libccd=internal --enable-double-precision --prefix=$HOME/Games/xonotic/misc/builddeps/linux64/ode --with-pic`
155
156 # libavw
157 *Note:* Old and not used in Xonotic but also not disabled :) Adding this for the sake of completeness.
158
159 ### Windows
160 Darkplaces loads: `libavw.dll`
161
162 Source code: https://github.com/paulvortex/DpLibAVW
163
164 ### macOS
165 Darkplaces loads: `libavw.dylib`