Files
libdnf/libdnf-0.72.0-with-static-libsolvext.patch
Neal Gompa e9a3501783 - Update to 0.72.0
+ PGP: Use new librepo PGP API, remove gpgme dependency
  + API: Basic support for OpenPGP public keys
  + Avoid using GNU extensions in the dependency splitter regex
  + filterAdvisory: match installed_solvables sort with lower_bound (rh#2212838)
  + Make code C++20 compatible
  + Avoid reinstalling installonly packages marked for ERASE (rh#2163474)
  + transaction: Save the reason for installing (rh#1733274)
  + hawkey.subject: get_best_selectors only obsoleters of latest (rh#2183279, rh#2176263)
  + conf: Add limited shell-style variable expansion (rh#1789346)
  + conf: Add support for $releasever_major, $releasever_minor (rh#1789346)
  + repo: Don't download the repository if the local cache is up to date
  + Allow DNF to be removed by DNF 5 (rh#2221907)
  + Include dist-info for python3-libdnf
  + bindings: Load all modules with RTLD_GLOBAL
  + Update translations
- Fix RHBZ references
- Refresh patch to link with static libsolvext
  + Remove patch: libdnf-0.48.0-with-static-libsolvext.patch
  + Add patch: libdnf-0.72.0-with-static-libsolvext.patch

OBS-URL: https://build.opensuse.org/package/show/system:packagemanager:dnf/libdnf?expand=0&rev=90
2023-11-04 18:53:45 +00:00

95 lines
3.0 KiB
Diff

From 96c3426bdfb9bb197d55829fa5dc608b21f5f373 Mon Sep 17 00:00:00 2001
From: Neal Gompa <neal@gompa.dev>
Date: Sat, 4 Nov 2023 14:42:27 -0400
Subject: [PATCH] Ensure libsolvext dynamic library dependencies are linked
libsolv, when built only build with static link libraries, does not
make a fully usable configuration for static libsolvext to be used
because the CMake and pkgconfig files do not declare the appropriate
libraries to successfully link a static libsolvext that has dynamic library
dependencies.
This patch works around it by doing the declarations here rather than
in libsolv, since it's not easy to fix there, given upstream constraints.
---
CMakeLists.txt | 13 +++++++++++++
cmake/modules/FindLZMA.cmake | 25 +++++++++++++++++++++++++
libdnf/CMakeLists.txt | 5 +++++
3 files changed, 43 insertions(+)
create mode 100644 cmake/modules/FindLZMA.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6444c374..15c86b40 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -68,6 +68,19 @@ pkg_check_modules(RPM REQUIRED rpm>=4.15.0)
pkg_check_modules(SMARTCOLS REQUIRED smartcols)
pkg_check_modules(SQLite3 REQUIRED sqlite3)
+# Ensure that static libsolvext dynamic library dependencies are linked in
+# libxml2 dependency
+find_package (LibXml2 REQUIRED)
+# zlib dependency
+find_package (ZLIB REQUIRED)
+# lzma dependency
+find_package (LZMA REQUIRED)
+# bzip2 dependency
+find_package (BZip2 REQUIRED)
+# zstd dependency
+find_library (ZSTD_LIBRARY NAMES zstd)
+# End static libsolvext dynamic library dependencies
+
# always enable linking with libdnf utils
include_directories(${CMAKE_SOURCE_DIR} libdnf/utils/)
diff --git a/cmake/modules/FindLZMA.cmake b/cmake/modules/FindLZMA.cmake
new file mode 100644
index 00000000..eb112dff
--- /dev/null
+++ b/cmake/modules/FindLZMA.cmake
@@ -0,0 +1,25 @@
+# - Find lzma
+# Find the native LZMA headers and library
+#
+# LZMA_INCLUDE_DIR - where to find lzma.h, etc.
+# LZMA_LIBRARIES - List of libraries when using liblzma.
+# LZMA_FOUND - True if liblzma found.
+
+IF (LZMA_INCLUDE_DIR)
+ # Already in cache, be silent
+ SET(LZMA_FIND_QUIETLY TRUE)
+ENDIF (LZMA_INCLUDE_DIR)
+
+FIND_PATH(LZMA_INCLUDE_DIR lzma.h)
+FIND_LIBRARY(LZMA_LIBRARY NAMES lzma liblzma)
+
+# handle the QUIETLY and REQUIRED arguments and set LZMA_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZMA DEFAULT_MSG LZMA_LIBRARY LZMA_INCLUDE_DIR)
+
+IF(LZMA_FOUND)
+ SET( LZMA_LIBRARIES ${LZMA_LIBRARY} )
+ELSE(LZMA_FOUND)
+ SET( LZMA_LIBRARIES )
+ENDIF(LZMA_FOUND)
diff --git a/libdnf/CMakeLists.txt b/libdnf/CMakeLists.txt
index f37d236a..854a50e9 100644
--- a/libdnf/CMakeLists.txt
+++ b/libdnf/CMakeLists.txt
@@ -81,6 +81,11 @@ target_link_libraries(libdnf
${JSONC_LIBRARIES}
${LIBMODULEMD_LIBRARIES}
${SMARTCOLS_LIBRARIES}
+ ${LIBXML2_LIBRARIES}
+ ${ZLIB_LIBRARY}
+ ${LZMA_LIBRARY}
+ ${BZIP2_LIBRARY}
+ ${ZSTD_LIBRARY}
)
if(ENABLE_RHSM_SUPPORT)
--
2.41.0