]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
Version shared libraries
authorMathieu Baudier <redacted>
Sun, 23 Feb 2025 10:45:16 +0000 (11:45 +0100)
committerMathieu Baudier <redacted>
Sun, 23 Feb 2025 11:10:20 +0000 (12:10 +0100)
debian/cmake/debian-llama-cpp.cmake [new file with mode: 0644]
debian/cmake/debian-llama.cpp.cmake [deleted file]
debian/libllama0-dev.install
debian/libllama0.install
debian/libllama0.lintian-overrides
debian/libllama0.triggers [deleted file]
debian/patches/0001-improve-cmake-build.patch [new file with mode: 0644]
debian/patches/series [new file with mode: 0644]
debian/rules

diff --git a/debian/cmake/debian-llama-cpp.cmake b/debian/cmake/debian-llama-cpp.cmake
new file mode 100644 (file)
index 0000000..479a21a
--- /dev/null
@@ -0,0 +1,24 @@
+# GGML dependencies
+# libggml-base as external library
+find_library(GGML_BASE_LOCATION ggml-base)
+message (STATUS "Found GGML base library: ${GGML_BASE_LOCATION}") 
+add_library(ggml-base SHARED IMPORTED GLOBAL)
+set_target_properties(ggml-base PROPERTIES IMPORTED_LOCATION ${GGML_BASE_LOCATION})
+
+# libggml as external library
+# defines GGML as target so that it is disabled in llama.cpp build
+find_library(GGML_LOCATION ggml)
+message (STATUS "Found GGML library: ${GGML_LOCATION}") 
+add_library(ggml SHARED IMPORTED GLOBAL)
+set_target_properties(ggml PROPERTIES IMPORTED_LOCATION ${GGML_LOCATION})
+# transitive dependency
+target_link_libraries(ggml INTERFACE ${GGML_BASE_LOCATION})
+
+add_compile_definitions(NDEBUG)
+
+install(DIRECTORY ${CMAKE_BINARY_DIR}/common/ DESTINATION lib/${CMAKE_LIBRARY_ARCHITECTURE}/llama.cpp/common FILES_MATCHING PATTERN "*.a" )
+install(DIRECTORY ${CMAKE_SOURCE_DIR}/common/ DESTINATION include/llama.cpp/common FILES_MATCHING PATTERN "*.h" )
+
+# build number, in line with changelog
+set(BUILD_NUMBER 4719)
+
diff --git a/debian/cmake/debian-llama.cpp.cmake b/debian/cmake/debian-llama.cpp.cmake
deleted file mode 100644 (file)
index 36214c6..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-cmake_minimum_required(VERSION 3.14) # for add_link_options and implicit target directories.
-
-# GGML dependencies
-# libggml-base as external library
-find_library(GGML_BASE_LOCATION ggml-base)
-message (STATUS "Found GGML base library: ${GGML_BASE_LOCATION}") 
-add_library(ggml-base SHARED IMPORTED GLOBAL)
-set_target_properties(ggml-base PROPERTIES IMPORTED_LOCATION ${GGML_BASE_LOCATION})
-
-# libggml as external library
-# defines GGML as target so that it is disabled in llama.cpp build
-find_library(GGML_LOCATION ggml)
-message (STATUS "Found GGML library: ${GGML_LOCATION}") 
-add_library(ggml SHARED IMPORTED GLOBAL)
-set_target_properties(ggml PROPERTIES IMPORTED_LOCATION ${GGML_LOCATION})
-# transitive dependency
-target_link_libraries(ggml INTERFACE ${GGML_BASE_LOCATION})
-
-add_compile_definitions(NDEBUG)
-
-install(DIRECTORY ${CMAKE_BINARY_DIR}/common/ DESTINATION lib/${CMAKE_LIBRARY_ARCHITECTURE}/llama.cpp/common FILES_MATCHING PATTERN "*.a" )
-install(DIRECTORY ${CMAKE_SOURCE_DIR}/common/ DESTINATION include/llama.cpp/common FILES_MATCHING PATTERN "*.h" )
-
index d981e574dd12accd817ebae84096c6f4a7288e47..133993dfd9fe2e8ecb8d3065b81df7f6c356f445 100644 (file)
@@ -1,5 +1,8 @@
 /usr/include/llama*.h
 include/llama-cpp.h /usr/include/
 
