From 6f99c0cf0d6ed05779f99f6d88c5c71e8d01681f Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Sat, 21 Feb 2026 23:19:56 -0500 Subject: [PATCH] [slang] Add new port (version 10.0) --- ports/slang/fix-get-target-property.patch | 35 +++++++++++++ ports/slang/portfile.cmake | 60 +++++++++++++++++++++++ ports/slang/usage | 4 ++ ports/slang/use-expected-lite.patch | 41 ++++++++++++++++ ports/slang/vcpkg.json | 33 +++++++++++++ versions/baseline.json | 4 ++ versions/s-/slang.json | 9 ++++ 7 files changed, 186 insertions(+) create mode 100644 ports/slang/fix-get-target-property.patch create mode 100644 ports/slang/portfile.cmake create mode 100644 ports/slang/usage create mode 100644 ports/slang/use-expected-lite.patch create mode 100644 ports/slang/vcpkg.json create mode 100644 versions/s-/slang.json diff --git a/ports/slang/fix-get-target-property.patch b/ports/slang/fix-get-target-property.patch new file mode 100644 index 00000000000000..754e468775550f --- /dev/null +++ b/ports/slang/fix-get-target-property.patch @@ -0,0 +1,35 @@ +diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt +index 1234567..abcdefg 100644 +--- a/external/CMakeLists.txt ++++ b/external/CMakeLists.txt +@@ -44,7 +44,8 @@ endif() + + if(fmt_FOUND) + get_target_property(FMT_CFG fmt::fmt IMPORTED_CONFIGURATIONS) +- get_target_property(FMT_LIB fmt::fmt IMPORTED_LOCATION_${FMT_CFG}) ++ list(GET FMT_CFG 0 FMT_CFG_FIRST) ++ get_target_property(FMT_LIB fmt::fmt IMPORTED_LOCATION_${FMT_CFG_FIRST}) + get_target_property(FMT_INC fmt::fmt INTERFACE_INCLUDE_DIRECTORIES) + message(STATUS "Found system fmt library: ${FMT_LIB}") + message(STATUS "Using system fmt include: ${FMT_INC}") +@@ -76,7 +77,7 @@ if(SLANG_USE_MIMALLOC) + + set(find_pkg_args "") + if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24.0") +- set(find_pkg_args "FIND_PACKAGE_ARGS" "${mimalloc_min_version}") ++ set(find_pkg_args "FIND_PACKAGE_ARGS") + endif() + + set(MI_OVERRIDE +@@ -116,8 +117,9 @@ if(SLANG_USE_MIMALLOC) + endif() + + get_target_property(MIMALLOC_CFG ${mimalloc_target} IMPORTED_CONFIGURATIONS) +- get_target_property(MIMALLOC_LIB ${mimalloc_target} +- IMPORTED_LOCATION_${MIMALLOC_CFG}) ++ list(GET MIMALLOC_CFG 0 MIMALLOC_CFG_FIRST) ++ get_target_property(MIMALLOC_LIB ${mimalloc_target} ++ IMPORTED_LOCATION_${MIMALLOC_CFG_FIRST}) + get_target_property(MIMALLOC_INC ${mimalloc_target} + INTERFACE_INCLUDE_DIRECTORIES) + message(STATUS "Found system mimalloc library: ${MIMALLOC_LIB}") diff --git a/ports/slang/portfile.cmake b/ports/slang/portfile.cmake new file mode 100644 index 00000000000000..5758f68e294943 --- /dev/null +++ b/ports/slang/portfile.cmake @@ -0,0 +1,60 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO MikePopoloski/slang + REF "v${VERSION}" + SHA512 f8402e422e8278be363d4630f264885230f11dcf969ffeafefc88c0ac5d0761dd81e7ee5d50bab1d4363d0783600bb974181db78609c021bde4406d8fcf1dbc5 + HEAD_REF master + PATCHES + fix-get-target-property.patch + use-expected-lite.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + mimalloc SLANG_USE_MIMALLOC + tools SLANG_INCLUDE_TOOLS +) + +vcpkg_find_acquire_program(PYTHON3) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} + "-DPython_EXECUTABLE=${PYTHON3}" + -DSLANG_INCLUDE_TESTS=OFF + -DSLANG_INCLUDE_DOCS=OFF + -DSLANG_INCLUDE_PYLIB=OFF + -DSLANG_INCLUDE_INSTALL=ON + -DSLANG_INCLUDE_COVERAGE=OFF + -DSLANG_USE_CPPTRACE=OFF +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/slang") + +# Move misplaced pkgconfig files to the correct directory +if(EXISTS "${CURRENT_PACKAGES_DIR}/share/pkgconfig/sv-lang.pc") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig") + file(RENAME "${CURRENT_PACKAGES_DIR}/share/pkgconfig/sv-lang.pc" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/sv-lang.pc") +endif() +if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/share/pkgconfig/sv-lang.pc") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig") + file(RENAME "${CURRENT_PACKAGES_DIR}/debug/share/pkgconfig/sv-lang.pc" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/sv-lang.pc") +endif() + +vcpkg_fixup_pkgconfig() +vcpkg_copy_pdbs() + +if("tools" IN_LIST FEATURES) + vcpkg_copy_tools(TOOL_NAMES slang slang-hier slang-reflect slang-tidy AUTO_CLEAN) +endif() + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" + "${CURRENT_PACKAGES_DIR}/share/pkgconfig" +) + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/slang/usage b/ports/slang/usage new file mode 100644 index 00000000000000..86a8f4e8f40ef4 --- /dev/null +++ b/ports/slang/usage @@ -0,0 +1,4 @@ +slang provides CMake targets: + + find_package(slang CONFIG REQUIRED) + target_link_libraries(main PRIVATE slang::slang_slang) diff --git a/ports/slang/use-expected-lite.patch b/ports/slang/use-expected-lite.patch new file mode 100644 index 00000000000000..4bc0e5fadbb1cc --- /dev/null +++ b/ports/slang/use-expected-lite.patch @@ -0,0 +1,41 @@ +diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt +index 1a54f7a24..bcc698bd0 100644 +--- a/external/CMakeLists.txt ++++ b/external/CMakeLists.txt +@@ -217,10 +217,6 @@ if(SLANG_INCLUDE_INSTALL) + DIRECTORY ${PROJECT_SOURCE_DIR}/external/ieee1800/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ieee1800 + COMPONENT slang_Development) +- install( +- FILES ${PROJECT_SOURCE_DIR}/external/expected.hpp +- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +- COMPONENT slang_Development) + + if(NOT fmt_FOUND) + install( +diff --git a/include/slang/syntax/SyntaxTree.h b/include/slang/syntax/SyntaxTree.h +index 5a9030bc8..32d93de93 100644 +--- a/include/slang/syntax/SyntaxTree.h ++++ b/include/slang/syntax/SyntaxTree.h +@@ -7,7 +7,7 @@ + //------------------------------------------------------------------------------ + #pragma once + +-#include ++#include + #include + #include + +diff --git a/include/slang/text/SourceManager.h b/include/slang/text/SourceManager.h +index 0bbdf05bc..a06c8c5b8 100644 +--- a/include/slang/text/SourceManager.h ++++ b/include/slang/text/SourceManager.h +@@ -8,7 +8,7 @@ + #pragma once + + #include +-#include ++#include + #include + #include + #include diff --git a/ports/slang/vcpkg.json b/ports/slang/vcpkg.json new file mode 100644 index 00000000000000..caf913b1df782f --- /dev/null +++ b/ports/slang/vcpkg.json @@ -0,0 +1,33 @@ +{ + "name": "slang", + "version": "10.0", + "description": "SystemVerilog compiler and language services", + "homepage": "https://github.com/MikePopoloski/slang", + "license": "MIT", + "supports": "!arm32 & !(windows & !x64)", + "dependencies": [ + "boost-unordered", + "expected-lite", + "fmt", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "mimalloc": { + "description": "Use the mimalloc allocator", + "supports": "!(windows & !static)", + "dependencies": [ + "mimalloc" + ] + }, + "tools": { + "description": "Build the slang command-line tool" + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index 231a51f6f57d0c..97808cf4df9dbe 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -9168,6 +9168,10 @@ "baseline": "3.0.0", "port-version": 0 }, + "slang": { + "baseline": "10.0", + "port-version": 0 + }, "sleef": { "baseline": "3.9.0", "port-version": 1 diff --git a/versions/s-/slang.json b/versions/s-/slang.json new file mode 100644 index 00000000000000..65091a79483b69 --- /dev/null +++ b/versions/s-/slang.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "882ab2ac3a544d40d80994db1c083afc5871222a", + "version": "10.0", + "port-version": 0 + } + ] +}