From 67b9493d650898b51c30eea5b5f6f4aac240117e Mon Sep 17 00:00:00 2001
From: j1nx
Date: Tue, 25 Apr 2023 13:47:21 +0000
Subject: [PATCH] Allow whisper.cpp to be build for both aarch64 and x86-64
and enabling it for x86-64 build
---
.../configs/x86_64-base_defconfig | 1 +
.../package/whispercpp/Config.in | 1 -
.../package/whispercpp/whispercpp.hash | 2 +-
.../package/whispercpp/whispercpp.mk | 18 +++++++++++++-----
4 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/buildroot-external/configs/x86_64-base_defconfig b/buildroot-external/configs/x86_64-base_defconfig
index 69ab9d20..a5997650 100644
--- a/buildroot-external/configs/x86_64-base_defconfig
+++ b/buildroot-external/configs/x86_64-base_defconfig
@@ -548,6 +548,7 @@ BR2_PACKAGE_SNAPCAST=y
BR2_PACKAGE_SNAPCAST_SERVER=y
BR2_PACKAGE_SPOTIFYD=y
BR2_PACKAGE_TENSORFLOW_LITE=y
+BR2_PACKAGE_WHISPERCPP=y
BR2_PACKAGE_PYTHON_ADAPT_PARSER=y
BR2_PACKAGE_PYTHON_ASTRAL=y
BR2_PACKAGE_PYTHON_AUDIO_METADATA=y
diff --git a/buildroot-external/package/whispercpp/Config.in b/buildroot-external/package/whispercpp/Config.in
index 3f3aae88..e7468419 100644
--- a/buildroot-external/package/whispercpp/Config.in
+++ b/buildroot-external/package/whispercpp/Config.in
@@ -1,6 +1,5 @@
config BR2_PACKAGE_WHISPERCPP
bool "whispercpp"
- select BR2_PACKAGE_OPENBLAS
help
High-performance inference of OpenAI's Whisper
automatic speech recognition (ASR) model
diff --git a/buildroot-external/package/whispercpp/whispercpp.hash b/buildroot-external/package/whispercpp/whispercpp.hash
index a88fad0d..23fb51ef 100644
--- a/buildroot-external/package/whispercpp/whispercpp.hash
+++ b/buildroot-external/package/whispercpp/whispercpp.hash
@@ -1,2 +1,2 @@
# Locally computed
-sha256 e167fd5ce5973e7d86147d579a4eeeb558bc138dbad831955340fd753ed59831 whispercpp-0a2d1210bcb98978214bbf4e100922a413afd39d.tar.gz
+sha256 44666942b2da5c88f755d4cc4f1bf0cc5c1d90c96bd83984243985ca3241dbee whispercpp-c23588cc4b2c4be4ba3634a21c7f2b302c5f370e.tar.gz
diff --git a/buildroot-external/package/whispercpp/whispercpp.mk b/buildroot-external/package/whispercpp/whispercpp.mk
index 05bcabdc..0cc89af2 100644
--- a/buildroot-external/package/whispercpp/whispercpp.mk
+++ b/buildroot-external/package/whispercpp/whispercpp.mk
@@ -4,20 +4,28 @@
#
################################################################################
-WHISPERCPP_VERSION = 0a2d1210bcb98978214bbf4e100922a413afd39d
+WHISPERCPP_VERSION = c23588cc4b2c4be4ba3634a21c7f2b302c5f370e
WHISPERCPP_SITE = $(call github,ggerganov,whisper.cpp,$(WHISPERCPP_VERSION))
WHISPERCPP_LICENSE = Apache License 2.0
WHISPERCPP_INSTALL_STAGING = YES
-WHISPERCPP_DEPENDENCIES = host-pkgconf openblas
+WHISPERCPP_DEPENDENCIES = host-pkgconf
WHISPERCPP_SUPPORTS_IN_SOURCE_BUILD = NO
WHISPERCPP_CONF_OPTS = \
-DBUILD_SHARED_LIBS_DEFAULT=ON \
- -DWHISPER_SUPPORT_OPENBLAS=ON \
-DWHISPER_BUILD_TESTS=ON \
- -DWHISPER_BUILD_EXAMPLES=ON \
- -DWHISPER_SUPPORT_SDL2=ON
+ -DWHISPER_BUILD_EXAMPLES=ON
+
+ifeq ($(BR2_PACKAGE_OPENBLAS),y)
+ WHISPERCPP_DEPENDENCIES += openblas
+ WHISPERCPP_CONF_OPTS += -DWHISPER_SUPPORT_OPENBLAS=ON
+endif
+
+ifeq ($(BR2_PACKAGE_SDL2),y)
+ WHISPERCPP_DEPENDENCIES += sdl2
+ WHISPERCPP_CONF_OPTS += -DWHISPER_SUPPORT_SDL2=ON
+endif
WHISPERCPP_POST_INSTALL_TARGET_HOOKS = WHISPERCPP_INSTALL_BINS