From d121b49f2f600d3fec3364f762182e47591bc655 Mon Sep 17 00:00:00 2001 From: WangWeiLin-MV <156736127+WangWeiLin-MV@users.noreply.github.com> Date: Thu, 17 Oct 2024 01:33:00 +0800 Subject: [PATCH] [apr] Add HOST_TOOLS_DIR/gen_test_char for cross-compiling to Windows (#41416) --- ports/activemq-cpp/vcpkg.json | 4 ++-- ports/apr/0100-add-host-tools-dir.diff | 23 +++++++++++++++++++++++ ports/apr/portfile.cmake | 16 +++++++++++++--- ports/apr/vcpkg.json | 9 +++++++-- scripts/ci.baseline.txt | 2 -- versions/a-/activemq-cpp.json | 5 +++++ versions/a-/apr.json | 5 +++++ versions/baseline.json | 4 ++-- 8 files changed, 57 insertions(+), 11 deletions(-) create mode 100644 ports/apr/0100-add-host-tools-dir.diff diff --git a/ports/activemq-cpp/vcpkg.json b/ports/activemq-cpp/vcpkg.json index a332681ee8..9e597e1f48 100644 --- a/ports/activemq-cpp/vcpkg.json +++ b/ports/activemq-cpp/vcpkg.json @@ -1,10 +1,10 @@ { "name": "activemq-cpp", "version-semver": "3.9.5", - "port-version": 16, + "port-version": 17, "description": "Apache ActiveMQ is the most popular and powerful open source messaging and Integration Patterns server.", "license": "Apache-2.0", - "supports": "!(uwp | osx)", + "supports": "(windows & !uwp & (x86 | x64)) | (!windows & !osx)", "dependencies": [ "apr", { diff --git a/ports/apr/0100-add-host-tools-dir.diff b/ports/apr/0100-add-host-tools-dir.diff new file mode 100644 index 0000000000..c38d8975f6 --- /dev/null +++ b/ports/apr/0100-add-host-tools-dir.diff @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d16eec6..92146f4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -87,13 +87,17 @@ STRING(REGEX REPLACE ".*#define APR_PATCH_VERSION[ \t]+([0-9]+).*" "\\1" APR_PAT + + CONFIGURE_FILE(include/apr.hwc + ${PROJECT_BINARY_DIR}/apr.h) + + ADD_EXECUTABLE(gen_test_char tools/gen_test_char.c) + ++set(UNOFFICIAL_APR_HOST_TOOLS_DIR "$" CACHE STRING "") ++set(UNOFFICIAL_APR_HOST_EXECUTABLE_SUFFIX "$" CACHE STRING "") ++install(TARGETS gen_test_char) ++ + ADD_CUSTOM_COMMAND( + COMMENT "Generating character tables, apr_escape_test_char.h, for current locale" + DEPENDS gen_test_char +- COMMAND $ > ${PROJECT_BINARY_DIR}/apr_escape_test_char.h ++ COMMAND "${UNOFFICIAL_APR_HOST_TOOLS_DIR}/gen_test_char${UNOFFICIAL_APR_HOST_EXECUTABLE_SUFFIX}" > ${PROJECT_BINARY_DIR}/apr_escape_test_char.h + OUTPUT ${PROJECT_BINARY_DIR}/apr_escape_test_char.h + ) + ADD_CUSTOM_TARGET( diff --git a/ports/apr/portfile.cmake b/ports/apr/portfile.cmake index 895a98896a..fee527df8c 100644 --- a/ports/apr/portfile.cmake +++ b/ports/apr/portfile.cmake @@ -1,6 +1,3 @@ - -set(VERSION 1.7.5) - vcpkg_download_distfile(ARCHIVE URLS "https://archive.apache.org/dist/apr/apr-${VERSION}.tar.bz2" FILENAME "apr-${VERSION}.tar.bz2" @@ -11,8 +8,19 @@ vcpkg_extract_source_archive(SOURCE_PATH ARCHIVE "${ARCHIVE}" PATCHES unglue.patch + 0100-add-host-tools-dir.diff ) +set(CURRENT_HOST_TOOLS_DIR "${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT}") + +set(CROSSCOMPILING_OPTIONS "") +if(VCPKG_CROSSCOMPILING) + list(APPEND CROSSCOMPILING_OPTIONS + "-DUNOFFICIAL_APR_HOST_TOOLS_DIR=${CURRENT_HOST_TOOLS_DIR}" + "-DUNOFFICIAL_APR_HOST_EXECUTABLE_SUFFIX=${VCPKG_HOST_EXECUTABLE_SUFFIX}" + ) +endif() + if (VCPKG_TARGET_IS_WINDOWS) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES @@ -32,6 +40,7 @@ if (VCPKG_TARGET_IS_WINDOWS) -DMIN_WINDOWS_VER=Windows7 -DAPR_HAVE_IPV6=ON ${FEATURE_OPTIONS} + ${CROSSCOMPILING_OPTIONS} ) vcpkg_cmake_install() @@ -42,6 +51,7 @@ if (VCPKG_TARGET_IS_WINDOWS) ) # There is no way to suppress installation of the headers in debug builds. file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + vcpkg_copy_tools(TOOL_NAMES gen_test_char AUTO_CLEAN) vcpkg_copy_pdbs() diff --git a/ports/apr/vcpkg.json b/ports/apr/vcpkg.json index e052319294..7b4bbf485c 100644 --- a/ports/apr/vcpkg.json +++ b/ports/apr/vcpkg.json @@ -1,12 +1,17 @@ { "name": "apr", "version": "1.7.5", - "port-version": 1, + "port-version": 2, "description": "The Apache Portable Runtime (APR) is a C library that forms a system portability layer that covers many operating systems.", "homepage": "https://apr.apache.org/", "license": "Apache-2.0", - "supports": "!uwp", + "supports": "!uwp & !mingw", "dependencies": [ + { + "name": "apr", + "host": true, + "platform": "windows" + }, { "name": "vcpkg-cmake", "host": true, diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 0fb92d8ecf..d9a56e951b 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -51,8 +51,6 @@ allegro5:x64-android=fail apr:arm-neon-android=fail apr:arm64-android=fail apr:x64-android=fail -# Cross compiling CI machine cannot run gen_test_char to generate apr_escape_test_char.h -apr:arm64-windows=fail apsi:arm-neon-android=fail apsi:x64-android=fail # Broken with CUDA 12; needs update to 3.8.3 and https://github.com/arrayfire/arrayfire/issues/3349 fixed diff --git a/versions/a-/activemq-cpp.json b/versions/a-/activemq-cpp.json index 479edb6b02..b3bb8f5d0e 100644 --- a/versions/a-/activemq-cpp.json +++ b/versions/a-/activemq-cpp.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "0066f657df214848cbfd6b991e8ff4a52902e81b", + "version-semver": "3.9.5", + "port-version": 17 + }, { "git-tree": "1644c99e45b2364ea36c0307b4d7171f4717ccdc", "version-semver": "3.9.5", diff --git a/versions/a-/apr.json b/versions/a-/apr.json index 72e6287755..180bb00f4e 100644 --- a/versions/a-/apr.json +++ b/versions/a-/apr.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "dfa11d3e5058b640b37c1a6845dbc2980496a7c8", + "version": "1.7.5", + "port-version": 2 + }, { "git-tree": "499cf5fc0959f4a049ec72f0f556400e7191ffd3", "version": "1.7.5", diff --git a/versions/baseline.json b/versions/baseline.json index ba7a3c58b0..c84c796933 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -34,7 +34,7 @@ }, "activemq-cpp": { "baseline": "3.9.5", - "port-version": 16 + "port-version": 17 }, "ada-url": { "baseline": "2.9.2", @@ -170,7 +170,7 @@ }, "apr": { "baseline": "1.7.5", - "port-version": 1 + "port-version": 2 }, "apr-util": { "baseline": "1.6.3",