summaryrefslogtreecommitdiff
path: root/dev-libs/marisa/marisa-9999.ebuild
blob: 4a82017af3083e99635527683b3ec7784a1a6073 (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
# Copyright 2014-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="8"
PYTHON_COMPAT=( python3_{12..14} )
DISTUTILS_USE_PEP517="setuptools"
DISTUTILS_OPTIONAL="1"
DISTUTILS_EXT=1

inherit cmake distutils-r1 git-r3

DESCRIPTION="Matching Algorithm with Recursively Implemented StorAge"
HOMEPAGE="https://github.com/s-yata/marisa-trie"
EGIT_REPO_URI="https://github.com/s-yata/marisa-trie"

LICENSE="|| ( BSD-2 LGPL-2.1+ )"
SLOT="0"
IUSE="python tools"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

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

PATCHES=(
	"${FILESDIR}/marisa-0.3.1-install-all-configs.patch"
)

src_prepare() {
	cmake_src_prepare

	sed -e "s:^\([[:space:]]*\)libraries=:\1include_dirs=[\"${S}/include\"],\n\1library_dirs=[\"${BUILD_DIR}\"],\n&:" \
		-e "s:setup(name = \"marisa\":setup(name = \"marisa\", version = \"${PV}\":" \
		-i bindings/python/setup.py || die

	if use python; then
		pushd bindings/python > /dev/null || die
		distutils-r1_src_prepare
		popd > /dev/null || die
	fi
}

src_configure() {
	local mycmakeargs=(
		-DLIB_INSTALL_DIR="${EPREFIX}/usr/$(get_libdir)"
		-DENABLE_TOOLS=$(usex tools)
		-DBUILD_TESTING=OFF
	)
	cmake_src_configure

	if use python; then
		pushd bindings/python > /dev/null || die
		distutils-r1_src_configure
		popd > /dev/null || die
	fi
}

src_compile() {
	cmake_src_compile

	if use python; then
		emake -C bindings swig-python
		pushd bindings/python > /dev/null || die
		distutils-r1_src_compile
		popd > /dev/null || die
	fi
}

src_install() {
	cmake_src_install

	(
		docinto html
		dodoc docs/*
	)

	if use python; then
		pushd bindings/python > /dev/null || die
		distutils-r1_src_install
		popd > /dev/null || die
	fi
}