From 9e968a32120231124686d250520f5910ce0e66fe Mon Sep 17 00:00:00 2001 From: autoantwort <41973254+autoantwort@users.noreply.github.com> Date: Tue, 10 Oct 2023 00:07:33 +0200 Subject: [PATCH] [drogon] fix cross compilation (#33713) --- ports/drogon/0005-drogon-cross-compile.patch | 25 ++++++++++++++++++++ ports/drogon/portfile.cmake | 9 ++++++- ports/drogon/vcpkg.json | 13 +++++++++- versions/baseline.json | 2 +- versions/d-/drogon.json | 5 ++++ 5 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 ports/drogon/0005-drogon-cross-compile.patch diff --git a/ports/drogon/0005-drogon-cross-compile.patch b/ports/drogon/0005-drogon-cross-compile.patch new file mode 100644 index 0000000000..61f0edc4fa --- /dev/null +++ b/ports/drogon/0005-drogon-cross-compile.patch @@ -0,0 +1,25 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 88026025..d6f180fb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -13,6 +13,7 @@ option(BUILD_DOC "Build Doxygen documentation" OFF) + option(BUILD_BROTLI "Build Brotli" ON) + option(BUILD_YAML_CONFIG "Build yaml config" ON) + option(USE_SUBMODULE "Use trantor as a submodule" ON) ++set(DROGON_CTL_TOOL "" CACHE STRING "drogon_ctl tool executable when doing cross builds") + + include(CMakeDependentOption) + CMAKE_DEPENDENT_OPTION(BUILD_POSTGRESQL "Build with postgresql support" ON "BUILD_ORM" OFF) +diff --git a/drogon_ctl/CMakeLists.txt b/drogon_ctl/CMakeLists.txt +index 249c453d..16b346ea 100755 +--- a/drogon_ctl/CMakeLists.txt ++++ b/drogon_ctl/CMakeLists.txt +@@ -43,7 +43,7 @@ foreach(cspFile ${SCP_LIST}) + get_filename_component(classname ${cspFile} NAME_WE) + message(STATUS "view classname:" ${classname}) + add_custom_command(OUTPUT ${classname}.h ${classname}.cc +- COMMAND $ ++ COMMAND $,${DROGON_CTL_TOOL},$> + ARGS + create + view diff --git a/ports/drogon/portfile.cmake b/ports/drogon/portfile.cmake index 3aa87b8cf7..54d7508872 100644 --- a/ports/drogon/portfile.cmake +++ b/ports/drogon/portfile.cmake @@ -9,8 +9,14 @@ vcpkg_from_github( 0002-drogon-config.patch 0003-deps-redis.patch 0004-drogon-ctl.patch + 0005-drogon-cross-compile.patch ) +set(DROGON_CTL_TOOL "") +if(VCPKG_CROSSCOMPILING) + set(DROGON_CTL_TOOL "${CURRENT_HOST_INSTALLED_DIR}/tools/drogon/drogon_ctl${VCPKG_HOST_EXECUTABLE_SUFFIX}") +endif() + vcpkg_check_features( OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES @@ -33,7 +39,8 @@ vcpkg_cmake_configure( -DBUILD_EXAMPLES=OFF -DCMAKE_DISABLE_FIND_PACKAGE_Boost=ON -DUSE_SUBMODULE=OFF - ${FEATURE_OPTIONS} + "-DDROGON_CTL_TOOL=${DROGON_CTL_TOOL}" + ${FEATURE_OPTIONS} MAYBE_UNUSED_VARIABLES CMAKE_DISABLE_FIND_PACKAGE_Boost ) diff --git a/ports/drogon/vcpkg.json b/ports/drogon/vcpkg.json index f6ef00d672..a23057c4dc 100644 --- a/ports/drogon/vcpkg.json +++ b/ports/drogon/vcpkg.json @@ -1,6 +1,7 @@ { "name": "drogon", "version": "1.8.7", + "port-version": 1, "description": "A C++14/17 based HTTP web application framework running on Linux/macOS/Unix/Windows", "homepage": "https://github.com/an-tao/drogon", "documentation": "https://drogon.docsforge.com/master/overview/", @@ -26,7 +27,17 @@ ], "features": { "ctl": { - "description": "Build drogon_ctl tool." + "description": "Build drogon_ctl tool.", + "dependencies": [ + { + "name": "drogon", + "host": true, + "default-features": false, + "features": [ + "ctl" + ] + } + ] }, "mysql": { "description": "Support reading and writing from/to MySQL databases.", diff --git a/versions/baseline.json b/versions/baseline.json index 6fc4815f4d..ac181c9666 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2230,7 +2230,7 @@ }, "drogon": { "baseline": "1.8.7", - "port-version": 0 + "port-version": 1 }, "dstorage": { "baseline": "1.2.0", diff --git a/versions/d-/drogon.json b/versions/d-/drogon.json index 65b8a2fa4f..69d1c4f29d 100644 --- a/versions/d-/drogon.json +++ b/versions/d-/drogon.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "3dc8fd6d40ad624513353e295fbd39a0dd237c91", + "version": "1.8.7", + "port-version": 1 + }, { "git-tree": "01b8dcf586886018269bc888cc651751d074d4c6", "version": "1.8.7",