summaryrefslogtreecommitdiff
path: root/libmodbus-devel.spec
blob: a7e87d1658a21764a8131ec8958af4fad631b4d5 (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
# ---------------------------------------------------------------------------
# 上游项目:libmodbus (https://github.com/stephane/libmodbus)
#
# 包名说明:libmodbus-devel 是 rosdep key "libmodbus-dev" 在 RHEL/openEuler 系的
#   正确二进制名(rosdep base.yaml: fedora/rhel -> libmodbus-devel),由 ROS 包
#   at-sonde-ros-driver 声明(BuildRequires/Requires: libmodbus-devel)。
#   上游项目自身名为 libmodbus(AC_INIT([libmodbus]),pkg-config 名 "modbus")。
#   为使依赖名 libmodbus-devel 在 openEuler 官方源/ROS SIG/COPR 中有真实
#   provider,本 SRPM 以该名字构建:运行时共享库 + 开发文件同包交付,
#   并额外 Provides: libmodbus 供运行期依赖方解析。
#
# topdir(源码解压后顶层目录;构建驱动 --transform 已统一为 <name>-<version>):
#   libmodbus-devel-3.2.0
# ---------------------------------------------------------------------------

Name:           libmodbus-devel
Version:        3.2.0
Release:        1%{?dist}
Summary:        Modbus protocol library (runtime and development files)

License:        LGPL-2.1-or-later
URL:            https://github.com/stephane/libmodbus
Source0:        https://github.com/stephane/libmodbus/archive/refs/tags/v%{version}.tar.gz#/libmodbus-devel-%{version}.tar.gz

BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  make
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool

Provides:       libmodbus = %{version}-%{release}

%description
libmodbus is a free software library to send/receive data with a device which
respects the Modbus protocol. This library can use a serial port or an Ethernet
connection.

This package ships both the shared library (libmodbus.so.5) and the development
files (C headers, pkg-config file and linker symlink) needed to build software
against libmodbus. It provides the rosdep dependency "libmodbus-devel"
(rosdep key libmodbus-dev) used by ROS packages such as at-sonde-ros-driver.

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

%build
# 上游 git 归档不含生成的 configure 脚本,需先 autogen(等价于 ./autogen.sh)
autoreconf -fiv
%configure --disable-static --disable-tests
%make_build

%install
%make_install
# libtool 归档不属于本包
find %{buildroot} -type f -name '*.la' -delete
# 上游 dist_doc_DATA 安装到 %{_docdir}/libmodbus(取自 AC_INIT 包名),
# 改由 %doc 宏按本包名安装,避免游离未打包文件
rm -rf %{buildroot}%{_docdir}/libmodbus

%ldconfig_scriptlets

%files
%license COPYING.LESSER
%doc AUTHORS NEWS.md README.md
%{_libdir}/libmodbus.so.*
%{_libdir}/libmodbus.so
%dir %{_includedir}/modbus
%{_includedir}/modbus/*.h
%{_libdir}/pkgconfig/libmodbus.pc

%changelog
* Mon Sep 21 2026 AI Importer <ai-importer@openeuler.org> - 3.2.0-1
- Initial package for openEuler, built from upstream libmodbus v3.2.0