summaryrefslogtreecommitdiff
blob: ac9991c2c2afc4f5c2b563af70adffc61b70dfbc (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
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=4

PYTHON_DEPEND="python? *"
SUPPORT_PYTHON_ABIS="1"
GENTOO_DEPEND_ON_PERL="no"

inherit autotools eutils perl-module python versionator

DESCRIPTION="Library to support AppArmor userspace utilities"
HOMEPAGE="http://apparmor.net/"
SRC_URI="http://launchpad.net/apparmor/$(get_version_component_range 1-2)/${PV}/+download/apparmor-${PV}.tar.gz"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64"
IUSE="doc perl python"

RDEPEND="perl? ( dev-lang/perl )"

DEPEND="${RDEPEND}
	sys-devel/autoconf-archive
	sys-devel/bison
	sys-devel/flex
	doc? ( dev-lang/perl )
	perl? ( dev-lang/swig )
	python? ( dev-lang/swig )"

S=${WORKDIR}/apparmor-${PV}/libraries/${PN}

src_prepare() {
	epatch "${FILESDIR}"/libapparmor-2.6.1-python3.patch
	rm -rf m4 || die "failed to remove bundled macros"

	#fixes libtool version mismatch error
	eautoreconf
}

src_configure() {
	econf \
		$(use_with perl) \
		$(use_with python)
}

src_compile() {
	emake -C src

	use doc && emake -C doc
	use perl && emake -C swig/perl

	if use python; then
		python_copy_sources swig/python
		compile_bindings() {
			emake PYTHON="$(PYTHON)" PYTHON_INCLUDEDIR="$(python_get_includedir)" PYTHON_LIBDIR="$(python_get_libdir)"
		}
		python_execute_function -s --source-dir swig/python compile_bindings
	fi
}

src_install() {
	emake -C src DESTDIR="${D}" install
	use doc && emake -C doc DESTDIR="${D}" install

	if use perl; then
		emake -C swig/perl DESTDIR="${D}" install
		perlinfo
		insinto "${VENDOR_ARCH}"
		doins swig/perl/LibAppArmor.pm
	fi

	if use python; then
		install_bindings() {
			emake -C swig/python DESTDIR="${D}" install
		}
		python_execute_function -q install_bindings
	fi
}