aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/yaml-cpp
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/yaml-cpp
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/yaml-cpp')
-rw-r--r--vcpkg/ports/yaml-cpp/portfile.cmake42
-rw-r--r--vcpkg/ports/yaml-cpp/vcpkg.json19
-rw-r--r--vcpkg/ports/yaml-cpp/yaml-cpp-pr-1212.patch79
-rw-r--r--vcpkg/ports/yaml-cpp/yaml-cpp-pr-1310.patch38
4 files changed, 178 insertions, 0 deletions
diff --git a/vcpkg/ports/yaml-cpp/portfile.cmake b/vcpkg/ports/yaml-cpp/portfile.cmake
new file mode 100644
index 0000000..b8bd785
--- /dev/null
+++ b/vcpkg/ports/yaml-cpp/portfile.cmake
@@ -0,0 +1,42 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO jbeder/yaml-cpp
+ REF "${VERSION}"
+ SHA512 aae9d618f906117d620d63173e95572c738db518f4ff1901a06de2117d8deeb8045f554102ca0ba4735ac0c4d060153a938ef78da3e0da3406d27b8298e5f38e
+ HEAD_REF master
+ PATCHES
+ "yaml-cpp-pr-1212.patch"
+ "yaml-cpp-pr-1310.patch"
+)
+
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" YAML_BUILD_SHARED_LIBS)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DYAML_CPP_BUILD_TOOLS=OFF
+ -DYAML_CPP_BUILD_TESTS=OFF
+ -DYAML_BUILD_SHARED_LIBS=${YAML_BUILD_SHARED_LIBS}
+ -DYAML_CPP_INSTALL_CMAKEDIR=share/${PORT}
+)
+
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+
+vcpkg_cmake_config_fixup()
+if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/yaml-cpp.pc" "-lyaml-cpp" "-lyaml-cppd")
+endif()
+vcpkg_fixup_pkgconfig()
+
+# Remove debug include
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/yaml-cpp/dll.h" "#ifdef YAML_CPP_STATIC_DEFINE" "#if 0")
+else()
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/yaml-cpp/dll.h" "#ifdef YAML_CPP_STATIC_DEFINE" "#if 1")
+endif()
+
+# Handle copyright
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/yaml-cpp/vcpkg.json b/vcpkg/ports/yaml-cpp/vcpkg.json
new file mode 100644
index 0000000..2a2d4d7
--- /dev/null
+++ b/vcpkg/ports/yaml-cpp/vcpkg.json
@@ -0,0 +1,19 @@
+{
+ "name": "yaml-cpp",
+ "version-semver": "0.8.0",
+ "port-version": 3,
+ "description": "yaml-cpp is a YAML parser and emitter in C++ matching the YAML 1.2 spec.",
+ "homepage": "https://github.com/jbeder/yaml-cpp",
+ "documentation": "https://codedocs.xyz/jbeder/yaml-cpp/index.html",
+ "license": "MIT",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}
diff --git a/vcpkg/ports/yaml-cpp/yaml-cpp-pr-1212.patch b/vcpkg/ports/yaml-cpp/yaml-cpp-pr-1212.patch
new file mode 100644
index 0000000..784f3d5
--- /dev/null
+++ b/vcpkg/ports/yaml-cpp/yaml-cpp-pr-1212.patch
@@ -0,0 +1,79 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 46dc180..5055c24 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -31,6 +31,8 @@ cmake_dependent_option(YAML_CPP_BUILD_TESTS
+ cmake_dependent_option(YAML_MSVC_SHARED_RT
+ "MSVC: Build yaml-cpp with shared runtime libs (/MD)" ON
+ "CMAKE_SYSTEM_NAME MATCHES Windows" OFF)
++set(YAML_CPP_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/yaml-cpp"
++ CACHE STRING "Path to install the CMake package to")
+
+ if (YAML_CPP_FORMAT_SOURCE)
+ find_program(YAML_CPP_CLANG_FORMAT_EXE NAMES clang-format)
+@@ -143,13 +145,12 @@ set_target_properties(yaml-cpp PROPERTIES
+ PROJECT_LABEL "yaml-cpp ${yaml-cpp-label-postfix}"
+ DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
+
+-set(CONFIG_EXPORT_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/yaml-cpp")
+-set(EXPORT_TARGETS yaml-cpp)
++set(EXPORT_TARGETS yaml-cpp::yaml-cpp)
+ configure_package_config_file(
+ "${PROJECT_SOURCE_DIR}/yaml-cpp-config.cmake.in"
+ "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
+- INSTALL_DESTINATION "${CONFIG_EXPORT_DIR}"
+- PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR CONFIG_EXPORT_DIR YAML_BUILD_SHARED_LIBS)
++ INSTALL_DESTINATION "${YAML_CPP_INSTALL_CMAKEDIR}"
++ PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR)
+ unset(EXPORT_TARGETS)
+
+ write_basic_package_version_file(
+@@ -169,15 +170,14 @@ if (YAML_CPP_INSTALL)
+ FILES_MATCHING PATTERN "*.h")
+ install(EXPORT yaml-cpp-targets
+ NAMESPACE yaml-cpp::
+- DESTINATION "${CONFIG_EXPORT_DIR}")
++ DESTINATION "${YAML_CPP_INSTALL_CMAKEDIR}")
+ install(FILES
+ "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
+ "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
+- DESTINATION "${CONFIG_EXPORT_DIR}")
++ DESTINATION "${YAML_CPP_INSTALL_CMAKEDIR}")
+ install(FILES "${PROJECT_BINARY_DIR}/yaml-cpp.pc"
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+ endif()
+-unset(CONFIG_EXPORT_DIR)
+
+ if(YAML_CPP_BUILD_TESTS)
+ add_subdirectory(test)
+diff --git a/yaml-cpp-config.cmake.in b/yaml-cpp-config.cmake.in
+index 799b9b4..cbbc773 100644
+--- a/yaml-cpp-config.cmake.in
++++ b/yaml-cpp-config.cmake.in
+@@ -11,12 +11,23 @@ set_and_check(YAML_CPP_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
+ set_and_check(YAML_CPP_LIBRARY_DIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
+
+ # Are we building shared libraries?
+-set(YAML_CPP_SHARED_LIBS_BUILT "@PACKAGE_YAML_BUILD_SHARED_LIBS@")
++set(YAML_CPP_SHARED_LIBS_BUILT @YAML_BUILD_SHARED_LIBS@)
+
+ # Our library dependencies (contains definitions for IMPORTED targets)
+-include(@PACKAGE_CONFIG_EXPORT_DIR@/yaml-cpp-targets.cmake)
++include("${CMAKE_CURRENT_LIST_DIR}/yaml-cpp-targets.cmake")
+
+ # These are IMPORTED targets created by yaml-cpp-targets.cmake
+ set(YAML_CPP_LIBRARIES "@EXPORT_TARGETS@")
+
+-check_required_components(@EXPORT_TARGETS@)
++# Protect against multiple inclusion, which would fail when already imported targets are added once more.
++if(NOT TARGET yaml-cpp)
++ add_library(yaml-cpp INTERFACE IMPORTED)
++ target_link_libraries(yaml-cpp INTERFACE yaml-cpp::yaml-cpp)
++ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17)
++ set_target_properties(yaml-cpp PROPERTIES
++ DEPRECATION "The target yaml-cpp is deprecated and will be removed in version 0.10.0. Use the yaml-cpp::yaml-cpp target instead."
++ )
++ endif()
++endif()
++
++check_required_components(yaml-cpp)
diff --git a/vcpkg/ports/yaml-cpp/yaml-cpp-pr-1310.patch b/vcpkg/ports/yaml-cpp/yaml-cpp-pr-1310.patch
new file mode 100644
index 0000000..698a664
--- /dev/null
+++ b/vcpkg/ports/yaml-cpp/yaml-cpp-pr-1310.patch
@@ -0,0 +1,38 @@
+From 0bcee982a6556649ff2af9a7aa0845fa92e893e2 Mon Sep 17 00:00:00 2001
+From: Christopher Fore <csfore@posteo.net>
+Date: Wed, 14 Aug 2024 21:02:32 -0400
+Subject: [PATCH] emitterutils: Explicitly include <cstdint>
+
+GCC 15 will no longer include it by default, resulting in build
+failures in projects that do not explicitly include it.
+
+Error:
+src/emitterutils.cpp:221:11: error: 'uint16_t' was not declared in this scope
+ 221 | std::pair<uint16_t, uint16_t> EncodeUTF16SurrogatePair(int codePoint) {
+ | ^~~~~~~~
+src/emitterutils.cpp:13:1: note: 'uint16_t' is defined in header '<cstdint>';
+this is probably fixable by adding '#include <cstdint>'
+ 12 | #include "yaml-cpp/null.h"
+ +++ |+#include <cstdint>
+ 13 | #include "yaml-cpp/ostream_wrapper.h"
+
+Tests pass.
+
+Closes: #1307
+See-also: https://gcc.gnu.org/pipermail/gcc-cvs/2024-August/407124.html
+See-also: https://bugs.gentoo.org/937412
+Signed-off-by: Christopher Fore <csfore@posteo.net>
+---
+ src/emitterutils.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/emitterutils.cpp b/src/emitterutils.cpp
+index fc41011a5..f801b1d0c 100644
+--- a/src/emitterutils.cpp
++++ b/src/emitterutils.cpp
+@@ -1,4 +1,5 @@
+ #include <algorithm>
++#include <cstdint>
+ #include <iomanip>
+ #include <sstream>
+