summaryrefslogtreecommitdiff
blob: 651440322594c4f6eca5a8faacba5683222a5bdd (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

PYTHON_COMPAT=( python3_{8..10} )
CMAKE_ECLASS=cmake

inherit cmake-multilib python-r1

DESCRIPTION="A tool to test PAM applications and PAM modules"
HOMEPAGE="https://cwrap.org/pam_wrapper.html"
SRC_URI="
	https://www.samba.org/ftp/pub/cwrap/${P}.tar.gz
	https://ftp.samba.org/pub/cwrap/${P}.tar.gz
"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86"
IUSE="test"
RESTRICT="!test? ( test )"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"

RDEPEND="
	${PYTHON_DEPS}
	sys-libs/pam:0=[${MULTILIB_USEDEP}]
"
DEPEND="
	${RDEPEND}
	test? ( dev-util/cmocka[${MULTILIB_USEDEP}] )
"

multilib_src_configure() {
	configure_for_python() {
		local libpam="${EPREFIX}/$(get_libdir)/libpam.so.0"

		local mycmakeargs=(
			-DPAM_LIBRARY="${libpam}"
			-DUNIT_TESTING=OFF
		)

		cmake_src_configure
	}

	if multilib_is_native_abi ; then
		# Build the Pythons for each version (but only for the native ABI)
		# bug #737468
		python_foreach_impl configure_for_python
	fi

	# Do the regular build now
	local libpam="${EPREFIX}"
	multilib_is_native_abi || libpam+="/usr"
	libpam+="/$(get_libdir)/libpam.so.0"

	local mycmakeargs=(
		-DPAM_LIBRARY="${libpam}"
		-DUNIT_TESTING=$(usex test)
		-DCMAKE_DISABLE_FIND_PACKAGE_Python{Libs,Interp,SiteLibs}=ON
	)

	cmake_src_configure
}

multilib_src_compile() {
	if multilib_is_native_abi ; then
		python_foreach_impl cmake_src_compile
	fi

	# Compile the "proper" version without Python last
	cmake_src_compile
}

multilib_src_install() {
	if multilib_is_native_abi ; then
		python_foreach_impl cmake_src_install
	fi

	# Install the "proper" version without Python last
	cmake_src_install
}