From 86ec91b6ee56ab59a03d966fc3e38e74f4382874 Mon Sep 17 00:00:00 2001 From: Lily <47812810+wangli28@users.noreply.github.com> Date: Wed, 14 Aug 2019 05:12:28 +0800 Subject: [PATCH] [yasm] Add new port (#7478) * [yasm] Add new port * [yasm] Add new port * Remove patch; Use port var; use vcpkg_add_to_path --- ports/yasm/CONTROL | 4 +++ ports/yasm/portfile.cmake | 51 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 ports/yasm/CONTROL create mode 100644 ports/yasm/portfile.cmake diff --git a/ports/yasm/CONTROL b/ports/yasm/CONTROL new file mode 100644 index 0000000000..5cb3492708 --- /dev/null +++ b/ports/yasm/CONTROL @@ -0,0 +1,4 @@ +Source: yasm +Version: 1.3.0 +Homepage: https://github.com/yasm/yasm +Description: Yasm is a complete rewrite of the NASM assembler under the “new” BSD License. diff --git a/ports/yasm/portfile.cmake b/ports/yasm/portfile.cmake new file mode 100644 index 0000000000..5dfe2a51cf --- /dev/null +++ b/ports/yasm/portfile.cmake @@ -0,0 +1,51 @@ +include(vcpkg_common_functions) + +if (NOT VCPKG_TARGET_IS_WINDOWS) + message(FATAL_ERROR "${PORT} only supports windows") +elseif (TRIPLET_SYSTEM_ARCH MATCHES "arm") + message(FATAL_ERROR "ARM is currently not supported.") +elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore) + message(FATAL_ERROR "Error: UWP builds are currently not supported.") +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO yasm/yasm + REF v1.3.0 + SHA512 f5053e2012e0d2ce88cc1cc06e3bdb501054aed5d1f78fae40bb3e676fe2eb9843d335a612d7614d99a2b9e49dca998d57f61b0b89fac8225afa4ae60ae848f1 + HEAD_REF master +) + +vcpkg_find_acquire_program(PYTHON2) +get_filename_component(PYTHON_PATH ${PYTHON2} DIRECTORY) +vcpkg_add_to_path("${PYTHON_PATH}") + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() + +file(REMOVE + ${CURRENT_PACKAGES_DIR}/debug/bin/vsyasm.exe + ${CURRENT_PACKAGES_DIR}/debug/bin/yasm.exe + ${CURRENT_PACKAGES_DIR}/debug/bin/ytasm.exe +) + +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/${PORT}) +file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vsyasm.exe ${CURRENT_PACKAGES_DIR}/tools/${PORT}/vsyasm.exe) +file(RENAME ${CURRENT_PACKAGES_DIR}/bin/yasm.exe ${CURRENT_PACKAGES_DIR}/tools/${PORT}/yasm.exe) +file(RENAME ${CURRENT_PACKAGES_DIR}/bin/ytasm.exe ${CURRENT_PACKAGES_DIR}/tools/${PORT}/ytasm.exe) + +vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT}) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(COPY ${SOURCE_PATH}/COPYING ${SOURCE_PATH}/README DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/COPYING ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) \ No newline at end of file