summaryrefslogtreecommitdiff
blob: 6a5b50e6c3c458f3e202e24bc4b2020fce9636c3 (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
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-libs/marisa/marisa-0.2.4.ebuild,v 1.1 2014/08/22 02:45:53 dlan Exp $

EAPI=5

PYTHON_COMPAT=( python{2_7,3_3} )
DISTUTILS_OPTIONAL=1

inherit distutils-r1 eutils

DESCRIPTION="Matching Algorithm with Recursively Implemented StorAge"
HOMEPAGE="https://code.google.com/p/marisa-trie/"
SRC_URI="https://marisa-trie.googlecode.com/files/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="python doc static-libs sse2 sse3 ssse3 sse4.1 sse4.2 sse4 sse4a popcnt"

DEPEND="python? ( dev-lang/swig ${PYTHON_DEPS} )"
RDEPEND="python? ( ${PYTHON_DEPS} )"

src_prepare() {
	epatch "${FILESDIR}/${P}-python.patch"
	if use python; then
		pushd bindings/python
		ln -sf ../marisa-swig.i marisa-swig.i
		ln -sf ../marisa-swig.h marisa-swig.h
		ln -sf ../marisa-swig.cxx marisa-swig.cxx
		distutils-r1_src_prepare
		popd
	fi
}

src_configure() {
	local myeconfargs=(
		$(use_enable static-libs static)
		$(use_enable sse2)
		$(use_enable sse3)
		$(use_enable ssse3)
		$(use_enable sse4.1)
		$(use_enable sse4.2)
		$(use_enable sse4)
		$(use_enable sse4a)
		$(use_enable popcnt)
	)
	econf "${myeconfargs[@]}"

	if use python; then
		pushd bindings/python
		distutils-r1_src_prepare
		popd
	fi
}

src_compile() {
	default
	if use python; then
		pushd bindings/python
		distutils-r1_src_compile
		popd
	fi
}

src_install() {
	default
	if use python; then
		pushd bindings/python
		distutils-r1_src_install
		popd
	fi
	use doc && dohtml docs/readme.en.html
	prune_libtool_files
}