sys-libs/libcap: Separate libpsx stuff into own pkgconfig file
authorLars Wendler <polynomial-c@gentoo.org>
Sat, 28 Dec 2019 17:58:00 +0000 (18:58 +0100)
committerLars Wendler <polynomial-c@gentoo.org>
Sat, 28 Dec 2019 18:02:24 +0000 (19:02 +0100)
Bug: https://bugs.gentoo.org/703932
Package-Manager: Portage-2.3.84, Repoman-2.3.20
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
sys-devel/gettext/gettext-0.20.1.ebuild
sys-libs/libcap/files/libcap-2.29-libpsx_pkgconfig.patch [new file with mode: 0644]
sys-libs/libcap/libcap-2.29-r2.ebuild [new file with mode: 0644]

index 251b2681eb3190bfd9f50ca9e28e50589d17dd68..7de043924130756a86102a54192966e17daaa143 100644 (file)
@@ -5,7 +5,7 @@
 
 EAPI=7
 
-inherit mono-env libtool java-pkg-opt-2 multilib-minimal
+inherit epunt-cxx mono-env libtool java-pkg-opt-2 multilib-minimal
 
 DESCRIPTION="GNU locale utilities"
 HOMEPAGE="https://www.gnu.org/software/gettext/"
@@ -70,6 +70,7 @@ src_prepare() {
 
        default
 
+       epunt_cxx
        elibtoolize
 }
 
