Skip to content

Commit 9d7400a

Browse files
committed
Update build-mingw.sh to keep it working
1 parent 9367e45 commit 9d7400a

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

util/build-mingw.sh

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
#!/bin/bash -e
22

3-
[ -z "$CXX" ] && exit 255
4-
export CC=false # don't need it actually
5-
6-
variant=win32
7-
[[ "$(basename "$CXX")" == "x86_64-"* ]] && variant=win64
8-
93
#######
10-
# this expects unpacked libraries similar to what Luanti's buildbot uses
11-
# $extradlls will typically point to the DLLs for libgcc, libstdc++ and libpng
4+
# this expects unpacked libraries and a toolchain file like Luanti's buildbot uses
5+
# $extradlls will typically contain the compiler-specific DLLs and libpng
6+
toolchain_file=
127
libgd_dir=
138
zlib_dir=
149
zstd_dir=
1510
sqlite_dir=
1611
leveldb_dir=
17-
extradlls=()
12+
extradlls=(
13+
)
1814
#######
1915

20-
[ -f ./CMakeLists.txt ] || exit 1
16+
[ -f "$toolchain_file" ] || exit 1
17+
variant=win32
18+
grep -q 'CX?X?_COMPILER.*x86_64-' $toolchain_file && variant=win64
19+
echo "Detected target $variant"
20+
21+
[ -f ./CMakeLists.txt ] || { echo "run from root folder" >&2; exit 1; }
2122

2223
cmake -S . -B build \
23-
-DCMAKE_SYSTEM_NAME=Windows \
24+
-DCMAKE_TOOLCHAIN_FILE="$toolchain_file" \
2425
-DCMAKE_EXE_LINKER_FLAGS="-s" \
2526
\
2627
-DENABLE_LEVELDB=1 \
@@ -34,7 +35,7 @@ cmake -S . -B build \
3435
-DZLIB_INCLUDE_DIR=$zlib_dir/include \
3536
-DZLIB_LIBRARY=$zlib_dir/lib/libz.dll.a \
3637
-DZSTD_INCLUDE_DIR=$zstd_dir/include \
37-
-DZSTD_LIBRARY=$zstd_dir/lib/libzstd.dll.a \
38+
-DZSTD_LIBRARY=$zstd_dir/lib/libzstd.dll.a
3839

3940
make -C build -j4
4041

0 commit comments

Comments
 (0)