Initialize for libcbor

This commit is contained in:
zyppe 2024-02-09 18:58:32 +08:00
commit bd7b126a6b
6 changed files with 4563 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
libcbor-0.5.0.tar.gz

1
.libcbor.metadata Normal file
View file

@ -0,0 +1 @@
55c9a23225112fc222aa2d7f5537b6324459628fc4c718787c962bc44cb0e910 libcbor-0.5.0.tar.gz

View file

@ -0,0 +1,44 @@
https://github.com/PJK/libcbor/pull/72
From 965d41b53d47d1bde4a4902c512ce64462fb920f Mon Sep 17 00:00:00 2001
From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
Date: Sun, 7 Oct 2018 05:23:07 +0200
Subject: [PATCH] Do not build two shared libraries
Without this patch, when building with make -j1
cmake would create and install two shared libraries
libcbor.so and libcbor.so.0.0.0
instead of creating libcbor.so as a symlink.
This broke verification of reproducible builds.
See https://reproducible-builds.org/ for why this matters.
Also, (like before) do not install libcbor.a
because static linking is bad for maintainability
(all programs have to be re-built with fixed libraries)
---
src/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: libcbor-0.5.0/src/CMakeLists.txt
===================================================================
--- libcbor-0.5.0.orig/src/CMakeLists.txt
+++ libcbor-0.5.0/src/CMakeLists.txt
@@ -11,7 +11,7 @@ if (NOT DEFINED CMAKE_MACOSX_RPATH)
set(CMAKE_MACOSX_RPATH 0)
endif()
-add_library(cbor ${SOURCES})
+add_library(cbor STATIC ${SOURCES})
add_library(cbor_shared SHARED ${SOURCES})
set_target_properties(cbor_shared PROPERTIES OUTPUT_NAME cbor VERSION "0.0.0" SOVERSION 0)
@@ -20,7 +20,7 @@ configure_file(libcbor.pc.in libcbor.pc
#http://www.cmake.org/Wiki/CMake:Install_Commands
-install(TARGETS cbor cbor_shared
+install(TARGETS cbor_shared
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION bin)

4378
libcbor.1 Normal file

File diff suppressed because it is too large Load diff

13
libcbor.changes Normal file
View file

@ -0,0 +1,13 @@
* Tue Apr 5 2022 pgajdos@suse.com
- do not build manual page for 15sp4, it does not succeed
[bsc#1197743]
- added sources
+ libcbor.1
* Fri Jun 25 2021 bwiedemann@suse.com
- Add libcbor-0.5.0-fix-lib.patch to not build shared lib twice
and make package build reproducible (boo#1102408)
* Fri Sep 28 2018 jengelh@inai.de
- 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

126
libcbor.spec Normal file
View file

@ -0,0 +1,126 @@
#
# spec file for package libcbor
#
# Copyright (c) 2022-2023 ZhuningOS
#
%define sover 0
%define lname libcbor%{sover}
# in 15sp4, the doc build is unsuccessful
# [ 10s] updating environment: [new config] 22 added, 0 changed, 0 removed
# [ 10s] reading sources... [ 4%] api
# [ 10s] reading sources... [ 9%] api/decoding
# [ 10s] /usr/lib/python3.6/site-packages/sphinx/util/docutils.py:285: RemovedInSphinx30Warning: function based directive support is now deprecated. Use class based directive instead.
# [ 10s] RemovedInSphinx30Warning)
# [ 10s]
# [ 10s] Exception occurred:
# [ 10s] File "/usr/lib/python3.6/site-packages/sphinx/domains/cpp.py", line 3801, in describe_signature
# [ 10s] assert self.directiveType in ('class', 'struct')
# [ 10s] AssertionError
# [ 10s] The full traceback has been saved in /tmp/sphinx-err-tiyhezax.log, if you want to report the issue to the developers.
# [ 10s] Please also report this if it was a user error, so that a better error message can be provided next time.
# [ 10s] A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
# [ 10s] make: *** [Makefile:131: man] Error 2
# [ 10s] make: Leaving directory '/home/abuild/rpmbuild/BUILD/libcbor-0.9.0/doc'
# [ 10s] error: Bad exit status from /var/tmp/rpm-tmp.0BVyVe (%build)
#
# this does not happen on e. g. 15sp3 or TW currently
%if 0%{?sle_version} == 150400
%define build_man 0
%else
%define build_man 1
%endif
Name: libcbor
Version: 0.5.0
Release: 150100.4.6.1
Summary: Library for parsing Concise Binary Object Representation (CBOR)
License: MIT
Group: Development/Libraries/C and C++
URL: http://libcbor.org
Source0: https://github.com/PJK/libcbor/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: libcbor.1
Patch0: libcbor-0.5.0-fix-lib.patch
BuildRequires: cmake
BuildRequires: doxygen
BuildRequires: libcmocka-devel
BuildRequires: gcc-c++
BuildRequires: pkg-config
%if %{build_man}
BuildRequires: python3-breathe
BuildRequires: python3-Sphinx
BuildRequires: python3-Sphinx-doc
BuildRequires: python3-sphinx_rtd_theme
BuildRequires: python3-packaging
BuildRequires: python3-ujson
%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 -p1
sed -i 's|${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig|${CMAKE_INSTALL_LIBDIR}/pkgconfig|' src/CMakeLists.txt
%build
%if %{build_man}
mkdir -p doc/build/doxygen
doxygen
make %{?_smp_mflags} -C doc man
%endif
%cmake .. -DCMAKE_BUILD_TYPE=Release -DWITH_TESTS=ON
make %{?_smp_mflags}
%install
%cmake_install
mkdir -p %{buildroot}%{_mandir}/man1
%if %{build_man}
cp doc/build/man/* %{buildroot}%{_mandir}/man1
%else
cp %{SOURCE1} %{buildroot}%{_mandir}/man1
%endif
%post -n %{lname} -p /sbin/ldconfig
%postun -n %{lname} -p /sbin/ldconfig
%files -n %{lname}
%doc README.md
%{_mandir}/*/*
%{_libdir}/libcbor.so.%{sover}
%{_libdir}/libcbor.so.%{sover}.?.?
%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
%license LICENSE.md
%changelog