blob: 8cd6dcd8d154a2514632b22f6c465ff419eb8725 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
pkgname=openwhispr-vulkan
pkgver=1.9.2
pkgrel=1
pkgdesc="Voice-to-text dictation app with local Whisper/Parakeet and cloud models (Vulkan GPU acceleration)"
arch=('x86_64')
url="https://github.com/OpenWhispr/openwhispr"
license=('MIT')
provides=('openwhispr')
conflicts=('openwhispr' 'openwhispr-bin' 'openwhispr-appimage')
depends=(
'alsa-lib'
'at-spi2-core'
'gcc-libs'
'gtk3'
'libnotify'
'libsecret'
'libx11'
'libxss'
'libxtst'
'nss'
'vulkan-icd-loader'
'vulkan-driver'
'xdg-utils'
)
makedepends=(
'cmake'
'gcc'
'shaderc'
'spirv-headers'
'vulkan-headers'
)
optdepends=(
'ydotool: Clipboard auto-paste on Wayland'
'xdotool: Clipboard auto-paste on X11'
'wtype: Clipboard auto-paste on wlroots Wayland'
'wl-clipboard: Clipboard support on Wayland'
)
options=('!strip' '!debug')
# Whisper.cpp fork version used by OpenWhispr
_whisper_cpp_ver=0.0.9
source=(
"https://github.com/OpenWhispr/openwhispr/releases/download/v${pkgver}/OpenWhispr-${pkgver}-linux-x64.tar.gz"
"whisper.cpp-${_whisper_cpp_ver}.tar.gz::https://github.com/OpenWhispr/whisper.cpp/archive/refs/tags/${_whisper_cpp_ver}.tar.gz"
)
sha256sums=('af97777bc5857e14947aedf08d353dd27fc5d2f10e27a22a3f05f2f5a0f041cd'
'b12474c8b951116ddd7bbe5fb6c24924cd1f885517adc44f583a7eb9ca45c11c')
# ^ Placeholders: the CI workflow replaces these with real SHA-256 sums
# via `updpkgsums` every time either version is bumped.
build() {
cd "${srcdir}/whisper.cpp-${_whisper_cpp_ver}"
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DGGML_VULKAN=ON \
-DBUILD_SHARED_LIBS=OFF \
-DWHISPER_BUILD_EXAMPLES=ON \
-DWHISPER_BUILD_SERVER=ON \
-DWHISPER_BUILD_TESTS=OFF
cmake --build build --target whisper-server -j"$(nproc)"
}
package() {
local src="${srcdir}/OpenWhispr-${pkgver}-linux-x64"
local dst="${pkgdir}/opt/openwhispr"
local license_dir="${pkgdir}/usr/share/licenses/${pkgname}"
# Install official app to /opt/openwhispr
install -dm755 "${dst}"
cp -r "${src}"/* "${dst}/"
# Remove chrome-sandbox (not needed with --no-sandbox)
rm -f "${dst}/chrome-sandbox"
# Set permissions
chmod +x "${dst}/open-whispr" "${dst}/chrome_crashpad_handler"
find "${dst}/resources/bin" -type f -name '*-linux-x64' -exec chmod +x {} \;
# Replace CPU whisper-server with Vulkan build
local vulkan_bin="${srcdir}/whisper.cpp-${_whisper_cpp_ver}/build/bin/whisper-server"
local target="${dst}/resources/bin/whisper-server-linux-x64"
if [ -f "${vulkan_bin}" ]; then
install -Dm755 "${vulkan_bin}" "${target}"
echo " -> Replaced whisper-server with Vulkan GPU build"
else
echo " -> ERROR: Vulkan whisper-server not found, aborting package build" >&2
exit 1
fi
# /usr/bin launcher
install -Dm755 /dev/stdin "${pkgdir}/usr/bin/openwhispr" <<'LAUNCHER'
#!/bin/bash
exec /opt/openwhispr/open-whispr --no-sandbox "$@"
LAUNCHER
# .desktop file
install -Dm644 /dev/stdin "${pkgdir}/usr/share/applications/openwhispr.desktop" <<EOF
[Desktop Entry]
Name=OpenWhispr
Comment=Voice-to-text dictation with local and cloud AI models (Vulkan GPU)
Exec=/opt/openwhispr/open-whispr --no-sandbox %U
Icon=openwhispr
Type=Application
Categories=Utility;AudioVideo;
StartupWMClass=open-whispr
MimeType=x-scheme-handler/openwhispr;
EOF
# Icon
install -Dm644 "${src}/resources/src/assets/icon.png" "${pkgdir}/usr/share/pixmaps/openwhispr.png"
# License
install -dm755 "${license_dir}"
cp -r "${src}"/LICENSE* "${src}"/LICENSES* "${license_dir}/" 2>/dev/null || true
}
|