Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/libcap/, sys-libs/libcap/files/
Date: Mon, 30 Aug 2021 06:12:39
Message-Id: 1630303947.377ecb31bade3f21c3b9648125eb00c3d23023b3.sam@gentoo
1 commit: 377ecb31bade3f21c3b9648125eb00c3d23023b3
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Mon Aug 30 06:09:30 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Mon Aug 30 06:12:27 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=377ecb31
7
8 sys-libs/libcap: add 2.55 (unkeyworded)
9
10 Only significant change here is revamping
11 of our (previously rather large) build system
12 patch. See the patch itself for more details.
13
14 Much smaller version of patches from before thanks
15 to upstream incorporating some of our changes.
16
17 Unkeyworded for now just to give it a bit
18 of time to settle, as the patch is a fair
19 bit different to what it was before.
20
21 Bug: https://bugs.gentoo.org/808807 (given this is where discussion occurred)
22 Bug: https://bugzilla.kernel.org/show_bug.cgi?id=214085
23 Thanks-to: Andrew G. Morgan <morgan <AT> kernel.org> (for reaching out & incorporating patches)
24 Signed-off-by: Sam James <sam <AT> gentoo.org>
25
26 sys-libs/libcap/Manifest | 1 +
27 .../files/libcap-2.55-build-system-fixes.patch | 119 +++++++++++++++++++++
28 sys-libs/libcap/libcap-2.55.ebuild | 85 +++++++++++++++
29 3 files changed, 205 insertions(+)
30
31 diff --git a/sys-libs/libcap/Manifest b/sys-libs/libcap/Manifest
32 index 787ee81d3f2..fb0ba3e19b1 100644
33 --- a/sys-libs/libcap/Manifest
34 +++ b/sys-libs/libcap/Manifest
35 @@ -1,3 +1,4 @@
36 DIST libcap-2.49.tar.xz 139568 BLAKE2B 5746dcdf2a737e747450bd50a701ee8543277b17b7fbf1304b79f707a088ea74dc6dc79c61ff89b55b718a460a7b0814f960f44d07944a97b832b78f4e14e07f SHA512 2934a2ded1370edeb9603dbf43d8ca23a2eb5d67efc5cec5d4ba96c707a8db2702da8aa9be0cb86c5ff100d37ec96115c7777a7566ad0ab2e0b4a288bbe357d0
37 DIST libcap-2.51.tar.xz 145440 BLAKE2B 9f004e28891fbbb3552016e2e9250eab38935b6b40ad9e808a64ab07eecb52c5fa9032caed0baab719df8afe9aeec98403d10b05336bebe15a50b64020e5afc2 SHA512 3b4a97ef864a2ce2f87056ebc282223b0c71ca71c539744dc629ffe7905ca5fdde937ca70c34ec84406fe54863d39abf32775818a5e5a6fdf3069706b1723a88
38 DIST libcap-2.52.tar.xz 158720 BLAKE2B 0696ae00a485df019f5441efe1d71676ddf294f1116e7fc3f352ad0595f9d4830f2e4fac1f98353016de36a4866f9d018f53419970ccd114c6df0faa556bcea3 SHA512 95d9e0f81fd955c42a0f299163a4402f00e9e7a2b392dfbabe613abea4babba2730576e76c9b612665a0bb8bd88aa98bf28ea3eb5582b5c06cd1137594a59893
39 +DIST libcap-2.55.tar.xz 166164 BLAKE2B 75136d228c6b42086698aea79e774bed37d43aa0692154026708ddd27275fc611a702dafd0ad76b16b32d8006f863f7ca3aff1f645c74f1649ad5ae9b77db47c SHA512 b7c682b45800d96a86d12489855f643e8166849606e50ffae45da143790304858d677fe0d19067a9e09f5fa711548aee4bd7a6fda662a87ea2cc35c9455e8a2c
40
41 diff --git a/sys-libs/libcap/files/libcap-2.55-build-system-fixes.patch b/sys-libs/libcap/files/libcap-2.55-build-system-fixes.patch
42 new file mode 100644
43 index 00000000000..9bd357ed714
44 --- /dev/null
45 +++ b/sys-libs/libcap/files/libcap-2.55-build-system-fixes.patch
46 @@ -0,0 +1,119 @@
47 +From 4cdf9413b7b4ff27299c14f05d7a6fa038e4d59f Mon Sep 17 00:00:00 2001
48 +From: Sam James <sam@g.o>
49 +Date: Mon, 30 Aug 2021 07:04:15 +0100
50 +Subject: [PATCH] Build system fixes
51 +
52 +Summary:
53 +- Respect tool choices: CC/AR/OBJCOPY/RANLIB
54 +- Respect *FLAGS: CFLAGS/CPPFLAGS
55 +- Use existing make process to spawn new jobs
56 +- Only build tests conditionally (when we're going to run them)
57 +
58 +Much smaller version of patches from before thanks
59 +to upstream incorporating some of our changes.
60 +
61 +See < 2.55 patches for some more context/history; the
62 +original patch was from Mike Frysinger <vapier@g.o>
63 +and was forward-ported by Lars Wendler <polynomial-c@g.o>.
64 +
65 +Bug: https://bugs.gentoo.org/808807 (given this is where discussion occurred)
66 +Bug: https://bugzilla.kernel.org/show_bug.cgi?id=214085
67 +Signed-off-by: Sam James <sam@g.o>
68 +---
69 + Make.Rules | 13 +++++--------
70 + Makefile | 1 -
71 + pam_cap/Makefile | 2 +-
72 + progs/Makefile | 6 +++---
73 + 4 files changed, 9 insertions(+), 13 deletions(-)
74 +
75 +diff --git a/Make.Rules b/Make.Rules
76 +index 66207b4..1e0366e 100644
77 +--- a/Make.Rules
78 ++++ b/Make.Rules
79 +@@ -64,24 +64,20 @@ KERNEL_HEADERS := $(topdir)/libcap/include/uapi
80 + LIBCAP_INCLUDES = -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include
81 + DEFINES := -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
82 +
83 +-CC := $(CROSS_COMPILE)gcc
84 + LD=$(CC) -Wl,-x -shared
85 + SUDO := sudo
86 + COPTS ?= -O2
87 +-CFLAGS ?= $(COPTS) $(DEFINES)
88 ++CFLAGS ?= $(COPTS)
89 + LDFLAGS ?= #-g
90 +-CPPFLAGS += $(LIBCAP_INCLUDES)
91 ++CPPFLAGS += $(LIBCAP_INCLUDES) $(DEFINES)
92 +
93 + BUILD_CC ?= $(CC)
94 + BUILD_LD ?= $(BUILD_CC) -Wl,-x -shared
95 + BUILD_COPTS ?= $(COPTS)
96 +-BUILD_CFLAGS ?= $(BUILD_COPTS) $(DEFINES)
97 ++BUILD_CFLAGS ?= $(CFLAGS)
98 + BUILD_LDFLAGS ?= $(LDFLAGS)
99 + BUILD_CPPFLAGS += $(LIBCAP_INCLUDES)
100 +
101 +-AR := $(CROSS_COMPILE)ar
102 +-RANLIB := $(CROSS_COMPILE)ranlib
103 +-OBJCOPY := $(CROSS_COMPILE)objcopy
104 + DEBUG = -g #-DDEBUG
105 + WARNINGS=-Wall -Wwrite-strings \
106 + -Wpointer-arith -Wcast-qual -Wcast-align \
107 +@@ -95,7 +91,8 @@ BUILD_GPERF := $(shell which gperf >/dev/null 2>/dev/null && echo yes)
108 +
109 + SYSTEM_HEADERS = /usr/include
110 + INCS=$(topdir)/libcap/include/sys/capability.h
111 +-CFLAGS += -Dlinux $(WARNINGS) $(DEBUG)
112 ++CPPFLAGS += -Dlinux
113 ++CFLAGS += $(WARNINGS) $(DEBUG)
114 + INDENT := $(shell if [ -n "$$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi)
115 +
116 + # SHARED tracks whether or not the SHARED libraries (libcap.so,
117 +diff --git a/Makefile b/Makefile
118 +index 1c195dd..3f71b12 100644
119 +--- a/Makefile
120 ++++ b/Makefile
121 +@@ -17,7 +17,6 @@ ifeq ($(GOLANG),yes)
122 + $(MAKE) -C go $@
123 + rm -f cap/go.sum
124 + endif
125 +- $(MAKE) -C tests $@
126 + $(MAKE) -C progs $@
127 + $(MAKE) -C doc $@
128 + $(MAKE) -C kdebug $@
129 +diff --git a/pam_cap/Makefile b/pam_cap/Makefile
130 +index d5da6be..0cba3e1 100644
131 +--- a/pam_cap/Makefile
132 ++++ b/pam_cap/Makefile
133 +@@ -65,7 +65,7 @@ test_pam_cap: test_pam_cap.c pam_cap.c ../libcap/libcap.a
134 + $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ test_pam_cap.c $(LIBCAPLIB) $(LDFLAGS) --static
135 +
136 + testlink: test.c pam_cap.o
137 +- $(CC) $(CFLAGS) -o $@ $+ -lpam -ldl $(LIBCAPLIB) $(LDFLAGS)
138 ++ $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $+ -lpam -ldl $(LIBCAPLIB) $(LDFLAGS)
139 +
140 + test: testlink test_pam_cap pam_cap.so
141 + $(MAKE) testlink
142 +diff --git a/progs/Makefile b/progs/Makefile
143 +index 51e9a63..98fe1b0 100644
144 +--- a/progs/Makefile
145 ++++ b/progs/Makefile
146 +@@ -22,13 +22,13 @@ DEPS = ../libcap/libcap.a
147 + endif
148 +
149 + ../libcap/libcap.a:
150 +- make -C ../libcap libcap.a
151 ++ $(MAKE) -C ../libcap libcap.a
152 +
153 + ../libcap/libcap.so:
154 +- make -C ../libcap libcap.so
155 ++ $(MAKE) -C ../libcap libcap.so
156 +
157 + $(BUILD): %: %.o $(DEPS)
158 +- $(CC) $(CFLAGS) -o $@ $< $(LIBCAPLIB) $(LDFLAGS)
159 ++ $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $< $(LIBCAPLIB) $(LDFLAGS)
160 +
161 + %.o: %.c $(INCS)
162 + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
163 +--
164 +2.33.0
165 +
166
167 diff --git a/sys-libs/libcap/libcap-2.55.ebuild b/sys-libs/libcap/libcap-2.55.ebuild
168 new file mode 100644
169 index 00000000000..b0f32594b17
170 --- /dev/null
171 +++ b/sys-libs/libcap/libcap-2.55.ebuild
172 @@ -0,0 +1,85 @@
173 +# Copyright 1999-2021 Gentoo Authors
174 +# Distributed under the terms of the GNU General Public License v2
175 +
176 +EAPI=7
177 +
178 +inherit multilib-minimal toolchain-funcs pam usr-ldscript
179 +
180 +DESCRIPTION="POSIX 1003.1e capabilities"
181 +HOMEPAGE="https://sites.google.com/site/fullycapable/"
182 +SRC_URI="https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/${P}.tar.xz"
183 +
184 +# it's available under either of the licenses
185 +LICENSE="|| ( GPL-2 BSD )"
186 +SLOT="0"
187 +# Temporarily unkeyworded for testing as the build system patch changed substantially
188 +#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
189 +IUSE="pam static-libs"
190 +
191 +# While the build system optionally uses gperf, we don't DEPEND on it because
192 +# the build automatically falls back when it's unavailable. #604802
193 +PDEPEND="pam? ( sys-libs/pam[${MULTILIB_USEDEP}] )"
194 +DEPEND="${PDEPEND}
195 + sys-kernel/linux-headers"
196 +
197 +# Requires test suite being run as root (via sudo)
198 +RESTRICT="test"
199 +
200 +PATCHES=(
201 + "${FILESDIR}"/${PN}-2.55-build-system-fixes.patch
202 + "${FILESDIR}"/${PN}-2.38-no_perl.patch
203 + "${FILESDIR}"/${PN}-2.25-ignore-RAISE_SETFCAP-install-failures.patch
204 + "${FILESDIR}"/${PN}-2.21-include.patch
205 +)
206 +
207 +src_prepare() {
208 + default
209 + multilib_copy_sources
210 +}
211 +
212 +run_emake() {
213 + local args=(
214 + exec_prefix="${EPREFIX}"
215 + lib_prefix="${EPREFIX}/usr"
216 + lib="$(get_libdir)"
217 + prefix="${EPREFIX}/usr"
218 + PAM_CAP="$(usex pam yes no)"
219 + DYNAMIC=yes
220 + GOLANG=no
221 + )
222 + emake "${args[@]}" "$@"
223 +}
224 +
225 +src_configure() {
226 + tc-export AR CC OBJCOPY RANLIB
227 + tc-export_build_env BUILD_CC
228 + multilib-minimal_src_configure
229 +}
230 +
231 +multilib_src_compile() {
232 + run_emake
233 +}
234 +
235 +multilib_src_install() {
236 + # no configure, needs explicit install line #444724#c3
237 + run_emake DESTDIR="${D}" install
238 +
239 + gen_usr_ldscript -a cap
240 + gen_usr_ldscript -a psx
241 + if ! use static-libs ; then
242 + rm "${ED}"/usr/$(get_libdir)/lib{cap,psx}.a || die
243 + fi
244 +
245 + if [[ -d "${ED}"/usr/$(get_libdir)/security ]] ; then
246 + rm -r "${ED}"/usr/$(get_libdir)/security || die
247 + fi
248 +
249 + if use pam ; then
250 + dopammod pam_cap/pam_cap.so
251 + dopamsecurity '' pam_cap/capability.conf
252 + fi
253 +}
254 +
255 +multilib_src_install_all() {
256 + dodoc CHANGELOG README doc/capability.notes
257 +}