From 127782bdfe47deede0b13f361d7e62ff2d057e26 Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Sun, 6 Feb 2011 21:37:43 +0000 Subject: Set SUPPORT_PYTHON_ABIS (bug #308279). Fix building with SWIG 2. (Portage version: 2.2.0_alpha20/cvs/Linux x86_64) --- app-admin/setools/ChangeLog | 8 ++- app-admin/setools/setools-3.3.7.ebuild | 104 ++++++++++++++++++++++++++++----- 2 files changed, 96 insertions(+), 16 deletions(-) (limited to 'app-admin') diff --git a/app-admin/setools/ChangeLog b/app-admin/setools/ChangeLog index 52247b50a05a..4df0f844aa5a 100644 --- a/app-admin/setools/ChangeLog +++ b/app-admin/setools/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for app-admin/setools -# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-admin/setools/ChangeLog,v 1.62 2010/05/12 13:30:25 pebenito Exp $ +# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/app-admin/setools/ChangeLog,v 1.63 2011/02/06 21:37:43 arfrever Exp $ + + 06 Feb 2011; Arfrever Frehtes Taifersar Arahesis + setools-3.3.7.ebuild: + Set SUPPORT_PYTHON_ABIS (bug #308279). Fix building with SWIG 2. *setools-3.3.7 (12 May 2010) diff --git a/app-admin/setools/setools-3.3.7.ebuild b/app-admin/setools/setools-3.3.7.ebuild index 57c2a645a5fe..ef67aeffffd7 100644 --- a/app-admin/setools/setools-3.3.7.ebuild +++ b/app-admin/setools/setools-3.3.7.ebuild @@ -1,8 +1,13 @@ -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-admin/setools/setools-3.3.7.ebuild,v 1.1 2010/05/12 13:30:25 pebenito Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-admin/setools/setools-3.3.7.ebuild,v 1.2 2011/02/06 21:37:43 arfrever Exp $ -inherit java-pkg-opt-2 autotools +EAPI="2" +PYTHON_DEPEND="python? 2" +SUPPORT_PYTHON_ABIS="1" +RESTRICT_PYTHON_ABIS="3.* *-jython" + +inherit autotools java-pkg-opt-2 python DESCRIPTION="SELinux policy tools" HOMEPAGE="http://www.tresys.com/selinux/selinux_policy_tools.shtml" @@ -24,10 +29,7 @@ DEPEND=">=sys-libs/libsepol-2.0.37 >=dev-lang/swig-1.3.28 >=virtual/jdk-1.4 ) - python? ( - >=dev-lang/python-2.4 - >=dev-lang/swig-1.3.28 - ) + python? ( >=dev-lang/swig-1.3.28 ) X? ( >=dev-lang/tk-8.4.9 >=gnome-base/libglade-2.0 @@ -39,7 +41,6 @@ RDEPEND=">=sys-libs/libsepol-2.0.37 >=dev-db/sqlite-3.2 dev-libs/libxml2 java? ( >=virtual/jre-1.4 ) - python? ( >=dev-lang/python-2.4 ) X? ( >=dev-lang/tk-8.4.9 >=dev-tcltk/bwidget-1.8 @@ -47,14 +48,38 @@ RDEPEND=">=sys-libs/libsepol-2.0.37 >=x11-libs/gtk+-2.8 )" -src_unpack() { - unpack ${A} +RESTRICT="test" + +pkg_setup() { + if use java; then + java-pkg-opt-2_pkg_setup + fi + + if use python; then + python_pkg_setup + PYTHON_DIRS="libapol/swig/python libpoldiff/swig/python libqpol/swig/python libseaudit/swig/python libsefs/swig/python" + fi +} + +src_prepare() { + # Disable broken check for SWIG version. + sed -e "s/AC_PROG_SWIG(1.3.28)/AC_PROG_SWIG/" -i configure.ac || die "sed failed" + + local dir + for dir in ${PYTHON_DIRS}; do + # Python bindings are built/installed manually. + sed -e "s/MAYBE_PYSWIG = python/MAYBE_PYSWIG =/" -i ${dir%python}Makefile.am || die "sed failed" + # Make PYTHON_LDFLAGS replaceable during running `make`. + sed -e "/^AM_LDFLAGS =/s/@PYTHON_LDFLAGS@/\$(PYTHON_LDFLAGS)/" -i ${dir}/Makefile.am || die "sed failed" + done - cd "${S}" eautoreconf + + # Disable byte-compilation of Python modules. + echo '#!/bin/sh' > py-compile } -src_compile() { +src_configure() { econf \ --with-java-prefix=${JAVA_HOME} \ --disable-selinux-check \ @@ -68,10 +93,61 @@ src_compile() { # work around swig c99 issues. it does not require # c99 anyway. sed -i -e 's/-std=gnu99//' "${S}/libseaudit/swig/python/Makefile" +} - emake || die +src_compile() { + default + + if use python; then + local dir + for dir in ${PYTHON_DIRS}; do + python_copy_sources ${dir} + building() { + emake \ + SWIG_PYTHON_CPPFLAGS="-I$(python_get_includedir)" \ + PYTHON_LDFLAGS="$(python_get_library -l)" \ + pyexecdir="$(python_get_sitedir)" \ + pythondir="$(python_get_sitedir)" + } + python_execute_function \ + --action-message "Building of Python bindings from ${dir} directory with \$(python_get_implementation) \$(python_get_version)" \ + --failure-message "Building of Python bindings from ${dir} directory with \$(python_get_implementation) \$(python_get_version) failed" \ + -s --source-dir ${dir} \ + building + done + fi } src_install() { - emake DESTDIR="${D}" install || die "install failed." + emake DESTDIR="${D}" install || die "emake install failed" + + if use python; then + local dir + for dir in ${PYTHON_DIRS}; do + installation() { + emake \ + DESTDIR="${D}" \ + pyexecdir="$(python_get_sitedir)" \ + pythondir="$(python_get_sitedir)" \ + install + } + python_execute_function \ + --action-message "Installation of Python bindings from ${dir} directory with \$(python_get_implementation) \$(python_get_version)" \ + --failure-message "Installation of Python bindings from ${dir} directory with \$(python_get_implementation) \$(python_get_version) failed" \ + -s --source-dir ${dir} \ + installation + done + fi +} + +pkg_postinst() { + if use python; then + python_mod_optimize setools + fi +} + +pkg_postrm() { + if use python; then + python_mod_cleanup setools + fi } -- cgit v1.2.3-65-gdbad