summaryrefslogtreecommitdiff
path: root/ros-humble-cwiid.spec
blob: bc30f03d9c51c25e5d8aef440873bd65098911c1 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# topdir: ros-humble-cwiid-0.6.00
# 上游 abstrakraft/cwiid 为 autotools(configure.ac + Makefile.in 模板)C 项目,
# 无 release tag,版本号取自 configure.ac 的 AC_INIT(CWiid,0.6.00)。
# 本包为 ROS humble 依赖闭包中的第三方系统级蓝牙库/工具,按普通 C 包规范安装到 /usr。
# python 模块因 configure.ac 使用 python2 语法(print sys.version[:3])不兼容 python3,故 --without-python 跳过。

Name:           ros-humble-cwiid
Version:        0.6.00
Release:        6%{?dist}
Summary:        CWiid Wiimote Interface — libcwiid and tools (wmgui/wminput/lswm)

License:        GPLv2
URL:            https://github.com/abstrakraft/cwiid
Source0:        https://github.com/abstrakraft/cwiid/archive/fadf11e89b579bcc0336a0692ac15c93785f3f82.tar.gz#/ros-humble-cwiid-0.6.00.tar.gz
# defs.mak.in 硬编码 CFLAGS 覆盖 RPM optflags(含 -specs=generic-hardened-cc1 的 -fPIE),
# 而 LDFLAGS 未被覆盖(RPM -specs=generic-hardened-ld 启用 PIE 链接),
# 导致 aarch64 编译产物无 PIC 但链接 PIE → R_AARCH64_ADR_PREL_PG_HI21 重定位失败。
# 修复:在 CFLAGS 定义中前置 @CFLAGS@(configure 保存的 RPM optflags)。
Patch0:         cwiid-cflags.patch
# wmgui/main.c:445 将非字面量 message 直接传给 gtk_message_dialog_new 的
# 格式串参数,触发 -Werror=format-security(RPM optflags 含 -Werror=format-security)。
# 修复:改用 "%s", message 显式格式串。
Patch1:         cwiid-format-security.patch
# wmdemo/Makefile.in 的 LDLIBS 仅含 -lcwiid,缺 -lbluetooth;wmdemo.c 调用
# str2ba()(libbluetooth 符号)。generic-hardened-ld 的 -z,now 禁止
# 传递性 DSO 解析,导致 "DSO missing from command line" 链接失败。
# 修复:与 wmgui/lswm/wminput 一致,LDLIBS 追加 -lbluetooth。
Patch2:         cwiid-wmdemo-bluetooth.patch

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

BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  make
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  flex
BuildRequires:  bison
BuildRequires:  bluetooth-devel
BuildRequires:  gtk2-devel
BuildRequires:  glib2-devel
BuildRequires:  kernel-headers

%description
CWiid provides a C library (libcwiid) and a set of tools to interface with
the Nintendo Wiimote over Bluetooth:
  * libcwiid  — wiimote C API (shared library).
  * wmgui     — GTK GUI for inspecting the wiimote.
  * wminput   — event/joystick/mouse driver for the wiimote (with plugins).
  * lswm      — list wiimote devices.
The Python binding is disabled in this build (upstream uses Python 2 syntax
incompatible with openEuler's Python 3).

%package devel
Summary:        Development files for %{name}
Group:          Development/Libraries
Packager:       openEuler Builder <builder@openeuler.org>
Requires:       %{name} = %{version}-%{release}
Requires:       bluetooth-devel

%description devel
Header files, static library, development symlink and pkg-config file
for %{name}.

# 用 %setup + 显式 %patch -p1 替代 %autosetup:本 chroot 的 rpm 中
# %autosetup 展开后调用 patch 不带 -p 参数(-p0),对 git diff 多层路径
# (a/wmgui/main.c)报 "No file to patch";单层路径(a/defs.mak.in)靠
# patch 智能重试偶然成功。显式 -p1 剥掉 a//b/ 前缀,两层 patch 均可靠应用。
%prep
%setup -n %{name}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1

%build
# 源码仅含 configure.ac,需先生成 configure 脚本
autoreconf -if
%configure \
    --without-python \
    --with-cwiid-config-dir=%{_sysconfdir}/cwiid \
    --with-cwiid-plugins-dir=%{_libdir}/cwiid/plugins
# LDCONFIG=true 抑制 install_shared 在构建环境调用 ldconfig(DESTDIR 下无意义且会失败)
%make_build LDCONFIG=true

%install
%make_install LDCONFIG=true

%files
%license COPYING
%doc README NEWS ChangeLog AUTHORS
# doc/Makefile.in 安装 Xmodmap 与 wminput.list 到 $(docdir)=/usr/share/doc/cwiid
# (autoconf PACKAGE_TARNAME 取 AC_INIT(CWiid) → "cwiid",非 RPM 包名),
# 与 %doc 宏的 /usr/share/doc/ros-humble-cwiid 不同,需显式声明。
%{_defaultdocdir}/cwiid/
%{_libdir}/libcwiid.so.1
%{_libdir}/libcwiid.so.1.0
%{_bindir}/wmgui
%{_bindir}/wminput
%{_bindir}/lswm
%{_libdir}/cwiid/
%config(noreplace) %{_sysconfdir}/cwiid/
%{_mandir}/man1/wmgui.1*
%{_mandir}/man1/wminput.1*

%files devel
%{_includedir}/cwiid.h
%{_libdir}/libcwiid.so
%{_libdir}/libcwiid.a
%{_libdir}/pkgconfig/cwiid.pc

%changelog
* Thu Oct 22 2026 openEuler Builder <builder@openeuler.org> - 0.6.00-6
- Fix "Installed (but unpackaged) file(s)": package /usr/share/doc/cwiid/
  (Xmodmap, wminput.list installed by doc/Makefile.in to autoconf docdir).

* Thu Oct 22 2026 openEuler Builder <builder@openeuler.org> - 0.6.00-5
- Fix wmdemo link failure: add -lbluetooth to LDLIBS in wmdemo/Makefile.in
  (str2ba symbol from libbluetooth; -z,now forbids transitive DSO resolution).

* Thu Oct 22 2026 openEuler Builder <builder@openeuler.org> - 0.6.00-4
- Fix Patch1 apply failure ("No file to patch"): replace %autosetup with
  explicit %setup + %patch -p1; this chroot's rpm expands %autosetup to
  patch without -p, which fails on multi-path git diffs (a/wmgui/main.c).

* Thu Oct 22 2026 openEuler Builder <builder@openeuler.org> - 0.6.00-3
- Fix -Werror=format-security in wmgui/main.c: use "%s" format literal for gtk_message_dialog_new.

* Thu Oct 22 2026 openEuler Builder <builder@openeuler.org> - 0.6.00-2
- Fix aarch64 PIE link failure: include @CFLAGS@ (RPM optflags with -fPIE) in defs.mak.in.

* Thu Oct 22 2026 openEuler Builder <builder@openeuler.org> - 0.6.00-1
- Initial package for openEuler (ROS humble dependency closure).