# 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 %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 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 - 0.20241207-1 - Initial package