...
|
...
|
@@ -29,7 +29,7 @@ if [ "m\$2" = "m--help" ] ; then
|
29
|
29
|
exit 1
|
30
|
30
|
fi
|
31
|
31
|
. "$parentdir/toolchain-zig/env.sh" >/dev/null
|
32
|
|
-exec zig cc "-I$parentdir/toolchain-zig/windows-msys2-mingw/include/" "-I$parentdir/toolchain-zig/windows-msys2-mingw/include/w32api/" "-I$parentdir/toolchain-zig/windows-msys2-mingw/include/SDL2" "-I$parentdir/toolchain-zig/windows-msys2-mingw/include/SDL" "\$@" -target x86_64-windows-gnu
|
|
32
|
+exec zig cc "-I$parentdir/toolchain-zig/windows-msys2-mingw/include/" "-I$parentdir/toolchain-zig/windows-msys2-mingw/include/w32api/" "-I$parentdir/toolchain-zig/windows-msys2-mingw/include/SDL2" "-I$parentdir/toolchain-zig/windows-msys2-mingw/include/SDL" "-I$parentdir/toolchain-zig/sdl3-windows/SDL3/include" "-I$parentdir/toolchain-zig/sdl3-windows/SDL_ttf/include" "\$@" -target x86_64-windows-gnu
|
33
|
33
|
EOF
|
34
|
34
|
chmod 755 compile.sh
|
35
|
35
|
cat > compile-cpp.sh <<EOF
|
...
|
...
|
@@ -39,7 +39,7 @@ if [ "m$2" = "m--help" ] ; then
|
39
|
39
|
exit 1
|
40
|
40
|
fi
|
41
|
41
|
. "$parentdir/toolchain-zig/env.sh" >/dev/null
|
42
|
|
-exec zig c++ "-I$parentdir/toolchain-zig/windows-msys2-mingw/include/" "-I$parentdir/toolchain-zig/windows-msys2-mingw/include/w32api/" "-I$parentdir/toolchain-zig/windows-msys2-mingw/include/SDL2" "-I$parentdir/toolchain-zig/windows-msys2-mingw/include/SDL" "\$@" -target x86_64-windows-gnu
|
|
42
|
+exec zig c++ "-I$parentdir/toolchain-zig/windows-msys2-mingw/include/" "-I$parentdir/toolchain-zig/windows-msys2-mingw/include/w32api/" "-I$parentdir/toolchain-zig/windows-msys2-mingw/include/SDL2" "-I$parentdir/toolchain-zig/windows-msys2-mingw/include/SDL" "-I$parentdir/toolchain-zig/sdl3-windows/SDL3/include" "-I$parentdir/toolchain-zig/sdl3-windows/SDL_ttf/include" "\$@" -target x86_64-windows-gnu
|
43
|
43
|
EOF
|
44
|
44
|
chmod 755 compile-cpp.sh
|
45
|
45
|
|
...
|
...
|
@@ -66,7 +66,7 @@ shift
|
66
|
66
|
convert "\$icon" "\${icon/.png/-buildiconobject.ico}" && \
|
67
|
67
|
echo "1 ICON \"\${icon/.png/-buildiconobject.ico}\"" > "\${icon/.png/-buildiconobject.rc}" && \
|
68
|
68
|
x86_64-w64-mingw32-windres --preprocessor /usr/bin/cpp "\${icon/.png/-buildiconobject.rc}" "\${icon/.png/-buildiconobject.o}" && \
|
69
|
|
- zig build-exe --subsystem windows "\$@" \${icon/.png/-buildiconobject.o} -L$parentdir/toolchain-zig/windows-msys2-mingw/lib/ -L$parentdir/toolchain-zig/windows-msys2-mingw/lib/w32api -lSDL2 -lSDL2main -lSDL2_ttf -lfreetype -lgdi32 -lwinmm -lsetupapi -lmincore -lwindowsapp -limm32 -lversion -lgraphite2 -lpng -lbrotlidec -lbrotlicommon -lharfbuzz -lstdc++ -lbz2 -lz --name \$name -target x86_64-windows-gnu && rm \${name}.lib \${name}.pdb
|
|
69
|
+ zig build-exe --subsystem windows "\$@" \${icon/.png/-buildiconobject.o} -L$parentdir/toolchain-zig/windows-msys2-mingw/lib/ -L$parentdir/toolchain-zig/windows-msys2-mingw/lib/w32api $parentdir/toolchain-zig/sdl3-windows/libSDL3.dll.a $parentdir/toolchain-zig/sdl3-windows/libSDL3_ttf.dll.a $parentdir/toolchain-zig/sdl3-windows/libfreetype.a -lgdi32 -lwinmm -lsetupapi -lmincore -lwindowsapp -limm32 -lversion -lgraphite2 -lpng -lbrotlidec -lbrotlicommon -lharfbuzz -lstdc++ -lbz2 -lz --name \$name -target x86_64-windows-gnu && rm \${name}.lib \${name}.pdb
|
70
|
70
|
res=\$?
|
71
|
71
|
rm "\${icon/.png/-buildiconobject.ico}" "\${icon/.png/-buildiconobject.rc}" "\${icon/.png/-buildiconobject.o}"
|
72
|
72
|
if [ \$tmpicon -eq 1 ] ; then rm "\$icon" ; fi
|
...
|
...
|
@@ -186,34 +186,46 @@ chmod a+x add-xz.sh add-zst.sh
|
186
|
186
|
cd ..
|
187
|
187
|
# Check for windres
|
188
|
188
|
if ! which x86_64-w64-mingw32-windres >/dev/null 2>/dev/null; then
|
189
|
|
- echo "Please, install windres manually using your distribution, i.e.:"
|
190
|
|
- echo "sudo apt-get install binutils-mingw-w64-x86-64"
|
|
189
|
+ echo "Please, install windres manually using your distribution, i.e.:" >> tooldchain-zig/error.log
|
|
190
|
+ echo "sudo apt-get install binutils-mingw-w64-x86-64" >> tooldchain-zig/error.log
|
191
|
191
|
fi
|
192
|
192
|
if ! which convert >/dev/null 2>/dev/null; then
|
193
|
|
- echo "Please, install imagemagick manually using your distribution, i.e.:"
|
194
|
|
- echo "sudo apt-get install imagemagick"
|
|
193
|
+ echo "Please, install imagemagick manually using your distribution, i.e.:" >> tooldchain-zig/error.log
|
|
194
|
+ echo "sudo apt-get install imagemagick" >> tooldchain-zig/error.log
|
195
|
195
|
fi
|
196
|
196
|
# SDL3 for mingw
|
197
|
|
-mkdir -p sdl3-windows
|
198
|
|
-cat > sdl3-windows/setup.sh <<'SeTuPeOf'
|
|
197
|
+mkdir -p "$parentdir/toolchain-zig/sdl3-windows"
|
|
198
|
+cd "$parentdir/toolchain-zig/sdl3-windows"
|
|
199
|
+cat > setup.sh <<'SeTuPeOf'
|
199
|
200
|
#!/bin/bash
|
200
|
201
|
#SDL3
|
201
|
|
-if [ ! -e SDL3-devel-3.1.3-mingw.tar.xz ] ; then
|
202
|
|
- wget https://github.com/libsdl-org/SDL/releases/download/preview-3.1.3/SDL3-devel-3.1.3-mingw.tar.xz
|
|
202
|
+if [ ! -e ../../toolchain-zig-dl/SDL3-preview-3.1.6.tgz ] ; then
|
|
203
|
+ wget https://github.com/libsdl-org/SDL/archive/refs/tags/preview-3.1.6.tar.gz -O ../../toolchain-zig-dl/SDL3-preview-3.1.6.tgz
|
203
|
204
|
fi
|
204
|
|
-xz -d < SDL3-devel-3.1.3-mingw.tar.xz | tar -xvf -
|
205
|
|
-cp ./SDL3-3.1.3/x86_64-w64-mingw32/bin/SDL3.dll .
|
|
205
|
+tar -xvzf ../../toolchain-zig-dl/SDL3-preview-3.1.6.tgz
|
|
206
|
+mv SDL3-3.1.6 SDL3
|
|
207
|
+cd SDL3
|
|
208
|
+ln -s PARENTDIR/toolchain-zig/compile.sh x86_64-w64-mingw32-gcc
|
|
209
|
+ln -s PARENTDIR/toolchain-zig/compile-cpp.sh x86_64-w64-mingw32-g++
|
|
210
|
+cat >> src/winresrc.h <<'EOF'
|
|
211
|
+#define LANG_ENGLISH 0x09
|
|
212
|
+#define SUBLANG_ENGLISH_US 0x01
|
|
213
|
+EOF
|
|
214
|
+PATH=$(pwd):$PATH cmake -S . -B build -DBUILD_SHARED_LIBS=ON -DCMAKE_TOOLCHAIN_FILE=build-scripts/cmake-toolchain-mingw64-x86_64.cmake -DCMAKE_MAKE_PROGRAM=make -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ && cmake --build build
|
|
215
|
+cd ..
|
|
216
|
+cp ./SDL3/build/SDL3.dll .
|
|
217
|
+cp ./SDL3/build/libSDL3.dll.a .
|
206
|
218
|
#SDL3_ttf
|
207
|
|
-rm -rf SDL_ttf
|
208
|
|
-if [ ! -e SDL_ttf.tgz ] ; then
|
209
|
|
- git clone --recurse-submodules -j4 https://github.com/libsdl-org/SDL_ttf.git
|
210
|
|
- tar -cf SDL_ttf.tgz SDL_ttf
|
|
219
|
+if [ -e ../../toolchain-zig-dl/SDL_ttf.tgz ] ; then
|
|
220
|
+ tar -xf ../../toolchain-zig-dl/SDL_ttf.tgz
|
211
|
221
|
else
|
212
|
|
- tar -xf SDL_ttf.tgz
|
|
222
|
+ git clone --recurse-submodules -j4 https://github.com/libsdl-org/SDL_ttf.git
|
|
223
|
+ tar -cf ../../toolchain-zig-dl/SDL_ttf.tgz SDL_ttf
|
213
|
224
|
fi
|
214
|
225
|
cd SDL_ttf
|
215
|
|
-ln -s ~/Programacion/sources/boxui/toolchain-zig/compile.sh x86_64-w64-mingw32-gcc
|
216
|
|
-ln -s ~/Programacion/sources/boxui/toolchain-zig/compile-cpp.sh x86_64-w64-mingw32-g++
|
|
226
|
+sed -i "s/SDL_REQUIRED_VERSION 3\.1\.5/SDL_REQUIRED_VERSION 3.1.6/g" CMakeLists.txt
|
|
227
|
+ln -s PARENTDIR/toolchain-zig/compile.sh x86_64-w64-mingw32-gcc
|
|
228
|
+ln -s PARENTDIR/toolchain-zig/compile-cpp.sh x86_64-w64-mingw32-g++
|
217
|
229
|
mkdir -p build/external/freetype/include
|
218
|
230
|
cat >> build/external/freetype/include/windows.h <<'EOF'
|
219
|
231
|
#define VS_FF_DEBUG 0x01L
|
...
|
...
|
@@ -259,18 +271,22 @@ index f96d5087..b2028178 100644
|
259
|
271
|
}
|
260
|
272
|
EOF
|
261
|
273
|
# revert patch https://discourse.libsdl.org/t/sdl-ttf-use-sdl-stepbackutf8/54854
|
262
|
|
-( patch -R -p1 < ./freetype_Use_SDL_StepBackUTF8.patch )
|
|
274
|
+#( patch -R -p1 < ./freetype_Use_SDL_StepBackUTF8.patch )
|
263
|
275
|
sed -i "s/vendored_default FALSE/vendored_default TRUE/g" CMakeLists.txt
|
264
|
|
-PATH=$(pwd):$PATH cmake -S . -B build -DBUILD_SHARED_LIBS=ON -DCMAKE_TOOLCHAIN_FILE=build-scripts/cmake-toolchain-mingw64-x86_64.cmake -DCMAKE_MAKE_PROGRAM=make -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -DSDL3_DIR=/home/bit/Programacion/sources/boxui/sdl3-windows/SDL3-3.1.3/x86_64-w64-mingw32/lib/cmake/SDL3/ && cmake --build build
|
|
276
|
+PATH=$(pwd):$PATH cmake -S . -B build -DBUILD_SHARED_LIBS=ON -DCMAKE_TOOLCHAIN_FILE=build-scripts/cmake-toolchain-mingw64-x86_64.cmake -DCMAKE_MAKE_PROGRAM=make -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -DSDL3_DIR=PARENTDIR/toolchain-zig/sdl3-windows/SDL3/build && cmake --build build
|
265
|
277
|
cd ..
|
266
|
278
|
cp SDL_ttf/build/SDL3_ttf.dll .
|
267
|
279
|
cp SDL_ttf/build/libSDL3_ttf.dll.a .
|
268
|
280
|
cp SDL_ttf/build/external/freetype/libfreetype.a .
|
269
|
281
|
SeTuPeOf
|
270
|
|
-cd sdl3-windows
|
|
282
|
+sed -i "s#PARENTDIR#$parentdir#g" setup.sh
|
271
|
283
|
chmod a+x setup.sh
|
272
|
284
|
./setup.sh
|
273
|
285
|
cd ..
|
|
286
|
+# Show errors if tehre is an error.log file
|
|
287
|
+if [ -e toolchain-zig/error.log ] ; then
|
|
288
|
+ cat toolchain-zig/error.log
|
|
289
|
+fi
|
274
|
290
|
# Success message
|
275
|
291
|
echo ""
|
276
|
292
|
echo "Installation complete."
|