]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Automatically package MinGW runtime in buildbot
authorsfan5 <sfan5@live.de>
Mon, 25 Oct 2021 20:33:13 +0000 (22:33 +0200)
committerrubenwardy <rw@rubenwardy.com>
Sun, 31 Oct 2021 22:32:48 +0000 (22:32 +0000)
.gitlab-ci.yml
README.md
src/CMakeLists.txt
util/buildbot/buildwin32.sh
util/buildbot/buildwin64.sh

index 5b085c36c853e9d7d702f7c4bf24bea3d2baf648..f1079c568dddb842d4dcd2392252f9ea78e2bb43 100644 (file)
@@ -204,19 +204,6 @@ build:fedora-28:
 .build_win_template:
   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:
@@ -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"
 
index 372276b854f8a1b98cc94066c46f62ef7ddbf10f..9322912cf8ceaf6d59ba31b54c76a4a15d698903 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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
index 7ae5c15d4ccaa57ab2d62da2ce5da3f43f09874b..1549587b7db349889c9fdfa7adc4b5e8cc1a9c57 100644 (file)
@@ -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/
index c1edbfa1f08c3fa481ca690c14f52e36917b4a98..66f299a6a5bacd937ed856f6e6c3108c9e54a820 100755 (executable)
@@ -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 \
index 134bc08de7213b50ee3f40ca7000bc4bc5a51327..e9b17c420a9c1de4a106ecc9faeba6c9e50d635d 100755 (executable)
@@ -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 \