Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ports/yasm-tool-helper/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "yasm-tool-helper",
"version-string": "2020-03-11",
"description": "Backfill that depends on yasm-tool:host",
"port-version": 1,
"description": "Backfill that depends on yasm:host",
"homepage": "https://github.com/Microsoft/vcpkg",
"dependencies": [
{
"name": "yasm-tool",
"name": "yasm",
"host": true
}
]
Expand Down
47 changes: 0 additions & 47 deletions ports/yasm-tool/portfile.cmake

This file was deleted.

7 changes: 0 additions & 7 deletions ports/yasm-tool/vcpkg.json

This file was deleted.

5 changes: 0 additions & 5 deletions ports/yasm/CONTROL

This file was deleted.

42 changes: 14 additions & 28 deletions ports/yasm/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,49 +1,35 @@
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_fail_port_install(ON_TARGET "uwp")

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO yasm/yasm
REF v1.3.0
SHA512 f5053e2012e0d2ce88cc1cc06e3bdb501054aed5d1f78fae40bb3e676fe2eb9843d335a612d7614d99a2b9e49dca998d57f61b0b89fac8225afa4ae60ae848f1
REF 009450c7ad4d425fa5a10ac4bd6efbd25248d823 # 1.3.0 plus bugfixes for https://github.com/yasm/yasm/issues/153
SHA512 a542577558676d11b52981925ea6219bffe699faa1682c033b33b7534f5a0dfe9f29c56b32076b68c48f65e0aef7c451be3a3af804c52caa4d4357de4caad83c
HEAD_REF master
)

vcpkg_find_acquire_program(PYTHON2)
get_filename_component(PYTHON_PATH ${PYTHON2} DIRECTORY)
vcpkg_add_to_path("${PYTHON_PATH}")
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()

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})
vcpkg_copy_pdbs()

if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(EXTRA_OPTION yasmstd${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX})
endif()
vcpkg_copy_tools(TOOL_NAMES vsyasm yasm ytasm DYNAMIC_DEPENS ${EXTRA_OPTION} AUTO_CLEAN)

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)
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ function(yasm_tool_helper)
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()
find_program(YASM yasm PATHS "${Z_YASM_TOOL_HELPER_LIST_DIR}/../../tools/yasm-tool")

if(arg_APPEND_TO_PATH)
get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY)
Expand Down
8 changes: 8 additions & 0 deletions ports/yasm/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "yasm",
"version-semver": "1.3.0",
"port-version": 1,
"description": "Yasm is a complete rewrite of the NASM assembler under the “new” BSD License.",
"homepage": "https://github.com/yasm/yasm",
"supports": "!uwp"
}
24 changes: 21 additions & 3 deletions scripts/cmake/vcpkg_copy_tool_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ Copy all DLL dependencies of built tools into the tool folder.

## Usage
```cmake
vcpkg_copy_tool_dependencies(<${CURRENT_PACKAGES_DIR}/tools/${PORT}>)
vcpkg_copy_tool_dependencies(
TOOL_DIR <${CURRENT_PACKAGES_DIR}/tools/${PORT}>
[DYNAMIC_DEPENS <dep1>...]
)
```
## Parameters
## TOOL_DIR
The path to the directory containing the tools.

### DYNAMIC_DEPENS
A list of tool’s dynamic dependency library names.

## Notes
This command should always be called by portfiles after they have finished rearranging the binary output, if they have any tools.

Expand All @@ -20,6 +26,7 @@ This command should always be called by portfiles after they have finished rearr
#]===]

