[yasm-tool] Migrate to Host Dependencies (#16478)

* [yasm-tool] Fix usage of port to be host dependencies

This allows mpg123, nettle, and gmp to support non-x86 windows manifest mode

* fix gmp

* oops

* versions update
This commit is contained in:
nicole mazzuca 2021-05-21 11:56:32 -07:00 committed by GitHub
parent 2f9972005f
commit 49b67d9cb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 113 additions and 94 deletions

View File

@ -9,13 +9,12 @@ if(VCPKG_TARGET_IS_WINDOWS)
REF 0018c44e8dfcc3b64b43e0aea4b3f419f0b65fd0 #v6.2.1-2
SHA512 2405e2536ca9fe0b890f44f54c936ac0e4b5a9ebe6a19e1c48a9c21b7211d2a1b45865852e3c65a98a6735216a4e27bea75c0fd6e52efeed4baecd95da9895a5
HEAD_REF master
PATCHES
PATCHES
vs.build.patch
runtime.patch
adddef.patch
adddef.patch
)
include(${CURRENT_INSTALLED_DIR}/share/yasm-tool-helper/yasm-tool-helper.cmake)
yasm_tool_helper(OUT_VAR YASM)
file(TO_NATIVE_PATH "${YASM}" YASM)
@ -42,12 +41,11 @@ if(VCPKG_TARGET_IS_WINDOWS)
set(_file "${_porjectfile}")
file(READ "${_file}" _contents)
string(REPLACE [[<Import Project="$(VCTargetsPath)\BuildCustomizations\yasm.props" />]]
"<Import Project=\"${CURRENT_INSTALLED_DIR}/share/vs-yasm/yasm.props\" />"
"<Import Project=\"${CURRENT_HOST_INSTALLED_DIR}/share/vs-yasm/yasm.props\" />"
_contents "${_contents}")
string(REPLACE [[<Import Project="$(VCTargetsPath)\BuildCustomizations\yasm.targets" />]]
"<Import Project=\"${CURRENT_INSTALLED_DIR}/share/vs-yasm/yasm.targets\" />"
"<Import Project=\"${CURRENT_HOST_INSTALLED_DIR}/share/vs-yasm/yasm.targets\" />"
_contents "${_contents}")
string(REGEX REPLACE "${VCPKG_ROOT_DIR}/installed/[^/]+/share" "${CURRENT_INSTALLED_DIR}/share" _contents "${_contents}") # Above already replaced by another triplet
file(WRITE "${_file}" "${_contents}")
vcpkg_install_msbuild(

View File

@ -1,7 +1,7 @@
{
"name": "gmp",
"version-string": "6.2.1",
"port-version": 5,
"port-version": 6,
"description": "The GNU Multiple Precision Arithmetic Library",
"homepage": "https://gmplib.org",
"supports": "!(windows & (arm | arm64))",
@ -15,11 +15,6 @@
"name": "yasm-tool",
"host": true,
"platform": "windows"
},
{
"name": "yasm-tool-helper",
"host": true,
"platform": "windows"
}
]
}

View File

@ -1,2 +1,5 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
configure_file(${CMAKE_CURRENT_LIST_DIR}/yasm-tool-helper.cmake ${CURRENT_PACKAGES_DIR}/share/yasm-tool-helper/yasm-tool-helper.cmake COPYONLY)
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
configure_file(
"${CMAKE_CURRENT_LIST_DIR}/yasm-tool-helper.cmake.in"
"${CURRENT_PACKAGES_DIR}/share/${PORT}/yasm-tool-helper.cmake"
@ONLY)

View File

@ -1,12 +1,12 @@
{
"name": "yasm-tool-helper",
"version-string": "2020-10-12",
"description": "This port provides helper functions for ports needing to consume YASM",
"version-string": "2020-03-11",
"description": "Backfill that depends on yasm-tool:host",
"homepage": "https://github.com/Microsoft/vcpkg",
"dependencies": [
{
"name": "yasm-tool",
"platform": "x86 & windows"
"host": true
}
]
}

View File

@ -1,34 +0,0 @@
function(yasm_tool_helper)
cmake_parse_arguments(PARSE_ARGV 0 a
"APPEND_TO_PATH;PREPEND_TO_PATH"
"OUT_VAR"
""
)
if(CMAKE_HOST_WIN32)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_UWP)
# Native compilation
set(YASM "${CURRENT_INSTALLED_DIR}/tools/yasm-tool/yasm.exe")
else()
# Cross compilation
get_filename_component(YASM "${CURRENT_INSTALLED_DIR}/../x86-windows/tools/yasm-tool/yasm.exe" ABSOLUTE)
if(NOT EXISTS "${YASM}")
message(FATAL_ERROR "Cross-targetting and x64 ports requiring yasm require the x86-windows yasm-tool to be available. Please install yasm-tool:x86-windows first.")
endif()
endif()
else()
vcpkg_find_acquire_program(YASM)
endif()
if(a_APPEND_TO_PATH)
get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY)
vcpkg_add_to_path("${YASM_EXE_PATH}")
endif()
if(a_PREPEND_TO_PATH)
get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY)
vcpkg_add_to_path(PREPEND "${YASM_EXE_PATH}")
endif()
if(a_OUT_VAR)
set(${a_OUT_VAR} "${YASM}" PARENT_SCOPE)
endif()
endfunction()

View File

@ -0,0 +1 @@
include("${CMAKE_CURRENT_LIST_DIR}/../../../@HOST_TRIPLET@/share/yasm-tool/vcpkg-port-config.cmake")

