legacy package [release 0.7.0-4mamba;Tue Oct 10 2023]

This commit is contained in:
Silvan Calarco 2024-01-05 20:00:01 +01:00
parent bb8ac13437
commit f9491e186c
3 changed files with 225 additions and 0 deletions

View File

@ -1,2 +1,4 @@
# yaml-cpp7 # yaml-cpp7
yaml-cpp is a YAML parser and emitter in C++ matching the YAML 1.2 spec.

View File

@ -0,0 +1,110 @@
From 4aad2b1666a4742743b04e765a34742512915674 Mon Sep 17 00:00:00 2001
From: Felix Schwitzer <flx107809@gmail.com>
Date: Fri, 1 Apr 2022 05:26:47 +0200
Subject: [PATCH] Fix CMake export files (#1077)
After configuring the file `yaml-cpp-config.cmake.in`, the result ends up with
empty variables. (see also the discussion in #774).
Rework this file and the call to `configure_package_config_file` according the
cmake documentation
(https://cmake.org/cmake/help/v3.22/module/CMakePackageConfigHelpers.html?highlight=configure_package_config#command:configure_package_config_file)
to overcome this issue and allow a simple `find_package` after install.
As there was some discussion about the place where to install the
`yaml-cpp-config.cmake` file, e.g. #1055, factor out the install location into
an extra variable to make it easier changing this location in the future.
Also untabify CMakeLists.txt in some places to align with the other code parts in this file.
---
CMakeLists.txt | 29 ++++++++++++++++++-----------
yaml-cpp-config.cmake.in | 10 ++++++----
2 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 564b7c8d1..ccc1964ea 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -133,10 +133,16 @@ set_target_properties(yaml-cpp PROPERTIES
PROJECT_LABEL "yaml-cpp ${yaml-cpp-label-postfix}"
DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
+# FIXME(felix2012): A more common place for the cmake export would be
+# `CMAKE_INSTALL_LIBDIR`, as e.g. done in ubuntu or in this project for GTest
+set(CONFIG_EXPORT_DIR "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp")
+set(EXPORT_TARGETS yaml-cpp)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/yaml-cpp-config.cmake.in"
"${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
- INSTALL_DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp")
+ INSTALL_DESTINATION "${CONFIG_EXPORT_DIR}"
+ PATH_VARS CMAKE_INSTALL_INCLUDEDIR CONFIG_EXPORT_DIR)
+unset(EXPORT_TARGETS)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
@@ -145,30 +151,31 @@ write_basic_package_version_file(
configure_file(yaml-cpp.pc.in yaml-cpp.pc @ONLY)
if (YAML_CPP_INSTALL)
- install(TARGETS yaml-cpp
+ install(TARGETS yaml-cpp
EXPORT yaml-cpp-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
- install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
+ install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
- FILES_MATCHING PATTERN "*.h")
+ FILES_MATCHING PATTERN "*.h")
install(EXPORT yaml-cpp-targets
- DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp")
- install(FILES
- "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
- "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
- DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp")
+ DESTINATION "${CONFIG_EXPORT_DIR}")
+ install(FILES
+ "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
+ "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
+ DESTINATION "${CONFIG_EXPORT_DIR}")
install(FILES "${PROJECT_BINARY_DIR}/yaml-cpp.pc"
DESTINATION ${CMAKE_INSTALL_DATADIR}/pkgconfig)
endif()
+unset(CONFIG_EXPORT_DIR)
if(YAML_CPP_BUILD_TESTS)
- add_subdirectory(test)
+ add_subdirectory(test)
endif()
if(YAML_CPP_BUILD_TOOLS)
- add_subdirectory(util)
+ add_subdirectory(util)
endif()
if (YAML_CPP_CLANG_FORMAT_EXE)
diff --git a/yaml-cpp-config.cmake.in b/yaml-cpp-config.cmake.in
index 7b41e3f30..a7ace3dc0 100644
--- a/yaml-cpp-config.cmake.in
+++ b/yaml-cpp-config.cmake.in
@@ -3,12 +3,14 @@
# YAML_CPP_INCLUDE_DIR - include directory
# YAML_CPP_LIBRARIES - libraries to link against
-# Compute paths
-get_filename_component(YAML_CPP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
-set(YAML_CPP_INCLUDE_DIR "@CONFIG_INCLUDE_DIRS@")
+@PACKAGE_INIT@
+
+set_and_check(YAML_CPP_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
# Our library dependencies (contains definitions for IMPORTED targets)
-include("${YAML_CPP_CMAKE_DIR}/yaml-cpp-targets.cmake")
+include(@PACKAGE_CONFIG_EXPORT_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@)

113
yaml-cpp7.spec Normal file
View File

@ -0,0 +1,113 @@
Name: yaml-cpp7
Version: 0.7.0
Release: 4mamba
Summary: A YAML parser and emitter in C++ matching the YAML 1.2 spec
Group: Development/Tools
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://github.com/jbeder/yaml-cpp
Source: https://github.com/jbeder/yaml-cpp.git/yaml-cpp-%{version}/yaml-cpp-%{version}.tar.bz2
Patch0: yaml-cpp-0.7.0-fix-cmake-export-files.patch
License: MIT
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libgcc
BuildRequires: libstdc++6-devel
## AUTOBUILDREQ-END
BuildRequires: cmake
Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release}
%description
yaml-cpp is a YAML parser and emitter in C++ matching the YAML 1.2 spec.
%package -n lib%{name}
Group: System/Libraries
Summary: A YAML parser and emitter in C++ matching the YAML 1.2 spec
%description -n lib%{name}
yaml-cpp is a YAML parser and emitter in C++ matching the YAML 1.2 spec.
This package contains shared libraries for %{name}.
%package -n lib%{name}-devel
Group: Development/Libraries
Summary: Development files for %{name}
Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release}
Requires: pkg-config
%description -n lib%{name}-devel
yaml-cpp is a YAML parser and emitter in C++ matching the YAML 1.2 spec.
This package contains libraries and header files for developing applications that use %{name}.
%debug_package
%prep
%setup -q -n yaml-cpp-%{version}
%patch0 -p1 -b .fix-cmake-export-files
%build
%cmake -d build \
-DYAML_BUILD_SHARED_LIBS=ON \
-DYAML_CPP_BUILD_TESTS=OFF
%make
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeinstall -C build
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%post -n lib%{name} -p /sbin/ldconfig
%postun -n lib%{name} -p /sbin/ldconfig
%files -n lib%{name}
%defattr(-,root,root)
%{_libdir}/libyaml-cpp.so.*
%files -n lib%{name}-devel
%defattr(-,root,root)
%dir %{_includedir}/yaml-cpp
%{_includedir}/yaml-cpp/*.h
%dir %{_includedir}/yaml-cpp/contrib
%{_includedir}/yaml-cpp/contrib/*.h
%dir %{_includedir}/yaml-cpp/node
%{_includedir}/yaml-cpp/node/*.h
%dir %{_includedir}/yaml-cpp/node/detail
%{_includedir}/yaml-cpp/node/detail/*.h
%{_libdir}/libyaml-cpp.so
%{_datadir}/pkgconfig/yaml-cpp.pc
%dir %{_datadir}/cmake/yaml-cpp/
%{_datadir}/cmake/yaml-cpp/yaml-cpp*.cmake
%changelog
* Tue Oct 10 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 0.7.0-4mamba
- legacy package
* Wed Aug 24 2022 Silvan Calarco <silvan.calarco@mambasoft.it> 0.7.0-3mamba
- apply another (upstream) patch to fix cmake exported files
* Tue Aug 23 2022 Silvan Calarco <silvan.calarco@mambasoft.it> 0.7.0-2mamba
- added a patch to fix broken cmake targets
* Sun Jul 18 2021 Automatic Build System <autodist@mambasoft.it> 0.7.0-1mamba
- automatic version update by autodist
* Fri Oct 04 2019 Automatic Build System <autodist@mambasoft.it> 0.6.3-1mamba
- automatic version update by autodist
* Sun Jun 30 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 0.6.2-1mamba
- update to 0.6.2
* Thu Jan 14 2016 Automatic Build System <autodist@mambasoft.it> 0.5.3-1mamba
- automatic version update by autodist
* Thu Dec 17 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 0.5.2-2mamba
- rebuilt with gcc 5.2.0
* Sat Apr 04 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 0.5.2-1mamba
- update to 0.5.2
* Tue Feb 03 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 0.5.1-1mamba
- package created using the webbuild interface