summaryrefslogtreecommitdiff
blob: 006c97d4b8255b9f3d08d4d87b4e7b473004f93b (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
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="6"

inherit autotools

MY_P="${P^^[crf]}"

DESCRIPTION="Yet Another CRF toolkit for segmenting/labelling sequential data"
HOMEPAGE="https://taku910.github.io/crfpp/"
SRC_URI="mirror://gentoo/${MY_P}.tar.gz"

LICENSE="|| ( BSD LGPL-2.1 )"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="examples static-libs"

S="${WORKDIR}/${MY_P}"

PATCHES=( "${FILESDIR}"/${PN}-automake-1.13.patch )
HTML_DOCS=( doc/. )

src_prepare() {
	sed -i \
		-e "/CFLAGS/s/-O3/${CFLAGS}/" \
		-e "/CXXFLAGS/s/-O3/${CXXFLAGS}/" \
		configure.in

	default
	mv configure.{in,ac} || die
	eautoreconf
}

src_configure() {
	econf $(use_enable static-libs static)
}

src_test() {
	local d
	for d in example/*; do
		cd "${d}"
		./exec.sh || die "failed test in ${d}"
		cd - >/dev/null
	done
}

src_install() {
	emake DESTDIR="${D}" install
	einstalldocs

	if use examples; then
		docompress -x /usr/share/doc/${PF}/example
		insinto /usr/share/doc/${PF}
		doins -r example
	fi

	if ! use static-libs; then
		find "${ED}" -name "*.la" -type f -delete || die
	fi
}