From 11d35aa32e5ebe0f8115d6add2103a0bb5e9b4a7 Mon Sep 17 00:00:00 2001 From: madomado Date: Fri, 19 Jul 2024 23:01:59 +0800 Subject: [PATCH] fix: voicevox (#1577) closes #942 (cherry picked from commit 4c682a1b687f47fa97fa384c824adada782b2bad) --- ...add-repository-entry-in-package.json.patch | 22 ------- anda/apps/voicevox/anda.hcl | 1 + anda/apps/voicevox/update.rhai | 6 +- anda/apps/voicevox/voicevox.spec | 62 ++++++++----------- 4 files changed, 27 insertions(+), 64 deletions(-) delete mode 100644 anda/apps/voicevox/0001-feat-add-repository-entry-in-package.json.patch diff --git a/anda/apps/voicevox/0001-feat-add-repository-entry-in-package.json.patch b/anda/apps/voicevox/0001-feat-add-repository-entry-in-package.json.patch deleted file mode 100644 index 8b3c61bd79..0000000000 --- a/anda/apps/voicevox/0001-feat-add-repository-entry-in-package.json.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 6b8c81d1d4ac0ac562b69e7f8164c8a92dafe13a Mon Sep 17 00:00:00 2001 -From: windowsboy111 -Date: Mon, 19 Jun 2023 10:33:20 +0800 -Subject: [PATCH] feat: add repository entry in package.json - ---- - package.json | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/package.json b/package.json -index 622756a..b3d3dfa 100644 ---- a/package.json -+++ b/package.json -@@ -1,4 +1,5 @@ - { -+ "repository": "github:VOICEVOX/voicevox", - "name": "voicevox", - "version": "999.999.999", - "author": "Hiroshiba Kazuyuki", --- -2.40.1 - diff --git a/anda/apps/voicevox/anda.hcl b/anda/apps/voicevox/anda.hcl index 2a748721bc..455f83d7d4 100644 --- a/anda/apps/voicevox/anda.hcl +++ b/anda/apps/voicevox/anda.hcl @@ -1,4 +1,5 @@ project pkg { + arches = ["x86_64"] rpm { spec = "voicevox.spec" } diff --git a/anda/apps/voicevox/update.rhai b/anda/apps/voicevox/update.rhai index 20399b6d08..3f2735939d 100644 --- a/anda/apps/voicevox/update.rhai +++ b/anda/apps/voicevox/update.rhai @@ -1,5 +1 @@ -let v = gh("VOICEVOX/voicevox"); -rpm.global("ver", v); -let engines = get(`https://raw.githubusercontent.com/VOICEVOX/voicevox/${v}/package.json`).json().engines; -rpm.global("nodev", find(">=([\\d.]+)", engines.node, 1)); -rpm.global("npmv", find(">=([\\d.]+)", engines.npm, 1)); +rpm.version(gh("VOICEVOX/voicevox")); diff --git a/anda/apps/voicevox/voicevox.spec b/anda/apps/voicevox/voicevox.spec index 647a305bfa..9cdb9c692c 100644 --- a/anda/apps/voicevox/voicevox.spec +++ b/anda/apps/voicevox/voicevox.spec @@ -1,6 +1,3 @@ -%global nodev 20.12.2 -%global npmv 10.5.0 -%global ver 0.19.2 %define debug_package %nil %global _build_id_links none @@ -9,20 +6,16 @@ %global __provides_exclude_from %{_datadir}/%{name}/.*\\.so Name: voicevox -Version: %ver +Version: 0.19.2 Release: 4%?dist Summary: Free Japanese text-to-speech editor License: LGPL-3.0 URL: https://voicevox.hiroshiba.jp -Source0: https://github.com/VOICEVOX/voicevox/archive/refs/tags/%version.tar.gz -# requires specific node and npm version -%ifarch x86_64 -%global a x64 -%elifarch aarch64 -%global a arm64 -%endif -Source1: https://nodejs.org/download/release/v%nodev/node-v%nodev-linux-%a.tar.xz -Patch0: 0001-feat-add-repository-entry-in-package.json.patch +Source0: https://github.com/VOICEVOX/voicevox/releases/download/%version/VOICEVOX.AppImage.7z.001 +Source1: https://github.com/VOICEVOX/voicevox/releases/download/%version/VOICEVOX.AppImage.7z.002 +Source2: https://github.com/VOICEVOX/voicevox/releases/download/%version/VOICEVOX.AppImage.7z.003 +BuildRequires: p7zip-plugins +ExclusiveArch: x86_64 %description VOICEVOX is a free Japanese text-to-speech software with medium output quality. @@ -34,33 +27,28 @@ Summary: Documentation files for voicevox (Japanese) %summary. %prep -%autosetup -p1 -tar xf %SOURCE1 -PATH="$PATH:$PWD/node-v%nodev-linux-%a/bin/" -npx npm@%npmv i +cat< voicevox.sh +#!/bin/sh +/usr/share/voicevox/VOICEVOX.AppImage +EOF +7z x %SOURCE0 +chmod a+x VOICEVOX.AppImage + +./VOICEVOX.AppImage --appimage-extract '*.desktop' +./VOICEVOX.AppImage --appimage-extract 'usr/share/icons/**' + +sed -i "s|Exec=.*|Exec=/usr/share/voicevox/VOICEVOX.AppImage|" squashfs-root/voicevox.desktop %build -PATH="$PATH:$PWD/node-v%nodev-linux-%a/bin/" -npx browserslist@latest --update-db -PATH="$PATH:$PWD/node-v%nodev-linux-%a/bin/" -npm run electron:build %install -rm dist_electron/linux-unpacked/README.txt # dummy -mkdir -p %buildroot%_datadir/%name %buildroot%_bindir %buildroot%_docdir/%name/res -mv dist_electron/linux-unpacked/* %buildroot%_datadir/%name/ -ln -s %_datadir/%name/%name %buildroot%_bindir/%name -install -Dm644 docs/*.md %buildroot%_docdir/%name/ -install -Dm644 docs/res/* %buildroot%_docdir/%name/res/ +install -Dm755 VOICEVOX.AppImage %buildroot%_datadir/voicevox/VOICEVOX.AppImage +install -Dm755 voicevox.sh %buildroot%_bindir/voicevox +install -Dm644 squashfs-root%_iconsdir/hicolor/0x0/apps/voicevox.png %buildroot%_iconsdir/hicolor/256x256/apps/voicevox.png +install -Dm644 squashfs-root/voicevox.desktop %buildroot%_datadir/applications/voicevox.desktop %files -%doc README.md -%license LICENSE LGPL_LICENSE -%_bindir/%name -%_datadir/%name/ - -%files doc -%doc %_docdir/%name/ - -%changelog -%autochangelog +%_bindir/voicevox +%_datadir/applications/voicevox.desktop +%_datadir/voicevox/VOICEVOX.AppImage +%_iconsdir/hicolor/256x256/apps/voicevox.png