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

EAPI=7

DISTUTILS_USE_SETUPTOOLS=no
PYTHON_COMPAT=( python3_{7,8,9} )
inherit toolchain-funcs distutils-r1

DESCRIPTION="Routing application based on openstreetmap data"
HOMEPAGE="https://routino.org/"
SRC_URI="https://routino.org/download/${P}.tgz"

LICENSE="AGPL-3+"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="python test"

REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
RESTRICT="!test? ( test )"

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

PATCHES=( "${FILESDIR}"/${P}.patch )

src_prepare() {
	default

	sed -i -e "s@libdir=\(.*\)@libdir=\$(prefix)/$(get_libdir)@" \
		-e "s@CC=gcc@CC=$(tc-getCC)@" \
		-e "s@LD=gcc@LD=$(tc-getCC)@" \
		Makefile.conf || die "failed sed"
}

src_compile() {
	emake -j1
	rm README.txt || die "rm README.txt failed"
	mv doc/README.txt . || die "mv doc/README.txt . failed"
	if use python; then
		pushd python > /dev/null
		python_compile() {
			rm -f build/.timestamp || die
			emake PYTHON=${EPYTHON}
		}
		python_foreach_impl python_compile
		popd > /dev/null
	fi
}

src_test() {
	emake test
#	if use python; then
#		pushd python > /dev/null
#		python_test() {
#			echo "######## ${EPYTHON} ########"
#			emake PYTHON=${EPYTHON} test
#		}
#		python_foreach_impl python_test
#		popd > /dev/null
#	fi
}

src_install() {
	default
	if use python; then
		pushd python > /dev/null
		python_install() {
			esetup.py install
			python_optimize
		}
		python_foreach_impl python_install
		newdoc README.txt README_python.txt
		popd > /dev/null
	fi

}