summaryrefslogtreecommitdiff
path: root/libnanopb-dev.spec
blob: 8c6e2ba5dc2b2ef1545b14448ec2e69e0fefa5c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# topdir: libnanopb-dev-0.4.9.2
# Self-provides cmake(Nanopb): the installed nanopb-config.cmake makes
# find_package(Nanopb) work for downstream consumers. find_package(Nanopb)
# seen by the dependency scanner only comes from examples/ and build-tests/
# (consumer CMakeLists), never from the library's own build.

%global debug_package %{nil}

Name:           libnanopb-dev
Version:        0.4.9.2
Release:        2%{?dist}
Summary:        Protocol Buffers for embedded systems - development files

License:        Zlib
URL:            https://github.com/nanopb/nanopb
Source0:        https://github.com/nanopb/nanopb/archive/0f6d088e777a33dd7b54297f137ef10d745c5da8.tar.gz#/libnanopb-dev-%{version}.tar.gz

Group:          Development/Libraries
Packager:       openEuler Builder <builder@openeuler.org>

BuildRequires:  cmake
BuildRequires:  gcc
BuildRequires:  make
BuildRequires:  protobuf-compiler
BuildRequires:  python3-devel

Requires:       python3
Requires:       python3-protobuf
Requires:       protobuf-compiler

# This package installs nanopb-config.cmake, so it provides the cmake(Nanopb)
# capability that downstream find_package(Nanopb) consumers look for.
Provides:       cmake(Nanopb) = %{version}-%{release}

%description
Nanopb is a small code-size Protocol Buffers implementation in ANSI C. It is
especially suitable for use in microcontrollers, but fits any memory
restricted system.

This package contains the C runtime headers, the static library
(libprotobuf-nanopb.a), the CMake integration files (nanopb-config.cmake) and
the nanopb code generator, which converts .proto definitions into .pb.c/.pb.h
source files.

%prep
%autosetup -n %{name}-%{version}

%build
%cmake \
    -DBUILD_SHARED_LIBS=OFF \
    -DBUILD_STATIC_LIBS=ON \
    -Dnanopb_BUILD_RUNTIME=ON \
    -Dnanopb_BUILD_GENERATOR=ON \
    -DPython_EXECUTABLE=%{_bindir}/python3
# This chroot's %cmake performs an in-source build (writes Makefile into the
# source tree) while %cmake_build expects an out-of-source dir named
# %{_vpath_builddir} (aarch64-openEuler-linux-gnu) -> "is not a directory".
# %make_build / %make_install run against the in-source Makefile that %cmake
# actually generated, sidestepping the mismatched cmake-macros pair.
%make_build

%install
%make_install

%files
%license LICENSE.txt
%doc README.md AUTHORS.txt CHANGELOG.txt
%{_includedir}/nanopb/
%{_libdir}/libprotobuf-nanopb.a
%{_libdir}/cmake/nanopb/
%{_bindir}/nanopb_generator
%{_bindir}/nanopb_generator.py
%{_bindir}/protoc-gen-nanopb
%{python3_sitelib}/nanopb/

%changelog
* Wed Sep 23 2026 openEuler Builder <builder@openeuler.org> - 0.4.9.2-2
- Fix %build: use %make_build/%make_install against %cmake in-source Makefile
  (chroot's %cmake_build expects absent out-of-source dir)

* Wed Sep 23 2026 openEuler Builder <builder@openeuler.org> - 0.4.9.2-1
- Initial package for openEuler