summaryrefslogtreecommitdiff
path: root/app-accessibility
diff options
context:
space:
mode:
authorCrucible <crucible@localhost>2026-09-22 18:47:35 -0500
committerCrucible <crucible@localhost>2026-09-22 18:47:35 -0500
commitcde96c5ea0c81397fd3214d455a374f76179a7aa (patch)
tree12c86d59eb88887c244b1145411db084ae5a6c1f /app-accessibility
parent47516b9667518dacb1efd6d257f7b3e6a481ec93 (diff)
downloadbaldeagleos-repo-cde96c5ea0c81397fd3214d455a374f76179a7aa.tar.gz
baldeagleos-repo-cde96c5ea0c81397fd3214d455a374f76179a7aa.tar.xz
baldeagleos-repo-cde96c5ea0c81397fd3214d455a374f76179a7aa.zip
Publish baldeagleos-repo candidate 0000000325-20260922-184323
Diffstat (limited to 'app-accessibility')
-rw-r--r--app-accessibility/whisper-cpp/Manifest4
-rw-r--r--app-accessibility/whisper-cpp/files/whisper-cpp-1.9.4-remove-test-vad-full.patch24
-rw-r--r--app-accessibility/whisper-cpp/metadata.xml5
-rw-r--r--app-accessibility/whisper-cpp/whisper-cpp-1.7.6.ebuild49
-rw-r--r--app-accessibility/whisper-cpp/whisper-cpp-1.8.3-r2.ebuild56
-rw-r--r--app-accessibility/whisper-cpp/whisper-cpp-1.9.4.ebuild207
-rw-r--r--app-accessibility/whisper-cpp/whisper-cpp-9999.ebuild193
7 files changed, 407 insertions, 131 deletions
diff --git a/app-accessibility/whisper-cpp/Manifest b/app-accessibility/whisper-cpp/Manifest
index 3fdc44bf5b0b..72958df4ad66 100644
--- a/app-accessibility/whisper-cpp/Manifest
+++ b/app-accessibility/whisper-cpp/Manifest
@@ -1,3 +1,3 @@
-DIST whisper.cpp-1.7.6.tar.gz 7307730 BLAKE2B 3c03346f2f2aef0aed5c4c2dc856efc730f6a7440106fde0db47ac7d042830c5c5d5cd18c5a8ab4871f54ae60e50aa89c0900bb6509f9c61dc1745dd497b74f2 SHA512 7e0ec9d6afe234afaaa83d7d69051504252c27ecdacbedf3d70992429801bcd1078794a0bb76cf4dafb74131dd0f506bd24c3f3100815c35b8ac2b12336492ef
-DIST whisper.cpp-1.8.3.tar.gz 7898461 BLAKE2B 6bee9c9a55bd24ac9c33e6223dcaec9153dca17ea209723ef5525d6646409cc9930ab15abd6d345b7efa9bbfe97a765612b2939298ca3ff8a547aa14e4a26199 SHA512 be5b02e4d48a92d632e5f2385c42c0c74b176021fb2a68fb6961ef3c83e85fe4930d168b6436667f62c4637315a321c5825644c6f459f6b6ed0660306a1bb4e0
+DIST ggerganov_models_whisper.cpp_ggml-base.en-80da2d8bfee42b0e836fc3a9890373e5defc00a6.bin 147964211 BLAKE2B 0fb29f4e5288d3ba2e641e00d51ea7ccb1d70b01e305c4116efd927c604135a32ecdba6f8fe2d83d20f072ecd40f0c118148fbab89319f6cc476d65bad90f40a SHA512 9045c5618e6dab779b495a9e639793de6eb6fd6dc4c85ed4e1e31bab6763d0ca0a40bf89f084154c4765d151adc7feceb56c4e8c90578dee2850286f086d9772
+DIST whisper-cpp-1.9.4.tar.gz 9353438 BLAKE2B a338435d12a499f3d1bf8a37534446ae1c55240ecc32acdf8538ab7a49ae8e79f58997f759a2cc7b3aad3e428d59de817ff4fc3e1d40062d68ec1580906b66ae SHA512 4e839ce3b00eb5f7c42fb6af53318953cecbb44f2949aa3d030a0b768d45217a9790aa6aa432ef31fa250329b21314b16491f38e78a0d9fa3e729451337dbe3b
DIST whisper.cpp-1.8.4.tar.gz 8206306 BLAKE2B d2f208733a8b6dfeb0692c84149ddf373df23a0082a522d8e0047c268dceb066ee968c07086996da0d08eec6f7b08ab2c1cf6a7e2b0054ef71811bf72ce5d1a1 SHA512 3b41035f9aaad31f0360b2d54d01c9c238628dec7b24a2a012afa6c5f82be998e002c8d3a98d6d4187198ac1fba6dea894b2e9307e2aa07cd5f28d8da17b27be
diff --git a/app-accessibility/whisper-cpp/files/whisper-cpp-1.9.4-remove-test-vad-full.patch b/app-accessibility/whisper-cpp/files/whisper-cpp-1.9.4-remove-test-vad-full.patch
new file mode 100644
index 000000000000..aeedbdf53bf6
--- /dev/null
+++ b/app-accessibility/whisper-cpp/files/whisper-cpp-1.9.4-remove-test-vad-full.patch
@@ -0,0 +1,24 @@
+fix test-vad-full model path
+
+Bug: https://bugs.gentoo.org/974516
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -107,18 +107,6 @@
+ add_test(NAME ${VAD_TEST} COMMAND ${VAD_TEST})
+ set_tests_properties(${VAD_TEST} PROPERTIES LABELS "unit")
+
+-# VAD test full uses whisper_full with VAD enabled
+-set(VAD_TEST test-vad-full)
+-add_executable(${VAD_TEST} ${VAD_TEST}.cpp)
+-target_include_directories(${VAD_TEST} PRIVATE ../include ../ggml/include ../examples)
+-target_link_libraries(${VAD_TEST} PRIVATE common)
+-target_compile_definitions(${VAD_TEST} PRIVATE
+- WHISPER_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/ggml-base.en.bin"
+- VAD_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/for-tests-silero-v6.2.0-ggml.bin"
+- SAMPLE_PATH="${PROJECT_SOURCE_DIR}/samples/jfk.wav")
+-add_test(NAME ${VAD_TEST} COMMAND ${VAD_TEST})
+-set_tests_properties(${VAD_TEST} PROPERTIES LABELS "base;en")
+-
+ # Parakeet model loading test
+ set(PARAKEET_TEST test-parakeet)
+ add_executable(${PARAKEET_TEST} ${PARAKEET_TEST}.cpp)
diff --git a/app-accessibility/whisper-cpp/metadata.xml b/app-accessibility/whisper-cpp/metadata.xml
index 7a998b8a5fb6..fd0f970d9821 100644
--- a/app-accessibility/whisper-cpp/metadata.xml
+++ b/app-accessibility/whisper-cpp/metadata.xml
@@ -6,7 +6,12 @@
<name>Paul Zander</name>
</maintainer>
<use>
+ <flag name="blis">Build a BLIS backend</flag>
+ <flag name="flexiblas">Build a FlexiBLAS backend</flag>
<flag name="hip">Build a HIP (ROCm) backend</flag>
+ <flag name="openblas">Build an OpenBLAS backend</flag>
+ <flag name="opencl">Build an OpenCL backend, so far only works on Adreno and Intel GPUs</flag>
+ <flag name="rocm">Build a HIP (ROCm) backend</flag>
<flag name="sdl2">Build and install example applications that use media-libs/libsdl2</flag>
</use>
<origin>baldeagleos-repo</origin>
diff --git a/app-accessibility/whisper-cpp/whisper-cpp-1.7.6.ebuild b/app-accessibility/whisper-cpp/whisper-cpp-1.7.6.ebuild
deleted file mode 100644
index 95efd479f2cd..000000000000
--- a/app-accessibility/whisper-cpp/whisper-cpp-1.7.6.ebuild
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright 2023-2025 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-inherit cmake
-
-MyPN="whisper.cpp"
-MyP="${MyPN}-${PV}"
-
-DESCRIPTION="Port of OpenAI's Whisper model in C/C++ "
-HOMEPAGE="https://github.com/ggml-org/whisper.cpp"
-SRC_URI="https://github.com/ggml-org/whisper.cpp/archive/refs/tags/v${PV}.tar.gz -> ${MyP}.tar.gz"
-
-S="${WORKDIR}/${MyP}"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="~amd64"
-IUSE="blas cuda hip opencl sdl2 vulkan"
-
-CDEPEND="blas? ( sci-libs/openblas )
- cuda? ( dev-util/nvidia-cuda-toolkit:= )
- hip? ( sci-libs/hipBLAS:= )
- opencl? ( sci-libs/clblast:= )
- sdl2? ( media-libs/libsdl2:= )"
-DEPEND="${CDEPEND}
- vulkan? ( dev-util/vulkan-headers )
-"
-RDEPEND="${CDEPEND}
- vulkan? ( media-libs/vulkan-loader )
-"
-BDEPEND="media-libs/shaderc"
-
-src_configure() {
- # Note: CUDA and HIP are currently untested. Build failures may occur.
- # Turning off examples causes errors during configure
- # -DWHISPER_BUILD_TESTS=$(usex test)
- local mycmakeargs=(
- -DWHISPER_BUILD_EXAMPLES=ON
- -DGGML_BLAS=$(usex blas)
- -DGGML_CLBLAST=$(usex opencl)
- -DGGML_CUBLAS=$(usex cuda)
- -DGGML_HIPBLAS=$(usex hip)
- -DGGML_VULKAN=$(usex vulkan)
- -DWHISPER_SDL2=$(usex sdl2)
- )
- cmake_src_configure
-}
diff --git a/app-accessibility/whisper-cpp/whisper-cpp-1.8.3-r2.ebuild b/app-accessibility/whisper-cpp/whisper-cpp-1.8.3-r2.ebuild
deleted file mode 100644
index 13d50f306066..000000000000
--- a/app-accessibility/whisper-cpp/whisper-cpp-1.8.3-r2.ebuild
+++ /dev/null
@@ -1,56 +0,0 @@
-# Copyright 2023-2025 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-inherit cmake
-
-MyPN="whisper.cpp"
-MyP="${MyPN}-${PV}"
-
-DESCRIPTION="Port of OpenAI's Whisper model in C/C++ "
-HOMEPAGE="https://github.com/ggml-org/whisper.cpp"
-SRC_URI="https://github.com/ggml-org/whisper.cpp/archive/refs/tags/v${PV}.tar.gz -> ${MyP}.tar.gz"
-
-S="${WORKDIR}/${MyP}"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="~amd64"
-IUSE="blas cuda hip opencl sdl2 vulkan"
-
-CDEPEND="blas? ( sci-libs/openblas )
- cuda? ( dev-util/nvidia-cuda-toolkit:= )
- hip? ( sci-libs/hipBLAS:= )
- opencl? ( sci-libs/clblast:= )
- sdl2? ( media-libs/libsdl2:= )"
-DEPEND="${CDEPEND}
- vulkan? ( dev-util/vulkan-headers )
-"
-RDEPEND="${CDEPEND}
- vulkan? ( media-libs/vulkan-loader )
-"
-BDEPEND="media-libs/shaderc"
-
-src_configure() {
- # Note: CUDA and HIP are currently untested. Build failures may occur.
- # Turning off examples causes errors during configure
- # -DWHISPER_BUILD_TESTS=$(usex test)
- local mycmakeargs=(
- -DWHISPER_BUILD_EXAMPLES=ON
- -DGGML_BLAS=$(usex blas)
- -DGGML_CLBLAST=$(usex opencl)
- -DGGML_CUBLAS=$(usex cuda)
- -DGGML_HIP=$(usex hip)
- -DGGML_VULKAN=$(usex vulkan)
- -DWHISPER_SDL2=$(usex sdl2)
- )
- cmake_src_configure
-}
-
-src_install() {
- cmake_src_install
-
- newinitd "${FILESDIR}/${PN}.init" "${PN}"
- newconfd "${FILESDIR}/${PN}.confd" "${PN}"
-}
diff --git a/app-accessibility/whisper-cpp/whisper-cpp-1.9.4.ebuild b/app-accessibility/whisper-cpp/whisper-cpp-1.9.4.ebuild
new file mode 100644
index 000000000000..1132157d387b
--- /dev/null
+++ b/app-accessibility/whisper-cpp/whisper-cpp-1.9.4.ebuild
@@ -0,0 +1,207 @@
+# Copyright 2023-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ROCM_VERSION="6.1"
+
+inherit cmake cuda rocm linux-info toolchain-funcs
+
+MY_PN="${PN/-/.}"
+MY_P="${MY_PN}-${PV}"
+WHISPER_CPP_LLAMAS_COMMIT="80da2d8bfee42b0e836fc3a9890373e5defc00a6"
+
+DESCRIPTION="Port of OpenAI's Whisper model in C/C++ "
+HOMEPAGE="https://github.com/ggml-org/whisper.cpp"
+
+if [[ ${PV} == *9999* ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/ggml-org/whisper.cpp"
+else
+ SRC_URI="https://github.com/ggml-org/whisper.cpp/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}/${MY_P}"
+ KEYWORDS="~amd64"
+fi
+
+SRC_URI+="
+ test? (
+ https://huggingface.co/ggerganov/whisper.cpp/resolve/${WHISPER_CPP_LLAMAS_COMMIT}/ggml-base.en.bin
+ -> ggerganov_models_whisper.cpp_ggml-base.en-${WHISPER_CPP_LLAMAS_COMMIT}.bin
+ )
+"
+
+LICENSE="MIT"
+SLOT="0"
+
+# GGML CPU flags
+X86_CPU_FLAGS=(
+ amx_bf16
+ amx_int8
+ amx_tile
+ avx
+ avx2
+ avx512_bf16
+ avx512_vnni
+ avx512f
+ avx512vbmi
+ avx_vnni
+ bmi2
+ f16c
+ fma3
+ sse4_2
+)
+CPU_FLAGS=( "${X86_CPU_FLAGS[@]/#/cpu_flags_x86_}" )
+GGML_IUSE="${CPU_FLAGS[*]} blis cuda flexiblas openblas opencl +openmp rocm vulkan"
+unset X86_CPU_FLAGS CPU_FLAGS
+
+IUSE="${GGML_IUSE} ffmpeg sdl2 test"
+unset GGML_IUSE
+REQUIRED_USE="
+ ?? (
+ openblas
+ blis
+ flexiblas
+ )
+ rocm? ( ${ROCM_REQUIRED_USE} )
+"
+RESTRICT="!test? ( test )"
+
+COMMON_DEPEND="
+ openblas? ( sci-libs/openblas:= )
+ openmp? ( llvm-runtimes/openmp:= )
+ blis? ( sci-libs/blis:= )
+ flexiblas? ( sci-libs/flexiblas:= )
+ rocm? (
+ >=dev-util/hip-${ROCM_VERSION}:=
+ >=sci-libs/hipBLAS-${ROCM_VERSION}:=
+ )
+ cuda? ( dev-util/nvidia-cuda-toolkit:= )
+ ffmpeg? ( media-video/ffmpeg:= )
+ sdl2? (
+ >=sci-misc/llama-cpp-0.3.0:=
+ media-libs/libsdl2:=
+ )
+"
+DEPEND="${COMMON_DEPEND}
+ opencl? ( dev-util/opencl-headers )
+ vulkan? (
+ dev-util/spirv-headers
+ dev-util/vulkan-headers
+ )
+"
+RDEPEND="${COMMON_DEPEND}
+ opencl? ( dev-libs/opencl-icd-loader )
+ vulkan? ( media-libs/vulkan-loader )
+"
+BDEPEND="vulkan? ( media-libs/shaderc )"
+
+pkg_pretend() {
+ [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+}
+
+pkg_setup() {
+ if use rocm; then
+ linux-info_pkg_setup
+ if linux-info_get_any_version && linux_config_exists; then
+ if ! linux_chkconfig_present HSA_AMD_SVM; then
+ ewarn "To use ROCm/HIP, you need to have HSA_AMD_SVM option enabled in your kernel."
+ fi
+ fi
+ fi
+
+ [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+}
+
+src_prepare() {
+ use cuda && cuda_src_prepare
+ cmake_src_prepare
+ if use test; then
+ cp "${DISTDIR}/ggerganov_models_whisper.cpp_ggml-base.en-${WHISPER_CPP_LLAMAS_COMMIT}.bin" \
+ "${S}"/models/ggml-base.en.bin || die
+ fi
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DWHISPER_USE_SYSTEM_LLAMA=$(usex sdl2)
+ -DWHISPER_BUILD_TESTS=$(usex test)
+ -DWHISPER_BUILD_EXAMPLES=ON
+ -DWHISPER_SDL2=$(usex sdl2)
+ -DWHISPER_COMMON_FFMPEG=$(usex ffmpeg)
+
+ # avoid clashing with sci-ml/ggml
+ -DCMAKE_INSTALL_INCLUDEDIR="include/${MY_PN}"
+ -DCMAKE_INSTALL_LIBDIR="$(get_libdir)/${MY_PN}"
+ -DCMAKE_INSTALL_RPATH="\$ORIGIN/../$(get_libdir)/${MY_PN};\$ORIGIN"
+ )
+
+ # GGML backends
+ mycmakeargs+=(
+ -DGGML_NATIVE=OFF # don't set march
+
+ # CPU Flags
+ -DGGML_SSE42=$(usex cpu_flags_x86_sse4_2)
+ -DGGML_AVX=$(usex cpu_flags_x86_avx)
+ -DGGML_AVX_VNNI=$(usex cpu_flags_x86_avx_vnni)
+ -DGGML_AVX2=$(usex cpu_flags_x86_avx2)
+ -DGGML_BMI2=$(usex cpu_flags_x86_bmi2)
+ -DGGML_AVX512=$(usex cpu_flags_x86_avx512f)
+ -DGGML_AVX512_VBMI=$(usex cpu_flags_x86_avx512vbmi)
+ -DGGML_AVX512_VNNI=$(usex cpu_flags_x86_avx512_vnni)
+ -DGGML_AVX512_BF16=$(usex cpu_flags_x86_avx512_bf16)
+ -DGGML_FMA=$(usex cpu_flags_x86_fma3)
+ -DGGML_F16C=$(usex cpu_flags_x86_f16c)
+ -DGGML_AMX_TILE=$(usex cpu_flags_x86_amx_tile)
+ -DGGML_AMX_INT8=$(usex cpu_flags_x86_amx_int8)
+ -DGGML_AMX_BF16=$(usex cpu_flags_x86_amx_bf16)
+
+ -DGGML_CUDA=$(usex cuda)
+ -DGGML_VULKAN=$(usex vulkan)
+ -DGGML_OPENMP=$(usex openmp)
+ -DGGML_RPC=ON
+ -DGGML_OPENCL=$(usex opencl)
+ )
+
+ if use openblas ; then
+ mycmakeargs+=(
+ -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
+ )
+ fi
+
+ if use blis ; then
+ mycmakeargs+=(
+ -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=FLAME
+ )
+ fi
+
+ if use flexiblas; then
+ mycmakeargs+=(
+ -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=FlexiBLAS
+ )
+ fi
+
+ if use cuda; then
+ local -x CUDAHOSTCXX="$(cuda_gccdir)"
+ # tries to recreate dev symlinks
+ cuda_add_sandbox
+ addpredict "/dev/char/"
+ fi
+
+ if use rocm; then
+ # See ${S}/docs/build.md#hip
+ export HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -p)"
+ mycmakeargs+=(
+ -DGGML_HIP=ON
+ -DGPU_TARGETS=$(get_amdgpu_flags)
+ )
+ fi
+
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+
+ newinitd "${FILESDIR}/${PN}.init" "${PN}"
+ newconfd "${FILESDIR}/${PN}.confd" "${PN}"
+}
diff --git a/app-accessibility/whisper-cpp/whisper-cpp-9999.ebuild b/app-accessibility/whisper-cpp/whisper-cpp-9999.ebuild
index 780ee6173435..1132157d387b 100644
--- a/app-accessibility/whisper-cpp/whisper-cpp-9999.ebuild
+++ b/app-accessibility/whisper-cpp/whisper-cpp-9999.ebuild
@@ -1,9 +1,15 @@
-# Copyright 2023-2025 Gentoo Authors
+# Copyright 2023-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
-inherit cmake
+ROCM_VERSION="6.1"
+
+inherit cmake cuda rocm linux-info toolchain-funcs
+
+MY_PN="${PN/-/.}"
+MY_P="${MY_PN}-${PV}"
+WHISPER_CPP_LLAMAS_COMMIT="80da2d8bfee42b0e836fc3a9890373e5defc00a6"
DESCRIPTION="Port of OpenAI's Whisper model in C/C++ "
HOMEPAGE="https://github.com/ggml-org/whisper.cpp"
@@ -12,45 +18,184 @@ if [[ ${PV} == *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/ggml-org/whisper.cpp"
else
- MyPN="whisper.cpp"
- MyP="${MyPN}-${PV}"
- SRC_URI="https://github.com/ggml-org/whisper.cpp/archive/refs/tags/v${PV}.tar.gz -> ${MyP}.tar.gz"
- S="${WORKDIR}/${MyP}"
+ SRC_URI="https://github.com/ggml-org/whisper.cpp/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}/${MY_P}"
KEYWORDS="~amd64"
fi
+SRC_URI+="
+ test? (
+ https://huggingface.co/ggerganov/whisper.cpp/resolve/${WHISPER_CPP_LLAMAS_COMMIT}/ggml-base.en.bin
+ -> ggerganov_models_whisper.cpp_ggml-base.en-${WHISPER_CPP_LLAMAS_COMMIT}.bin
+ )
+"
+
LICENSE="MIT"
SLOT="0"
-IUSE="blas cuda ffmpeg hip opencl sdl2 vulkan"
-CDEPEND="blas? ( sci-libs/openblas )
+# GGML CPU flags
+X86_CPU_FLAGS=(
+ amx_bf16
+ amx_int8
+ amx_tile
+ avx
+ avx2
+ avx512_bf16
+ avx512_vnni
+ avx512f
+ avx512vbmi
+ avx_vnni
+ bmi2
+ f16c
+ fma3
+ sse4_2
+)
+CPU_FLAGS=( "${X86_CPU_FLAGS[@]/#/cpu_flags_x86_}" )
+GGML_IUSE="${CPU_FLAGS[*]} blis cuda flexiblas openblas opencl +openmp rocm vulkan"
+unset X86_CPU_FLAGS CPU_FLAGS
+
+IUSE="${GGML_IUSE} ffmpeg sdl2 test"
+unset GGML_IUSE
+REQUIRED_USE="
+ ?? (
+ openblas
+ blis
+ flexiblas
+ )
+ rocm? ( ${ROCM_REQUIRED_USE} )
+"
+RESTRICT="!test? ( test )"
+
+COMMON_DEPEND="
+ openblas? ( sci-libs/openblas:= )
+ openmp? ( llvm-runtimes/openmp:= )
+ blis? ( sci-libs/blis:= )
+ flexiblas? ( sci-libs/flexiblas:= )
+ rocm? (
+ >=dev-util/hip-${ROCM_VERSION}:=
+ >=sci-libs/hipBLAS-${ROCM_VERSION}:=
+ )
cuda? ( dev-util/nvidia-cuda-toolkit:= )
ffmpeg? ( media-video/ffmpeg:= )
- hip? ( sci-libs/hipBLAS:= )
- opencl? ( sci-libs/clblast:= )
- sdl2? ( media-libs/libsdl2:= )"
-DEPEND="${CDEPEND}
- vulkan? ( dev-util/vulkan-headers )
+ sdl2? (
+ >=sci-misc/llama-cpp-0.3.0:=
+ media-libs/libsdl2:=
+ )
+"
+DEPEND="${COMMON_DEPEND}
+ opencl? ( dev-util/opencl-headers )
+ vulkan? (
+ dev-util/spirv-headers
+ dev-util/vulkan-headers
+ )
"
-RDEPEND="${CDEPEND}
+RDEPEND="${COMMON_DEPEND}
+ opencl? ( dev-libs/opencl-icd-loader )
vulkan? ( media-libs/vulkan-loader )
"
-BDEPEND="media-libs/shaderc"
+BDEPEND="vulkan? ( media-libs/shaderc )"
+
+pkg_pretend() {
+ [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+}
+
+pkg_setup() {
+ if use rocm; then
+ linux-info_pkg_setup
+ if linux-info_get_any_version && linux_config_exists; then
+ if ! linux_chkconfig_present HSA_AMD_SVM; then
+ ewarn "To use ROCm/HIP, you need to have HSA_AMD_SVM option enabled in your kernel."
+ fi
+ fi
+ fi
+
+ [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+}
+
+src_prepare() {
+ use cuda && cuda_src_prepare
+ cmake_src_prepare
+ if use test; then
+ cp "${DISTDIR}/ggerganov_models_whisper.cpp_ggml-base.en-${WHISPER_CPP_LLAMAS_COMMIT}.bin" \
+ "${S}"/models/ggml-base.en.bin || die
+ fi
+}
src_configure() {
- # Note: CUDA and HIP are currently untested. Build failures may occur.
- # Turning off examples causes errors during configure
- # -DWHISPER_BUILD_TESTS=$(usex test)
local mycmakeargs=(
+ -DWHISPER_USE_SYSTEM_LLAMA=$(usex sdl2)
+ -DWHISPER_BUILD_TESTS=$(usex test)
-DWHISPER_BUILD_EXAMPLES=ON
- -DGGML_BLAS=$(usex blas)
- -DGGML_CLBLAST=$(usex opencl)
- -DGGML_CUBLAS=$(usex cuda)
- -DGGML_HIP=$(usex hip)
- -DGGML_VULKAN=$(usex vulkan)
- -DWHISPER_FFMPEG=$(usex ffmpeg)
-DWHISPER_SDL2=$(usex sdl2)
+ -DWHISPER_COMMON_FFMPEG=$(usex ffmpeg)
+
+ # avoid clashing with sci-ml/ggml
+ -DCMAKE_INSTALL_INCLUDEDIR="include/${MY_PN}"
+ -DCMAKE_INSTALL_LIBDIR="$(get_libdir)/${MY_PN}"
+ -DCMAKE_INSTALL_RPATH="\$ORIGIN/../$(get_libdir)/${MY_PN};\$ORIGIN"
+ )
+
+ # GGML backends
+ mycmakeargs+=(
+ -DGGML_NATIVE=OFF # don't set march
+
+ # CPU Flags
+ -DGGML_SSE42=$(usex cpu_flags_x86_sse4_2)
+ -DGGML_AVX=$(usex cpu_flags_x86_avx)
+ -DGGML_AVX_VNNI=$(usex cpu_flags_x86_avx_vnni)
+ -DGGML_AVX2=$(usex cpu_flags_x86_avx2)
+ -DGGML_BMI2=$(usex cpu_flags_x86_bmi2)
+ -DGGML_AVX512=$(usex cpu_flags_x86_avx512f)
+ -DGGML_AVX512_VBMI=$(usex cpu_flags_x86_avx512vbmi)
+ -DGGML_AVX512_VNNI=$(usex cpu_flags_x86_avx512_vnni)
+ -DGGML_AVX512_BF16=$(usex cpu_flags_x86_avx512_bf16)
+ -DGGML_FMA=$(usex cpu_flags_x86_fma3)
+ -DGGML_F16C=$(usex cpu_flags_x86_f16c)
+ -DGGML_AMX_TILE=$(usex cpu_flags_x86_amx_tile)
+ -DGGML_AMX_INT8=$(usex cpu_flags_x86_amx_int8)
+ -DGGML_AMX_BF16=$(usex cpu_flags_x86_amx_bf16)
+
+ -DGGML_CUDA=$(usex cuda)
+ -DGGML_VULKAN=$(usex vulkan)
+ -DGGML_OPENMP=$(usex openmp)
+ -DGGML_RPC=ON
+ -DGGML_OPENCL=$(usex opencl)
)
+
+ if use openblas ; then
+ mycmakeargs+=(
+ -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
+ )
+ fi
+
+ if use blis ; then
+ mycmakeargs+=(
+ -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=FLAME
+ )
+ fi
+
+ if use flexiblas; then
+ mycmakeargs+=(
+ -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=FlexiBLAS
+ )
+ fi
+
+ if use cuda; then
+ local -x CUDAHOSTCXX="$(cuda_gccdir)"
+ # tries to recreate dev symlinks
+ cuda_add_sandbox
+ addpredict "/dev/char/"
+ fi
+
+ if use rocm; then
+ # See ${S}/docs/build.md#hip
+ export HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -p)"
+ mycmakeargs+=(
+ -DGGML_HIP=ON
+ -DGPU_TARGETS=$(get_amdgpu_flags)
+ )
+ fi
+
cmake_src_configure
}