# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. # Disable build id note requirement for now %undefine _missing_build_ids_terminate_build # Force special prefix for Vespa %define _prefix /opt/vespa-deps %global debug_package %{nil} # Don't provide shared library or pkgconfig %global __provides_exclude ^(lib.*\\.so[0-9.]*\\(\\)\\(64bit\\)|(cmake|pkgconfig)\\(.*)$ %global __requires_exclude ^lib(jllama|llama|ggml)\.so[0-9.]*\\([A-Z._0-9]*\\)\\(64bit\\)$ # Version %define ver_major 4 %define ver_minor 1 %define ver_patch 0 %define ver_release 1 %if 0%{?fedora} %if %{fedora} > 39 %global _vespa_java_version 21 %endif %endif %if 0%{?el10} %global _vespa_java_version 21 %endif %if ! 0%{?_vespa_java_version:1} %global _vespa_java_version 17 %endif Summary: Native part of Java Bindings for llama.cpp Name: vespa-jllama Version: %{ver_major}.%{ver_minor}.%{ver_patch} Release: %{ver_release}%{?dist} License: MIT URL: https://github.com/kherud/ Source0: https://github.com/kherud/java-llama.cpp/archive/refs/tags/v%{version}.tar.gz %if 0%{?amzn2023} BuildRequires: java-17-amazon-corretto-devel BuildRequires: java-17-amazon-corretto BuildRequires: maven-amazon-corretto17 %else %if 0%{?el8} || 0%{?el9} || 0%{?el10} || 0%{?fedora} BuildRequires: java-%{_vespa_java_version}-openjdk-devel %endif %if 0%{?el8} BuildRequires: maven >= 1:3.8.0 %else BuildRequires: maven %endif %endif %if 0%{?el8}%{?el9} BuildRequires: vespa-toolset-12-meta BuildRequires: gcc-toolset-12-gcc-c++ %define _devtoolset_enable /opt/rh/gcc-toolset-12/enable BuildRequires: vespa-ccache BuildRequires: vespa-cmake %else BuildRequires: cmake %endif %if 0%{?el10} || 0%{?fedora} BuildRequires: gcc-c++ %endif BuildRequires: make BuildRequires: git %global _vespa_3rdparty_deps_packaging_notice \ See https://github.com/vespa-engine/vespa-3rdparty-deps for details \ about packaging. %description %{_vespa_3rdparty_deps_packaging_notice} %prep %setup -q -n java-llama.cpp-%{version} %build %if 0%{?_devtoolset_enable:1} source %{_devtoolset_enable} || true %endif PATH=%{_prefix}/bin:$PATH mvn compile mkdir build cmake -B build \ -DCMAKE_INSTALL_RPATH=\$ORIGIN \ -DCMAKE_BUILD_WITH_INSTALL_RPATH=true \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_C_FLAGS_RELWITHDEBINFO="-g -O3 -DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-g -O3 -DNDEBUG" \ -DGGML_METAL=OFF \ -DGGML_OPENMP=OFF \ -DGGML_NATIVE=OFF \ -DLLAMA_NATIVE=OFF VERBOSE=1 cmake --build build --config RelWithDebInfo -j 4 %install mkdir -p %{buildroot}%{_libdir} cp -p src/main/resources/de/kherud/llama/Linux/*/lib*.so %{buildroot}%{_libdir} %files %license LICENSE.md %{_libdir} %changelog