aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanner Gooding <tagoo@outlook.com>2020-01-06 13:14:20 -0800
committerdan-shaw <51385773+dan-shaw@users.noreply.github.com>2020-01-06 13:14:20 -0800
commitfb2006edf9b2b7338263abc629d59441b5da32d1 (patch)
tree7765cde3322dc1b6829193978b5d388ff84f4a46
parent38260a7936a1ec1c02c80fb8a593b7b5d6f199ff (diff)
downloadvcpkg-fb2006edf9b2b7338263abc629d59441b5da32d1.tar.gz
vcpkg-fb2006edf9b2b7338263abc629d59441b5da32d1.zip
[nethost] Adding a port for nethost (#8701)
* Adding a port for nethost * Fixing ref, removing unneeded include, and marking unsupported architectures for nethost * Fixing the expected sha512 for nethost * Setting nethost to fail on static and uwp * Removing an unecessary file(REMOVE_RECURSE) from nethost * update baseline * [nethost] Update to latest from dotnet/runtime * [vcpkg-baseline] Update baseline for nethost * [vcpkg-baseline] Update baseline for nethost Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
-rw-r--r--ports/nethost/0001-nethost-cmakelists.patch58
-rw-r--r--ports/nethost/0002-settings-cmake.patch13
-rw-r--r--ports/nethost/CONTROL4
-rw-r--r--ports/nethost/portfile.cmake68
-rw-r--r--ports/nethost/usage6
-rw-r--r--scripts/ci.baseline.txt2
6 files changed, 151 insertions, 0 deletions
diff --git a/ports/nethost/0001-nethost-cmakelists.patch b/ports/nethost/0001-nethost-cmakelists.patch
new file mode 100644
index 000000000..93d49b95e
--- /dev/null
+++ b/ports/nethost/0001-nethost-cmakelists.patch
@@ -0,0 +1,58 @@
+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($<$<CONFIG:RelWithDebInfo>:/MT>)
+- add_compile_options($<$<CONFIG:Release>:/MT>)
+- add_compile_options($<$<CONFIG:Debug>:/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 @@
+ # 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)
+ project(nethost)
+
+ set(DOTNET_PROJECT_NAME "nethost")
+
+ # Include directories
++include(../../../settings.cmake)
++include(../../../functions.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)
+ endif()
+
++if(BUILD_SHARED_LIBS)
+ include(../lib.cmake)
++else()
+ include(../lib_static.cmake)
++endif()
+
+ add_definitions(-DFEATURE_LIBHOST=1)
+ add_definitions(-DNETHOST_EXPORT)
+
+-install(FILES nethost.h DESTINATION corehost)
+-install(TARGETS nethost DESTINATION corehost)
+-install(TARGETS libnethost DESTINATION corehost)
+-install_symbols(nethost corehost)
+\ 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)
++endif()
diff --git a/ports/nethost/0002-settings-cmake.patch b/ports/nethost/0002-settings-cmake.patch
new file mode 100644
index 000000000..7143b942a
--- /dev/null
+++ b/ports/nethost/0002-settings-cmake.patch
@@ -0,0 +1,13 @@
+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}/$<CONFIG>/${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/CONTROL b/ports/nethost/CONTROL
new file mode 100644
index 000000000..f1e97e1d0
--- /dev/null
+++ b/ports/nethost/CONTROL
@@ -0,0 +1,4 @@
+Source: nethost
+Version: 2019-12-21
+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
diff --git a/ports/nethost/portfile.cmake b/ports/nethost/portfile.cmake
new file mode 100644
index 000000000..3809d9872
--- /dev/null
+++ b/ports/nethost/portfile.cmake
@@ -0,0 +1,68 @@
+vcpkg_fail_port_install(ON_TARGET "uwp")
+
+set(COMMIT_HASH 188427d7e18102c45fc6d0e20c135e226f215992)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO dotnet/runtime
+ REF ${COMMIT_HASH}
+ SHA512 5a93c66c87e2113f733702d938efd39456c99fb74b383097b8d877df21536fcbcba901606aa70db6c8f1a16421ea8f06822c5b0ab1d882631b6daecbed8d03cc
+ HEAD_REF master
+ PATCHES
+ 0001-nethost-cmakelists.patch
+ 0002-settings-cmake.patch
+)
+
+set(PRODUCT_VERSION "5.0.0")
+
+if(VCPKG_TARGET_IS_WINDOWS)
+ set(RID_PLAT "win")
+elseif(VCPKG_TARGET_IS_OSX)
+ set(RID_PLAT "osx")
+elseif(VCPKG_TARGET_IS_LINUX)
+ set(RID_PLAT "linux")
+else()
+ message(FATAL_ERROR "Unsupported platform")
+endif()
+
+if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
+ set(RID_ARCH "x86")
+ set(ARCH_NAME "I386")
+elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
+ set(RID_ARCH "x64")
+ set(ARCH_NAME "AMD64")
+elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
+ set(RID_ARCH "arm")
+ set(ARCH_NAME "ARM")
+elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
+ set(RID_ARCH "arm64")
+ set(ARCH_NAME "ARM64")
+else()
+ message(FATAL_ERROR "Unsupported architecture")
+endif()
+
+set(BASE_RID "${RID_PLAT}-${RID_ARCH}")
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}/src/installer/corehost/cli/nethost
+ PREFER_NINJA
+ OPTIONS
+ "-DSKIP_VERSIONING=1"
+ "-DCLI_CMAKE_HOST_POLICY_VER:STRING=${PRODUCT_VERSION}"
+ "-DCLI_CMAKE_HOST_FXR_VER:STRING=${PRODUCT_VERSION}"
+ "-DCLI_CMAKE_HOST_VER:STRING=${PRODUCT_VERSION}"
+ "-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"
+ "-DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=10.0"
+)
+
+vcpkg_install_cmake()
+
+vcpkg_copy_pdbs()
+
+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})
diff --git a/ports/nethost/usage b/ports/nethost/usage
new file mode 100644
index 000000000..6e6d860d1
--- /dev/null
+++ b/ports/nethost/usage
@@ -0,0 +1,6 @@
+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})
diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt
index 9aa7f493a..f27711839 100644
--- a/scripts/ci.baseline.txt
+++ b/scripts/ci.baseline.txt
@@ -1097,6 +1097,8 @@ nanovg:x86-windows=ignore
nativefiledialog:arm-uwp=fail
nativefiledialog:x64-uwp=fail
netcdf-cxx4:x64-linux=ignore
+nethost:x64-uwp=fail
+nethost:arm-uwp=fail
networkdirect-sdk:arm64-windows=fail
networkdirect-sdk:arm-uwp=fail
networkdirect-sdk:x64-linux=fail