mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-03-28 08:52:07 +01:00
88 lines
3.1 KiB
Diff
88 lines
3.1 KiB
Diff
From d091a821cc41407ecfb7201da34d5c7cd0636d67 Mon Sep 17 00:00:00 2001
|
|
From: Hugo Osvaldo Barrera <hugo@whynothugo.nl>
|
|
Date: Wed, 25 Mar 2026 01:24:08 +0100
|
|
Subject: [PATCH] Install libraries into LLAMA_LIB_INSTALL_DIR
|
|
|
|
Using the following:
|
|
|
|
-DGGML_LIB_INSTALL_DIR=/usr/lib/llama.cpp \
|
|
-DLLAMA_LIB_INSTALL_DIR=/usr/lib/llama.cpp \
|
|
|
|
Several libraries are still installed into /usr/lib:
|
|
|
|
/usr/lib/libggml-base.so.0
|
|
/usr/lib/libggml-base.so.0.9.8
|
|
/usr/lib/libggml.so.0
|
|
/usr/lib/libggml.so.0.9.8
|
|
/usr/lib/libllama.so.0
|
|
/usr/lib/libllama.so.0.0.8508
|
|
/usr/lib/libmtmd.so.0
|
|
/usr/lib/libmtmd.so.0.0.8508
|
|
|
|
Install all these libraries into LLAMA_LIB_INSTALL_DIR instead, so they
|
|
don't collide with non-vendored libraries provided by other packages.
|
|
|
|
Also set the rpath if LLAMA_LIB_INSTALL_DIR is set, so that libraries
|
|
are properly loaded.
|
|
---
|
|
CMakeLists.txt | 6 +++++-
|
|
ggml/CMakeLists.txt | 4 ++--
|
|
tools/mtmd/CMakeLists.txt | 2 +-
|
|
3 files changed, 8 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 69da97dc1..4fb10e62c 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -238,6 +238,10 @@ set(LLAMA_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Location o
|
|
set(LLAMA_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Location of library files")
|
|
set(LLAMA_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Location of binary files")
|
|
|
|
+if (NOT LLAMA_LIB_INSTALL_DIR STREQUAL CMAKE_INSTALL_LIBDIR)
|
|
+ set(CMAKE_INSTALL_RPATH "${LLAMA_LIB_INSTALL_DIR}")
|
|
+endif()
|
|
+
|
|
set(LLAMA_PUBLIC_HEADERS
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include/llama.h
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include/llama-cpp.h)
|
|
@@ -246,7 +250,7 @@ set_target_properties(llama
|
|
PROPERTIES
|
|
PUBLIC_HEADER "${LLAMA_PUBLIC_HEADERS}")
|
|
|
|
-install(TARGETS llama LIBRARY PUBLIC_HEADER)
|
|
+install(TARGETS llama LIBRARY DESTINATION ${LLAMA_LIB_INSTALL_DIR} PUBLIC_HEADER)
|
|
|
|
configure_package_config_file(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/llama-config.cmake.in
|
|
diff --git a/ggml/CMakeLists.txt b/ggml/CMakeLists.txt
|
|
index c780077ac..4800f9741 100644
|
|
--- a/ggml/CMakeLists.txt
|
|
+++ b/ggml/CMakeLists.txt
|
|
@@ -336,8 +336,8 @@ set_target_properties(ggml PROPERTIES PUBLIC_HEADER "${GGML_PUBLIC_HEADERS}")
|
|
#if (GGML_METAL)
|
|
# set_target_properties(ggml PROPERTIES RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/src/ggml-metal.metal")
|
|
#endif()
|
|
-install(TARGETS ggml LIBRARY PUBLIC_HEADER)
|
|
-install(TARGETS ggml-base LIBRARY)
|
|
+install(TARGETS ggml LIBRARY DESTINATION ${GGML_LIB_INSTALL_DIR} PUBLIC_HEADER)
|
|
+install(TARGETS ggml-base LIBRARY DESTINATION ${GGML_LIB_INSTALL_DIR})
|
|
|
|
if (GGML_STANDALONE)
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ggml.pc.in
|
|
diff --git a/tools/mtmd/CMakeLists.txt b/tools/mtmd/CMakeLists.txt
|
|
index a39de8c92..9c9c0f87f 100644
|
|
--- a/tools/mtmd/CMakeLists.txt
|
|
+++ b/tools/mtmd/CMakeLists.txt
|
|
@@ -66,7 +66,7 @@ set_target_properties(mtmd
|
|
PROPERTIES
|
|
PRIVATE_HEADER debug/mtmd-debug.h)
|
|
|
|
-install(TARGETS mtmd LIBRARY PUBLIC_HEADER)
|
|
+install(TARGETS mtmd LIBRARY DESTINATION ${LLAMA_LIB_INSTALL_DIR} PUBLIC_HEADER)
|
|
|
|
if (NOT MSVC)
|
|
# for stb_image.h and miniaudio.h
|
|
--
|
|
2.53.0
|
|
|