+# Symbolic links
+/usr/lib/*/libllama.so
+
 /usr/lib/*/pkgconfig/*.pc
 /usr/lib/*/cmake/llama/llama-*.cmake
index 54c30f17f94bd6dd7aad911ebdd15b7eaa94e4cd..b091b2a4805798e8518a114e75da0e9cb0009d4d 100644 (file)
@@ -1 +1 @@
-/usr/lib/*/libllama*
\ No newline at end of file
+/usr/lib/*/libllama.so.*
index 854b71f99a18fc2529df103b9f1128f21baeb683..1db8017b7f428eb96686c6f0f357bccc83d93aef 100644 (file)
@@ -1 +1,3 @@
-libllama0: no-symbols-control-file usr/lib/x86_64-linux-gnu/libllama.so
+# According to https://wiki.debian.org/UsingSymbolsFiles
+# "For C++ libraries it is often better not to ship symbols files."
+libllama0: no-symbols-control-file usr/lib/x86_64-linux-gnu/libllama.so.*
diff --git a/debian/libllama0.triggers b/debian/libllama0.triggers
deleted file mode 100644 (file)
index dd86603..0000000
+++ /dev/null
@@ -1 +0,0 @@
-activate-noawait ldconfig
diff --git a/debian/patches/0001-improve-cmake-build.patch b/debian/patches/0001-improve-cmake-build.patch
new file mode 100644 (file)
index 0000000..27f4bd1
--- /dev/null
@@ -0,0 +1,41 @@
+From: Mathieu Baudier <mbaudier@argeo.org>
+Date: Sun, 23 Feb 2025 11:31:46 +0100
+Subject: improve-cmake-build
+
+---
+ cmake/build-info.cmake | 4 ++++
+ src/CMakeLists.txt     | 4 ++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/cmake/build-info.cmake b/cmake/build-info.cmake
+index c1a456e..66072b3 100644
+--- a/cmake/build-info.cmake
++++ b/cmake/build-info.cmake
+@@ -1,3 +1,5 @@
++if(NOT DEFINED BUILD_NUMBER) # Debian patch
++
+ set(BUILD_NUMBER 0)
+ set(BUILD_COMMIT "unknown")
+ set(BUILD_COMPILER "unknown")
+@@ -39,6 +41,8 @@ if(Git_FOUND)
+     endif()
+ endif()
++endif() # END Debian patch
++
+ if(MSVC)
+     set(BUILD_COMPILER "${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
+     set(BUILD_TARGET ${CMAKE_VS_PLATFORM_NAME})
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index e1b02e4..5883a5a 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -38,4 +38,8 @@ if (BUILD_SHARED_LIBS)
+     set_target_properties(llama PROPERTIES POSITION_INDEPENDENT_CODE ON)
+     target_compile_definitions(llama PRIVATE LLAMA_BUILD)
+     target_compile_definitions(llama PUBLIC  LLAMA_SHARED)
++      if(DEFINED BUILD_NUMBER)
++        message(STATUS "Set llama shared library version to 0.0.${BUILD_NUMBER}")
++      set_target_properties(llama PROPERTIES VERSION 0.0.${BUILD_NUMBER} SOVERSION 0)
++    endif()
+ endif()
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644 (file)
index 0000000..b9192bb
--- /dev/null
@@ -0,0 +1 @@
+0001-improve-cmake-build.patch
index d0b858bfb146f754eeeceedfdbed120bab0f17ef..f60e7520eeb17b7aca043ab35187daf3f8572b03 100755 (executable)
@@ -27,7 +27,7 @@ override_dh_auto_configure:
        dh_auto_configure -- \
        -DCMAKE_LIBRARY_ARCHITECTURE="$(DEB_HOST_MULTIARCH)" \
        -DCMAKE_BUILD_TYPE=Release \
-       -DCMAKE_PROJECT_llama.cpp_INCLUDE=debian/cmake/debian-llama.cpp.cmake \
+       -DCMAKE_PROJECT_llama.cpp_INCLUDE=debian/cmake/debian-llama-cpp.cmake \
        -DBUILD_SHARED_LIBS=ON \
        -DGGML_BACKEND_DL=ON \
        -DLLAMA_ALL_WARNINGS=OFF \