Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/libcap/, sys-libs/libcap/files/
Date: Tue, 25 May 2021 14:19:06
Message-Id: 1621952337.149cb0b85d203efa4ec6624092355a8946b48106.polynomial-c@gentoo
1 commit: 149cb0b85d203efa4ec6624092355a8946b48106
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 25 14:18:26 2021 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Tue May 25 14:18:57 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=149cb0b8
7
8 sys-libs/libcap: Bump to version 2.50
9
10 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
11
12 sys-libs/libcap/Manifest | 1 +
13 .../files/libcap-2.50-build-system-fixes.patch | 209 +++++++++++++++++++++
14 sys-libs/libcap/libcap-2.50.ebuild | 89 +++++++++
15 3 files changed, 299 insertions(+)
16
17 diff --git a/sys-libs/libcap/Manifest b/sys-libs/libcap/Manifest
18 index 38190faf3eb..671d87f49eb 100644
19 --- a/sys-libs/libcap/Manifest
20 +++ b/sys-libs/libcap/Manifest
21 @@ -1,3 +1,4 @@
22 DIST libcap-2.43.tar.xz 125284 BLAKE2B bde36f8397f4adb74760eb403daa06bee1b8f45ddc253cc3c3ef1f6e95d0e4c76d0f2e6fa3335a8bc451f18ac7128c96230f6aba9ae0320fa4f9d669e7b4f715 SHA512 817add571fb2c54ad2a39974e6545b8fc8d855ecdcf2e00b2cc10e583802c49dfea2d8bca484c89ecd574fdacfc46565b51e3064a4407cf1985defb913240d45
23 DIST libcap-2.48.tar.xz 132280 BLAKE2B 43ab75b73a5297ec24467fae82378f8c7aba5356afcebfb32a695d664a4b5268526fd90a009596c0f516a626d8f4523a9b49ec3225b6a886da32e62eb5b55ea5 SHA512 3cb1e2b026c0f60d6f225c7255944d45023e59fd065b8f832739fc90d33b3347981675de12dd705c4ecbd647a494a17daf39e1d92599bcd1a83306886edadba1
24 DIST libcap-2.49.tar.xz 139568 BLAKE2B 5746dcdf2a737e747450bd50a701ee8543277b17b7fbf1304b79f707a088ea74dc6dc79c61ff89b55b718a460a7b0814f960f44d07944a97b832b78f4e14e07f SHA512 2934a2ded1370edeb9603dbf43d8ca23a2eb5d67efc5cec5d4ba96c707a8db2702da8aa9be0cb86c5ff100d37ec96115c7777a7566ad0ab2e0b4a288bbe357d0
25 +DIST libcap-2.50.tar.xz 143792 BLAKE2B be83dfe1e55a4363936f53afb13edd2c1fd8c9bc27f7946bfda1eb8fb3046d0370997dcf85ba9dab7de10673527b4e8d15f104a75eaf407cba8ed0fc42465790 SHA512 6ac2df1ea9a9154e082c0595d343380ff8abed953b53c635a9297683289f2fa708eff488a42c6053e5ac556a5d90faa8709b3d98a47b2911f05bf80f2663a543
26
27 diff --git a/sys-libs/libcap/files/libcap-2.50-build-system-fixes.patch b/sys-libs/libcap/files/libcap-2.50-build-system-fixes.patch
28 new file mode 100644
29 index 00000000000..45b24421c8a
30 --- /dev/null
31 +++ b/sys-libs/libcap/files/libcap-2.50-build-system-fixes.patch
32 @@ -0,0 +1,209 @@
33 +From 1f2465ec2b9dccd9823a54938722dc4e5edb8105 Mon Sep 17 00:00:00 2001
34 +From: Mike Frysinger <vapier@g.o>
35 +Date: Wed, 4 Nov 2020 22:46:20 +0100
36 +Subject: [PATCH] build system fixes
37 +
38 +This touches up the homebrewed build system to work much better "out of the
39 +box" for people. Specifically:
40 + - allow toolchain vars to be set via environment
41 + - CC / BUILD_CC / AR / RANLIB
42 + - CFLAGS / CPPFLAGS / LDFLAGS
43 + - split CPPFLAGS out of CFLAGS
44 + - break -fPIC out of global CFLAGS and only use where needed
45 + - use LDLIBS for libraries, not LDFLAGS
46 +
47 +Signed-off-by: Mike Frysinger <vapier@g.o>
48 +
49 +Forward ported from libcap-2.24 to libcap-2.25
50 +Forward ported from libcap-2.25 to libcap-2.28
51 +Forward ported from libcap-2.28 to libcap-2.29
52 +Forward ported from libcap-2.29 to libcap-2.33
53 +Forward ported from libcap-2.33 to libcap-2.34
54 +Forward ported from libcap-2.34 to libcap-2.37
55 +Forward ported from libcap-2.37 to libcap-2.39
56 +Forward ported from libcap-2.39 to libcap-2.42
57 +Forward ported from libcap-2.42 to libcap-2.44
58 +Forward ported from libcap-2.44 to libcap-2.45
59 +Forward ported from libcap-2.45 to libcap-2.48
60 +Forward ported from libcap-2.48 to libcap-2.50
61 +
62 +Signed-off-by: Lars Wendler <polynomial-c@g.o>
63 +---
64 + Make.Rules | 10 ++++++----
65 + Makefile | 1 -
66 + libcap/Makefile | 7 ++++---
67 + pam_cap/Makefile | 8 +++++---
68 + progs/Makefile | 4 ++--
69 + tests/Makefile | 6 ++++--
70 + 6 files changed, 21 insertions(+), 15 deletions(-)
71 +
72 +diff --git a/Make.Rules b/Make.Rules
73 +index 98284e2..a797347 100644
74 +--- a/Make.Rules
75 ++++ b/Make.Rules
76 +@@ -52,7 +52,6 @@ GOMAJOR=1
77 + # Compilation specifics
78 +
79 + KERNEL_HEADERS := $(topdir)/libcap/include/uapi
80 +-IPATH += -fPIC -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include
81 +
82 + CC := $(CROSS_COMPILE)gcc
83 + DEFINES := -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
84 +@@ -60,7 +59,7 @@ COPTS ?= -O2
85 + CFLAGS ?= $(COPTS) $(DEFINES)
86 + BUILD_CC ?= $(CC)
87 + BUILD_COPTS ?= -O2
88 +-BUILD_CFLAGS ?= $(BUILD_COPTS) $(DEFINES) $(IPATH)
89 ++BUILD_CFLAGS ?= $(CFLAGS)
90 + AR := $(CROSS_COMPILE)ar
91 + RANLIB := $(CROSS_COMPILE)ranlib
92 + DEBUG = -g #-DDEBUG
93 +@@ -76,10 +75,13 @@ LIBPSXLIB := -L$(topdir)/libcap -lpsx $(PSXLINKFLAGS)
94 +
95 + BUILD_GPERF := $(shell which gperf >/dev/null 2>/dev/null && echo yes)
96 +
97 +-SYSTEM_HEADERS = /usr/include
98 ++LIBCAP_CPPFLAGS = -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include $(DEFINES)
99 ++CPPFLAGS += $(LIBCAP_CPPFLAGS)
100 ++BUILD_CPPFLAGS += $(LIBCAP_CPPFLAGS)
101 + INCS=$(topdir)/libcap/include/sys/capability.h
102 + LDFLAGS += -L$(topdir)/libcap
103 +-CFLAGS += -Dlinux $(WARNINGS) $(DEBUG)
104 ++CPPFLAGS += -Dlinux
105 ++CFLAGS += $(WARNINGS) $(DEBUG)
106 + INDENT := $(shell if [ -n "$$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi)
107 +
108 + # SHARED tracks whether or not the SHARED libraries (libcap.so,
109 +diff --git a/Makefile b/Makefile
110 +index bfc2089..2b06c9a 100644
111 +--- a/Makefile
112 ++++ b/Makefile
113 +@@ -17,7 +17,6 @@ ifeq ($(GOLANG),yes)
114 + $(MAKE) -C go $@
115 + rm -f cap/go.sum
116 + endif
117 +- $(MAKE) -C tests $@
118 + $(MAKE) -C progs $@
119 + $(MAKE) -C doc $@
120 + $(MAKE) -C kdebug $@
121 +diff --git a/libcap/Makefile b/libcap/Makefile
122 +index 9563d88..4b42f01 100644
123 +--- a/libcap/Makefile
124 ++++ b/libcap/Makefile
125 +@@ -25,6 +25,7 @@ MINCAPLIBNAME=$(MAJCAPLIBNAME).$(MINOR)
126 + PSXOBJS=$(addsuffix .o, $(PSXFILES))
127 + MAJPSXLIBNAME=$(PSXLIBNAME).$(VERSION)
128 + MINPSXLIBNAME=$(MAJPSXLIBNAME).$(MINOR)
129 ++CFLAGS += -fPIC
130 +
131 + all: pcs $(STACAPLIBNAME)
132 + ifeq ($(SHARED),yes)
133 +@@ -66,7 +67,7 @@ libpsx.pc: libpsx.pc.in
134 + $< >$@
135 +
136 + _makenames: _makenames.c cap_names.list.h
137 +- $(BUILD_CC) $(BUILD_CFLAGS) $< -o $@
138 ++ $(BUILD_CC) $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@
139 +
140 + cap_names.h: _makenames
141 + ./_makenames > cap_names.h
142 +@@ -105,10 +106,10 @@ $(PSXLIBNAME) $(MAJPSXLIBNAME) $(MINPSXLIBNAME): $(PSXOBJS) include/sys/psx_sysc
143 + endif
144 +
145 + %.o: %.c $(INCLS)
146 +- $(CC) $(CFLAGS) $(IPATH) -c $< -o $@
147 ++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
148 +
149 + cap_text.o: cap_text.c $(USE_GPERF_OUTPUT) $(INCLS)
150 +- $(CC) $(CFLAGS) $(IPATH) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@
151 ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@
152 +
153 + cap_test: cap_test.c libcap.h
154 + $(CC) $(CFLAGS) $(IPATH) $< -o $@
155 +diff --git a/pam_cap/Makefile b/pam_cap/Makefile
156 +index 56604fd..2da4674 100644
157 +--- a/pam_cap/Makefile
158 ++++ b/pam_cap/Makefile
159 +@@ -3,6 +3,8 @@
160 + topdir=$(shell pwd)/..
161 + include ../Make.Rules
162 +
163 ++CFLAGS += -fPIC
164 ++
165 + all: pam_cap.so
166 + $(MAKE) testlink
167 +
168 +@@ -16,16 +18,16 @@ install: all
169 + # written (and you know why it fails), email me and explain why. Thanks!
170 +
171 + pam_cap.so: pam_cap.o
172 +- $(LD) -o pam_cap.so $< $(LIBCAPLIB) $(LDFLAGS)
173 ++ $(LD) $(CFLAGS) -o pam_cap.so $< $(LIBCAPLIB) $(LDFLAGS)
174 +
175 + pam_cap.o: pam_cap.c
176 +- $(CC) $(CFLAGS) $(IPATH) -c $< -o $@
177 ++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
178 +
179 + test_pam_cap: test_pam_cap.c pam_cap.c
180 + $(CC) $(CFLAGS) $(IPATH) -o $@ test_pam_cap.c $(LIBCAPLIB) $(LDFLAGS) --static
181 +
182 + testlink: test.c pam_cap.o
183 +- $(CC) $(CFLAGS) -o $@ $+ -lpam -ldl $(LIBCAPLIB) $(LDFLAGS)
184 ++ $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $+ -lpam -ldl $(LIBCAPLIB) $(LDFLAGS)
185 +
186 + test: pam_cap.so
187 + make testlink
188 +diff --git a/progs/Makefile b/progs/Makefile
189 +index 289186e..313dc4d 100644
190 +--- a/progs/Makefile
191 ++++ b/progs/Makefile
192 +@@ -28,7 +28,7 @@ $(BUILD): %: %.o $(DEPS)
193 + $(CC) $(CFLAGS) -o $@ $< $(LIBCAPLIB) $(LDFLAGS)
194 +
195 + %.o: %.c $(INCS)
196 +- $(CC) $(IPATH) $(CFLAGS) -c $< -o $@
197 ++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
198 +
199 + install: all
200 + mkdir -p -m 0755 $(FAKEROOT)$(SBINDIR)
201 +@@ -46,7 +46,7 @@ capshdoc.h.cf: capshdoc.h ./mkcapshdoc.sh
202 + diff -u capshdoc.h $@ || (rm $@ ; exit 1)
203 +
204 + capsh: capsh.c capshdoc.h.cf $(DEPS)
205 +- $(CC) $(IPATH) $(CAPSH_SHELL) $(CFLAGS) -o $@ $< $(LIBCAPLIB) $(LDFLAGS)
206 ++ $(CC) $(CAPSH_SHELL) $(CFLAGS) $(CPPFLAGS) -o $@ $< $(LIBCAPLIB) $(LDFLAGS)
207 +
208 + tcapsh-static: capsh.c capshdoc.h.cf $(DEPS)
209 + $(CC) $(IPATH) $(CAPSH_SHELL) $(CFLAGS) -o $@ $< $(LIBCAPLIB) $(LDFLAGS) --static
210 +diff --git a/tests/Makefile b/tests/Makefile
211 +index 3a917c4..07eb2d5 100644
212 +--- a/tests/Makefile
213 ++++ b/tests/Makefile
214 +@@ -13,6 +13,8 @@ ifeq ($(PTHREADS),yes)
215 + $(MAKE) psx_test libcap_psx_test libcap_psx_launch_test
216 + endif
217 +
218 ++CFLAGS += -fPIC
219 ++
220 + install: all
221 +
222 + ifeq ($(DYNAMIC),yes)
223 +@@ -63,13 +65,13 @@ run_psx_test: psx_test
224 + ./psx_test
225 +
226 + psx_test: psx_test.c $(DEPS)
227 +- $(CC) $(CFLAGS) $(IPATH) $< -o $@ $(LINKEXTRA) $(LIBPSXLIB) $(LDFLAGS)
228 ++ $(CC) $(CFLAGS) $(CPPFLAGS) $< -o $@ $(LINKEXTRA) $(LIBPSXLIB) $(LDFLAGS)
229 +
230 + run_libcap_psx_test: libcap_psx_test
231 + ./libcap_psx_test
232 +
233 + libcap_psx_test: libcap_psx_test.c $(DEPS)
234 +- $(CC) $(CFLAGS) $(IPATH) $< -o $@ $(LINKEXTRA) $(LIBCAPLIB) $(LIBPSXLIB) $(LDFLAGS)
235 ++ $(CC) $(CFLAGS) $(CPPFLAGS) $< -o $@ $(LINKEXTRA) $(LIBCAPLIB) $(LIBPSXLIB) $(LDFLAGS)
236 +
237 + # privileged
238 + uns_test: uns_test.c $(DEPS)
239 +--
240 +2.32.0.rc1
241 +
242
243 diff --git a/sys-libs/libcap/libcap-2.50.ebuild b/sys-libs/libcap/libcap-2.50.ebuild
244 new file mode 100644
245 index 00000000000..20f0382faa4
246 --- /dev/null
247 +++ b/sys-libs/libcap/libcap-2.50.ebuild
248 @@ -0,0 +1,89 @@
249 +# Copyright 1999-2021 Gentoo Authors
250 +# Distributed under the terms of the GNU General Public License v2
251 +
252 +EAPI=7
253 +
254 +inherit multilib-minimal toolchain-funcs pam usr-ldscript
255 +
256 +DESCRIPTION="POSIX 1003.1e capabilities"
257 +HOMEPAGE="https://sites.google.com/site/fullycapable/"
258 +SRC_URI="https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/${P}.tar.xz"
259 +
260 +# it's available under either of the licenses
261 +LICENSE="|| ( GPL-2 BSD )"
262 +SLOT="0"
263 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
264 +IUSE="pam static-libs"
265 +
266 +# While the build system optionally uses gperf, we don't DEPEND on it because
267 +# the build automatically falls back when it's unavailable. #604802
268 +RDEPEND=">=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}]"
269 +PDEPEND="pam? ( sys-libs/pam[${MULTILIB_USEDEP}] )"
270 +DEPEND="${RDEPEND}
271 + ${PDEPEND}
272 + sys-kernel/linux-headers"
273 +
274 +# Requires test suite being run as root (via sudo)
275 +RESTRICT="test"
276 +
277 +PATCHES=(
278 + "${FILESDIR}"/${PN}-2.50-build-system-fixes.patch
279 + "${FILESDIR}"/${PN}-2.38-no_perl.patch
280 + "${FILESDIR}"/${PN}-2.25-ignore-RAISE_SETFCAP-install-failures.patch
281 + "${FILESDIR}"/${PN}-2.21-include.patch
282 +)
283 +
284 +src_prepare() {
285 + default
286 + multilib_copy_sources
287 +}
288 +
289 +run_emake() {
290 + local args=(
291 + exec_prefix="${EPREFIX}"
292 + lib_prefix="${EPREFIX}/usr"
293 + lib="$(get_libdir)"
294 + prefix="${EPREFIX}/usr"
295 + PAM_CAP="$(usex pam yes no)"
296 + DYNAMIC=yes
297 + GOLANG=no
298 + CC="$(tc-getCC)"
299 + AR="$(tc-getAR)"
300 + RANLIB="$(tc-getRANLIB)"
301 + )
302 + emake "${args[@]}" "$@"
303 +}
304 +
305 +src_configure() {
306 + tc-export AR CC RANLIB
307 + tc-export_build_env BUILD_CC
308 + multilib-minimal_src_configure
309 +}
310 +
311 +multilib_src_compile() {
312 + run_emake
313 +}
314 +
315 +multilib_src_install() {
316 + # no configure, needs explicit install line #444724#c3
317 + run_emake DESTDIR="${D}" install
318 +
319 + gen_usr_ldscript -a cap
320 + gen_usr_ldscript -a psx
321 + if ! use static-libs ; then
322 + rm "${ED}"/usr/$(get_libdir)/lib{cap,psx}.a || die
323 + fi
324 +
325 + if [[ -d "${ED}"/usr/$(get_libdir)/security ]] ; then
326 + rm -r "${ED}"/usr/$(get_libdir)/security || die
327 + fi
328 +
329 + if use pam ; then
330 + dopammod pam_cap/pam_cap.so
331 + dopamsecurity '' pam_cap/capability.conf
332 + fi
333 +}
334 +
335 +multilib_src_install_all() {
336 + dodoc CHANGELOG README doc/capability.notes
337 +}