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
134
135
136
137
138
139
140
|
# topdir: EpollShim-0.20241207
%global debug_package %{nil}
Name: EpollShim
Version: 0.20241207
Release: 1%{?dist}
Summary: Small epoll implementation using kqueue
License: MIT
URL: https://github.com/jiixyj/epoll-shim
Source0: https://github.com/jiixyj/epoll-shim/archive/18159584bb3d17e601b9315a7398ace018251bdc.tar.gz#/EpollShim-%{version}.tar.gz
Group: Development/Libraries
Packager: openEuler Builder <builder@openeuler.org>
%description
epoll-shim is a small library that implements epoll on top of kqueue.
On Linux, where epoll is natively available, this package provides
compatibility headers and build integration files for cross-platform
projects that detect epoll-shim via pkg-config or CMake find_package.
%package devel
Summary: Development files for %{name}
Group: Development/Libraries
Packager: openEuler Builder <builder@openeuler.org>
Provides: %{name}-static = %{version}-%{release}
Provides: epoll-shim-devel = %{version}-%{release}
Provides: pkgconfig(epoll-shim)
Provides: cmake(epoll-shim)
%description devel
Header files, pkgconfig, and CMake configuration for %{name}.
On Linux, epoll is natively available; this package provides the
shim headers and build integration files for cross-platform projects
that unconditionally detect epoll-shim.
%prep
%autosetup -n %{name}-%{version} -p1
%build
# On Linux, epoll is natively available. epoll-shim's CMakeLists.txt
# creates INTERFACE-only targets (no .so) and returns early, skipping
# all install rules. No compilation is needed — the library code uses
# kqueue which is BSD/macOS-only.
%install
# CMake install is a no-op on Linux (early return in CMakeLists.txt).
# Manually install headers, pkgconfig, and CMake config files.
mkdir -p %{buildroot}%{_includedir}/libepoll-shim/sys
mkdir -p %{buildroot}%{_includedir}/libepoll-shim/epoll-shim/detail
mkdir -p %{buildroot}%{_libdir}/pkgconfig
mkdir -p %{buildroot}%{_libdir}/cmake/epoll-shim
# Install headers (substitute @POLLRDHUP_VALUE@ with 0x2000 on Linux)
# On Linux, HAVE_EVENTFD and HAVE_TIMERFD are true, so sys/eventfd.h
# and sys/timerfd.h are not installed (Linux provides them natively).
sed 's/@POLLRDHUP_VALUE@/0x2000/g' include/sys/epoll.h \
> %{buildroot}%{_includedir}/libepoll-shim/sys/epoll.h
install -p -m 644 include/sys/signalfd.h \
%{buildroot}%{_includedir}/libepoll-shim/sys/signalfd.h
install -p -m 644 include/epoll-shim/detail/common.h \
%{buildroot}%{_includedir}/libepoll-shim/epoll-shim/detail/common.h
install -p -m 644 include/epoll-shim/detail/poll.h \
%{buildroot}%{_includedir}/libepoll-shim/epoll-shim/detail/poll.h
install -p -m 644 include/epoll-shim/detail/read.h \
%{buildroot}%{_includedir}/libepoll-shim/epoll-shim/detail/read.h
install -p -m 644 include/epoll-shim/detail/write.h \
%{buildroot}%{_includedir}/libepoll-shim/epoll-shim/detail/write.h
# Create pkgconfig files (empty Libs since epoll is native on Linux)
cat > %{buildroot}%{_libdir}/pkgconfig/epoll-shim.pc << PCEOF
prefix=/usr
exec_prefix=\${prefix}
libdir=\${exec_prefix}/%{_lib}
includedir=\${prefix}/include
Name: epoll-shim
URL: https://github.com/jiixyj/epoll-shim
Description: Small epoll implementation using kqueue
Version: %{version}
Cflags: -I\${includedir}/libepoll-shim
PCEOF
cat > %{buildroot}%{_libdir}/pkgconfig/epoll-shim-interpose.pc << PCEOF
prefix=/usr
exec_prefix=\${prefix}
libdir=\${exec_prefix}/%{_lib}
includedir=\${prefix}/include
Name: epoll-shim-interpose
URL: https://github.com/jiixyj/epoll-shim
Description: Small epoll implementation using kqueue (interposing wrapper)
Version: %{version}
Requires: epoll-shim
Cflags: -I\${includedir}/libepoll-shim -DEPOLL_SHIM_DISABLE_WRAPPER_MACROS
PCEOF
# Create CMake config files (INTERFACE IMPORTED targets for Linux)
cat > %{buildroot}%{_libdir}/cmake/epoll-shim/epoll-shim-config.cmake << 'CMEOF'
# epoll-shim CMake config for Linux (INTERFACE-only, epoll is native)
include("${CMAKE_CURRENT_LIST_DIR}/epoll-shim-targets.cmake")
CMEOF
cat > %{buildroot}%{_libdir}/cmake/epoll-shim/epoll-shim-targets.cmake << 'CMEOF'
# On Linux, epoll is natively available. These are INTERFACE IMPORTED
# targets providing include directories for cross-platform compatibility.
set(_IMPORT_PREFIX "/usr")
if(NOT TARGET epoll-shim::epoll-shim)
add_library(epoll-shim::epoll-shim INTERFACE IMPORTED)
set_target_properties(epoll-shim::epoll-shim PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/libepoll-shim")
endif()
if(NOT TARGET epoll-shim::epoll-shim-interpose)
add_library(epoll-shim::epoll-shim-interpose INTERFACE IMPORTED)
set_target_properties(epoll-shim::epoll-shim-interpose PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/libepoll-shim"
INTERFACE_COMPILE_DEFINITIONS "EPOLL_SHIM_DISABLE_WRAPPER_MACROS")
endif()
CMEOF
cat > %{buildroot}%{_libdir}/cmake/epoll-shim/epoll-shim-config-version.cmake << 'CMEOF'
set(PACKAGE_VERSION "0.20241207")
set(PACKAGE_VERSION_EXACT FALSE)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
set(PACKAGE_VERSION_UNSUITABLE FALSE)
CMEOF
%files devel
%license LICENSE
%doc README.md
%{_includedir}/libepoll-shim/
%{_libdir}/pkgconfig/epoll-shim.pc
%{_libdir}/pkgconfig/epoll-shim-interpose.pc
%{_libdir}/cmake/epoll-shim/
%changelog
* Wed Sep 23 2026 openEuler Builder <builder@openeuler.org> - 0.20241207-1
- Initial package
|