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: Fri, 05 Feb 2021 10:59:37
Message-Id: 1612522770.7eb18730f3c700ccee7f6ff24ac44107c39a0131.polynomial-c@gentoo
1 commit: 7eb18730f3c700ccee7f6ff24ac44107c39a0131
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Fri Feb 5 10:58:42 2021 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 5 10:59:30 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7eb18730
7
8 sys-libs/libcap: Bump to version 2.48
9
10 Package-Manager: Portage-3.0.14, Repoman-3.0.2
11 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
12
13 sys-libs/libcap/Manifest | 1 +
14 .../files/libcap-2.48-build-system-fixes.patch | 199 +++++++++++++++++++++
15 sys-libs/libcap/libcap-2.48.ebuild | 89 +++++++++
16 3 files changed, 289 insertions(+)
17
18 diff --git a/sys-libs/libcap/Manifest b/sys-libs/libcap/Manifest
19 index d4c82b42888..1ed10abdfee 100644
20 --- a/sys-libs/libcap/Manifest
21 +++ b/sys-libs/libcap/Manifest
22 @@ -1,3 +1,4 @@
23 DIST libcap-2.43.tar.xz 125284 BLAKE2B bde36f8397f4adb74760eb403daa06bee1b8f45ddc253cc3c3ef1f6e95d0e4c76d0f2e6fa3335a8bc451f18ac7128c96230f6aba9ae0320fa4f9d669e7b4f715 SHA512 817add571fb2c54ad2a39974e6545b8fc8d855ecdcf2e00b2cc10e583802c49dfea2d8bca484c89ecd574fdacfc46565b51e3064a4407cf1985defb913240d45
24 DIST libcap-2.46.tar.xz 129296 BLAKE2B 22df1dcf37a920e831c47edad62df2b3e35b5360605ed24bdb9199ac8ba1fd30cd20492f8a9eae25232cc042cbef9a89a3649e0d06412b84c58f12e7795844bc SHA512 6dcb249aac78efde959a986e7f06a364b2e6e57dd40b14e791d5a56012df485b2395dee0228f4cc3e1cddb2a4e3dcb9c1d83d5331ed084f23a46848494933845
25 DIST libcap-2.47.tar.xz 131960 BLAKE2B 745bd3ba9819a1582880dff81d94ccf198fcf3f89d776ac0ce3055535e5370a0be57c5efdf7287f99ed50189af14ee46e90805d0a324f92d394211ffc6d7002d SHA512 cfa4aaa82b7dbb76e38cd207401603582343b14eb91d6df23e0ea6698d0ec0ab2b368fe0d08208a014a1b1a68d11316ecefa45c27983f9ad95e7b8184351fad8
26 +DIST libcap-2.48.tar.xz 132280 BLAKE2B 43ab75b73a5297ec24467fae82378f8c7aba5356afcebfb32a695d664a4b5268526fd90a009596c0f516a626d8f4523a9b49ec3225b6a886da32e62eb5b55ea5 SHA512 3cb1e2b026c0f60d6f225c7255944d45023e59fd065b8f832739fc90d33b3347981675de12dd705c4ecbd647a494a17daf39e1d92599bcd1a83306886edadba1
27
28 diff --git a/sys-libs/libcap/files/libcap-2.48-build-system-fixes.patch b/sys-libs/libcap/files/libcap-2.48-build-system-fixes.patch
29 new file mode 100644
30 index 00000000000..a672ecedaca
31 --- /dev/null
32 +++ b/sys-libs/libcap/files/libcap-2.48-build-system-fixes.patch
33 @@ -0,0 +1,199 @@
34 +From d0e5c20fda92fcc48109bce7055d5fad458579ca Mon Sep 17 00:00:00 2001
35 +From: Mike Frysinger <vapier@g.o>
36 +Date: Wed, 4 Nov 2020 22:46:20 +0100
37 +Subject: [PATCH] build system fixes
38 +
39 +This touches up the homebrewed build system to work much better "out of the
40 +box" for people. Specifically:
41 + - allow toolchain vars to be set via environment
42 + - CC / BUILD_CC / AR / RANLIB
43 + - CFLAGS / CPPFLAGS / LDFLAGS
44 + - split CPPFLAGS out of CFLAGS
45 + - break -fPIC out of global CFLAGS and only use where needed
46 + - use LDLIBS for libraries, not LDFLAGS
47 +
48 +Signed-off-by: Mike Frysinger <vapier@g.o>
49 +
50 +Forward ported from libcap-2.24 to libcap-2.25
51 +Forward ported from libcap-2.25 to libcap-2.28
52 +Forward ported from libcap-2.28 to libcap-2.29
53 +Forward ported from libcap-2.29 to libcap-2.33
54 +Forward ported from libcap-2.33 to libcap-2.34
55 +Forward ported from libcap-2.34 to libcap-2.37
56 +Forward ported from libcap-2.37 to libcap-2.39
57 +Forward ported from libcap-2.39 to libcap-2.42
58 +Forward ported from libcap-2.42 to libcap-2.44
59 +Forward ported from libcap-2.44 to libcap-2.45
60 +Forward ported from libcap-2.45 to libcap-2.48
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 | 2 +-
69 + tests/Makefile | 6 ++++--
70 + 6 files changed, 20 insertions(+), 14 deletions(-)
71 +
72 +diff --git a/Make.Rules b/Make.Rules
73 +index ded9014..07b716f 100644
74 +--- a/Make.Rules
75 ++++ b/Make.Rules
76 +@@ -52,7 +52,6 @@ GOMAJOR=0
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 7150b9b..9dff1e9 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 1d7fc7a..64dbe86 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) $(CAPSH_SHELL) $(CFLAGS) -c $< -o $@
197 ++ $(CC) $(CAPSH_SHELL) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
198 +
199 + install: all
200 + mkdir -p -m 0755 $(FAKEROOT)$(SBINDIR)
201 +diff --git a/tests/Makefile b/tests/Makefile
202 +index 1e7039d..5874624 100644
203 +--- a/tests/Makefile
204 ++++ b/tests/Makefile
205 +@@ -13,6 +13,8 @@ ifeq ($(PTHREADS),yes)
206 + make psx_test libcap_psx_test libcap_psx_launch_test
207 + endif
208 +
209 ++CFLAGS += -fPIC
210 ++
211 + install: all
212 +
213 + ifeq ($(DYNAMIC),yes)
214 +@@ -62,13 +64,13 @@ run_psx_test: psx_test
215 + ./psx_test
216 +
217 + psx_test: psx_test.c $(DEPS)
218 +- $(CC) $(CFLAGS) $(IPATH) $< -o $@ $(LINKEXTRA) $(LIBPSXLIB) $(LDFLAGS)
219 ++ $(CC) $(CFLAGS) $(CPPFLAGS) $< -o $@ $(LINKEXTRA) $(LIBPSXLIB) $(LDFLAGS)
220 +
221 + run_libcap_psx_test: libcap_psx_test
222 + ./libcap_psx_test
223 +
224 + libcap_psx_test: libcap_psx_test.c $(DEPS)
225 +- $(CC) $(CFLAGS) $(IPATH) $< -o $@ $(LINKEXTRA) $(LIBCAPLIB) $(LIBPSXLIB) $(LDFLAGS)
226 ++ $(CC) $(CFLAGS) $(CPPFLAGS) $< -o $@ $(LINKEXTRA) $(LIBCAPLIB) $(LIBPSXLIB) $(LDFLAGS)
227 +
228 + # privileged
229 + run_libcap_launch_test: libcap_launch_test noop ../progs/tcapsh-static
230 +--
231 +2.30.0
232 +
233
234 diff --git a/sys-libs/libcap/libcap-2.48.ebuild b/sys-libs/libcap/libcap-2.48.ebuild
235 new file mode 100644
236 index 00000000000..2c01dccada7
237 --- /dev/null
238 +++ b/sys-libs/libcap/libcap-2.48.ebuild
239 @@ -0,0 +1,89 @@
240 +# Copyright 1999-2021 Gentoo Authors
241 +# Distributed under the terms of the GNU General Public License v2
242 +
243 +EAPI=7
244 +
245 +inherit multilib multilib-minimal toolchain-funcs pam usr-ldscript
246 +
247 +DESCRIPTION="POSIX 1003.1e capabilities"
248 +HOMEPAGE="https://sites.google.com/site/fullycapable/"
249 +SRC_URI="https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/${P}.tar.xz"
250 +
251 +# it's available under either of the licenses
252 +LICENSE="|| ( GPL-2 BSD )"
253 +SLOT="0"
254 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
255 +IUSE="pam static-libs"
256 +
257 +# While the build system optionally uses gperf, we don't DEPEND on it because
258 +# the build automatically falls back when it's unavailable. #604802
259 +RDEPEND=">=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}]"
260 +PDEPEND="pam? ( sys-libs/pam[${MULTILIB_USEDEP}] )"
261 +DEPEND="${RDEPEND}
262 + ${PDEPEND}
263 + sys-kernel/linux-headers"
264 +
265 +# Requires test suite being run as root (via sudo)
266 +RESTRICT="test"
267 +
268 +PATCHES=(
269 + "${FILESDIR}"/${PN}-2.48-build-system-fixes.patch
270 + "${FILESDIR}"/${PN}-2.38-no_perl.patch
271 + "${FILESDIR}"/${PN}-2.25-ignore-RAISE_SETFCAP-install-failures.patch
272 + "${FILESDIR}"/${PN}-2.21-include.patch
273 +)
274 +
275 +src_prepare() {
276 + default
277 + multilib_copy_sources
278 +}
279 +
280 +run_emake() {
281 + local args=(
282 + exec_prefix="${EPREFIX}"
283 + lib_prefix="${EPREFIX}/usr"
284 + lib="$(get_libdir)"
285 + prefix="${EPREFIX}/usr"
286 + PAM_CAP="$(usex pam yes no)"
287 + DYNAMIC=yes
288 + GOLANG=no
289 + CC="$(tc-getCC)"
290 + AR="$(tc-getAR)"
291 + RANLIB="$(tc-getRANLIB)"
292 + )
293 + emake "${args[@]}" "$@"
294 +}
295 +
296 +src_configure() {
297 + tc-export AR CC RANLIB
298 + tc-export_build_env BUILD_CC
299 + multilib-minimal_src_configure
300 +}
301 +
302 +multilib_src_compile() {
303 + run_emake
304 +}
305 +
306 +multilib_src_install() {
307 + # no configure, needs explicit install line #444724#c3
308 + run_emake DESTDIR="${D}" install
309 +
310 + gen_usr_ldscript -a cap
311 + gen_usr_ldscript -a psx
312 + if ! use static-libs ; then
313 + rm "${ED}"/usr/$(get_libdir)/lib{cap,psx}.a || die
314 + fi
315 +
316 + if [[ -d "${ED}"/usr/$(get_libdir)/security ]] ; then
317 + rm -r "${ED}"/usr/$(get_libdir)/security || die
318 + fi
319 +
320 + if use pam; then
321 + dopammod pam_cap/pam_cap.so
322 + dopamsecurity '' pam_cap/capability.conf
323 + fi
324 +}
325 +
326 +multilib_src_install_all() {
327 + dodoc CHANGELOG README doc/capability.notes
328 +}