From 9242f417c8002c0fe0ab5e7f429882aaaa42c010 Mon Sep 17 00:00:00 2001 From: lanyi Date: Mon, 30 May 2022 13:19:32 +0200 Subject: [PATCH 01/11] update nethost --- ports/nethost/0001-nethost-cmakelists.patch | 80 +++++++++++---------- ports/nethost/0002-settings-cmake.patch | 13 ---- ports/nethost/nethost-config.cmake.in | 2 + ports/nethost/portfile.cmake | 18 +++-- ports/nethost/usage | 7 +- ports/nethost/vcpkg.json | 4 +- 6 files changed, 62 insertions(+), 62 deletions(-) delete mode 100644 ports/nethost/0002-settings-cmake.patch create mode 100644 ports/nethost/nethost-config.cmake.in diff --git a/ports/nethost/0001-nethost-cmakelists.patch b/ports/nethost/0001-nethost-cmakelists.patch index 93d49b95e16439..140a96a3eb5e3d 100644 --- a/ports/nethost/0001-nethost-cmakelists.patch +++ b/ports/nethost/0001-nethost-cmakelists.patch @@ -1,58 +1,64 @@ -diff --git a/src/installer/corehost/cli/common.cmake b/src/installer/corehost/cli/common.cmake -index 63e7306..639c90e 100644 ---- a/src/installer/corehost/cli/common.cmake -+++ b/src/installer/corehost/cli/common.cmake -@@ -5,9 +5,6 @@ - project(${DOTNET_PROJECT_NAME}) - - if(WIN32) -- add_compile_options($<$:/MT>) -- add_compile_options($<$:/MT>) -- add_compile_options($<$:/MTd>) - else() - add_compile_options(-fvisibility=hidden) - endif() -diff --git a/src/installer/corehost/cli/nethost/CMakeLists.txt b/src/installer/corehost/cli/nethost/CMakeLists.txt -index 7473958..49c664f 100644 ---- a/src/installer/corehost/cli/nethost/CMakeLists.txt -+++ b/src/installer/corehost/cli/nethost/CMakeLists.txt -@@ -2,12 +2,14 @@ +diff --git a/src/native/corehost/nethost/CMakeLists.txt b/src/native/corehost/nethost/CMakeLists.txt +index a9f44e720..9dc0a43b2 100644 +--- a/src/native/corehost/nethost/CMakeLists.txt ++++ b/src/native/corehost/nethost/CMakeLists.txt +@@ -1,11 +1,14 @@ + # Licensed to the .NET Foundation under one or more agreements. # The .NET Foundation licenses this file to you under the MIT license. - # See the LICENSE file in the project root for more information. --cmake_minimum_required (VERSION 2.6) -+cmake_minimum_required (VERSION 3.14) ++cmake_minimum_required (VERSION 3.14.5) project(nethost) set(DOTNET_PROJECT_NAME "nethost") # Include directories -+include(../../../settings.cmake) -+include(../../../functions.cmake) ++include(../../../../eng/native/configurepaths.cmake) ++include(${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake) include_directories(../fxr) # CMake does not recommend using globbing since it messes with the freshness checks -@@ -22,13 +24,18 @@ if(WIN32) - Exports.def) +@@ -20,7 +23,9 @@ if(CLR_CMAKE_TARGET_WIN32) endif() -+if(BUILD_SHARED_LIBS) include(../lib.cmake) -+else() ++ include(../lib_static.cmake) -+endif() ++target_compile_definitions(libnethost PUBLIC NETHOST_USE_AS_STATIC) add_definitions(-DFEATURE_LIBHOST=1) add_definitions(-DNETHOST_EXPORT) +@@ -33,14 +38,23 @@ if (WIN32) + ) + endif(WIN32) +-install(FILES ../coreclr_delegates.h DESTINATION corehost) +-install(FILES ../hostfxr.h DESTINATION corehost) -install(FILES nethost.h DESTINATION corehost) --install(TARGETS nethost DESTINATION corehost) --install(TARGETS libnethost DESTINATION corehost) --install_symbols(nethost corehost) +-install_with_stripped_symbols(nethost TARGETS corehost) +- +-# Only Windows creates a symbols file for static libs. +-if (WIN32) +- install_with_stripped_symbols(libnethost TARGETS corehost) ++set(NETHOST_HEADERS nethost.h ../coreclr_delegates.h ../hostfxr.h) ++install(FILES ${NETHOST_HEADERS} DESTINATION include) ++if (BUILD_SHARED_LIBS) ++ set(NETHOST_ACTIVE_TARGET nethost) + else() +- install(TARGETS libnethost DESTINATION corehost) +-endif(WIN32) \ No newline at end of file -+install(FILES nethost.h ../coreclr_delegates.h ../hostfxr.h DESTINATION include) -+if(BUILD_SHARED_LIBS) -+install(TARGETS nethost) -+else() -+install(TARGETS libnethost) ++ set(NETHOST_ACTIVE_TARGET libnethost) +endif() ++ ++target_include_directories(${NETHOST_ACTIVE_TARGET} INTERFACE $) ++install(TARGETS ${NETHOST_ACTIVE_TARGET} EXPORT nethost-targets ++ ARCHIVE DESTINATION lib ++ LIBRARY DESTINATION lib ++ RUNTIME DESTINATION bin ++) ++ ++include(CMakePackageConfigHelpers) ++configure_package_config_file(nethost-config.cmake.in nethost-config.cmake INSTALL_DESTINATION share/nethost) ++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/nethost-config.cmake DESTINATION share/nethost) ++ ++install(EXPORT nethost-targets DESTINATION share/nethost FILE nethost-targets.cmake) diff --git a/ports/nethost/0002-settings-cmake.patch b/ports/nethost/0002-settings-cmake.patch deleted file mode 100644 index 7143b942a9b405..00000000000000 --- a/ports/nethost/0002-settings-cmake.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/installer/settings.cmake b/src/installer/settings.cmake -index 29d57b44..6ea63902 100644 ---- a/src/installer/settings.cmake -+++ b/src/installer/settings.cmake -@@ -114,7 +114,7 @@ endfunction() - - function(install_symbols targetName destination_path) - if(WIN32) -- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pdb DESTINATION ${destination_path}) -+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${targetName}.pdb DESTINATION ${destination_path}) - else() - strip_symbols(${targetName} strip_destination_file) - install(FILES ${strip_destination_file} DESTINATION ${destination_path}) diff --git a/ports/nethost/nethost-config.cmake.in b/ports/nethost/nethost-config.cmake.in new file mode 100644 index 00000000000000..8ee7d7ef1cc600 --- /dev/null +++ b/ports/nethost/nethost-config.cmake.in @@ -0,0 +1,2 @@ +@PACKAGE_INIT@ +include("${CMAKE_CURRENT_LIST_DIR}/nethost-targets.cmake") \ No newline at end of file diff --git a/ports/nethost/portfile.cmake b/ports/nethost/portfile.cmake index c7d4aae3b89ede..81822bbb0a3f43 100644 --- a/ports/nethost/portfile.cmake +++ b/ports/nethost/portfile.cmake @@ -1,17 +1,16 @@ -set(COMMIT_HASH 188427d7e18102c45fc6d0e20c135e226f215992) +set(COMMIT_HASH v6.0.5) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO dotnet/runtime REF ${COMMIT_HASH} - SHA512 5a93c66c87e2113f733702d938efd39456c99fb74b383097b8d877df21536fcbcba901606aa70db6c8f1a16421ea8f06822c5b0ab1d882631b6daecbed8d03cc + SHA512 ccf4865bd9ea63c525fc11b0008774052d51f9247427fc28a91e3836e8e8d157569565bdac17326fe44a446d98a3e4b74a55779d01bede596f2458f4ec86f3aa HEAD_REF master PATCHES 0001-nethost-cmakelists.patch - 0002-settings-cmake.patch ) -set(PRODUCT_VERSION "5.0.0") +set(PRODUCT_VERSION "6.0.5") if(VCPKG_TARGET_IS_WINDOWS) set(RID_PLAT "win") @@ -41,9 +40,14 @@ endif() set(BASE_RID "${RID_PLAT}-${RID_ARCH}") +set(NETHOST_SOURCE_PATH ${SOURCE_PATH}/src/native/corehost/nethost/) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/nethost-config.cmake.in DESTINATION ${NETHOST_SOURCE_PATH}) + vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH}/src/installer/corehost/cli/nethost + SOURCE_PATH ${NETHOST_SOURCE_PATH} PREFER_NINJA + # vcpkg's /utf-8 is incompatible with dotnet's own /source-charset:utf-8 + NO_CHARSET_FLAG OPTIONS "-DSKIP_VERSIONING=1" "-DCLI_CMAKE_HOST_POLICY_VER:STRING=${PRODUCT_VERSION}" @@ -53,13 +57,15 @@ vcpkg_configure_cmake( "-DCLI_CMAKE_PKG_RID:STRING=${BASE_RID}" "-DCLI_CMAKE_COMMIT_HASH:STRING=${COMMIT_HASH}" "-DCLI_CMAKE_PLATFORM_ARCH_${ARCH_NAME}=1" - "-DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=10.0" + "-DCLR_CMAKE_HOST_ARCH=${RID_ARCH}" ) vcpkg_install_cmake() vcpkg_copy_pdbs() +vcpkg_fixup_cmake_targets() + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(INSTALL ${SOURCE_PATH}/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/nethost/usage b/ports/nethost/usage index 6e6d860d1fb27c..54adf2922d95fe 100644 --- a/ports/nethost/usage +++ b/ports/nethost/usage @@ -1,6 +1,5 @@ The package nethost can be used via CMake: - find_path(NETHOST_INCLUDE_DIRS nethost.h) - find_library(NETHOST_LIBRARY NAMES libnethost nethost) - target_include_directories(main PRIVATE ${NETHOST_INCLUDE_DIRS}) - target_link_libraries(main PRIVATE ${NETHOST_LIBRARY}) + find_package(nethost CONFIG REQUIRED) + target_link_libraries(main PRIVATE nethost) # DLL + target_link_libraries(main PRIVATE libnethost) # Static diff --git a/ports/nethost/vcpkg.json b/ports/nethost/vcpkg.json index 0f65e50da87bbe..dd05c113766e7f 100644 --- a/ports/nethost/vcpkg.json +++ b/ports/nethost/vcpkg.json @@ -1,7 +1,7 @@ { "name": "nethost", - "version-date": "2019-12-21", - "port-version": 2, + "version-date": "2022-05-30", + "port-version": 3, "description": "Provides a set of APIs that can be used to host .NET Core (dotnet)", "homepage": "https://github.com/dotnet/runtime/tree/master/src/installer/corehost/cli/nethost", "supports": "!uwp" From 16f8683599befea0740cb1175d69fd1b2e69977e Mon Sep 17 00:00:00 2001 From: lanyi Date: Mon, 30 May 2022 13:19:57 +0200 Subject: [PATCH 02/11] bump nethost version --- versions/baseline.json | 4 ++-- versions/n-/nethost.json | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/versions/baseline.json b/versions/baseline.json index 82baf583d7fb74..6e5b8c60c3df67 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4833,8 +4833,8 @@ "port-version": 3 }, "nethost": { - "baseline": "2019-12-21", - "port-version": 2 + "baseline": "2022-05-30", + "port-version": 3 }, "nettle": { "baseline": "3.7.3", diff --git a/versions/n-/nethost.json b/versions/n-/nethost.json index 0181e8cdef56e8..f9dc4b3eebc5fb 100644 --- a/versions/n-/nethost.json +++ b/versions/n-/nethost.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "6972f3a23d39e25d9dbb5e6c0f55cf2b2e68a06b", + "version-date": "2022-05-30", + "port-version": 3 + }, { "git-tree": "5b1a7d98ce2c1520bbb370dfc2fcb8c3d704c300", "version-date": "2019-12-21", From 8082b31323ba0583eb228b92b91959b2269bca21 Mon Sep 17 00:00:00 2001 From: lanyi Date: Tue, 31 May 2022 07:32:41 +0200 Subject: [PATCH 03/11] Add CMake exports in an unofficial- namespace https://github.com/microsoft/vcpkg/blob/master/docs/maintainers/maintainer-guide.md#add-cmake-exports-in-an-unofficial--namespace --- ports/nethost/0001-nethost-cmakelists.patch | 28 ++++++++++++++----- ports/nethost/nethost-config.cmake.in | 2 -- ports/nethost/portfile.cmake | 4 +-- .../unofficial-nethost-config.cmake.in | 2 ++ ports/nethost/usage | 6 ++-- 5 files changed, 28 insertions(+), 14 deletions(-) delete mode 100644 ports/nethost/nethost-config.cmake.in create mode 100644 ports/nethost/unofficial-nethost-config.cmake.in diff --git a/ports/nethost/0001-nethost-cmakelists.patch b/ports/nethost/0001-nethost-cmakelists.patch index 140a96a3eb5e3d..66143e924cff1f 100644 --- a/ports/nethost/0001-nethost-cmakelists.patch +++ b/ports/nethost/0001-nethost-cmakelists.patch @@ -1,5 +1,5 @@ diff --git a/src/native/corehost/nethost/CMakeLists.txt b/src/native/corehost/nethost/CMakeLists.txt -index a9f44e720..9dc0a43b2 100644 +index a9f44e720..7d678c562 100644 --- a/src/native/corehost/nethost/CMakeLists.txt +++ b/src/native/corehost/nethost/CMakeLists.txt @@ -1,11 +1,14 @@ @@ -27,7 +27,7 @@ index a9f44e720..9dc0a43b2 100644 add_definitions(-DFEATURE_LIBHOST=1) add_definitions(-DNETHOST_EXPORT) -@@ -33,14 +38,23 @@ if (WIN32) +@@ -33,14 +38,37 @@ if (WIN32) ) endif(WIN32) @@ -41,6 +41,12 @@ index a9f44e720..9dc0a43b2 100644 - install_with_stripped_symbols(libnethost TARGETS corehost) +set(NETHOST_HEADERS nethost.h ../coreclr_delegates.h ../hostfxr.h) +install(FILES ${NETHOST_HEADERS} DESTINATION include) ++# Original src/native/corehost/nethost/CMakeLists.txt uses install_with_stripped_symbols() to install ++# targets with symbols. However, on Windows symbols will be put into PDB ++# folder which doesn't seem to be recognizable by vcpkg functions. ++# Furthermore, install_with_stripped_symbols() may install files instead of ++# targets. ++# For these reason, they are replaced with a plain install(). +if (BUILD_SHARED_LIBS) + set(NETHOST_ACTIVE_TARGET nethost) else() @@ -48,17 +54,25 @@ index a9f44e720..9dc0a43b2 100644 -endif(WIN32) \ No newline at end of file + set(NETHOST_ACTIVE_TARGET libnethost) -+endif() ++endif(BUILD_SHARED_LIBS) + +target_include_directories(${NETHOST_ACTIVE_TARGET} INTERFACE $) -+install(TARGETS ${NETHOST_ACTIVE_TARGET} EXPORT nethost-targets ++install(TARGETS ${NETHOST_ACTIVE_TARGET} EXPORT unofficial-nethost-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin +) + +include(CMakePackageConfigHelpers) -+configure_package_config_file(nethost-config.cmake.in nethost-config.cmake INSTALL_DESTINATION share/nethost) -+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/nethost-config.cmake DESTINATION share/nethost) ++configure_package_config_file(unofficial-nethost-config.cmake.in unofficial-nethost-config.cmake ++ INSTALL_DESTINATION share/unofficial-nethost ++) ++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unofficial-nethost-config.cmake ++ DESTINATION share/unofficial-nethost ++) + -+install(EXPORT nethost-targets DESTINATION share/nethost FILE nethost-targets.cmake) ++install(EXPORT unofficial-nethost-targets ++ DESTINATION share/unofficial-nethost ++ FILE unofficial-nethost-targets.cmake ++ NAMESPACE unofficial::nethost:: ++) diff --git a/ports/nethost/nethost-config.cmake.in b/ports/nethost/nethost-config.cmake.in deleted file mode 100644 index 8ee7d7ef1cc600..00000000000000 --- a/ports/nethost/nethost-config.cmake.in +++ /dev/null @@ -1,2 +0,0 @@ -@PACKAGE_INIT@ -include("${CMAKE_CURRENT_LIST_DIR}/nethost-targets.cmake") \ No newline at end of file diff --git a/ports/nethost/portfile.cmake b/ports/nethost/portfile.cmake index 81822bbb0a3f43..af25c4ccb2cfa5 100644 --- a/ports/nethost/portfile.cmake +++ b/ports/nethost/portfile.cmake @@ -41,7 +41,7 @@ endif() set(BASE_RID "${RID_PLAT}-${RID_ARCH}") set(NETHOST_SOURCE_PATH ${SOURCE_PATH}/src/native/corehost/nethost/) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/nethost-config.cmake.in DESTINATION ${NETHOST_SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/unofficial-nethost-config.cmake.in DESTINATION ${NETHOST_SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${NETHOST_SOURCE_PATH} @@ -64,7 +64,7 @@ vcpkg_install_cmake() vcpkg_copy_pdbs() -vcpkg_fixup_cmake_targets() +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-nethost) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) diff --git a/ports/nethost/unofficial-nethost-config.cmake.in b/ports/nethost/unofficial-nethost-config.cmake.in new file mode 100644 index 00000000000000..eccfc3f3e20f31 --- /dev/null +++ b/ports/nethost/unofficial-nethost-config.cmake.in @@ -0,0 +1,2 @@ +@PACKAGE_INIT@ +include("${CMAKE_CURRENT_LIST_DIR}/unofficial-nethost-targets.cmake") \ No newline at end of file diff --git a/ports/nethost/usage b/ports/nethost/usage index 54adf2922d95fe..123922cd8918e2 100644 --- a/ports/nethost/usage +++ b/ports/nethost/usage @@ -1,5 +1,5 @@ The package nethost can be used via CMake: - find_package(nethost CONFIG REQUIRED) - target_link_libraries(main PRIVATE nethost) # DLL - target_link_libraries(main PRIVATE libnethost) # Static + find_package(unofficial-nethost CONFIG REQUIRED) + target_link_libraries(main PRIVATE unofficial::nethost::nethost) # DLL + target_link_libraries(main PRIVATE unofficial::nethost::libnethost) # Static From 8984bc10499896173a091c00374b9c5a7f89e981 Mon Sep 17 00:00:00 2001 From: lanyi Date: Tue, 31 May 2022 07:34:09 +0200 Subject: [PATCH 04/11] fix port version and deprecated functions --- ports/nethost/portfile.cmake | 5 ++--- ports/nethost/vcpkg.json | 13 +++++++++++-- versions/n-/nethost.json | 5 ----- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ports/nethost/portfile.cmake b/ports/nethost/portfile.cmake index af25c4ccb2cfa5..eda99686e7b142 100644 --- a/ports/nethost/portfile.cmake +++ b/ports/nethost/portfile.cmake @@ -43,9 +43,8 @@ set(BASE_RID "${RID_PLAT}-${RID_ARCH}") set(NETHOST_SOURCE_PATH ${SOURCE_PATH}/src/native/corehost/nethost/) file(COPY ${CMAKE_CURRENT_LIST_DIR}/unofficial-nethost-config.cmake.in DESTINATION ${NETHOST_SOURCE_PATH}) -vcpkg_configure_cmake( +vcpkg_cmake_configure( SOURCE_PATH ${NETHOST_SOURCE_PATH} - PREFER_NINJA # vcpkg's /utf-8 is incompatible with dotnet's own /source-charset:utf-8 NO_CHARSET_FLAG OPTIONS @@ -60,7 +59,7 @@ vcpkg_configure_cmake( "-DCLR_CMAKE_HOST_ARCH=${RID_ARCH}" ) -vcpkg_install_cmake() +vcpkg_cmake_install() vcpkg_copy_pdbs() diff --git a/ports/nethost/vcpkg.json b/ports/nethost/vcpkg.json index dd05c113766e7f..f08abde3fa5e3f 100644 --- a/ports/nethost/vcpkg.json +++ b/ports/nethost/vcpkg.json @@ -1,8 +1,17 @@ { "name": "nethost", "version-date": "2022-05-30", - "port-version": 3, "description": "Provides a set of APIs that can be used to host .NET Core (dotnet)", "homepage": "https://github.com/dotnet/runtime/tree/master/src/installer/corehost/cli/nethost", - "supports": "!uwp" + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] } diff --git a/versions/n-/nethost.json b/versions/n-/nethost.json index f9dc4b3eebc5fb..0181e8cdef56e8 100644 --- a/versions/n-/nethost.json +++ b/versions/n-/nethost.json @@ -1,10 +1,5 @@ { "versions": [ - { - "git-tree": "6972f3a23d39e25d9dbb5e6c0f55cf2b2e68a06b", - "version-date": "2022-05-30", - "port-version": 3 - }, { "git-tree": "5b1a7d98ce2c1520bbb370dfc2fcb8c3d704c300", "version-date": "2019-12-21", From 62d20f97eec0724ae3c394c4a57675f3ffa7383c Mon Sep 17 00:00:00 2001 From: lanyi Date: Tue, 31 May 2022 10:38:33 +0200 Subject: [PATCH 05/11] change nethost version date to version --- ports/nethost/vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nethost/vcpkg.json b/ports/nethost/vcpkg.json index f08abde3fa5e3f..b5cf0998984dad 100644 --- a/ports/nethost/vcpkg.json +++ b/ports/nethost/vcpkg.json @@ -1,6 +1,6 @@ { "name": "nethost", - "version-date": "2022-05-30", + "version": "6.0.5", "description": "Provides a set of APIs that can be used to host .NET Core (dotnet)", "homepage": "https://github.com/dotnet/runtime/tree/master/src/installer/corehost/cli/nethost", "supports": "!uwp", From 4ad22786c8ce91b5d7a154ca7492e624ed97521a Mon Sep 17 00:00:00 2001 From: lanyi Date: Tue, 31 May 2022 13:42:38 +0200 Subject: [PATCH 06/11] update usage --- ports/nethost/usage | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ports/nethost/usage b/ports/nethost/usage index 123922cd8918e2..2834021b255245 100644 --- a/ports/nethost/usage +++ b/ports/nethost/usage @@ -1,5 +1,6 @@ The package nethost can be used via CMake: find_package(unofficial-nethost CONFIG REQUIRED) - target_link_libraries(main PRIVATE unofficial::nethost::nethost) # DLL - target_link_libraries(main PRIVATE unofficial::nethost::libnethost) # Static + target_link_libraries(main PRIVATE $,unofficial::nethost::nethost,unofficial::nethost::libnethost>) + # unofficial::nethost::nethost is the shared library target + # unofficial::nethost::libnethost is the static libray target availaible in static triplets From bc3f6144b9978dcc6f096dfa2066839fde8cac7a Mon Sep 17 00:00:00 2001 From: lanyi Date: Wed, 1 Jun 2022 10:41:01 +0200 Subject: [PATCH 07/11] add quotes to paths and export targets directly --- ports/nethost/0001-nethost-cmakelists.patch | 20 ++++++------------- ports/nethost/portfile.cmake | 11 +++++----- .../unofficial-nethost-config.cmake.in | 2 -- 3 files changed, 11 insertions(+), 22 deletions(-) delete mode 100644 ports/nethost/unofficial-nethost-config.cmake.in diff --git a/ports/nethost/0001-nethost-cmakelists.patch b/ports/nethost/0001-nethost-cmakelists.patch index 66143e924cff1f..8a2be4efd58d20 100644 --- a/ports/nethost/0001-nethost-cmakelists.patch +++ b/ports/nethost/0001-nethost-cmakelists.patch @@ -1,5 +1,5 @@ diff --git a/src/native/corehost/nethost/CMakeLists.txt b/src/native/corehost/nethost/CMakeLists.txt -index a9f44e720..7d678c562 100644 +index a9f44e720..7149ea6c6 100644 --- a/src/native/corehost/nethost/CMakeLists.txt +++ b/src/native/corehost/nethost/CMakeLists.txt @@ -1,11 +1,14 @@ @@ -13,7 +13,7 @@ index a9f44e720..7d678c562 100644 # Include directories +include(../../../../eng/native/configurepaths.cmake) -+include(${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake) ++include("${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake") include_directories(../fxr) # CMake does not recommend using globbing since it messes with the freshness checks @@ -27,7 +27,7 @@ index a9f44e720..7d678c562 100644 add_definitions(-DFEATURE_LIBHOST=1) add_definitions(-DNETHOST_EXPORT) -@@ -33,14 +38,37 @@ if (WIN32) +@@ -33,14 +38,29 @@ if (WIN32) ) endif(WIN32) @@ -57,22 +57,14 @@ index a9f44e720..7d678c562 100644 +endif(BUILD_SHARED_LIBS) + +target_include_directories(${NETHOST_ACTIVE_TARGET} INTERFACE $) -+install(TARGETS ${NETHOST_ACTIVE_TARGET} EXPORT unofficial-nethost-targets ++install(TARGETS ${NETHOST_ACTIVE_TARGET} EXPORT unofficial-nethost-config + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin +) + -+include(CMakePackageConfigHelpers) -+configure_package_config_file(unofficial-nethost-config.cmake.in unofficial-nethost-config.cmake -+ INSTALL_DESTINATION share/unofficial-nethost -+) -+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unofficial-nethost-config.cmake -+ DESTINATION share/unofficial-nethost -+) -+ -+install(EXPORT unofficial-nethost-targets ++install(EXPORT unofficial-nethost-config + DESTINATION share/unofficial-nethost -+ FILE unofficial-nethost-targets.cmake ++ FILE unofficial-nethost-config.cmake + NAMESPACE unofficial::nethost:: +) diff --git a/ports/nethost/portfile.cmake b/ports/nethost/portfile.cmake index eda99686e7b142..3c4129e978d751 100644 --- a/ports/nethost/portfile.cmake +++ b/ports/nethost/portfile.cmake @@ -40,11 +40,10 @@ endif() set(BASE_RID "${RID_PLAT}-${RID_ARCH}") -set(NETHOST_SOURCE_PATH ${SOURCE_PATH}/src/native/corehost/nethost/) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/unofficial-nethost-config.cmake.in DESTINATION ${NETHOST_SOURCE_PATH}) +set(NETHOST_SOURCE_PATH "${SOURCE_PATH}/src/native/corehost/nethost/") vcpkg_cmake_configure( - SOURCE_PATH ${NETHOST_SOURCE_PATH} + SOURCE_PATH "${NETHOST_SOURCE_PATH}" # vcpkg's /utf-8 is incompatible with dotnet's own /source-charset:utf-8 NO_CHARSET_FLAG OPTIONS @@ -65,7 +64,7 @@ vcpkg_copy_pdbs() vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-nethost) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") -file(INSTALL ${SOURCE_PATH}/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) -file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +file(INSTALL "${SOURCE_PATH}/LICENSE.TXT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/nethost/unofficial-nethost-config.cmake.in b/ports/nethost/unofficial-nethost-config.cmake.in deleted file mode 100644 index eccfc3f3e20f31..00000000000000 --- a/ports/nethost/unofficial-nethost-config.cmake.in +++ /dev/null @@ -1,2 +0,0 @@ -@PACKAGE_INIT@ -include("${CMAKE_CURRENT_LIST_DIR}/unofficial-nethost-targets.cmake") \ No newline at end of file From 9c647354e27dff6fa9634dd576944471dd630451 Mon Sep 17 00:00:00 2001 From: lanyi Date: Wed, 1 Jun 2022 11:36:59 +0200 Subject: [PATCH 08/11] bump nethost version --- versions/baseline.json | 4 ++-- versions/n-/nethost.json | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/versions/baseline.json b/versions/baseline.json index 6e5b8c60c3df67..263b92c7717dcb 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4833,8 +4833,8 @@ "port-version": 3 }, "nethost": { - "baseline": "2022-05-30", - "port-version": 3 + "baseline": "6.0.5", + "port-version": 0 }, "nettle": { "baseline": "3.7.3", diff --git a/versions/n-/nethost.json b/versions/n-/nethost.json index 0181e8cdef56e8..0bda3ebc05032e 100644 --- a/versions/n-/nethost.json +++ b/versions/n-/nethost.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "e67b10bd3465a67082a70b35b822052086f14a2d", + "version": "6.0.5", + "port-version": 0 + }, { "git-tree": "5b1a7d98ce2c1520bbb370dfc2fcb8c3d704c300", "version-date": "2019-12-21", From 45fe29b04a8d0882c104eb84476be67540f73959 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Wed, 1 Jun 2022 19:24:45 +0000 Subject: [PATCH 09/11] [nethost] Only build one flavor --- ports/nethost/0001-nethost-cmakelists.patch | 36 +++++++++------------ ports/nethost/portfile.cmake | 15 ++++++--- ports/nethost/usage | 4 +-- versions/n-/nethost.json | 2 +- 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/ports/nethost/0001-nethost-cmakelists.patch b/ports/nethost/0001-nethost-cmakelists.patch index 8a2be4efd58d20..4afe608829f438 100644 --- a/ports/nethost/0001-nethost-cmakelists.patch +++ b/ports/nethost/0001-nethost-cmakelists.patch @@ -17,17 +17,25 @@ index a9f44e720..7149ea6c6 100644 include_directories(../fxr) # CMake does not recommend using globbing since it messes with the freshness checks -@@ -20,7 +23,9 @@ if(CLR_CMAKE_TARGET_WIN32) +@@ -19,8 +22,17 @@ if(CLR_CMAKE_TARGET_WIN32) + Exports.def) endif() ++if(BUILD_SHARED_LIBS) include(../lib.cmake) -+ ++set(targets nethost) ++else() include(../lib_static.cmake) -+target_compile_definitions(libnethost PUBLIC NETHOST_USE_AS_STATIC) ++add_library(nethost INTERFACE) ++target_link_libraries(nethost INTERFACE libnethost) ++set(targets libnethost nethost) ++target_include_directories(libnethost INTERFACE $) ++endif() ++target_include_directories(nethost INTERFACE $) add_definitions(-DFEATURE_LIBHOST=1) add_definitions(-DNETHOST_EXPORT) -@@ -33,14 +38,29 @@ if (WIN32) +@@ -33,14 +45,16 @@ if (WIN32) ) endif(WIN32) @@ -39,25 +47,13 @@ index a9f44e720..7149ea6c6 100644 -# Only Windows creates a symbols file for static libs. -if (WIN32) - install_with_stripped_symbols(libnethost TARGETS corehost) -+set(NETHOST_HEADERS nethost.h ../coreclr_delegates.h ../hostfxr.h) -+install(FILES ${NETHOST_HEADERS} DESTINATION include) -+# Original src/native/corehost/nethost/CMakeLists.txt uses install_with_stripped_symbols() to install -+# targets with symbols. However, on Windows symbols will be put into PDB -+# folder which doesn't seem to be recognizable by vcpkg functions. -+# Furthermore, install_with_stripped_symbols() may install files instead of -+# targets. -+# For these reason, they are replaced with a plain install(). -+if (BUILD_SHARED_LIBS) -+ set(NETHOST_ACTIVE_TARGET nethost) - else() +-else() - install(TARGETS libnethost DESTINATION corehost) -endif(WIN32) \ No newline at end of file -+ set(NETHOST_ACTIVE_TARGET libnethost) -+endif(BUILD_SHARED_LIBS) -+ -+target_include_directories(${NETHOST_ACTIVE_TARGET} INTERFACE $) -+install(TARGETS ${NETHOST_ACTIVE_TARGET} EXPORT unofficial-nethost-config ++set(NETHOST_HEADERS nethost.h ../coreclr_delegates.h ../hostfxr.h) ++install(FILES ${NETHOST_HEADERS} DESTINATION include) ++install(TARGETS ${targets} EXPORT unofficial-nethost-config + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin diff --git a/ports/nethost/portfile.cmake b/ports/nethost/portfile.cmake index 3c4129e978d751..79c4ed49f3f426 100644 --- a/ports/nethost/portfile.cmake +++ b/ports/nethost/portfile.cmake @@ -40,10 +40,8 @@ endif() set(BASE_RID "${RID_PLAT}-${RID_ARCH}") -set(NETHOST_SOURCE_PATH "${SOURCE_PATH}/src/native/corehost/nethost/") - vcpkg_cmake_configure( - SOURCE_PATH "${NETHOST_SOURCE_PATH}" + SOURCE_PATH "${SOURCE_PATH}/src/native/corehost/nethost/" # vcpkg's /utf-8 is incompatible with dotnet's own /source-charset:utf-8 NO_CHARSET_FLAG OPTIONS @@ -54,8 +52,11 @@ vcpkg_cmake_configure( "-DCLI_CMAKE_COMMON_HOST_VER:STRING=${PRODUCT_VERSION}" "-DCLI_CMAKE_PKG_RID:STRING=${BASE_RID}" "-DCLI_CMAKE_COMMIT_HASH:STRING=${COMMIT_HASH}" - "-DCLI_CMAKE_PLATFORM_ARCH_${ARCH_NAME}=1" + "-DCLR_CMAKE_TARGET_ARCH_${ARCH_NAME}=1" + "-DCLR_CMAKE_TARGET_ARCH=${RID_ARCH}" "-DCLR_CMAKE_HOST_ARCH=${RID_ARCH}" + MAYBE_UNUSED_VARIABLES + SKIP_VERSIONING # only used on WIN32 ) vcpkg_cmake_install() @@ -66,5 +67,11 @@ vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-nethost) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/nethost.h" "#ifdef NETHOST_USE_AS_STATIC" "#if 1") +else() + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/nethost.h" "#ifdef NETHOST_USE_AS_STATIC" "#if 0") +endif() + file(INSTALL "${SOURCE_PATH}/LICENSE.TXT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/nethost/usage b/ports/nethost/usage index 2834021b255245..26a41d92f21202 100644 --- a/ports/nethost/usage +++ b/ports/nethost/usage @@ -1,6 +1,4 @@ The package nethost can be used via CMake: find_package(unofficial-nethost CONFIG REQUIRED) - target_link_libraries(main PRIVATE $,unofficial::nethost::nethost,unofficial::nethost::libnethost>) - # unofficial::nethost::nethost is the shared library target - # unofficial::nethost::libnethost is the static libray target availaible in static triplets + target_link_libraries(main PRIVATE unofficial::nethost::nethost) diff --git a/versions/n-/nethost.json b/versions/n-/nethost.json index 0bda3ebc05032e..f16c1c7918aeab 100644 --- a/versions/n-/nethost.json +++ b/versions/n-/nethost.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "e67b10bd3465a67082a70b35b822052086f14a2d", + "git-tree": "0976c2b73111ab7bcaf065128b2ef23fde3e2490", "version": "6.0.5", "port-version": 0 }, From 8a572378b0bd6e436716ca97cab49a88835aee65 Mon Sep 17 00:00:00 2001 From: lanyi Date: Thu, 2 Jun 2022 00:20:58 +0200 Subject: [PATCH 10/11] fix build error --- ports/nethost/0001-nethost-cmakelists.patch | 31 +++++++++++++-------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/ports/nethost/0001-nethost-cmakelists.patch b/ports/nethost/0001-nethost-cmakelists.patch index 4afe608829f438..c45f3b4749e75a 100644 --- a/ports/nethost/0001-nethost-cmakelists.patch +++ b/ports/nethost/0001-nethost-cmakelists.patch @@ -1,5 +1,5 @@ diff --git a/src/native/corehost/nethost/CMakeLists.txt b/src/native/corehost/nethost/CMakeLists.txt -index a9f44e720..7149ea6c6 100644 +index a9f44e720..0f24d4458 100644 --- a/src/native/corehost/nethost/CMakeLists.txt +++ b/src/native/corehost/nethost/CMakeLists.txt @@ -1,11 +1,14 @@ @@ -17,7 +17,7 @@ index a9f44e720..7149ea6c6 100644 include_directories(../fxr) # CMake does not recommend using globbing since it messes with the freshness checks -@@ -19,8 +22,17 @@ if(CLR_CMAKE_TARGET_WIN32) +@@ -19,12 +22,23 @@ if(CLR_CMAKE_TARGET_WIN32) Exports.def) endif() @@ -25,6 +25,7 @@ index a9f44e720..7149ea6c6 100644 include(../lib.cmake) +set(targets nethost) +else() ++include(../hostmisc/hostmisc.cmake) include(../lib_static.cmake) +add_library(nethost INTERFACE) +target_link_libraries(nethost INTERFACE libnethost) @@ -35,22 +36,21 @@ index a9f44e720..7149ea6c6 100644 add_definitions(-DFEATURE_LIBHOST=1) add_definitions(-DNETHOST_EXPORT) -@@ -33,14 +45,16 @@ if (WIN32) + ++if(NOT BUILD_SHARED_LIBS) + # Copy static lib PDB to the project output directory + if (WIN32) + set_target_properties(libnethost PROPERTIES +@@ -32,15 +46,18 @@ if (WIN32) + COMPILE_PDB_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}" ) endif(WIN32) ++endif() -install(FILES ../coreclr_delegates.h DESTINATION corehost) -install(FILES ../hostfxr.h DESTINATION corehost) -install(FILES nethost.h DESTINATION corehost) -install_with_stripped_symbols(nethost TARGETS corehost) -- --# Only Windows creates a symbols file for static libs. --if (WIN32) -- install_with_stripped_symbols(libnethost TARGETS corehost) --else() -- install(TARGETS libnethost DESTINATION corehost) --endif(WIN32) -\ No newline at end of file +set(NETHOST_HEADERS nethost.h ../coreclr_delegates.h ../hostfxr.h) +install(FILES ${NETHOST_HEADERS} DESTINATION include) +install(TARGETS ${targets} EXPORT unofficial-nethost-config @@ -58,7 +58,14 @@ index a9f44e720..7149ea6c6 100644 + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin +) -+ + +-# Only Windows creates a symbols file for static libs. +-if (WIN32) +- install_with_stripped_symbols(libnethost TARGETS corehost) +-else() +- install(TARGETS libnethost DESTINATION corehost) +-endif(WIN32) +\ No newline at end of file +install(EXPORT unofficial-nethost-config + DESTINATION share/unofficial-nethost + FILE unofficial-nethost-config.cmake From b10091923472df71ad787fc09c62e793dffc4c88 Mon Sep 17 00:00:00 2001 From: lanyi Date: Thu, 2 Jun 2022 00:50:02 +0200 Subject: [PATCH 11/11] bump nethost version --- versions/n-/nethost.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/n-/nethost.json b/versions/n-/nethost.json index f16c1c7918aeab..979f1d08540bc1 100644 --- a/versions/n-/nethost.json +++ b/versions/n-/nethost.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "0976c2b73111ab7bcaf065128b2ef23fde3e2490", + "git-tree": "267a7f140709e65c5d692a7f3add885021764c25", "version": "6.0.5", "port-version": 0 },