diff --git a/sys-libs/libcap/files/libcap-2.29-libpsx_pkgconfig.patch b/sys-libs/libcap/files/libcap-2.29-libpsx_pkgconfig.patch
new file mode 100644 (file)
index 0000000..413b279
--- /dev/null
@@ -0,0 +1,88 @@
+From e13e5b24fb98dc3ec2f76bc51ed0d714460e75d8 Mon Sep 17 00:00:00 2001
+From: Lars Wendler <polynomial-c@gentoo.org>
+Date: Sat, 28 Dec 2019 18:48:35 +0100
+Subject: [PATCH] USe separate libpsx.pc file instead of libcap.pc
+
+pkgconfig fails to parse current libcap.pc file but pkgconf succeeds
+
+Gentoo-bug: https://bugs.gentoo.org/703932
+---
+ libcap/Makefile     | 12 +++++++++++-
+ libcap/libcap.pc.in |  7 -------
+ libcap/libpsx.pc.in | 12 ++++++++++++
+ 3 files changed, 23 insertions(+), 8 deletions(-)
+ create mode 100644 libcap/libpsx.pc.in
+
+diff --git a/libcap/Makefile b/libcap/Makefile
+index 949cfad..5795458 100644
+--- a/libcap/Makefile
++++ b/libcap/Makefile
+@@ -22,7 +22,7 @@ MAJLIBNAME=$(LIBNAME).$(VERSION)
+ MINLIBNAME=$(MAJLIBNAME).$(MINOR)
+ GPERF_OUTPUT = _caps_output.gperf
+-all: $(MINLIBNAME) $(STACAPLIBNAME) libcap.pc $(STAPSXLIBNAME)
++all: $(MINLIBNAME) $(STACAPLIBNAME) libcap.pc libpsx.pc $(STAPSXLIBNAME)
+ ifeq ($(BUILD_GPERF),yes)
+ USE_GPERF_OUTPUT = $(GPERF_OUTPUT)
+@@ -38,6 +38,15 @@ libcap.pc: libcap.pc.in
+               -e 's,@deps@,$(DEPS),' \
+               $< >$@
++libpsx.pc: libpsx.pc.in
++      sed -e 's,@prefix@,$(prefix),' \
++              -e 's,@exec_prefix@,$(exec_prefix),' \
++              -e 's,@libdir@,$(LIBDIR),' \
++              -e 's,@includedir@,$(inc_prefix)/include,' \
++              -e 's,@VERSION@,$(VERSION).$(MINOR),' \
++              -e 's,@deps@,$(DEPS),' \
++              $< >$@
++
+ _makenames: _makenames.c cap_names.list.h
+       $(BUILD_CC) $(BUILD_CFLAGS) $< -o $@
+@@ -86,6 +95,7 @@ ifeq ($(FAKEROOT),)
+ endif
+       mkdir -p -m 0755 $(FAKEROOT)$(PKGCONFIGDIR)
+       install -m 0644 libcap.pc $(FAKEROOT)$(PKGCONFIGDIR)/libcap.pc
++      install -m 0644 libpsx.pc $(FAKEROOT)$(PKGCONFIGDIR)/libpsx.pc
+ ifeq ($(GOLANG),yes)
+       mkdir -p -m 0755 $(FAKEROOT)$(GOPKGDIR)/libcap/cap
+       install -m 0644 src/libcap/cap/* $(FAKEROOT)$(GOPKGDIR)/libcap/cap/
+diff --git a/libcap/libcap.pc.in b/libcap/libcap.pc.in
+index 3d6b273..69cd231 100644
+--- a/libcap/libcap.pc.in
++++ b/libcap/libcap.pc.in
+@@ -9,10 +9,3 @@ Version: @VERSION@
+ Libs: -L${libdir} -lcap
+ Libs.private: @deps@
+ Cflags: -I${includedir}
+-
+-Name: libpsx
+-Description: libpsx - linux posix syscall API for pthreads
+-Version: @VERSION@
+-Libs: -L${libdir} -lpsx -lpthread -Wl,-wrap,pthread_create
+-Libs.private: @deps@
+-Cflags: -I${includedir}
+diff --git a/libcap/libpsx.pc.in b/libcap/libpsx.pc.in
+new file mode 100644
+index 0000000..8677a86
+--- /dev/null
++++ b/libcap/libpsx.pc.in
+@@ -0,0 +1,12 @@
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++libdir=@libdir@
++includedir=@includedir@
++
++Name: libpsx
++Description: libpsx - linux posix syscall API for pthreads
++Version: @VERSION@
++Libs: -L${libdir} -lpsx -lpthread -Wl,-wrap,pthread_create
++Libs.private: @deps@
++Cflags: -I${includedir}
++Requires: libcap
+-- 
+2.24.1
+
diff --git a/sys-libs/libcap/libcap-2.29-r2.ebuild b/sys-libs/libcap/libcap-2.29-r2.ebuild
new file mode 100644 (file)
index 0000000..267e188
--- /dev/null
@@ -0,0 +1,85 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit multilib multilib-minimal toolchain-funcs pam usr-ldscript
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://www.friedhoff.org/posixfilecaps.html"
+SRC_URI="https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/${P}.tar.xz"
+
+# it's available under either of the licenses
+LICENSE="|| ( GPL-2 BSD )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="pam static-libs"
+
+# While the build system optionally uses gperf, we don't DEPEND on it because
+# the build automatically falls back when it's unavailable.  #604802
+RDEPEND=">=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}]
+       pam? ( sys-libs/pam[${MULTILIB_USEDEP}] )"
+DEPEND="${RDEPEND}
+       sys-kernel/linux-headers"
+
+# Requires test suite being run as root (via sudo)
+RESTRICT="test"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.29-build-system-fixes.patch
+       "${FILESDIR}"/${PN}-2.28-no_perl.patch
+       "${FILESDIR}"/${PN}-2.25-ignore-RAISE_SETFCAP-install-failures.patch
+       "${FILESDIR}"/${PN}-2.21-include.patch
+       "${FILESDIR}"/${PN}-2.29-libpsx_pkgconfig.patch
+)
+
+src_prepare() {
+       default
+       multilib_copy_sources
+}
+
+run_emake() {
+       local args=(
+               exec_prefix="${EPREFIX}"
+               lib_prefix="${EPREFIX}/usr"
+               lib="$(get_libdir)"
+               prefix="${EPREFIX}/usr"
+               PAM_CAP="$(usex pam yes no)"
+               DYNAMIC=yes
+               GOLANG=no
+       )
+       emake "${args[@]}" "$@"
+}
+
+multilib_src_compile() {
+       tc-export AR CC RANLIB
+       local BUILD_CC
+       tc-export_build_env BUILD_CC
+
+       run_emake
+}
+
+multilib_src_install() {
+       # no configure, needs explicit install line #444724#c3
+       run_emake DESTDIR="${D}" install
+
+       gen_usr_ldscript -a cap
+       if ! use static-libs ; then
+               # Don't remove libpsx.a!
+               # See https://bugs.gentoo.org/703912
+               rm "${ED}"/usr/$(get_libdir)/libcap.a || die
+       fi
+
+       if [[ -d "${ED}"/usr/$(get_libdir)/security ]] ; then
+               rm -r "${ED}"/usr/$(get_libdir)/security || die
+       fi
+
+       if use pam; then
+               dopammod pam_cap/pam_cap.so
+               dopamsecurity '' pam_cap/capability.conf
+       fi
+}
+
+multilib_src_install_all() {
+       dodoc CHANGELOG README doc/capability.notes
+}