View File

@ -1,37 +1,47 @@
vcpkg_fail_port_install(MESSAGE "The yasm-tool port is only intended to be built for x86 Windows" ON_TARGET "Linux" "OSX" ON_ARCH "x64" "arm")
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
set(VCPKG_LIBRARY_LINKAGE static)
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
vcpkg_add_to_path("${PYTHON3_DIR}")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO yasm/yasm
REF 009450c7ad4d425fa5a10ac4bd6efbd25248d823 # 7.0.3 plus bugfixes for https://github.com/yasm/yasm/issues/153
SHA512 a542577558676d11b52981925ea6219bffe699faa1682c033b33b7534f5a0dfe9f29c56b32076b68c48f65e0aef7c451be3a3af804c52caa4d4357de4caad83c
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DENABLE_NLS=OFF
-DYASM_BUILD_TESTS=OFF
)
vcpkg_install_cmake()
vcpkg_copy_tools(TOOL_NAMES yasm)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include")
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
foreach(LICENSE Artistic.txt BSD.txt GNU_GPL-2.0 GNU_LGPL-2.0)
file(COPY "${SOURCE_PATH}/${LICENSE}" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
endforeach()
vcpkg_fail_port_install(ON_TARGET "uwp")
if(VCPKG_TARGET_IS_WINDOWS)
set(YASM_BUILD_BINARY ON)
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
set(VCPKG_LIBRARY_LINKAGE static)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO yasm/yasm
REF 009450c7ad4d425fa5a10ac4bd6efbd25248d823 # 1.3.0 plus bugfixes for https://github.com/yasm/yasm/issues/153
SHA512 a542577558676d11b52981925ea6219bffe699faa1682c033b33b7534f5a0dfe9f29c56b32076b68c48f65e0aef7c451be3a3af804c52caa4d4357de4caad83c
)
file(INSTALL "${SOURCE_PATH}/COPYING"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
RENAME copyright)
foreach(LICENSE Artistic.txt BSD.txt GNU_GPL-2.0 GNU_LGPL-2.0)
file(COPY "${SOURCE_PATH}/${LICENSE}" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
endforeach()
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
vcpkg_add_to_path("${PYTHON3_DIR}")
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DENABLE_NLS=OFF
-DYASM_BUILD_TESTS=OFF
)
vcpkg_install_cmake()
vcpkg_copy_tools(TOOL_NAMES yasm)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include")
else()
set(YASM_BUILD_BINARY OFF)
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
endif()
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake.in"
"${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-port-config.cmake" @ONLY)

View File

@ -0,0 +1,31 @@
set(Z_YASM_TOOL_HELPER_LIST_DIR "${CMAKE_CURRENT_LIST_DIR}")
function(yasm_tool_helper)
cmake_parse_arguments(PARSE_ARGV 0 arg
"APPEND_TO_PATH;PREPEND_TO_PATH"
"OUT_VAR"
""
)
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unexpected arguments to yasm_tool_helper: ${arg_UNPARSED_ARGUMENTS}")
endif()
if(@YASM_BUILD_BINARY@)
set(YASM "${Z_YASM_TOOL_HELPER_LIST_DIR}/../../tools/yasm-tool/yasm.exe")
else()
vcpkg_find_acquire_program(YASM)
endif()
if(arg_APPEND_TO_PATH)
get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY)
vcpkg_add_to_path("${YASM_EXE_PATH}")
endif()
if(arg_PREPEND_TO_PATH)
get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY)
vcpkg_add_to_path(PREPEND "${YASM_EXE_PATH}")
endif()
if(DEFINED arg_OUT_VAR)
set("${arg_OUT_VAR}" "${YASM}" PARENT_SCOPE)
endif()
endfunction()

View File

@ -1,7 +1,7 @@
{
"name": "yasm-tool",
"version-string": "2020-10-12",
"description": "A modular assembler. This port is intended to build other ports and should not be used directly.",
"version": "1.3.0",
"description": "A modular assembler.",
"homepage": "http://yasm.tortall.net/",
"supports": "windows & x86"
"supports": "native & !uwp"
}

View File

@ -2326,7 +2326,7 @@
},
"gmp": {
"baseline": "6.2.1",
"port-version": 5
"port-version": 6
},
"google-cloud-cpp": {
"baseline": "1.27.0",
@ -6625,11 +6625,11 @@
"port-version": 0
},
"yasm-tool": {
"baseline": "2020-10-12",
"baseline": "1.3.0",
"port-version": 0
},
"yasm-tool-helper": {
"baseline": "2020-10-12",
"baseline": "2020-03-11",
"port-version": 0
},
"yato": {

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "645878e32f8ab4e926f605107c761433515a17dd",
"version-string": "6.2.1",
"port-version": 6
},
{
"git-tree": "90eb02f55e96530420b8e83209651a9b91b7b002",
"version-string": "6.2.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "7d0e3b2224338888cd1e2f7a00c182961a7ea760",
"version-string": "2020-03-11",
"port-version": 0
},
{
"git-tree": "cd72a3cb256fdf68ad6b78a64613744ca2bc1d1f",
"version-string": "2020-10-12",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "cb913a26c18cde98be038655f65d2363ecee2cc1",
"version": "1.3.0",
"port-version": 0
},
{
"git-tree": "40cca1c50553ac0d87c91af9c0125d8f3e6e8a09",
"version-string": "2020-10-12",