irrlicht/scripts/ci-build-mingw.sh

63 lines
1.9 KiB
Bash
Raw Normal View History

2021-03-08 23:48:28 +01:00
#!/bin/bash -e
[[ -z "$CC" || -z "$CXX" ]] && exit 255
variant=win32
[[ "$(basename "$CXX")" == "x86_64-"* ]] && variant=win64
2023-09-13 13:17:24 +02:00
with_sdl=0
[[ "$extras" == *"-sdl"* ]] && with_sdl=1
#with_gl3=0
#[[ "$extras" == *"-gl3"* ]] && with_gl3=1
2023-04-11 18:19:36 +02:00
libjpeg_version=2.1.5.1
libpng_version=1.6.39
2023-09-13 13:17:24 +02:00
sdl2_version=2.28.1
2023-04-11 18:19:36 +02:00
zlib_version=1.2.13
2021-03-08 23:48:28 +01:00
mkdir -p libs
pushd libs
libs=$PWD
[ -e libjpeg.zip ] || \
wget "http://minetest.kitsunemimi.pw/libjpeg-$libjpeg_version-$variant.zip" -O libjpeg.zip
[ -e libpng.zip ] || \
2023-04-11 18:19:36 +02:00
wget "http://minetest.kitsunemimi.pw/libpng-$libpng_version-$variant.zip" -O libpng.zip
2023-09-13 13:17:24 +02:00
[[ $with_sdl -eq 0 || -e sdl2.zip ]] || \
wget "http://minetest.kitsunemimi.pw/sdl2-$sdl2_version-$variant.zip" -O sdl2.zip
2021-03-08 23:48:28 +01:00
[ -e zlib.zip ] || \
2023-04-11 18:19:36 +02:00
wget "http://minetest.kitsunemimi.pw/zlib-$zlib_version-$variant.zip" -O zlib.zip
2021-03-08 23:48:28 +01:00
[ -d libjpeg ] || unzip -o libjpeg.zip -d libjpeg
[ -d libpng ] || unzip -o libpng.zip -d libpng
2023-09-13 13:17:24 +02:00
[[ $with_sdl -eq 0 || -d sdl2 ]] || unzip -o sdl2.zip -d sdl2
2021-03-08 23:48:28 +01:00
[ -d zlib ] || unzip -o zlib.zip -d zlib
popd
2022-02-04 21:08:37 +01:00
tmp=(
2021-03-08 23:48:28 +01:00
-DCMAKE_SYSTEM_NAME=Windows \
-DPNG_LIBRARY=$libs/libpng/lib/libpng.dll.a \
-DPNG_PNG_INCLUDE_DIR=$libs/libpng/include \
-DJPEG_LIBRARY=$libs/libjpeg/lib/libjpeg.dll.a \
-DJPEG_INCLUDE_DIR=$libs/libjpeg/include \
-DZLIB_LIBRARY=$libs/zlib/lib/libz.dll.a \
-DZLIB_INCLUDE_DIR=$libs/zlib/include
2022-02-04 21:08:37 +01:00
)
2023-09-13 13:17:24 +02:00
[ $with_sdl -eq 1 ] && tmp+=(
-DUSE_SDL2=ON
-DCMAKE_PREFIX_PATH=$libs/sdl2/lib/cmake
)
#[ $with_gl3 -eq 1 ] && tmp+=(-DENABLE_OPENGL=OFF -DENABLE_OPENGL3=ON)
2021-03-08 23:48:28 +01:00
2022-02-04 21:08:37 +01:00
cmake . "${tmp[@]}"
2021-03-08 23:48:28 +01:00
make -j$(nproc)
2022-02-04 21:08:37 +01:00
if [ "$1" = "package" ]; then
make DESTDIR=$PWD/_install install
# strip library
"${CXX%-*}-strip" --strip-unneeded _install/usr/local/lib/*.dll
2022-02-04 21:08:37 +01:00
# bundle the DLLs that are specific to Irrlicht (kind of a hack)
2023-09-13 13:17:24 +02:00
shopt -s nullglob
cp -p $libs/*/bin/{libjpeg,libpng,SDL}*.dll _install/usr/local/lib/
# create a ZIP
2023-09-13 13:17:24 +02:00
(cd _install/usr/local; zip -9r "$OLDPWD/irrlicht-$variant$extras.zip" -- *)
2022-02-04 21:08:37 +01:00
fi
2021-03-08 23:48:28 +01:00
exit 0