diff options
author | sfan5 <sfan5@live.de> | 2021-10-25 22:33:13 +0200 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2021-10-31 22:32:48 +0000 |
commit | 0b95da7ad3f36ad49e3dfb9d7e919d5f9fc8f57a (patch) | |
tree | d87b74739863c6931a3b95f91c7155645baa7878 | |
parent | ea1396f85693ee1f752219d91adcacb32041fc84 (diff) | |
download | minetest-0b95da7ad3f36ad49e3dfb9d7e919d5f9fc8f57a.tar.gz minetest-0b95da7ad3f36ad49e3dfb9d7e919d5f9fc8f57a.tar.bz2 minetest-0b95da7ad3f36ad49e3dfb9d7e919d5f9fc8f57a.zip |
Automatically package MinGW runtime in buildbot
-rw-r--r-- | .gitlab-ci.yml | 30 | ||||
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | src/CMakeLists.txt | 10 | ||||
-rwxr-xr-x | util/buildbot/buildwin32.sh | 16 | ||||
-rwxr-xr-x | util/buildbot/buildwin64.sh | 16 |
5 files changed, 34 insertions, 39 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5b085c36c..f1079c568 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -205,19 +205,6 @@ build:fedora-28: extends: .generic_win_template stage: build artifacts: - expire_in: 1h - paths: - - build/build/*.zip - -.package_win_template: - extends: .generic_win_template - stage: package - script: - - unzip build/build/*.zip - - cp -p /usr/${WIN_ARCH}-w64-mingw32/bin/libgcc*.dll minetest-*-win*/bin/ - - cp -p /usr/${WIN_ARCH}-w64-mingw32/bin/libstdc++*.dll minetest-*-win*/bin/ - - cp -p /usr/${WIN_ARCH}-w64-mingw32/bin/libwinpthread*.dll minetest-*-win*/bin/ - artifacts: expire_in: 90 day paths: - minetest-*-win*/* @@ -226,28 +213,15 @@ build:win32: extends: .build_win_template script: - EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin32.sh build + - unzip -q build/build/*.zip variables: WIN_ARCH: "i686" -package:win32: - extends: .package_win_template - needs: - - build:win32 - variables: - WIN_ARCH: "i686" - - build:win64: extends: .build_win_template script: - EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin64.sh build - variables: - WIN_ARCH: "x86_64" - -package:win64: - extends: .package_win_template - needs: - - build:win64 + - unzip -q build/build/*.zip variables: WIN_ARCH: "x86_64" @@ -269,6 +269,7 @@ Library specific options: CURL_LIBRARY - Only if building with cURL; path to libcurl.a/libcurl.so/libcurl.lib EGL_INCLUDE_DIR - Only if building with GLES; directory that contains egl.h EGL_LIBRARY - Only if building with GLES; path to libEGL.a/libEGL.so + EXTRA_DLL - Only on Windows; optional paths to additional DLLs that should be packaged FREETYPE_INCLUDE_DIR_freetype2 - Only if building with FreeType 2; directory that contains an freetype directory with files such as ftimage.h in it FREETYPE_INCLUDE_DIR_ft2build - Only if building with FreeType 2; directory that contains ft2build.h FREETYPE_LIBRARY - Only if building with FreeType 2; path to libfreetype.a/libfreetype.so/freetype.lib diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7ae5c15d4..1549587b7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -278,10 +278,12 @@ if(WIN32) endif() set(PLATFORM_LIBS ws2_32.lib version.lib shlwapi.lib ${PLATFORM_LIBS}) + set(EXTRA_DLL "" CACHE FILEPATH "Optional paths to additional DLLs that should be packaged") + # DLLs are automatically copied to the output directory by vcpkg when VCPKG_APPLOCAL_DEPS=ON if(NOT VCPKG_APPLOCAL_DEPS) - find_file(ZLIB_DLL NAMES "" DOC "Path to Zlib DLL for installation (optional)") - find_file(ZSTD_DLL NAMES "" DOC "Path to Zstd DLL for installation (optional)") + set(ZLIB_DLL "" CACHE FILEPATH "Path to Zlib DLL for installation (optional)") + set(ZSTD_DLL "" CACHE FILEPATH "Path to Zstd DLL for installation (optional)") if(ENABLE_SOUND) set(OPENAL_DLL "" CACHE FILEPATH "Path to OpenAL32.dll for installation (optional)") set(OGG_DLL "" CACHE FILEPATH "Path to libogg.dll for installation (optional)") @@ -294,7 +296,6 @@ if(WIN32) set(LUA_DLL "" CACHE FILEPATH "Path to luajit-5.1.dll for installation (optional)") endif() endif() - else() # Unix probably if(BUILD_CLIENT) @@ -794,6 +795,9 @@ endif() # Installation if(WIN32) + if(EXTRA_DLL) + install(FILES ${EXTRA_DLL} DESTINATION ${BINDIR}) + endif() if(VCPKG_APPLOCAL_DEPS) # Collect the dll's from the output path install(DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/Release/ diff --git a/util/buildbot/buildwin32.sh b/util/buildbot/buildwin32.sh index c1edbfa1f..66f299a6a 100755 --- a/util/buildbot/buildwin32.sh +++ b/util/buildbot/buildwin32.sh @@ -20,16 +20,24 @@ libdir=$builddir/libs # Test which win32 compiler is present command -v i686-w64-mingw32-gcc >/dev/null && - toolchain_file=$dir/toolchain_i686-w64-mingw32.cmake + compiler=i686-w64-mingw32-gcc command -v i686-w64-mingw32-gcc-posix >/dev/null && - toolchain_file=$dir/toolchain_i686-w64-mingw32-posix.cmake + compiler=i686-w64-mingw32-gcc-posix -if [ -z "$toolchain_file" ]; then +if [ -z "$compiler" ]; then echo "Unable to determine which mingw32 compiler to use" exit 1 fi +toolchain_file=$dir/toolchain_${compiler%-gcc}.cmake echo "Using $toolchain_file" +tmp=$(dirname "$(command -v $compiler)")/../i686-w64-mingw32/bin +runtime_dlls= +[ -d "$tmp" ] && runtime_dlls=$(echo $tmp/lib{gcc_,stdc++-,winpthread-}*.dll | tr ' ' ';') +[ -z "$runtime_dlls" ] && + echo "The compiler runtime DLLs could not be found, they might be missing in the final package." + +# Get stuff irrlicht_version=1.9.0mt3 ogg_version=1.3.4 vorbis_version=1.3.7 @@ -63,7 +71,6 @@ download () { fi } -# Get stuff cd $libdir download "https://github.com/minetest/irrlicht/releases/download/$irrlicht_version/win32.zip" irrlicht-$irrlicht_version.zip download "http://minetest.kitsunemimi.pw/zlib-$zlib_version-win32.zip" @@ -108,6 +115,7 @@ cmake -S $sourcedir -B . \ -DCMAKE_INSTALL_PREFIX=/tmp \ -DVERSION_EXTRA=$git_hash \ -DBUILD_CLIENT=1 -DBUILD_SERVER=0 \ + -DEXTRA_DLL="$runtime_dll" \ \ -DENABLE_SOUND=1 \ -DENABLE_CURL=1 \ diff --git a/util/buildbot/buildwin64.sh b/util/buildbot/buildwin64.sh index 134bc08de..e9b17c420 100755 --- a/util/buildbot/buildwin64.sh +++ b/util/buildbot/buildwin64.sh @@ -20,16 +20,24 @@ libdir=$builddir/libs # Test which win64 compiler is present command -v x86_64-w64-mingw32-gcc >/dev/null && - toolchain_file=$dir/toolchain_x86_64-w64-mingw32.cmake + compiler=x86_64-w64-mingw32 command -v x86_64-w64-mingw32-gcc-posix >/dev/null && - toolchain_file=$dir/toolchain_x86_64-w64-mingw32-posix.cmake + compiler=x86_64-w64-mingw32-posix -if [ -z "$toolchain_file" ]; then +if [ -z "$compiler" ]; then echo "Unable to determine which mingw32 compiler to use" exit 1 fi +toolchain_file=$dir/toolchain_${compiler%-gcc}.cmake echo "Using $toolchain_file" +tmp=$(dirname "$(command -v $compiler)")/../x86_64-w64-mingw32/bin +runtime_dlls= +[ -d "$tmp" ] && runtime_dlls=$(echo $tmp/lib{gcc_,stdc++-,winpthread-}*.dll | tr ' ' ';') +[ -z "$runtime_dlls" ] && + echo "The compiler runtime DLLs could not be found, they might be missing in the final package." + +# Get stuff irrlicht_version=1.9.0mt3 ogg_version=1.3.4 vorbis_version=1.3.7 @@ -63,7 +71,6 @@ download () { fi } -# Get stuff cd $libdir download "https://github.com/minetest/irrlicht/releases/download/$irrlicht_version/win64.zip" irrlicht-$irrlicht_version.zip download "http://minetest.kitsunemimi.pw/zlib-$zlib_version-win64.zip" @@ -108,6 +115,7 @@ cmake -S $sourcedir -B . \ -DCMAKE_INSTALL_PREFIX=/tmp \ -DVERSION_EXTRA=$git_hash \ -DBUILD_CLIENT=1 -DBUILD_SERVER=0 \ + -DEXTRA_DLL="$runtime_dll" \ \ -DENABLE_SOUND=1 \ -DENABLE_CURL=1 \ |