diff --git a/0001-cmake-add-support-to-build-shared-libraries.patch b/0001-cmake-add-support-to-build-shared-libraries.patch new file mode 100644 index 0000000..da5c89d --- /dev/null +++ b/0001-cmake-add-support-to-build-shared-libraries.patch @@ -0,0 +1,70 @@ +From 2d7459500175dc468a58421ca1780155e32a63c0 Mon Sep 17 00:00:00 2001 +From: Ralf Habacker +Date: Wed, 9 Jul 2025 14:46:16 +0200 +Subject: [PATCH 1/2] cmake: add support to build shared libraries + +Shared libraries can be build by adding -DCMAKE_SHARED_LIBS=ON to the +cmake configure line. +--- + CMakeLists.txt | 2 ++ + common/fw/CMakeLists.txt | 2 +- + third-party/realsense-file/CMakeLists.txt | 2 +- + third-party/rsutils/CMakeLists.txt | 2 +- + third-party/rsutils/src/configure-elpp-logger.cpp | 1 + + 5 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ae063e69d..5830699fa 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -4,6 +4,8 @@ cmake_minimum_required(VERSION 3.8) + set( LRS_TARGET realsense2 ) + project( ${LRS_TARGET} LANGUAGES CXX C ) + ++option(BUILD_SHARED_LIBS "Build using shared libraries" OFF) ++ + # Allow librealsense2 and all of the nested project to include the main repo folder + set(REPO_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) + include_directories(${REPO_ROOT}) +diff --git a/common/fw/CMakeLists.txt b/common/fw/CMakeLists.txt +index f2708445e..c5db880ae 100644 +--- a/common/fw/CMakeLists.txt ++++ b/common/fw/CMakeLists.txt +@@ -17,7 +17,7 @@ set(D4XX_FW_VERSION ${CMAKE_MATCH_1}) + set(D4XX_FW_SHA1 51e37fd01132c500bb4e4af408a41f42391289a5) + set(D4XX_FW_URL "${REALSENSE_FIRMWARE_URL}/Releases/RS4xx/FW") + +-add_library(${PROJECT_NAME} STATIC empty.c) ++add_library(${PROJECT_NAME} empty.c) + + # disable link time optimization for fw by adding -fno-lto to disable -flto flag + # jammy debian has build errors without it +diff --git a/third-party/realsense-file/CMakeLists.txt b/third-party/realsense-file/CMakeLists.txt +index 9ba89a0d9..e33f96572 100644 +--- a/third-party/realsense-file/CMakeLists.txt ++++ b/third-party/realsense-file/CMakeLists.txt +@@ -20,7 +20,7 @@ + lz4/lz4.c + ) + +-add_library(${PROJECT_NAME} STATIC ++add_library(${PROJECT_NAME} + ${AllSources} + ${HEADER_FILES_ROSBAG} + ${SOURCE_FILES_ROSBAG} +diff --git a/third-party/rsutils/CMakeLists.txt b/third-party/rsutils/CMakeLists.txt +index b0fc31049..bb27360b3 100644 +--- a/third-party/rsutils/CMakeLists.txt ++++ b/third-party/rsutils/CMakeLists.txt +@@ -3,7 +3,7 @@ + cmake_minimum_required(VERSION 3.8.0) # source_group(TREE) + project( rsutils ) + +-add_library( ${PROJECT_NAME} STATIC "" ) ++add_library( ${PROJECT_NAME} "" ) + # We cannot directly interface with nlohmann_json (doesn't work on bionic) + #target_link_libraries( ${PROJECT_NAME} PUBLIC nlohmann_json ) + target_compile_features( ${PROJECT_NAME} PUBLIC cxx_std_14 ) +-- +2.50.0 + diff --git a/0002-cmake-Use-the-same-version-for-all-libraries-that-ca.patch b/0002-cmake-Use-the-same-version-for-all-libraries-that-ca.patch new file mode 100644 index 0000000..c530a2b --- /dev/null +++ b/0002-cmake-Use-the-same-version-for-all-libraries-that-ca.patch @@ -0,0 +1,39 @@ +From 3e2a2e50e2d473da991c892a39e83b0863c14c33 Mon Sep 17 00:00:00 2001 +From: Ralf Habacker +Date: Wed, 9 Jul 2025 15:10:41 +0200 +Subject: [PATCH 2/2] cmake: Use the same version for all libraries that can be + created in shared mode + +--- + third-party/realsense-file/CMakeLists.txt | 2 +- + third-party/rsutils/CMakeLists.txt | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/third-party/realsense-file/CMakeLists.txt b/third-party/realsense-file/CMakeLists.txt +index e33f96572..a53f4c37b 100644 +--- a/third-party/realsense-file/CMakeLists.txt ++++ b/third-party/realsense-file/CMakeLists.txt +@@ -34,7 +34,7 @@ + ${LZ4_INCLUDE_PATH} + ) + +-#set_target_properties(${PROJECT_NAME} PROPERTIES VERSION "${LIBVERSION}" SOVERSION "${LIBSOVERSION}") ++set_target_properties(${LRS_TARGET} PROPERTIES VERSION ${REALSENSE_VERSION_STRING} SOVERSION "${REALSENSE_VERSION_MAJOR}.${REALSENSE_VERSION_MINOR}") + + set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER Library) + +diff --git a/third-party/rsutils/CMakeLists.txt b/third-party/rsutils/CMakeLists.txt +index bb27360b3..15153a1ff 100644 +--- a/third-party/rsutils/CMakeLists.txt ++++ b/third-party/rsutils/CMakeLists.txt +@@ -8,6 +8,7 @@ add_library( ${PROJECT_NAME} "" ) + #target_link_libraries( ${PROJECT_NAME} PUBLIC nlohmann_json ) + target_compile_features( ${PROJECT_NAME} PUBLIC cxx_std_14 ) + set_target_properties( ${PROJECT_NAME} PROPERTIES FOLDER Library ) ++set_target_properties( ${PROJECT_NAME} PROPERTIES VERSION ${REALSENSE_VERSION_STRING} SOVERSION "${REALSENSE_VERSION_MAJOR}.${REALSENSE_VERSION_MINOR}") + + target_include_directories( ${PROJECT_NAME} + PUBLIC +-- +2.50.0 + diff --git a/librealsense.changes b/librealsense.changes index 548e396..8876579 100644 --- a/librealsense.changes +++ b/librealsense.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Wed Jul 9 12:02:31 UTC 2025 - Ralf Habacker + +- Build all installed libraries as shared libraries to fix a problem + when building the monado package +- Add patches: + * 0001-cmake-add-support-to-build-shared-libraries.patch + * 0002-cmake-Use-the-same-version-for-all-libraries-that-ca.patch +- Rebased patches: + * rsutils.patch +- Removed obsolete patches: + * realsense_file.patch + ------------------------------------------------------------------- Tue May 13 05:46:06 UTC 2025 - Jiri Slaby diff --git a/librealsense.spec b/librealsense.spec index 60742dc..7026337 100644 --- a/librealsense.spec +++ b/librealsense.spec @@ -27,11 +27,13 @@ License: Apache-2.0 Group: Development/Libraries/C and C++ URL: https://github.com/IntelRealSense/librealsense Source: https://github.com/IntelRealSense/librealsense/archive/v%{version}.tar.gz -Patch0: presets_path.patch -Patch1: disable-pedantic.patch -Patch2: 0001-third-party-use-nlohmann_json-from-system.patch -Patch3: rsutils.patch -Patch4: realsense_file.patch +# see https://github.com/IntelRealSense/librealsense/pull/14125 +Patch0: 0001-cmake-add-support-to-build-shared-libraries.patch +Patch1: 0002-cmake-Use-the-same-version-for-all-libraries-that-ca.patch +Patch2: presets_path.patch +Patch3: disable-pedantic.patch +Patch4: 0001-third-party-use-nlohmann_json-from-system.patch +Patch5: rsutils.patch BuildRequires: cmake BuildRequires: fdupes BuildRequires: gcc-c++ @@ -85,6 +87,7 @@ sed -i "s/‘\|\’/\'/g" %{_builddir}/%{name}-%{version}/src/libusb/libusb.h %cmake \ -DOpenGL_GL_PREFERENCE=GLVND \ -DCHECK_FOR_UPDATES=OFF \ + -DBUILD_SHARED_LIBS=1 \ -DIMPORT_DEPTH_CAM_FW=OFF %cmake_build diff --git a/realsense_file.patch b/realsense_file.patch deleted file mode 100644 index 3367a5a..0000000 --- a/realsense_file.patch +++ /dev/null @@ -1,35 +0,0 @@ -From: Alessandro de Oliveira Faria -Subject: realsense-file: build as shared -Patch-mainline: never - -> I added two patches which fix the issue with the installation of -> static .a libs by forcing their build as shared library -> Thanks David Lanzendörfer (leviathanch) - ---- - third-party/realsense-file/CMakeLists.txt | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/third-party/realsense-file/CMakeLists.txt -+++ b/third-party/realsense-file/CMakeLists.txt -@@ -20,7 +20,7 @@ source_group("Source Files\\lz4" FILES - lz4/lz4.c - ) - --add_library(${PROJECT_NAME} STATIC -+add_library(${PROJECT_NAME} SHARED - ${AllSources} - ${HEADER_FILES_ROSBAG} - ${SOURCE_FILES_ROSBAG} -@@ -34,9 +34,9 @@ target_include_directories(${PROJECT_NAM - ${LZ4_INCLUDE_PATH} - ) - --#set_target_properties(${PROJECT_NAME} PROPERTIES VERSION "${LIBVERSION}" SOVERSION "${LIBSOVERSION}") -+set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${REALSENSE_VERSION_STRING} SOVERSION "${REALSENSE_VERSION_MAJOR}.${REALSENSE_VERSION_MINOR}") - --set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER Library) -+#set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER Library) - - set(CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/../cmake/realsense2") - diff --git a/rsutils.patch b/rsutils.patch index 703587d..91e039e 100644 --- a/rsutils.patch +++ b/rsutils.patch @@ -36,20 +36,6 @@ Patch-mainline: never { --- a/third-party/rsutils/CMakeLists.txt +++ b/third-party/rsutils/CMakeLists.txt -@@ -3,11 +3,12 @@ - cmake_minimum_required(VERSION 3.8.0) # source_group(TREE) - project( rsutils ) - --add_library( ${PROJECT_NAME} STATIC "" ) -+add_library( ${PROJECT_NAME} SHARED "" ) - # We cannot directly interface with nlohmann_json (doesn't work on bionic) - #target_link_libraries( ${PROJECT_NAME} PUBLIC nlohmann_json ) - target_compile_features( ${PROJECT_NAME} PUBLIC cxx_std_14 ) - set_target_properties( ${PROJECT_NAME} PROPERTIES FOLDER Library ) -+set_target_properties( ${PROJECT_NAME} PROPERTIES VERSION ${REALSENSE_VERSION_STRING} SOVERSION "${REALSENSE_VERSION_MAJOR}.${REALSENSE_VERSION_MINOR}") - - target_include_directories( ${PROJECT_NAME} - PUBLIC @@ -47,7 +48,7 @@ if( BUILD_EASYLOGGINGPP ) PRIVATE "${REPO_ROOT}/third-party/easyloggingpp/src/easylogging++.cc" ) # We want to disable any default ELPP log-file!