summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2021-05-23 16:49:45 -0400
committerMike Gilbert <floppym@gentoo.org>2021-05-23 18:26:03 -0400
commit0e4b6f02ff363c24df72105616bbad85af62f219 (patch)
tree6dd7fdc472d484ea1fb9719ea86f0353bc5ea1c6 /sys-libs
parentdev-util/conf2struct: Added ~mips to KEYWORDS (diff)
downloadgentoo-0e4b6f02ff363c24df72105616bbad85af62f219.tar.gz
gentoo-0e4b6f02ff363c24df72105616bbad85af62f219.tar.bz2
gentoo-0e4b6f02ff363c24df72105616bbad85af62f219.zip
sys-libs/libseccomp: rework python support
Apply a patch to link against the shared library. Eliminate a messy sed expression by copying some files around instead. Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Diffstat (limited to 'sys-libs')
-rw-r--r--sys-libs/libseccomp/files/libseccomp-python-shared.patch25
-rw-r--r--sys-libs/libseccomp/libseccomp-2.5.1-r1.ebuild91
-rw-r--r--sys-libs/libseccomp/libseccomp-9999.ebuild32
3 files changed, 135 insertions, 13 deletions
diff --git a/sys-libs/libseccomp/files/libseccomp-python-shared.patch b/sys-libs/libseccomp/files/libseccomp-python-shared.patch
new file mode 100644
index 000000000000..93e1ec8a9156
--- /dev/null
+++ b/sys-libs/libseccomp/files/libseccomp-python-shared.patch
@@ -0,0 +1,25 @@
+From 763b863c3028f604f16cc6d2de7452dc16458596 Mon Sep 17 00:00:00 2001
+From: Mike Gilbert <floppym@gentoo.org>
+Date: Sun, 23 May 2021 16:17:32 -0400
+Subject: [PATCH] Link python module against shared library
+
+---
+ src/python/setup.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/python/setup.py b/src/python/setup.py
+index 0419111..fb650d0 100755
+--- a/src/python/setup.py
++++ b/src/python/setup.py
+@@ -41,7 +41,7 @@ setup(
+ ext_modules = [
+ Extension("seccomp", ["seccomp.pyx"],
+ # unable to handle libtool libraries directly
+- extra_objects=["../.libs/libseccomp.a"],
++ extra_objects=["../.libs/libseccomp.so"],
+ # fix build warnings, see PEP 3123
+ extra_compile_args=["-fno-strict-aliasing"])
+ ]
+--
+2.32.0.rc1
+
diff --git a/sys-libs/libseccomp/libseccomp-2.5.1-r1.ebuild b/sys-libs/libseccomp/libseccomp-2.5.1-r1.ebuild
new file mode 100644
index 000000000000..c445290913e2
--- /dev/null
+++ b/sys-libs/libseccomp/libseccomp-2.5.1-r1.ebuild
@@ -0,0 +1,91 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7..9} )
+DISTUTILS_OPTIONAL=1
+DISTUTILS_USE_SETUPTOOLS=no
+
+inherit distutils-r1 multilib-minimal
+
+DESCRIPTION="high level interface to Linux seccomp filter"
+HOMEPAGE="https://github.com/seccomp/libseccomp"
+
+if [[ ${PV} == *9999 ]] ; then
+ EGIT_REPO_URI="https://github.com/seccomp/libseccomp.git"
+ PRERELEASE="2.6.0"
+ inherit autotools git-r3
+else
+ SRC_URI="https://github.com/seccomp/libseccomp/releases/download/v${PV}/${P}.tar.gz"
+ KEYWORDS="-* ~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~riscv ~s390 ~x86 ~amd64-linux ~x86-linux"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+IUSE="python static-libs"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+DEPEND="python? ( ${PYTHON_DEPS} )"
+RDEPEND="${DEPEND}"
+BDEPEND="${DEPEND}
+ dev-util/gperf
+ python? ( dev-python/cython[${PYTHON_USEDEP}] )
+"
+# We need newer kernel headers; we don't keep strict control of the exact
+# version here, just be safe and pull in the latest stable ones. #551248
+DEPEND="${DEPEND} >=sys-kernel/linux-headers-4.3"
+
+src_prepare() {
+ local PATCHES=(
+ "${FILESDIR}/libseccomp-python-shared.patch"
+ )
+ default
+ if [[ "${PV}" == *9999 ]] ; then
+ sed -i -e "s/0.0.0/${PRERELEASE}/" configure.ac
+ eautoreconf
+ fi
+}
+
+multilib_src_configure() {
+ local myeconfargs=(
+ $(use_enable static-libs static)
+ --disable-python
+ )
+ ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
+}
+
+do_python() {
+ # setup.py reads VERSION_RELEASE from the environment
+ local -x VERSION_RELEASE=${PRERELEASE-${PV}}
+ pushd "${BUILD_DIR}/src/python" >/dev/null || die
+ "$@"
+ popd >/dev/null || die
+}
+
+multilib_src_compile() {
+ emake
+
+ if multilib_is_native_abi && use python ; then
+ # setup.py expects libseccomp.so to live in "../.libs"
+ # Copy the python files to the right place for this.
+ rm -r "${BUILD_DIR}/src/python" || die
+ cp -r "${S}/src/python" "${BUILD_DIR}/src/python" || die
+ local -x CPPFLAGS="-I\"${BUILD_DIR}/include\" -I\"${S}/include\" ${CPPFLAGS}"
+ do_python distutils-r1_src_compile
+ fi
+}
+
+multilib_src_install() {
+ emake DESTDIR="${D}" install
+
+ if multilib_is_native_abi && use python ; then
+ do_python distutils-r1_src_install
+ fi
+}
+
+multilib_src_install_all() {
+ find "${ED}" -type f -name "${PN}.la" -delete || die
+ einstalldocs
+}
diff --git a/sys-libs/libseccomp/libseccomp-9999.ebuild b/sys-libs/libseccomp/libseccomp-9999.ebuild
index 9256faff2b5c..c445290913e2 100644
--- a/sys-libs/libseccomp/libseccomp-9999.ebuild
+++ b/sys-libs/libseccomp/libseccomp-9999.ebuild
@@ -25,11 +25,7 @@ LICENSE="LGPL-2.1"
SLOT="0"
IUSE="python static-libs"
-REQUIRED_USE="
- python? (
- static-libs
- ${PYTHON_REQUIRED_USE}
- )"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
DEPEND="python? ( ${PYTHON_DEPS} )"
RDEPEND="${DEPEND}"
@@ -42,6 +38,9 @@ BDEPEND="${DEPEND}
DEPEND="${DEPEND} >=sys-kernel/linux-headers-4.3"
src_prepare() {
+ local PATCHES=(
+ "${FILESDIR}/libseccomp-python-shared.patch"
+ )
default
if [[ "${PV}" == *9999 ]] ; then
sed -i -e "s/0.0.0/${PRERELEASE}/" configure.ac
@@ -57,16 +56,24 @@ multilib_src_configure() {
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
}
+do_python() {
+ # setup.py reads VERSION_RELEASE from the environment
+ local -x VERSION_RELEASE=${PRERELEASE-${PV}}
+ pushd "${BUILD_DIR}/src/python" >/dev/null || die
+ "$@"
+ popd >/dev/null || die
+}
+
multilib_src_compile() {
emake
if multilib_is_native_abi && use python ; then
- cd "${S}/src/python" || die
- sed -i -e "s/=.*VERSION_RELEASE.*,/=\"${PRERELEASE}\",/" \
- -e "/extra_objects/s,\.\.,${OLDPWD}/src," \
- setup.py || die
- local -x CPPFLAGS="-I${OLDPWD}/include -I../../include"
- distutils-r1_src_compile
+ # setup.py expects libseccomp.so to live in "../.libs"
+ # Copy the python files to the right place for this.
+ rm -r "${BUILD_DIR}/src/python" || die
+ cp -r "${S}/src/python" "${BUILD_DIR}/src/python" || die
+ local -x CPPFLAGS="-I\"${BUILD_DIR}/include\" -I\"${S}/include\" ${CPPFLAGS}"
+ do_python distutils-r1_src_compile
fi
}
@@ -74,8 +81,7 @@ multilib_src_install() {
emake DESTDIR="${D}" install
if multilib_is_native_abi && use python ; then
- cd "${S}/src/python" || die
- distutils-r1_src_install
+ do_python distutils-r1_src_install
fi
}