aboutsummaryrefslogtreecommitdiff
blob: 34bc161cc002bbbb8d1bb70bbaff6768480eaceb (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
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_USE_SETUPTOOLS=no
MY_PV="$(ver_rs 1-2 -)"
MY_P="${PN}-${MY_PV}"
PYTHON_COMPAT=( python3_{9..11} pypy3 )

inherit distutils-r1 edo flag-o-matic java-pkg-opt-2 perl-module

DESCRIPTION="Static cluster configuration database used for cluster configuration management"
HOMEPAGE="https://github.com/chaos/genders"
SRC_URI="https://github.com/chaos/${PN}/archive/${MY_P}.tar.gz"
S="${WORKDIR}/${PN}-${MY_P}"

KEYWORDS="~amd64"
LICENSE="GPL-2"
SLOT="0"
IUSE="cxx java perl python"

CDEPEND="
	perl? ( dev-lang/perl:= )
	python?	( ${PYTHON_DEPS} )
"
DEPEND="
	${CDEPEND}
	java? ( virtual/jdk:1.8 )
"
RDEPEND="
	${DEPEND}
	java? ( virtual/jre:1.8 )
"

REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
DOCS=( README TUTORIAL NEWS )

src_prepare() {
	sed -i "s|perl python||" src/extensions/Makefile.am || die
	sed -i "s|\$(DESTDIR)\$(docdir)-\$(VERSION)-javadoc|\$(DESTDIR)\$(docdir)/html/javadoc|" src/extensions/java/Makefile.am || die
	eapply_user
	java-pkg_clean
	edo ./autogen.sh
}

src_configure() {
	use java && append-cflags "-I${S}/src/libgenders"
	use java && append-cflags "$(java-pkg_get-jni-cflags)"

	local myconf=(
		--disable-static
		--with-non-shortened-hostnames
		$(use_with cxx cplusplus-extensions)
		$(use_with java java-extensions)
		$(use_with perl perl-extensions)
		$(use_with python python-extensions)
	)
	econf "${myconf[@]}"
}

src_compile() {
	default

	if use perl; then
		pushd "${S}/src/extensions/perl" || die
		perl-module_src_configure
		perl-module_src_compile
		popd || die
	fi

	if use python; then
		pushd "${S}/src/extensions/python" || die
		cp genderssetup.py setup.py || die
		distutils-r1_src_compile
		popd || die
	fi
}

src_test() {
	pushd src/testsuite || die
	default
	popd || die
}

src_install() {
	default

	if use perl ; then
		pushd "${S}/src/extensions/perl" || die
		unset DOCS
		myinst=( DESTDIR="${D}" )
		perl-module_src_install
		popd || die
	fi

	if use python; then
		pushd "${S}/src/extensions/python" || die
		unset DOCS
		python_install() {
			distutils-r1_python_install
		}
		distutils-r1_src_install
		popd || die
	fi

	find "${ED}" -name '*.la' -delete || die
	find "${ED}" -name '*.a' -delete || die
}