irrlicht/scripts/ci-build-mingw.sh

51 lines
1.4 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
2022-02-04 21:08:37 +01:00
libjpeg_version=2.1.2
2021-03-08 23:48:28 +01:00
libpng_version=1.6.37
zlib_version=1.2.11
mkdir -p libs
pushd libs
libs=$PWD
2022-02-04 21:08:37 +01:00
tmp=
[ "$variant" = win32 ] && tmp=dw2/
2021-03-08 23:48:28 +01:00
[ -e libjpeg.zip ] || \
wget "http://minetest.kitsunemimi.pw/libjpeg-$libjpeg_version-$variant.zip" -O libjpeg.zip
[ -e libpng.zip ] || \
2022-02-04 21:08:37 +01:00
wget "http://minetest.kitsunemimi.pw/${tmp}libpng-$libpng_version-$variant.zip" -O libpng.zip
2021-03-08 23:48:28 +01:00
[ -e zlib.zip ] || \
2022-02-04 21:08:37 +01:00
wget "http://minetest.kitsunemimi.pw/${tmp}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
[ -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
)
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)
cp -p $libs/*/bin/lib{jpeg,png}*.dll _install/usr/local/lib/
# create a ZIP
(cd _install/usr/local; zip -9r "$OLDPWD"/irrlicht-$variant.zip -- *)
2022-02-04 21:08:37 +01:00
fi
2021-03-08 23:48:28 +01:00
exit 0