function(vcpkg_copy_tool_dependencies TOOL_DIR)
cmake_parse_arguments(PARSE_ARGV 0 _vctd "" "TOOL_DIR" "DYNAMIC_DEPENS")
Comment thread
JackBoosY marked this conversation as resolved.
Outdated
if (VCPKG_TARGET_IS_WINDOWS)
find_program(PWSH_EXE pwsh)
if (NOT PWSH_EXE)
Expand All @@ -29,7 +36,7 @@ function(vcpkg_copy_tool_dependencies TOOL_DIR)
message(FATAL_ERROR "Could not find PowerShell Core; please open an issue to report this.")
endif()
macro(search_for_dependencies PATH_TO_SEARCH)
file(GLOB TOOLS "${TOOL_DIR}/*.exe" "${TOOL_DIR}/*.dll" "${TOOL_DIR}/*.pyd")
file(GLOB TOOLS "${_vctd_TOOL_DIR}/*.exe" "${_vctd_TOOL_DIR}/*.dll" "${_vctd_TOOL_DIR}/*.pyd")
foreach(TOOL IN LISTS TOOLS)
vcpkg_execute_required_process(
COMMAND "${PWSH_EXE}" -noprofile -executionpolicy Bypass -nologo
Expand All @@ -43,5 +50,16 @@ function(vcpkg_copy_tool_dependencies TOOL_DIR)
endmacro()
search_for_dependencies("${CURRENT_PACKAGES_DIR}/bin")
search_for_dependencies("${CURRENT_INSTALLED_DIR}/bin")

if (_vctd_DYNAMIC_DEPENS)
foreach (SEARCH_ITEM ${_vctd_DYNAMIC_DEPENS})
Comment thread
JackBoosY marked this conversation as resolved.
Outdated
if (EXISTS "${CURRENT_PACKAGES_DIR}/bin/${SEARCH_ITEM}")
debug_message("Copying file ${CURRENT_PACKAGES_DIR}/bin/${SEARCH_ITEM} to ${_vctd_TOOL_DIR}")
file(COPY "${CURRENT_PACKAGES_DIR}/bin/${SEARCH_ITEM}" DESTINATION "${_vctd_TOOL_DIR}")
else()
message(WARNING "Dynamic dependency ${SEARCH_ITEM} not found in ${CURRENT_PACKAGES_DIR}/bin.")
Comment thread
JackBoosY marked this conversation as resolved.
Outdated
endif()
endforeach()
endif()
endif()
endfunction()
10 changes: 7 additions & 3 deletions scripts/cmake/vcpkg_copy_tools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ vcpkg_copy_tools(
TOOL_NAMES <tool1>...
[SEARCH_DIR <${CURRENT_PACKAGES_DIR}/bin>]
[DESTINATION <${CURRENT_PACKAGES_DIR}/tools/${PORT}>]
[DYNAMIC_DEPENS <dep1>...]
[AUTO_CLEAN]
)
```
Expand All @@ -22,6 +23,9 @@ The path to the directory containing the tools. This will be set to `${CURRENT_P
### DESTINATION
Destination to copy the tools to. This will be set to `${CURRENT_PACKAGES_DIR}/tools/${PORT}` if omitted.

### DYNAMIC_DEPENS
A list of tool’s dynamic dependency library names.

### AUTO_CLEAN
Auto clean executables in `${CURRENT_PACKAGES_DIR}/bin` and `${CURRENT_PACKAGES_DIR}/debug/bin`.

Expand All @@ -34,7 +38,7 @@ Auto clean executables in `${CURRENT_PACKAGES_DIR}/bin` and `${CURRENT_PACKAGES_

function(vcpkg_copy_tools)
# parse parameters such that semicolons in options arguments to COMMAND don't get erased
cmake_parse_arguments(PARSE_ARGV 0 _vct "AUTO_CLEAN" "SEARCH_DIR;DESTINATION" "TOOL_NAMES")
cmake_parse_arguments(PARSE_ARGV 0 _vct "AUTO_CLEAN" "SEARCH_DIR;DESTINATION" "TOOL_NAMES;DYNAMIC_DEPENS")

if(NOT DEFINED _vct_TOOL_NAMES)
message(FATAL_ERROR "TOOL_NAMES must be specified.")
Expand Down Expand Up @@ -63,9 +67,9 @@ function(vcpkg_copy_tools)
endif()
endforeach()

vcpkg_copy_tool_dependencies(TOOL_DIR "${_vct_DESTINATION}" DYNAMIC_DEPENS "${_vct_DYNAMIC_DEPENS}")
Comment thread
JackBoosY marked this conversation as resolved.
Outdated

if(_vct_AUTO_CLEAN)
vcpkg_clean_executables_in_bin(FILE_NAMES ${_vct_TOOL_NAMES})
endif()

vcpkg_copy_tool_dependencies("${_vct_DESTINATION}")
endfunction()
4 changes: 0 additions & 4 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -6784,10 +6784,6 @@
"baseline": "1.3.0",
"port-version": 0
},
"yasm-tool": {
"baseline": "1.3.0",
"port-version": 0
},
"yasm-tool-helper": {
"baseline": "2020-03-11",
"port-version": 0
Expand Down
14 changes: 0 additions & 14 deletions versions/y-/yasm-tool.json

This file was deleted.