From 49b67d9cb856424ff69f10e7721aec5299624268 Mon Sep 17 00:00:00 2001 From: nicole mazzuca Date: Fri, 21 May 2021 11:56:32 -0700 Subject: [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 --- ports/gmp/portfile.cmake | 10 ++- ports/gmp/vcpkg.json | 7 +- ports/yasm-tool-helper/portfile.cmake | 7 +- ports/yasm-tool-helper/vcpkg.json | 6 +- ports/yasm-tool-helper/yasm-tool-helper.cmake | 34 ---------- ports/yasm-tool-helper/yasm-tool-helper.cmake.in | 1 + ports/yasm-tool/portfile.cmake | 84 +++++++++++++----------- ports/yasm-tool/vcpkg-port-config.cmake.in | 31 +++++++++ ports/yasm-tool/vcpkg.json | 6 +- versions/baseline.json | 6 +- versions/g-/gmp.json | 5 ++ versions/y-/yasm-tool-helper.json | 5 ++ versions/y-/yasm-tool.json | 5 ++ 13 files changed, 113 insertions(+), 94 deletions(-) delete mode 100644 ports/yasm-tool-helper/yasm-tool-helper.cmake create mode 100644 ports/yasm-tool-helper/yasm-tool-helper.cmake.in create mode 100644 ports/yasm-tool/vcpkg-port-config.cmake.in diff --git a/ports/gmp/portfile.cmake b/ports/gmp/portfile.cmake index 7c04c680f..5356098f4 100644 --- a/ports/gmp/portfile.cmake +++ b/ports/gmp/portfile.cmake @@ -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 [[]] - "" + "" _contents "${_contents}") string(REPLACE [[]] - "" + "" _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( diff --git a/ports/gmp/vcpkg.json b/ports/gmp/vcpkg.json index 93a6303a9..3f9b609b3 100644 --- a/ports/gmp/vcpkg.json +++ b/ports/gmp/vcpkg.json @@ -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" } ] } diff --git a/ports/yasm-tool-helper/portfile.cmake b/ports/yasm-tool-helper/portfile.cmake index 072b7894f..91f4fc738 100644 --- a/ports/yasm-tool-helper/portfile.cmake +++ b/ports/yasm-tool-helper/portfile.cmake @@ -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) diff --git a/ports/yasm-tool-helper/vcpkg.json b/ports/yasm-tool-helper/vcpkg.json index b37b33c22..72e1fba3b 100644 --- a/ports/yasm-tool-helper/vcpkg.json +++ b/ports/yasm-tool-helper/vcpkg.json @@ -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 } ] } diff --git a/ports/yasm-tool-helper/yasm-tool-helper.cmake b/ports/yasm-tool-helper/yasm-tool-helper.cmake deleted file mode 100644 index 24c44c9d0..000000000 --- a/ports/yasm-tool-helper/yasm-tool-helper.cmake +++ /dev/null @@ -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() diff --git a/ports/yasm-tool-helper/yasm-tool-helper.cmake.in b/ports/yasm-tool-helper/yasm-tool-helper.cmake.in new file mode 100644 index 000000000..48bd805f3 --- /dev/null +++ b/ports/yasm-tool-helper/yasm-tool-helper.cmake.in @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/../../../@HOST_TRIPLET@/share/yasm-tool/vcpkg-port-config.cmake") diff --git a/ports/yasm-tool/portfile.cmake b/ports/yasm-tool/portfile.cmake index a417f105c..d4949bc9c 100644 --- a/ports/yasm-tool/portfile.cmake +++ b/ports/yasm-tool/portfile.cmake @@ -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) diff --git a/ports/yasm-tool/vcpkg-port-config.cmake.in b/ports/yasm-tool/vcpkg-port-config.cmake.in new file mode 100644 index 000000000..5abe7520a --- /dev/null +++ b/ports/yasm-tool/vcpkg-port-config.cmake.in @@ -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() diff --git a/ports/yasm-tool/vcpkg.json b/ports/yasm-tool/vcpkg.json index 20e37b570..a3552faaa 100644 --- a/ports/yasm-tool/vcpkg.json +++ b/ports/yasm-tool/vcpkg.json @@ -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" } diff --git a/versions/baseline.json b/versions/baseline.json index 3123d2253..b787b58a0 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -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": { diff --git a/versions/g-/gmp.json b/versions/g-/gmp.json index dcbc75ee8..3b9358d4d 100644 --- a/versions/g-/gmp.json +++ b/versions/g-/gmp.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "645878e32f8ab4e926f605107c761433515a17dd", + "version-string": "6.2.1", + "port-version": 6 + }, { "git-tree": "90eb02f55e96530420b8e83209651a9b91b7b002", "version-string": "6.2.1", diff --git a/versions/y-/yasm-tool-helper.json b/versions/y-/yasm-tool-helper.json index 9c3fb6af8..606a5eee5 100644 --- a/versions/y-/yasm-tool-helper.json +++ b/versions/y-/yasm-tool-helper.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "7d0e3b2224338888cd1e2f7a00c182961a7ea760", + "version-string": "2020-03-11", + "port-version": 0 + }, { "git-tree": "cd72a3cb256fdf68ad6b78a64613744ca2bc1d1f", "version-string": "2020-10-12", diff --git a/versions/y-/yasm-tool.json b/versions/y-/yasm-tool.json index e71e3e578..3ae9fc640 100644 --- a/versions/y-/yasm-tool.json +++ b/versions/y-/yasm-tool.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "cb913a26c18cde98be038655f65d2363ecee2cc1", + "version": "1.3.0", + "port-version": 0 + }, { "git-tree": "40cca1c50553ac0d87c91af9c0125d8f3e6e8a09", "version-string": "2020-10-12", -- cgit v1.2.3