From ab4e0e4ccea7a5005a930445a1298de1375a5d74 Mon Sep 17 00:00:00 2001
From: j1nx
Date: Tue, 15 Nov 2022 13:27:27 +0100
Subject: [PATCH] Add libwhisper library package
---
buildroot-external/Config.in | 1 +
buildroot-external/configs/rpi4_64-gui_defconfig | 1 +
buildroot-external/package/whispercpp/Config.in | 8 ++++++++
.../package/whispercpp/whispercpp.hash | 2 ++
.../package/whispercpp/whispercpp.mk | 15 +++++++++++++++
5 files changed, 27 insertions(+)
create mode 100644 buildroot-external/package/whispercpp/Config.in
create mode 100644 buildroot-external/package/whispercpp/whispercpp.hash
create mode 100644 buildroot-external/package/whispercpp/whispercpp.mk
diff --git a/buildroot-external/Config.in b/buildroot-external/Config.in
index c5c04c1e..ea3b8079 100644
--- a/buildroot-external/Config.in
+++ b/buildroot-external/Config.in
@@ -99,6 +99,7 @@ endmenu
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/userland-tools/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/virtual-touch/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/vocalfusion/Config.in"
+ source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/whispercpp/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/wifi-connect/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/wiringpi2/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/xvf3510/Config.in"
diff --git a/buildroot-external/configs/rpi4_64-gui_defconfig b/buildroot-external/configs/rpi4_64-gui_defconfig
index d0db3e8a..3da2f290 100644
--- a/buildroot-external/configs/rpi4_64-gui_defconfig
+++ b/buildroot-external/configs/rpi4_64-gui_defconfig
@@ -600,6 +600,7 @@ BR2_PACKAGE_SPOTIFYD=y
BR2_PACKAGE_TENSORFLOW_LITE=y
BR2_PACKAGE_USERLAND_TOOLS=y
BR2_PACKAGE_VOCALFUSION=y
+BR2_PACKAGE_WHISPERCPP=y
BR2_PACKAGE_WIFI_CONNECT=y
BR2_PACKAGE_WIRINGPI2=y
BR2_PACKAGE_PYTHON_ADAFRUIT_BLINKA=y
diff --git a/buildroot-external/package/whispercpp/Config.in b/buildroot-external/package/whispercpp/Config.in
new file mode 100644
index 00000000..e7468419
--- /dev/null
+++ b/buildroot-external/package/whispercpp/Config.in
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_WHISPERCPP
+ bool "whispercpp"
+ help
+ High-performance inference of OpenAI's Whisper
+ automatic speech recognition (ASR) model
+
+ https://github.com/ggerganov/whisper.cpp
+
diff --git a/buildroot-external/package/whispercpp/whispercpp.hash b/buildroot-external/package/whispercpp/whispercpp.hash
new file mode 100644
index 00000000..0ada4a05
--- /dev/null
+++ b/buildroot-external/package/whispercpp/whispercpp.hash
@@ -0,0 +1,2 @@
+# Locally computed
+sha256 9fb608612936486e514513b02698d669b68784c19dcbf6f5f17ff3fa833096c2 whispercpp-83c742f1a78a018c4eac790fabab91f174d92c3a.tar.gz
diff --git a/buildroot-external/package/whispercpp/whispercpp.mk b/buildroot-external/package/whispercpp/whispercpp.mk
new file mode 100644
index 00000000..f186868e
--- /dev/null
+++ b/buildroot-external/package/whispercpp/whispercpp.mk
@@ -0,0 +1,15 @@
+################################################################################
+#
+# whispercpp
+#
+################################################################################
+
+WHISPERCPP_VERSION = 83c742f1a78a018c4eac790fabab91f174d92c3a
+WHISPERCPP_SITE = $(call github,ggerganov,whisper.cpp,$(WHISPERCPP_VERSION))
+WHISPERCPP_LICENSE = Apache License 2.0
+
+WHISPERCPP_INSTALL_STAGING = YES
+WHISPERCPP_DEPENDENCIES = host-pkgconf
+WHISPERCPP_SUPPORTS_IN_SOURCE_BUILD = NO
+
+$(eval $(cmake-package))