From 6c2881f1353054251c60626266843184a1cee778 Mon Sep 17 00:00:00 2001 From: Jesper Stemann Andersen Date: Sat, 28 Oct 2023 19:41:25 +0200 Subject: [PATCH] yaml_cpp: Changed recipe to build v0.5.3 Including: * Added boost_jll as a build dep. * Replaced GitHub automatic archive source with git source. * Added patch for obsolete boost/detail/iterator header. * Fixed Windows library name. * Fixed Clang platforms by enabling C++17 removed features - to get support for std::auto_ptr --- Y/yaml_cpp/build_tarballs.jl | 23 +++++++++++----- .../boost_detail_iterator_obsolete.patch | 26 +++++++++++++++++++ 2 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 Y/yaml_cpp/bundled/patches/boost_detail_iterator_obsolete.patch diff --git a/Y/yaml_cpp/build_tarballs.jl b/Y/yaml_cpp/build_tarballs.jl index 9360223e1fb..46bf6f311d1 100644 --- a/Y/yaml_cpp/build_tarballs.jl +++ b/Y/yaml_cpp/build_tarballs.jl @@ -3,24 +3,32 @@ using BinaryBuilder, Pkg name = "yaml_cpp" -version = v"0.7.0" +version = v"0.5.3" # Collection of sources required to complete build sources = [ - ArchiveSource("https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-$(version).zip", - "4d5e664a7fb2d7445fc548cc8c0e1aa7b1a496540eb382d137e2cc263e6d3ef5") + GitSource("https://github.com/jbeder/yaml-cpp.git", "b57efe94e7d445713c29f863adb8c23438eaa217"), + DirectorySource("bundled"), ] # Bash recipe for building across all platforms script = raw""" cd $WORKSPACE/srcdir/yaml-cpp*/ + +patch -p1 < ../patches/boost_detail_iterator_obsolete.patch + +if [[ $target == *-apple-darwin* || $target == *-freebsd* ]]; then + cmake_extra_args=-DCMAKE_C_FLAGS=-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES +fi + mkdir build && cd build cmake .. \ -DCMAKE_INSTALL_PREFIX=${prefix} \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ - -DYAML_BUILD_SHARED_LIBS=ON \ - -DYAML_CPP_BUILD_TESTS=OFF + -DBUILD_SHARED_LIBS=ON \ + -DYAML_CPP_BUILD_TOOLS=OFF \ + $cmake_extra_args make -j${nproc} make install @@ -32,11 +40,12 @@ platforms = expand_cxxstring_abis(supported_platforms(; experimental=true)) # The products that we will ensure are always built products = [ - LibraryProduct("libyaml-cpp", :libyaml_cpp) + LibraryProduct(["libyaml-cpp", "yaml-cpp"], :libyaml_cpp) ] # Dependencies that must be installed before this package can be built -dependencies = Dependency[ +dependencies = [ + BuildDependency(PackageSpec("boost_jll", v"1.76.0")), ] # Build the tarballs, and possibly a `build.jl` as well. diff --git a/Y/yaml_cpp/bundled/patches/boost_detail_iterator_obsolete.patch b/Y/yaml_cpp/bundled/patches/boost_detail_iterator_obsolete.patch new file mode 100644 index 00000000000..688504d6df9 --- /dev/null +++ b/Y/yaml_cpp/bundled/patches/boost_detail_iterator_obsolete.patch @@ -0,0 +1,26 @@ +diff --git a/include/yaml-cpp/node/detail/iterator.h b/include/yaml-cpp/node/detail/iterator.h +index 2c701af..232fca7 100644 +--- a/include/yaml-cpp/node/detail/iterator.h ++++ b/include/yaml-cpp/node/detail/iterator.h +@@ -45,7 +45,7 @@ class iterator_base + private: + friend class boost::iterator_core_access; + +- void increment() { this->base_reference() = boost::next(this->base()); } ++ void increment() { this->base_reference() = std::next(this->base()); } + + value_type dereference() const { + const typename base_type::value_type& v = *this->base(); +diff --git a/src/node_data.cpp b/src/node_data.cpp +index a1ca900..0bdb6e7 100644 +--- a/src/node_data.cpp ++++ b/src/node_data.cpp +@@ -104,7 +104,7 @@ void node_data::compute_seq_size() const { + void node_data::compute_map_size() const { + kv_pairs::iterator it = m_undefinedPairs.begin(); + while (it != m_undefinedPairs.end()) { +- kv_pairs::iterator jt = boost::next(it); ++ kv_pairs::iterator jt = std::next(it); + if (it->first->is_defined() && it->second->is_defined()) + m_undefinedPairs.erase(it); + it = jt;