1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 )
8 inherit autotools java-pkg-opt-2 python-r1 eutils toolchain-funcs
10 DESCRIPTION="SELinux policy tools"
11 HOMEPAGE="http://www.tresys.com/selinux/selinux_policy_tools.shtml"
12 SRC_URI="http://oss.tresys.com/projects/setools/chrome/site/dists/${P}/${P}.tar.bz2
13 https://dev.gentoo.org/~swift/patches/setools/${P}-01-fedora-patches.tar.gz
14 https://dev.gentoo.org/~swift/patches/setools/${P}-03-gentoo-patches.tar.gz"
19 IUSE="X debug java python"
21 DEPEND=">=sys-libs/libsepol-2.1.4
22 >=sys-libs/libselinux-2.3
38 >=gnome-base/libglade-2.0
42 RDEPEND=">=sys-libs/libsepol-2.1.4
43 >=sys-libs/libselinux-2.3
46 java? ( >=virtual/jre-1.4 )
48 >=dev-lang/tk-8.4.9:0=
49 >=dev-tcltk/bwidget-1.8
50 >=gnome-base/libglade-2.0
55 # setools dirs that contain python code to build
56 PYTHON_DIRS="libapol/swig/python libpoldiff/swig/python libqpol/swig/python libseaudit/swig/python libsefs/swig/python python"
60 java-pkg-opt-2_pkg_setup
65 EPATCH_MULTI_MSG="Applying various (Fedora-provided) setools fixes... " \
66 EPATCH_SUFFIX="patch" \
67 EPATCH_SOURCE="${WORKDIR}" \
71 EPATCH_MULTI_MSG="Applying various (Gentoo) setool fixes... " \
72 EPATCH_SUFFIX="patch" \
73 EPATCH_SOURCE="${WORKDIR}/gentoo-patches" \
77 # Disable broken check for SWIG version.
78 sed -e "s/AC_PROG_SWIG(2.0.0)/AC_PROG_SWIG/" -i configure.ac || die "sed failed"
80 sed -e 's/AC_PATH_PROG(\[SWIG\],\[swig\])/AC_PATH_PROG([SWIG],[swig1.3])/' -i m4/ac_pkg_swig.m4 || die "failed to set swig1.3"
81 # Fix build failure due to double __init__.py installation
82 sed -e "s/^wrappedpy_DATA = qpol.py \$(pkgpython_PYTHON)/wrappedpy_DATA = qpol.py/" -i libqpol/swig/python/Makefile.am || die
85 for dir in ${PYTHON_DIRS}; do
86 # Python bindings are built/installed manually.
87 sed -e "s/MAYBE_PYSWIG = python/MAYBE_PYSWIG =/" -i ${dir%python}Makefile.am || die "sed failed"
88 # Make PYTHON_LDFLAGS replaceable during running `make`.
89 sed -e "/^AM_LDFLAGS =/s/@PYTHON_LDFLAGS@/\$(PYTHON_LDFLAGS)/" -i ${dir}/Makefile.am || die "sed failed"
92 # temporary work around bug #424581 until automake-1.12 is stable (then
93 # depend on it). Need to use MKDIR_P in the mean time for 1.12+.
94 has_version ">=sys-devel/automake-1.12.1" && { find . -name 'Makefile.*' -exec sed -i -e 's:mkdir_p:MKDIR_P:g' {} + || die; }
98 # Disable byte-compilation of Python modules.
99 echo '#!/bin/sh' > py-compile
105 tc-ld-disable-gold #467136
107 --with-java-prefix=${JAVA_HOME} \
108 --disable-selinux-check \
109 --disable-bwidget-check \
110 $(use_enable python swig-python) \
111 $(use_enable java swig-java) \
112 $(use_enable X swig-tcl) \
113 $(use_enable X gui) \
116 # work around swig c99 issues. it does not require
118 sed -i -e 's/-std=gnu99//' "${S}/libseaudit/swig/python/Makefile"
126 python_export PYTHON_INCLUDEDIR
127 python_export PYTHON_SITEDIR
128 python_export PYTHON_LIBS
130 SWIG_PYTHON_CPPFLAGS="-I${PYTHON_INCLUDEDIR}" \
131 PYTHON_LDFLAGS="${PYTHON_LIBS}" \
132 pyexecdir="${PYTHON_SITEDIR}" \
133 pythondir="${PYTHON_SITEDIR}" \
137 for dir in ${PYTHON_DIRS}; do
138 python_foreach_impl building ${dir}
144 emake DESTDIR="${D}" install
148 python_export PYTHON_SITEDIR
149 emake DESTDIR="${D}" \
150 pyexecdir="${PYTHON_SITEDIR}" \
151 pythondir="${PYTHON_SITEDIR}" \
156 for dir in ${PYTHON_DIRS}; do
157 python_foreach_impl installation "${dir}"