libcbor/libcbor.spec
2024-02-09 18:58:32 +08:00

126 lines
4.2 KiB
RPMSpec

#
# 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