[yasm] Add new port (#7478)

* [yasm] Add new port

* [yasm] Add new port

* Remove patch; Use port var; use vcpkg_add_to_path
This commit is contained in:
Lily 2019-08-14 05:12:28 +08:00 committed by Griffin Downs
parent 1516bfddf7
commit 86ec91b6ee
2 changed files with 55 additions and 0 deletions

4
ports/yasm/CONTROL Normal file
View File

@ -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.

51
ports/yasm/portfile.cmake Normal file
View File

@ -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)