commit: 0e4b6f02ff363c24df72105616bbad85af62f219 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org> AuthorDate: Sun May 23 20:49:45 2021 +0000 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> CommitDate: Sun May 23 22:26:03 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0e4b6f02
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 <AT> gentoo.org> .../files/libseccomp-python-shared.patch | 25 +++++++++++++++++ ...comp-9999.ebuild => libseccomp-2.5.1-r1.ebuild} | 32 +++++++++++++--------- sys-libs/libseccomp/libseccomp-9999.ebuild | 32 +++++++++++++--------- 3 files changed, 63 insertions(+), 26 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 00000000000..93e1ec8a915 --- /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 <flop...@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-9999.ebuild b/sys-libs/libseccomp/libseccomp-2.5.1-r1.ebuild similarity index 70% copy from sys-libs/libseccomp/libseccomp-9999.ebuild copy to sys-libs/libseccomp/libseccomp-2.5.1-r1.ebuild index 9256faff2b5..c445290913e 100644 --- a/sys-libs/libseccomp/libseccomp-9999.ebuild +++ b/sys-libs/libseccomp/libseccomp-2.5.1-r1.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 } diff --git a/sys-libs/libseccomp/libseccomp-9999.ebuild b/sys-libs/libseccomp/libseccomp-9999.ebuild index 9256faff2b5..c445290913e 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 }