irrlicht/scripts/ci-build-mingw.sh

66 lines
1.9 KiB
Bash
Raw Normal View History

2021-03-08 23:48:28 +01:00
#!/bin/bash -e
2023-12-13 12:05:49 +01:00
topdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2021-03-08 23:48:28 +01:00
[[ -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
2023-12-13 12:05:49 +01:00
download () {
local url=$1
local filename=${url##*/}
local foldername=${filename%%[.-]*}
[ -d "./$foldername" ] && return 0
[ -e "$filename" ] || wget "$url" -O "$filename"
sha256sum -w -c <(grep -F "$filename" "$topdir/sha256sums.txt")
unzip -o "$filename" -d "$foldername"
}
2021-03-08 23:48:28 +01:00
mkdir -p libs
pushd libs
libs=$PWD
2023-12-13 12:05:49 +01:00
download "http://minetest.kitsunemimi.pw/libjpeg-$libjpeg_version-$variant.zip"
download "http://minetest.kitsunemimi.pw/libpng-$libpng_version-$variant.zip"
[ $with_sdl -eq 1 ] && download "http://minetest.kitsunemimi.pw/sdl2-$sdl2_version-$variant.zip"
download "http://minetest.kitsunemimi.pw/zlib-$zlib_version-$variant.zip"
2021-03-08 23:48:28 +01:00
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