Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/libcap/, sys-libs/libcap/files/
Date: Thu, 08 Oct 2020 22:53:26
Message-Id: 1602197597.9ee78d5bf69bf16fba7250dae355d34857d064ec.whissi@gentoo
1 commit: 9ee78d5bf69bf16fba7250dae355d34857d064ec
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 8 22:52:37 2020 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 8 22:53:17 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9ee78d5b
7
8 sys-libs/libcap: bump to v2.44
9
10 Package-Manager: Portage-3.0.8, Repoman-3.0.1
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 sys-libs/libcap/Manifest | 1 +
14 .../files/libcap-2.44-build-system-fixes.patch | 173 +++++++++++++++++++++
15 sys-libs/libcap/libcap-2.44.ebuild | 90 +++++++++++
16 3 files changed, 264 insertions(+)
17
18 diff --git a/sys-libs/libcap/Manifest b/sys-libs/libcap/Manifest
19 index 4ddc3241c0b..745cc38b3c8 100644
20 --- a/sys-libs/libcap/Manifest
21 +++ b/sys-libs/libcap/Manifest
22 @@ -1 +1,2 @@
23 DIST libcap-2.43.tar.xz 125284 BLAKE2B bde36f8397f4adb74760eb403daa06bee1b8f45ddc253cc3c3ef1f6e95d0e4c76d0f2e6fa3335a8bc451f18ac7128c96230f6aba9ae0320fa4f9d669e7b4f715 SHA512 817add571fb2c54ad2a39974e6545b8fc8d855ecdcf2e00b2cc10e583802c49dfea2d8bca484c89ecd574fdacfc46565b51e3064a4407cf1985defb913240d45
24 +DIST libcap-2.44.tar.xz 125568 BLAKE2B 758b756648d27e7fa81024e33712a77f2b676fe1aa0519c232412d1468afb6b982d5ab54162e2f46ebba5dbcb962d5779e5b15550c938aca52e499d406990a6f SHA512 1bb323ca362923bd6bd0e2e4639cf8726975165a620a243b31e797056439eb7efb2bfbc8e5521636783a86c7415b2037b1638c98747b79183ca7d3d42a04ff20
25
26 diff --git a/sys-libs/libcap/files/libcap-2.44-build-system-fixes.patch b/sys-libs/libcap/files/libcap-2.44-build-system-fixes.patch
27 new file mode 100644
28 index 00000000000..eeee8ba2ccf
29 --- /dev/null
30 +++ b/sys-libs/libcap/files/libcap-2.44-build-system-fixes.patch
31 @@ -0,0 +1,173 @@
32 +box" for people. Specifically:
33 + - allow toolchain vars to be set via environment
34 + - CC / BUILD_CC / AR / RANLIB
35 + - CFLAGS / CPPFLAGS / LDFLAGS
36 + - split CPPFLAGS out of CFLAGS
37 + - break -fPIC out of global CFLAGS and only use where needed
38 + - use LDLIBS for libraries, not LDFLAGS
39 +
40 +Signed-off-by: Mike Frysinger <vapier@g.o>
41 +
42 +Forward ported from libcap-2.24 to libcap-2.25
43 +Forward ported from libcap-2.25 to libcap-2.28
44 +Forward ported from libcap-2.28 to libcap-2.29
45 +Forward ported from libcap-2.29 to libcap-2.33
46 +Forward ported from libcap-2.33 to libcap-2.34
47 +Forward ported from libcap-2.34 to libcap-2.37
48 +Forward ported from libcap-2.37 to libcap-2.39
49 +Forward ported from libcap-2.39 to libcap-2.42
50 +Forward ported from libcap-2.42 to libcap-2.44
51 +
52 +
53 +--- a/Make.Rules
54 ++++ b/Make.Rules
55 +@@ -52,7 +52,6 @@ GOMAJOR=0
56 + # Compilation specifics
57 +
58 + KERNEL_HEADERS := $(topdir)/libcap/include/uapi
59 +-IPATH += -fPIC -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include
60 +
61 + CC := $(CROSS_COMPILE)gcc
62 + DEFINES := -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
63 +@@ -60,7 +59,7 @@ COPTS ?= -O2
64 + CFLAGS ?= $(COPTS) $(DEFINES)
65 + BUILD_CC ?= $(CC)
66 + BUILD_COPTS ?= -O2
67 +-BUILD_CFLAGS ?= $(BUILD_COPTS) $(DEFINES) $(IPATH)
68 ++BUILD_CFLAGS ?= $(CFLAGS)
69 + AR := $(CROSS_COMPILE)ar
70 + RANLIB := $(CROSS_COMPILE)ranlib
71 + DEBUG = -g #-DDEBUG
72 +@@ -75,16 +74,19 @@ LIBPSXLIB := -L$(topdir)/libcap -lpsx -lpthread -Wl,-wrap,pthread_create
73 +
74 + BUILD_GPERF := $(shell which gperf >/dev/null 2>/dev/null && echo yes)
75 +
76 +-SYSTEM_HEADERS = /usr/include
77 ++LIBCAP_CPPFLAGS = -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include $(DEFINES)
78 ++CPPFLAGS += $(LIBCAP_CPPFLAGS)
79 ++BUILD_CPPFLAGS += $(LIBCAP_CPPFLAGS)
80 + INCS=$(topdir)/libcap/include/sys/capability.h
81 + LDFLAGS += -L$(topdir)/libcap
82 +-CFLAGS += -Dlinux $(WARNINGS) $(DEBUG)
83 ++CPPFLAGS += -Dlinux
84 ++CFLAGS += $(WARNINGS) $(DEBUG)
85 + PAM_CAP ?= $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi)
86 + INDENT := $(shell if [ -n "$$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi)
87 + DYNAMIC := $(shell if [ ! -d "$(topdir)/.git" ]; then echo yes; fi)
88 +
89 + GO := go
90 +-GOLANG := $(shell if [ -n "$(shell $(GO) version 2>/dev/null)" ]; then echo yes ; else echo no ; fi)
91 ++GOLANG ?= $(shell if [ -n "$(shell $(GO) version 2>/dev/null)" ]; then echo yes ; else echo no ; fi)
92 + ifeq ($(GOLANG),yes)
93 + GOROOT := $(shell $(GO) env GOROOT)
94 + GOCGO := $(shell if [ "$(shell $(GO) env CGO_ENABLED)" = 1 ]; then echo yes ; else echo no ; fi)
95 +--- a/Makefile
96 ++++ b/Makefile
97 +@@ -17,7 +17,6 @@ ifeq ($(GOLANG),yes)
98 + $(MAKE) -C go $@
99 + rm -f cap/go.sum
100 + endif
101 +- $(MAKE) -C tests $@
102 + $(MAKE) -C progs $@
103 + $(MAKE) -C doc $@
104 + $(MAKE) -C kdebug $@
105 +--- a/libcap/Makefile
106 ++++ b/libcap/Makefile
107 +@@ -21,6 +21,7 @@ PSXOBJS=$(addsuffix .o, $(PSXFILES))
108 + MAJLIBNAME=$(LIBNAME).$(VERSION)
109 + MINLIBNAME=$(MAJLIBNAME).$(MINOR)
110 + GPERF_OUTPUT = _caps_output.gperf
111 ++CFLAGS += -fPIC
112 +
113 + all: $(MINLIBNAME) $(STACAPLIBNAME) pcs $(STAPSXLIBNAME)
114 +
115 +@@ -50,7 +51,7 @@ libpsx.pc: libpsx.pc.in
116 + $< >$@
117 +
118 + _makenames: _makenames.c cap_names.list.h
119 +- $(BUILD_CC) $(BUILD_CFLAGS) $< -o $@
120 ++ $(BUILD_CC) $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@
121 +
122 + cap_names.h: _makenames
123 + ./_makenames > cap_names.h
124 +@@ -82,10 +83,10 @@ $(MINLIBNAME): $(CAPOBJS)
125 + ln -sf $(MAJLIBNAME) $(LIBNAME)
126 +
127 + %.o: %.c $(INCLS)
128 +- $(CC) $(CFLAGS) $(IPATH) -c $< -o $@
129 ++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
130 +
131 + cap_text.o: cap_text.c $(USE_GPERF_OUTPUT) $(INCLS)
132 +- $(CC) $(CFLAGS) $(IPATH) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@
133 ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@
134 +
135 + cap_test: cap_test.c libcap.h
136 + $(CC) $(CFLAGS) $(IPATH) $< -o $@
137 +--- a/pam_cap/Makefile
138 ++++ b/pam_cap/Makefile
139 +@@ -3,6 +3,8 @@
140 + topdir=$(shell pwd)/..
141 + include ../Make.Rules
142 +
143 ++CFLAGS += -fPIC
144 ++
145 + all: pam_cap.so
146 + $(MAKE) testlink
147 +
148 +@@ -16,16 +18,16 @@ install: all
149 + # written (and you know why it fails), email me and explain why. Thanks!
150 +
151 + pam_cap.so: pam_cap.o
152 +- $(LD) -o pam_cap.so $< $(LIBCAPLIB) $(LDFLAGS)
153 ++ $(LD) $(CFLAGS) -o pam_cap.so $< $(LIBCAPLIB) $(LDFLAGS)
154 +
155 + pam_cap.o: pam_cap.c
156 +- $(CC) $(CFLAGS) $(IPATH) -c $< -o $@
157 ++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
158 +
159 + test_pam_cap: test_pam_cap.c pam_cap.c
160 + $(CC) $(CFLAGS) $(IPATH) -o $@ test_pam_cap.c $(LIBCAPLIB) $(LDFLAGS) --static
161 +
162 + testlink: test.c pam_cap.o
163 +- $(CC) $(CFLAGS) -o $@ $+ -lpam -ldl $(LIBCAPLIB) $(LDFLAGS)
164 ++ $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $+ -lpam -ldl $(LIBCAPLIB) $(LDFLAGS)
165 +
166 + test: pam_cap.so
167 + make testlink
168 +--- a/progs/Makefile
169 ++++ b/progs/Makefile
170 +@@ -27,7 +27,7 @@ $(BUILD): %: %.o $(DEPS)
171 + $(CC) $(CFLAGS) -o $@ $< $(LIBCAPLIB) $(LDFLAGS)
172 +
173 + %.o: %.c $(INCS)
174 +- $(CC) $(IPATH) $(CAPSH_SHELL) $(CFLAGS) -c $< -o $@
175 ++ $(CC) $(CAPSH_SHELL) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
176 +
177 + install: all
178 + mkdir -p -m 0755 $(FAKEROOT)$(SBINDIR)
179 +--- a/tests/Makefile
180 ++++ b/tests/Makefile
181 +@@ -24,19 +24,21 @@ test: run_psx_test run_libcap_psx_test
182 +
183 + sudotest: test run_libcap_launch_test run_libcap_launch_test
184 +
185 ++CFLAGS += -fPIC
186 ++
187 + install: all
188 +
189 + run_psx_test: psx_test
190 + $(LDPATH) ./psx_test
191 +
192 + psx_test: psx_test.c $(DEPS)
193 +- $(CC) $(CFLAGS) $(IPATH) $< -o $@ $(LIBPSXLIB)
194 ++ $(CC) $(CFLAGS) $(CPPFLAGS) $< -o $@ $(LIBPSXLIB)
195 +
196 + run_libcap_psx_test: libcap_psx_test
197 + $(LDPATH) ./libcap_psx_test
198 +
199 + libcap_psx_test: libcap_psx_test.c $(DEPS)
200 +- $(CC) $(CFLAGS) $(IPATH) $< -o $@ $(LIBCAPLIB) $(LIBPSXLIB) $(LDFLAGS)
201 ++ $(CC) $(CFLAGS) $(CPPFLAGS) $< -o $@ $(LIBCAPLIB) $(LIBPSXLIB) $(LDFLAGS)
202 +
203 + run_libcap_launch_test: libcap_launch_test libcap_psx_launch_test noop
204 + sudo $(LDPATH) ./libcap_launch_test
205
206 diff --git a/sys-libs/libcap/libcap-2.44.ebuild b/sys-libs/libcap/libcap-2.44.ebuild
207 new file mode 100644
208 index 00000000000..50d850b8a01
209 --- /dev/null
210 +++ b/sys-libs/libcap/libcap-2.44.ebuild
211 @@ -0,0 +1,90 @@
212 +# Copyright 1999-2020 Gentoo Authors
213 +# Distributed under the terms of the GNU General Public License v2
214 +
215 +EAPI=7
216 +
217 +inherit multilib multilib-minimal toolchain-funcs pam usr-ldscript
218 +
219 +DESCRIPTION="POSIX 1003.1e capabilities"
220 +HOMEPAGE="https://sites.google.com/site/fullycapable/"
221 +SRC_URI="https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/${P}.tar.xz"
222 +
223 +# it's available under either of the licenses
224 +LICENSE="|| ( GPL-2 BSD )"
225 +SLOT="0"
226 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
227 +IUSE="pam static-libs"
228 +
229 +# While the build system optionally uses gperf, we don't DEPEND on it because
230 +# the build automatically falls back when it's unavailable. #604802
231 +RDEPEND=">=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}]"
232 +PDEPEND="pam? ( sys-libs/pam[${MULTILIB_USEDEP}] )"
233 +DEPEND="${RDEPEND}
234 + ${PDEPEND}
235 + sys-kernel/linux-headers"
236 +
237 +# Requires test suite being run as root (via sudo)
238 +RESTRICT="test"
239 +
240 +PATCHES=(
241 + "${FILESDIR}"/${PN}-2.44-build-system-fixes.patch
242 + "${FILESDIR}"/${PN}-2.38-no_perl.patch
243 + "${FILESDIR}"/${PN}-2.25-ignore-RAISE_SETFCAP-install-failures.patch
244 + "${FILESDIR}"/${PN}-2.21-include.patch
245 +)
246 +
247 +src_prepare() {
248 + default
249 + multilib_copy_sources
250 +}
251 +
252 +run_emake() {
253 + local args=(
254 + exec_prefix="${EPREFIX}"
255 + lib_prefix="${EPREFIX}/usr"
256 + lib="$(get_libdir)"
257 + prefix="${EPREFIX}/usr"
258 + PAM_CAP="$(usex pam yes no)"
259 + DYNAMIC=yes
260 + GOLANG=no
261 + CC="$(tc-getCC)"
262 + AR="$(tc-getAR)"
263 + RANLIB="$(tc-getRANLIB)"
264 + )
265 + emake "${args[@]}" "$@"
266 +}
267 +
268 +src_configure() {
269 + tc-export AR CC RANLIB
270 + tc-export_build_env BUILD_CC
271 + multilib-minimal_src_configure
272 +}
273 +
274 +multilib_src_compile() {
275 + run_emake
276 +}
277 +
278 +multilib_src_install() {
279 + # no configure, needs explicit install line #444724#c3
280 + run_emake DESTDIR="${D}" install
281 +
282 + gen_usr_ldscript -a cap
283 + if ! use static-libs ; then
284 + # Don't remove libpsx.a!
285 + # See https://bugs.gentoo.org/703912
286 + rm "${ED}"/usr/$(get_libdir)/libcap.a || die
287 + fi
288 +
289 + if [[ -d "${ED}"/usr/$(get_libdir)/security ]] ; then
290 + rm -r "${ED}"/usr/$(get_libdir)/security || die
291 + fi
292 +
293 + if use pam; then
294 + dopammod pam_cap/pam_cap.so
295 + dopamsecurity '' pam_cap/capability.conf
296 + fi
297 +}
298 +
299 +multilib_src_install_all() {
300 + dodoc CHANGELOG README doc/capability.notes
301 +}