summaryrefslogtreecommitdiff
blob: 184920c28003bd0139c714f5c91a0545499ed13d (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="7"

inherit multilib toolchain-funcs

MY_P=${P/speech-/speech_}
PATCHSET="r3"

DESCRIPTION="Speech tools for Festival Text to Speech engine"
HOMEPAGE="http://www.cstr.ed.ac.uk/projects/speech_tools/"
SRC_URI="http://www.festvox.org/packed/festival/$(ver_cut 1-2)/${MY_P}-release.tar.gz
	https://dev.gentoo.org/~neurogeek/${PN}/speech_tools-2.1-${PATCHSET}-patches.tar.gz"

LICENSE="FESTIVAL HPND BSD rc regexp-UofT"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
IUSE="nas openmp X"

RDEPEND="
	media-libs/alsa-lib
	sys-libs/ncurses:0=
	nas? ( media-libs/nas )
	X? ( x11-libs/libX11
		x11-libs/libXt
	)
"
DEPEND="${RDEPEND}"
BDEPEND="virtual/pkgconfig"

S="${WORKDIR}/speech_tools"

DOCS=( README.md lib/cstrutt.dtd lib/example_data )

PATCHES=(
	"${WORKDIR}/patch/02_all_gcc42.patch"
	"${WORKDIR}/patch/03_all_GentooLinux.patch"
	"${WORKDIR}/patch/05_all_sharedlib.patch"
	"${WORKDIR}/patch/06_all_gcc43-include.patch"
	"${WORKDIR}/patch/09_all_remove-shared-refs.patch"
	"${WORKDIR}/patch/10_all_base_class.patch"
	"${WORKDIR}/patch/81_all_etcpath.patch"
	"${WORKDIR}/patch/91_all_gentoo-config.patch"
	"${WORKDIR}/patch/92_all_ldflags_fix.patch"
	"${WORKDIR}/patch/94_all_ncurses_tinfo.patch"

	# Fix underlinking, bug #493204
	"${FILESDIR}/${PN}-2.1-underlinking.patch"
	"${FILESDIR}/${PN}-2.5.0-fno-common.patch"
)

pkg_pretend() {
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}

pkg_setup() {
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}

src_prepare() {
	default

	sed -i -e '/^CXXFLAGS  =/s|CC_OTHER_FLAGS|CXX_OTHER_FLAGS|' \
		config/compilers/gcc_defaults.mak || die

	sed -i -e 's,{{HORRIBLELIBARCHKLUDGE}},"/usr/$(get_libdir)",' \
		main/siod_main.cc || die

	#WRT bug #309983
	sed -i -e "s:\(GCC_SYSTEM_OPTIONS =\).*:\1:" \
		"${S}"/config/systems/sparc_SunOS5.mak || die

	sed -i -e "s|\$(OMP_OPTS)|$(use openmp && echo -fopenmp)|g" \
		-e "s|\$(OMP_DEFS)|$(use openmp && echo -DOMP_WAGON=1)|g" \
		-e "/MAKE_SHARED_LIB =/s|-shared|$(use openmp && echo -fopenmp) -shared|" \
		config/compilers/gcc_defaults.mak
}

src_configure() {
	local CONFIG=config/config.in
	sed -i -e 's/@COMPILERTYPE@/gcc42/' ${CONFIG} || die
	if use nas; then
		sed -i -e "s/#.*\(INCLUDE_MODULES += NAS_AUDIO\)/\1/" \
			${CONFIG} || die
	fi
	if ! use X; then
		sed -i -e "s/-lX11 -lXt//" config/modules/esd_audio.mak || die
	fi
	econf
}

src_compile() {
	emake -j1 CC="$(tc-getCC)" CXX="$(tc-getCXX)" CXX_OTHER_FLAGS="${CXXFLAGS}" CC_OTHER_FLAGS="${CFLAGS}" \
		LDFLAGS="${LDFLAGS}"
}

src_install() {
	default

	dolib.so lib/libest*.so*

	insinto /usr/share/speech-tools
	doins -r config base_class

	insinto /usr/share/speech-tools/lib
	doins -r lib/siod

	mv include speech-tools || die
	doheader -r speech-tools
	dosym ../../include/speech-tools /usr/share/speech-tools/include

	for file in bin/*; do
		[ "${file}" = "bin/Makefile" ] && continue
		dobin ${file}
		dstfile="${ED}/usr/${file}"
		sed -i -e "s:${S}/testsuite/data:/usr/share/speech-tools/testsuite:g" \
			${dstfile} || die
		sed -i -e "s:${S}/bin:/usr/$(get_libdir)/speech-tools:g" \
			${dstfile} || die
		sed -i -e "s:${S}/main:/usr/$(get_libdir)/speech-tools:g" \
			${dstfile} || die

		# This just changes LD_LIBRARY_PATH
		sed -i -e "s:${S}/lib:/usr/$(get_libdir):g" ${dstfile} || die
	done

	exeinto /usr/$(get_libdir)/speech-tools
	for file in `find main -perm /111 -type f`; do
		doexe ${file}
	done

	# Remove bcat (only useful for testing on windows, see bug #418301).
	rm "${D}/usr/bin/bcat" || die
	rm "${D}/usr/$(get_libdir)/speech-tools/bcat" || die
}