summaryrefslogtreecommitdiff
path: root/libnanopb-dev.spec
blob: 0c2d28608f0e1aeeb3d07dd6f3c68d6a281e91c3 (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
# topdir: libnanopb-dev-0.4.9.2 (set by --transform in build driver)
# Self-provision note: cmake(Nanopb)/cmake(nanopb) is PROVIDED by this package
# (via extra/nanopb-config.cmake installed to %%{_libdir}/cmake/nanopb/), NOT required.
# The find_package(Nanopb) calls in source exist only in extra/FindNanopb.cmake
# (the find-module this package ships for consumers), build-tests/ and examples/
# (not built with -DBUILD_TESTING=OFF). Root CMakeLists.txt never calls it.

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

License:        Zlib
URL:            https://github.com/nanopb/nanopb
Source0:        https://github.com/nanopb/nanopb/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz

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

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

Requires:       protobuf-compiler
Requires:       python3-protobuf

# This package provides the CMake package 'nanopb' (config-mode) and the
# legacy find-module, so advertise them to satisfy cmake(Nanopb) consumers.
Provides:       cmake(Nanopb) = %{version}-%{release}
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 provides the C runtime static library (libprotobuf-nanopb.a),
header files, CMake integration files, and the Python-based code generator
(protoc plugin) used to compile .proto definitions into nanopb C source.

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

%build
%cmake \
    -DBUILD_SHARED_LIBS=OFF \
    -DBUILD_STATIC_LIBS=ON \
    -DBUILD_TESTING=OFF \
    -Dnanopb_BUILD_RUNTIME=ON \
    -Dnanopb_BUILD_GENERATOR=ON \
    -Dnanopb_PYTHON_INSTDIR_OVERRIDE=%{python3_sitelib}
%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
* Mon Sep 28 2026 openEuler Builder <builder@openeuler.org> - 0.4.9.2-2
- Fix %build: replace %cmake_build/%cmake_install with %make_build/%make_install
  (%cmake macro runs in-place but %cmake_build expects %{_target_platform} dir)
- Add %{_bindir}/nanopb_generator.py to %files (installed by cmake, was missing)

* Mon Sep 28 2026 openEuler Builder <builder@openeuler.org> - 0.4.9.2-1
- Initial package