public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/librealsense] rawhide: fix:cmake exprots to use system lz4
@ 2026-07-10 14:54 Sayan Paul
  0 siblings, 0 replies; only message in thread
From: Sayan Paul @ 2026-07-10 14:54 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/librealsense
            Branch : rawhide
            Commit : 859b8f914e332749a9d61a85a5da8c01176fe779
            Author : Sayan Paul <paul.sayan@gmail.com>
            Date   : 2026-06-27T01:03:25+05:30
            Stats  : +32/-3 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/librealsense/c/859b8f914e332749a9d61a85a5da8c01176fe779?branch=rawhide

            Log:
            fix:cmake exprots to use system lz4

Switch rs_lz4 to external lz4 via pkg-config and stop exporting a reference to /usr/lib64/librs_lz4.a

Signed-off-by: Sayan Paul <paul.sayan@gmail.com>

---
diff --git a/librealsense.spec b/librealsense.spec
index 7e35c82..1660af6 100644
--- a/librealsense.spec
+++ b/librealsense.spec
@@ -25,6 +25,8 @@ Patch5:         librealsense.use-system-json.patch
 Patch6:         librealsense.utf8-string-literals.patch
 # Fix pybind11 3.x incompatibility: def_property does not support keep_alive
 Patch7:         librealsense.fix-pybind11-keep-alive.patch
+# Use system lz4 via pkg-config instead of bundled static library
+Patch8:         librealsense.use-system-lz4.patch
 
 BuildRequires:  cmake
 BuildRequires:  cmake(glfw3)
@@ -42,6 +44,7 @@ BuildRequires:  pkgconfig(libudev)
 BuildRequires:  pybind11-devel
 BuildRequires:  python3-devel
 BuildRequires:  python3-setuptools
+BuildRequires:  pkgconfig(liblz4)
 
 Provides:       librealsense2 = %{version}-%{release}
 
@@ -105,7 +108,8 @@ with %{name}.
   -DCMAKE_INSTALL_LIBDIR=%{_libdir} \
   -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} \
   -DBUILD_PYTHON_BINDINGS:bool=true \
-  -DPYTHON_EXECUTABLE=%{python3}
+  -DPYTHON_EXECUTABLE=%{python3} \
+  -DUSE_EXTERNAL_LZ4=ON
 %cmake_build
 
 sed -i "s:/usr/local/bin:%{_datadir}/realsense:" config/*
@@ -123,8 +127,6 @@ popd
 %install
 %cmake_install
 
-rm -f %{buildroot}/%{_libdir}/librs_lz4.a
-
 mkdir -p %{buildroot}/%{_udevrulesdir}
 install -p -m644 config/99-realsense-libusb.rules %{buildroot}/%{_udevrulesdir}
 mkdir -p %{buildroot}/%{_datadir}/realsense

diff --git a/librealsense.use-system-lz4.patch b/librealsense.use-system-lz4.patch
new file mode 100644
index 0000000..adbfb75
--- /dev/null
+++ b/librealsense.use-system-lz4.patch
@@ -0,0 +1,27 @@
+Author: Sayan Paul <paul.sayan@gmail.com>
+Date:   Thu Jun 26 10:00:00 2026 +0530
+
+    Use system lz4 via pkg-config instead of bundled static library
+
+    Fedora's lz4-devel provides pkg-config (liblz4.pc) but not cmake
+    config files. Use pkg_check_modules to find system lz4 when
+    USE_EXTERNAL_LZ4 is enabled, and link via plain libraries so exported
+    CMake targets do not depend on PkgConfig::LZ4 in downstream consumers.
+
+diff --git a/third-party/realsense-file/CMakeLists.txt b/third-party/realsense-file/CMakeLists.txt
+--- a/third-party/realsense-file/CMakeLists.txt
++++ b/third-party/realsense-file/CMakeLists.txt
+@@ -16,9 +16,11 @@
+         )
+ 
+ if(USE_EXTERNAL_LZ4)
+-    find_package(lz4 REQUIRED)
++    find_package(PkgConfig REQUIRED)
++    pkg_check_modules(LZ4 REQUIRED liblz4)
+     add_library(rs_lz4 INTERFACE)
+-    target_link_libraries(rs_lz4 INTERFACE lz4::lz4)
++    target_include_directories(rs_lz4 INTERFACE ${LZ4_INCLUDE_DIRS})
++    target_link_libraries(rs_lz4 INTERFACE ${LZ4_LINK_LIBRARIES})
+ else()
+     add_library(rs_lz4 STATIC ${LZ4_DIR}/lz4.c ${LZ4_DIR}/lz4.h)
+     target_include_directories(rs_lz4 PUBLIC "$<BUILD_INTERFACE:${LZ4_DIR}>")

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-10 14:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-10 14:54 [rpms/librealsense] rawhide: fix:cmake exprots to use system lz4 Sayan Paul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox