aboutsummaryrefslogtreecommitdiff
blob: f593a64fa8ebca711254e30982d307f06d3f1494 (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
120
121
122
# Copyright 2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

CMAKE_REMOVE_MODULES_LIST=( Hardening VersionFromGit )
inherit cmake

DESCRIPTION="TTS engine with extended languages support (including Russian)"
HOMEPAGE="https://rhvoice.su https://github.com/RHVoice/RHVoice"
SRC_URI="https://github.com/${PN}/${PN}/releases/download/${PV}/${P}.tar.gz -> ${P}-release.tar.gz"

AGPL_LANGS=( mk )
CC_SA_LANGS=( pt-BR )
CC_NC_LANGS=( en eo ky ru uk )
NC_LANGS=( ka tt )
LANGS=( "${AGPL_LANGS[@]}" "${CC_SA_LANGS[@]}" "${CC_NC_LANGS[@]}" "${NC_LANGS[@]}" )

LICENSE="BSD GPL-2 GPL-3+ LGPL-2.1+
	$(printf 'l10n_%s? ( AGPL-3 )\n' "${AGPL_LANGS[@]}")
	$(printf 'l10n_%s? ( CC-BY-SA-4.0 )\n' "${CC_SA_LANGS[@]}")
	$(printf 'l10n_%s? ( CC-BY-NC-ND-4.0 )\n' "${CC_NC_LANGS[@]}")
	$(printf 'l10n_%s? ( free-noncomm )\n' "${NC_LANGS[@]}")
"
KEYWORDS="~amd64 ~x86"
IUSE="$(printf 'l10n_%s ' ${LANGS[@]}) ao cli portaudio +pulseaudio +server +speech-dispatcher"
SLOT="0"
REQUIRED_USE="|| ( ao portaudio pulseaudio )"

DEPEND="
	ao? ( media-libs/libao )
	portaudio? ( media-libs/portaudio )
	pulseaudio? ( media-sound/pulseaudio )
	server? (
		dev-libs/glib:2[dbus]
		dev-libs/libsigc++:2
		>=dev-cpp/glibmm-2.66.1:2
	)
	speech-dispatcher? ( app-accessibility/speech-dispatcher )
"
RDEPEND="${DEPEND}
	!dev-libs/hts_engine
"
# TODO: readd dev-libs/rapidxml in ::guru
BDEPEND="
	dev-cpp/cli11
	dev-libs/utfcpp
"
REQUIRED_USE="|| ( ao portaudio pulseaudio )"

DOCS=( README.md doc config/dicts )

delete_voices() {
	for voice in "$@"; do
		rm -r "data/voices/${voice}" || die
	done
}

src_prepare() {
	cmake_src_prepare

	sed "s|/lib/speech-dispatcher-modules|/$(get_libdir)/speech-dispatcher-modules|" \
		-i src/sd_module/CMakeLists.txt || die

	# fix dbus service install path
	sed "s|/systemd/system||" \
		-i src/service/CMakeLists.txt || die

	#sed -e "/set(RAPIDXML_INCLUDE_DIR/d" \
	#	-i src/third-party/CMakeLists.txt || die
	sed "/set(UTF8_INCLUDE_DIR/d" -i src/CMakeLists.txt || die

	# fix build failure
	sed 's/ "RHVoice_question_match"//' \
		-i src/third-party/mage/CMakeLists.txt || die

	sed -e "/include(VersionFromGit)/d" \
		-e "/include(Hardening)/d" \
		-e "/find_package(Sanitizers)/d" \
		-e "/getVersionFromGit/d" \
		-e "/harden/d" \
		-i CMakeLists.txt || die
	sed -e "/add_sanitizers/d" \
		-e "/harden/d" \
		-i src/*/CMakeLists.txt \
		-i src/third-party/*/CMakeLists.txt || die

	use l10n_en || delete_voices alan bdl clb evgeniy-eng slt
	use l10n_eo || delete_voices spomenka
	use l10n_ka || delete_voices natia
	use l10n_ky || delete_voices azamat nazgul
	use l10n_mk || delete_voices kiko
	use l10n_ru || delete_voices aleksandr aleksandr-hq anna arina artemiy \
		elena evgeniy-rus irina pavel victoria yuriy
	use l10n_tt || delete_voices talgat
	use l10n_uk || delete_voices anatol natalia volodymyr
	use l10n_pt-BR || delete_voices Leticia-F123
}

src_configure() {
	local mycmakeargs=(
		-Dcommon_doc_dir=/usr/share/doc/${PF}
		-DRHVOICE_VERSION=${PV}
		-DRHVOICE_VERSION_MAJOR=$(ver_cut 1)
		-DWITH_CLI11=ON
		# src/CMakeLists.txt
		-DBUILD_CLIENT=OFF	# deprecated
		-DBUILD_UTILS=OFF	# fails to build because of bundled tclap
		-DBUILD_TESTS=$(usex cli)
		-DBUILD_SERVICE=$(usex server)
		-DBUILD_SPEECHDISPATCHER_MODULE=$(usex speech-dispatcher)
		# src/audio/CMakeLists.txt
		-DWITH_LIBAO=$(usex ao)
		-DWITH_PULSE=$(usex pulseaudio)
		-DWITH_PORTAUDIO=$(usex portaudio)
		# src/third-party/CMakeLists.txt
		#-DRAPIDXML_INCLUDE_DIR=/usr/include/rapidxml
		-DUTF8_INCLUDE_DIR=/usr/include/utf8cpp
	)

	cmake_src_configure
}