# # spec file for package libcbor # # Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define socurrent 0 %define sorevision 11 %define soage 0 %define lname libcbor%{socurrent}_%{sorevision} %global flavor %{nil} %if "%{flavor}" == "doc" # in 15sp4/sp5/sp6, the doc fails to build with an assert in sphinx %if 0%{?sle_version} >= 150400 && 0%{?sle_version} <= 150600 %define build_man 0 %else %define build_man 1 %endif %else %define build_man 0 %endif %if "%{flavor}" == "doc" Name: libcbor-doc %else Name: libcbor %endif Version: 0.11.0 Release: 3.3 Summary: Library for parsing Concise Binary Object Representation (CBOR) License: MIT Group: Development/Libraries/C and C++ URL: https://github.com/PJK/libcbor Source0: https://github.com/PJK/libcbor/archive/v%{version}.tar.gz Source1: libcbor.3 %if %{build_man} BuildRequires: doxygen BuildRequires: python3-Sphinx BuildRequires: python3-breathe BuildRequires: python3-sphinx_rtd_theme %else BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: libcmocka-devel BuildRequires: ninja %endif %description libcbor is a C99 library for parsing and generating CBOR (RFC 7049), a general-purpose schema-less binary data format. It supports flexible memory management, UTF-8, streams & incremental processing, and has a layered architecture. %package -n %{lname} Summary: Library for parsing Concise Binary Object Representation (CBOR) Group: System/Libraries %description -n %{lname} libcbor is a C99 library for parsing and generating CBOR (RFC 7049), a general-purpose schema-less binary data format. It supports flexible memory management, UTF-8, streams & incremental processing, and has a layered architecture. %package devel Summary: Development files for libcbor Group: Development/Libraries/C and C++ Requires: %{lname} = %{version} %description devel libcbor is a C library for parsing and generating CBOR. The libcbor-devel contains libraries and header files for libcbor. %prep %autosetup -n libcbor-%{version} sed -i 's|${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig|${CMAKE_INSTALL_LIBDIR}/pkgconfig|' src/CMakeLists.txt %build export CFLAGS="%(echo %{optflags}) -Wno-return-type" export CXXFLAGS="$CFLAGS" %if %{build_man} %make_build -C doc man %else %define __builder ninja %cmake .. -DCMAKE_BUILD_TYPE=Release -DWITH_TESTS=ON %cmake_build %endif %install %if "%{flavor}" == "doc" mkdir -p %{buildroot}%{_mandir}/man3 %if %{build_man} cp doc/build/man/*.3 %{buildroot}%{_mandir}/man3 %else cp %{SOURCE1} %{buildroot}%{_mandir}/man3 %endif %else %cmake_install %endif %post -n %{lname} -p /sbin/ldconfig %postun -n %{lname} -p /sbin/ldconfig %if "%{flavor}" == "doc" %files %doc CHANGELOG.md README.md %{_mandir}/*/* %else %files -n %{lname} %license LICENSE.md %{_libdir}/libcbor.so.%{socurrent}.%{sorevision} %{_libdir}/libcbor.so.%{socurrent}.%{sorevision}.%{soage} %files devel %{_includedir}/cbor.h %dir %{_includedir}/cbor %{_includedir}/cbor/*.h %dir %{_includedir}/cbor/internal %{_includedir}/cbor/internal/*.h %{_libdir}/libcbor.so %{_libdir}/pkgconfig/libcbor.pc %{_libdir}/cmake %endif %changelog * Tue Jan 21 2025 Steve Kowalik - Explicitly BuildRequire sphinx_rtd_theme. * Mon Sep 16 2024 Eric Schirra - The doc fails to build with an assert in sphinx in 15sp6 also. * Tue Apr 2 2024 pgajdos@suse.com - version update to 0.11.0 * Updated documentation to refer to RFC 8949 * Improvements to cbor_describe Bytestring data will now be printed as well by akallabeth Formatting consistency and clarity improvements * Fix cbor_string_set_handle not setting the codepoint count * BREAKING: cbor_load will no longer fail on input strings that are well-formed but not valid UTF-8 If you were relying on the validation, please check the result using cbor_string_codepoint_count instead * BREAKING: All decoders like cbor_load and cbor_stream_decode will accept all well-formed tag values (bug discovered by dskern-github) Previously, decoding of certain values would fail with CBOR_ERR_MALFORMATED or CBOR_DECODER_ERROR This also makes decoding symmetrical with serialization, which already accepts all values * Mon Feb 27 2023 Paolo Stivanin - Update to 0.10.2: * Fixed minor test bug causing failures for x86 Linux * Made tests platform-independent * Wed Feb 22 2023 Antonio Larrosa - Merge change from SLE15 SP4 made by pgajdos@suse.com on Tue Apr 5 14:36:56 UTC 2022: - do not build manual page for 15sp4, it does not succeed [bsc#1197743] - added sources + libcbor.3 * Mon Jan 16 2023 Paolo Stivanin - Update to 0.10.1: * BREAKING: Fix cbor_copy leaking memory and creating invalid items when the allocator fails. * BREAKING: Improved half-float encoding for denormalized numbers. [#208] * Make the buffer_size optional in cbor_serialize_alloc [#205] * Fix a potential memory leak when the allocator fails during array or map decoding [#224] * Fix a memory leak when the allocator fails when adding chunks to indefinite bytestrings. * Fix a memory leak when the allocator fails when adding chunks to indefinite strings * Fix cbor_build_tag illegal memory behavior when the allocator fails * Add a new cbor_serialized_size API * Reworked cbor_serialize_alloc to allocate the exact amount of memory necessary upfront * Fri Aug 26 2022 Thorsten Kukuk - Install manual page in the correct man section * Tue Dec 7 2021 Dirk Müller - fix duplicate src package name issue on multibuild * Sun Dec 5 2021 Dirk Müller - update to 0.9.0: * Improved pkg-config paths handling * Use explicit math.h linkage * BREAKING: Fixed handling of items that exceed the host size_t range * cbor_decode explicitly checks size to avoid overflows (previously broken, potentially resulting in erroneous decoding on affected systems) - split docs into multibuild flavor to avoid build cycle via openssh<-> python-pyOpenSSL <-> python-cryptography * Tue Sep 22 2020 Ismail Dönmez - Update to version 0.8.0 * BREAKING: Fix cbor_tag_item not increasing the reference count on the tagged item reference it returns * BREAKING: CBOR_DECODER_EBUFFER removed from cbor_decoder_status + cbor_stream_decode will set CBOR_DECODER_NEDATA instead if the input buffer is empty * Fix cbor_stream_decode to set cbor_decoder_result.required to the minimum number of input bytes necessary to receive the next callback (as long as at least one byte was passed) * Fixed several minor manpage issue * Mon May 25 2020 Ismail Dönmez - Update to version 0.7.0 * Too many changes to list, see included CHANGELOG.md file - 0.6.0 includes patch by bwiedemann@suse.com to not build shared lib twice and make package build reproducible (boo#1102408, gh#PJK/libcbor#72) * Thu Jan 2 2020 Torsten Gruner - remove documentation build with doxygen * Fri Sep 28 2018 Jan Engelhardt - Rename %%SONAME to %%sover to better reflect its use. - Expand summary, compact and trim bias from description. * Thu Apr 26 2018 t.gruner@katodev.de - Initial release 0.5.0