Update to 0.6.0.

Add static library subpackage.
This commit is contained in:
Richard Shaw 2018-02-11 12:04:55 -06:00
parent f2f5a7c112
commit 45ce59b7fa
4 changed files with 186 additions and 16 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ yaml-cpp-0.2.5.tar.gz
/yaml-cpp-0.3.0.tar.gz
/yaml-cpp-0.5.1.tar.gz
/yaml-cpp-0.5.3.tar.gz
/yaml-cpp-0.6.0.tar.gz

View File

@ -1 +1 @@
64200ca0bf5e0af065804d8d3e8f6d42 yaml-cpp-0.5.3.tar.gz
SHA512 (yaml-cpp-0.6.0.tar.gz) = 186886201277a5d452801fd8f71e51434a31538af0443d0ab7ce8bb584e1171d083b28e21d29755bada9192e75b319e5e20a047325600045b1060385a307ab24

150
yaml-cpp-static.patch Normal file
View File

@ -0,0 +1,150 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,6 +47,11 @@ option(YAML_CPP_BUILD_CONTRIB "Enable co
# see http://www.cmake.org/cmake/help/cmake2.6docs.html#variable:BUILD_SHARED_LIBS
# http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_library
option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
+option(BUILD_STATIC_LIBS "Build Static Libraries" ON)
+
+if(NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
+ message(FATAL_ERROR "At least one library must be built.")
+endif()
# --> Apple
option(APPLE_UNIVERSAL_BIN "Apple: Build universal binary" OFF)
@@ -274,16 +279,24 @@ set(_INSTALL_DESTINATIONS
###
### Library
###
-add_library(yaml-cpp ${library_sources})
-set_target_properties(yaml-cpp PROPERTIES
- COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}"
-)
+if(BUILD_SHARED_LIBS)
+ add_library(yaml-cpp SHARED ${library_sources})
+ set_target_properties(yaml-cpp PROPERTIES
+ COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}"
+ )
-set_target_properties(yaml-cpp PROPERTIES
+ set_target_properties(yaml-cpp PROPERTIES
VERSION "${YAML_CPP_VERSION}"
SOVERSION "${YAML_CPP_VERSION_MAJOR}.${YAML_CPP_VERSION_MINOR}"
PROJECT_LABEL "yaml-cpp ${LABEL_SUFFIX}"
-)
+ )
+endif()
+if(BUILD_STATIC_LIBS)
+ add_library(yaml-cpp-static STATIC ${library_sources})
+ set_target_properties(yaml-cpp-static PROPERTIES
+ COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}"
+ OUTPUT_NAME yaml-cpp)
+endif()
if(IPHONE)
set_target_properties(yaml-cpp PROPERTIES
@@ -303,48 +316,70 @@ if(MSVC)
endif()
endif()
-install(TARGETS yaml-cpp EXPORT yaml-cpp-targets ${_INSTALL_DESTINATIONS})
install(
DIRECTORY ${header_directory}
DESTINATION ${INCLUDE_INSTALL_DIR}
FILES_MATCHING PATTERN "*.h"
)
-export(
- TARGETS yaml-cpp
- FILE "${PROJECT_BINARY_DIR}/yaml-cpp-targets.cmake")
-export(PACKAGE yaml-cpp)
-set(EXPORT_TARGETS yaml-cpp CACHE INTERNAL "export targets")
-
-set(CONFIG_INCLUDE_DIRS "${YAML_CPP_SOURCE_DIR}/include")
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in
- "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake" @ONLY)
+if(BUILD_SHARED_LIBS)
+ install(TARGETS yaml-cpp EXPORT yaml-cpp-targets ${_INSTALL_DESTINATIONS})
+ list(APPEND YAML_TARGETS "yaml-cpp")
+ list(APPEND EXPORT_TARGETS "yaml-cpp-targets")
+endif()
+if(BUILD_STATIC_LIBS)
+ install(TARGETS yaml-cpp-static EXPORT yaml-cpp-static-targets ${_INSTALL_DESTINATIONS})
+ list(APPEND YAML_TARGETS "yaml-cpp-static")
+ list(APPEND EXPORT_TARGETS "yaml-cpp-static-targets")
+endif()
+
+foreach(YAML_TARGET ${YAML_TARGETS})
+ export(TARGETS ${YAML_TARGET}
+ FILE "${PROJECT_BINARY_DIR}/${YAML_TARGET}-targets.cmake")
+ export(PACKAGE yaml-cpp)
+ set(EXPORT_TARGETS ${YAML_TARGET} CACHE INTERNAL "export targets")
+ set(CONFIG_INCLUDE_DIRS "${YAML_CPP_SOURCE_DIR}/include")
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in
+ "${PROJECT_BINARY_DIR}/${YAML_TARGET}-config.cmake" @ONLY)
+endforeach()
+if(NOT INSTALL_CMAKE_DIR)
if(WIN32 AND NOT CYGWIN)
set(INSTALL_CMAKE_DIR CMake)
else()
- set(INSTALL_CMAKE_DIR ${LIB_INSTALL_DIR}/cmake/yaml-cpp)
+ set(INSTALL_CMAKE_DIR ${LIB_INSTALL_DIR}/cmake/)
+endif()
endif()
file(RELATIVE_PATH REL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}" "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_ROOT_DIR}")
set(CONFIG_INCLUDE_DIRS "\${YAML_CPP_CMAKE_DIR}/${REL_INCLUDE_DIR}")
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in
- "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/yaml-cpp-config.cmake" @ONLY)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config-version.cmake.in
- "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake" @ONLY)
-
-install(FILES
- "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/yaml-cpp-config.cmake"
- "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
- DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev)
-install(EXPORT yaml-cpp-targets DESTINATION ${INSTALL_CMAKE_DIR})
+foreach(YAML_TARGET ${YAML_TARGETS})
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${YAML_TARGET}-config.cmake" @ONLY)
+
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config-version.cmake.in
+ "${PROJECT_BINARY_DIR}/${YAML_TARGET}-config-version.cmake" @ONLY)
+
+ install(FILES
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${YAML_TARGET}-config.cmake"
+ "${PROJECT_BINARY_DIR}/${YAML_TARGET}-config-version.cmake"
+ DESTINATION "${INSTALL_CMAKE_DIR}${YAML_TARGET}" COMPONENT dev)
+ install(EXPORT ${YAML_TARGET}-targets DESTINATION ${INSTALL_CMAKE_DIR}${YAML_TARGET})
+endforeach()
if(UNIX)
- set(PC_FILE ${CMAKE_BINARY_DIR}/yaml-cpp.pc)
+if(BUILD_SHARED_LIBS)
+ list(APPEND PC_FILES ${CMAKE_BINARY_DIR}/yaml-cpp.pc)
+endif()
+if(BUILD_STATIC_LIBS)
+ list(APPEND PC_FILES ${CMAKE_BINARY_DIR}/yaml-cpp-static.pc)
+endif()
+foreach(PC_FILE ${PC_FILES})
configure_file("yaml-cpp.pc.cmake" ${PC_FILE} @ONLY)
install(FILES ${PC_FILE} DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-endif()
+endforeach()
+endif(UNIX)
###
--- a/yaml-cpp-config.cmake.in
+++ b/yaml-cpp-config.cmake.in
@@ -8,7 +8,7 @@ get_filename_component(YAML_CPP_CMAKE_DI
set(YAML_CPP_INCLUDE_DIR "@CONFIG_INCLUDE_DIRS@")
# Our library dependencies (contains definitions for IMPORTED targets)
-include("${YAML_CPP_CMAKE_DIR}/yaml-cpp-targets.cmake")
+include("${YAML_CPP_CMAKE_DIR}/@YAML_TARGET@-targets.cmake")
# These are IMPORTED targets created by yaml-cpp-targets.cmake
set(YAML_CPP_LIBRARIES "@EXPORT_TARGETS@")

View File

@ -1,15 +1,15 @@
Name: yaml-cpp
Version: 0.5.3
Release: 10%{?dist}
Version: 0.6.0
Release: 1%{?dist}
Summary: A YAML parser and emitter for C++
Group: Development/Libraries
License: MIT
URL: https://github.com/jbeder/yaml-cpp
Source0: https://github.com/jbeder/yaml-cpp/archive/%{name}-%{version}.tar.gz
Patch0: yaml-cpp-static.patch
BuildRequires: cmake gcc-c++
BuildRequires: boost-devel
%description
yaml-cpp is a YAML parser and emitter in C++ written around the YAML 1.2 spec.
@ -28,24 +28,33 @@ The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%package static
Summary: Static library for %{name}
Group: Development/Libraries
License: MIT
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%description static
The %{name}-static package contains the static library for %{name}.
%prep
%setup -qn %{name}-release-%{version}
%autosetup -p1 -n %{name}-%{name}-%{version}
%build
# ask cmake to not strip binaries
%cmake . -DYAML_CPP_BUILD_TOOLS=0
make VERBOSE=1 %{?_smp_mflags}
%cmake -DYAML_CPP_BUILD_TOOLS=OFF \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_STATIC_LIBS=ON \
-DYAML_CPP_BUILD_TESTS=OFF \
./
%make_build
%install
%make_install
# Install cmake devel files
mkdir -p %{buildroot}%{_libdir}/cmake/%{name}
install -pm 0644 yaml-cpp-config{,-version}.cmake \
%{buildroot}%{_libdir}/cmake/%{name}/
%post -p /sbin/ldconfig
@ -60,11 +69,21 @@ install -pm 0644 yaml-cpp-config{,-version}.cmake \
%files devel
%{_includedir}/yaml-cpp/
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%{_libdir}/cmake/%{name}/
%{_libdir}/cmake/%{name}
%{_libdir}/pkgconfig/%{name}.pc
%files static
%license LICENSE
%{_libdir}/*.a
%{_libdir}/cmake/%{name}-static
%{_libdir}/pkgconfig/%{name}-static.pc
%changelog
* Sun Feb 11 2018 Richard Shaw <hobbes1069@gmail.com> - 0.6.0-1
- Update to 0.6.0.
- Add static library subpackage.
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.3-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
@ -88,7 +107,7 @@ install -pm 0644 yaml-cpp-config{,-version}.cmake \
* Fri Jan 27 2017 Jonathan Wakely <jwakely@redhat.com> - 0.5.3-3
- Rebuilt for Boost 1.63
* Fri Jan 27 2017 Jonathan Wakely <jwakely@redhat.com> - 0.5.3-2
- Rebuilt for Boost 1.63