1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
5 PYTHON_COMPAT=( python3_6 )
8 inherit python-r1 toolchain-funcs
12 MY_RELEASEDATE="20190315"
18 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
20 DESCRIPTION="SELinux core utilities"
21 HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki"
23 if [[ ${PV} == 9999 ]] ; then
25 EGIT_REPO_URI="https://github.com/SELinuxProject/selinux.git"
26 S="${WORKDIR}/${MY_P}/${PN#selinux-}"
28 SRC_URI="https://github.com/SELinuxProject/selinux/releases/download/${MY_RELEASEDATE}/${MY_P}.tar.gz"
29 KEYWORDS="amd64 ~arm64 ~mips x86"
30 S="${WORKDIR}/${MY_P}"
36 DEPEND=">=sys-libs/libselinux-${SELNX_VER}:=[python]
37 >=sys-libs/libsemanage-${SEMNG_VER}:=[python]
38 >=sys-libs/libsepol-${SEPOL_VER}:=
39 >=app-admin/setools-4.2.0[${PYTHON_USEDEP}]
40 dev-python/ipy[${PYTHON_USEDEP}]
48 sed -i 's/-Werror//g' "${S}"/*/Makefile || die "Failed to remove Werror"
55 emake -C "${BUILD_DIR}" \
57 LIBDIR="\$(PREFIX)/$(get_libdir)"
59 python_foreach_impl building
64 emake -C "${BUILD_DIR}" \
66 LIBDIR="\$(PREFIX)/$(get_libdir)" \
70 python_foreach_impl installation
72 # Set version-specific scripts
73 for pyscript in audit2allow sepolgen-ifgen sepolicy chcat; do
74 python_replicate_script "${ED}/usr/bin/${pyscript}"
76 for pyscript in semanage; do
77 python_replicate_script "${ED}/usr/sbin/${pyscript}"
80 # Create sepolgen.conf with different devel location definition
81 if [[ -f /etc/selinux/config ]];
83 local selinuxtype=$(awk -F'=' '/^SELINUXTYPE/ {print $2}' /etc/selinux/config);
84 mkdir -p "${D}"/etc/selinux || die "Failed to create selinux directory";
85 echo "SELINUX_DEVEL_PATH=/usr/share/selinux/${selinuxtype}/include:/usr/share/selinux/${selinuxtype}" > "${D}"/etc/selinux/sepolgen.conf;
87 local selinuxtype="${POLICY_TYPES%% *}";
88 if [[ -n "${selinuxtype}" ]];
90 echo "SELINUX_DEVEL_PATH=/usr/share/selinux/${selinuxtype}/include:/usr/share/selinux/${selinuxtype}" > "${D}"/etc/selinux/sepolgen.conf;
92 echo "SELINUX_DEVEL_PATH=/usr/share/selinux/strict/include:/usr/share/selinux/strict" > "${D}"/etc/selinux/sepolgen.conf;