$ git diff --patch-with-stat --summary a9a33cce1bbb6600758ab15fe109a4323b753724..93a3cd3f603458ae17dfaf122c5507165439a68c
...s.patch => libcap-2.25-build-system-fixes.patch | 84 +++++++++++++++-------
libcap-2.25-gperf.patch | 20 ++++++
libcap.spec | 18 ++++-
pam-linking.patch | 13 ++++
4 files changed, 108 insertions(+), 27 deletions(-)
rename libcap-2.24-build-system-fixes.patch => libcap-2.25-build-system-fixes.patch (61%)
create mode 100644 libcap-2.25-gperf.patch
create mode 100644 pam-linking.patch
diff --git a/libcap-2.24-build-system-fixes.patch b/libcap-2.25-build-system-fixes.patch
similarity index 61%
rename from libcap-2.24-build-system-fixes.patch
rename to libcap-2.25-build-system-fixes.patch
index 6d059ab..c33fffd 100644
--- a/libcap-2.24-build-system-fixes.patch
+++ b/libcap-2.25-build-system-fixes.patch
@@ -1,12 +1,40 @@
-diff -Naur libcap-2.25/Make.Rules libcap-2.25.tpg/Make.Rules
---- libcap-2.25/Make.Rules 2016-01-31 01:14:53.000000000 +0000
-+++ libcap-2.25.tpg/Make.Rules 2016-07-26 19:49:38.171245364 +0000
-@@ -46,27 +46,30 @@
+From d5a0c023a7f3deefd471d7b97ef4fa40ed374645 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Wed, 10 Feb 2016 09:47:27 +0100
+Subject: [PATCH] build system fixes
+
+This touches up the homebrewed build system to work much better "out of the
+box" for people. Specifically:
+ - allow toolchain vars to be set via environment
+ - CC / BUILD_CC / AR / RANLIB
+ - CFLAGS / CPPFLAGS / LDFLAGS
+ - split CPPFLAGS out of CFLAGS
+ - break -fPIC out of global CFLAGS and only use where needed
+ - use LDLIBS for libraries, not LDFLAGS
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+
+Forward ported from libcap-2.24 to libcap-2.25
+
+Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
+---
+ Make.Rules | 26 ++++++++++++++------------
+ libcap/Makefile | 7 ++++---
+ pam_cap/Makefile | 8 +++++---
+ progs/Makefile | 2 +-
+ 4 files changed, 24 insertions(+), 19 deletions(-)
+
+diff --git a/Make.Rules b/Make.Rules
+index 8347b26..d7196ef 100644
+--- a/Make.Rules
++++ b/Make.Rules
+@@ -45,28 +45,30 @@ MINOR=25
+
# Compilation specifics
- KERNEL_HEADERS := $(topdir)/libcap/include/uapi
+-KERNEL_HEADERS := $(topdir)/libcap/include/uapi
-IPATH += -fPIC -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include
-
+-
-CC := gcc
-CFLAGS := -O2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-BUILD_CC := $(CC)
@@ -30,6 +58,7 @@ diff -Naur libcap-2.25/Make.Rules libcap-2.25.tpg/Make.Rules
BUILD_GPERF := $(shell which gperf >/dev/null 2>/dev/null && echo yes)
-SYSTEM_HEADERS = /usr/include
++KERNEL_HEADERS = $(topdir)/libcap/include/uapi
+LIBCAP_CPPFLAGS = -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include
+LIBCAP_CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+CPPFLAGS += $(LIBCAP_CPPFLAGS)
@@ -42,10 +71,11 @@ diff -Naur libcap-2.25/Make.Rules libcap-2.25.tpg/Make.Rules
PAM_CAP := $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi)
INDENT := $(shell if [ -n "$$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi)
DYNAMIC := $(shell if [ ! -d "$(topdir)/.git" ]; then echo yes; fi)
-diff -Naur libcap-2.25/libcap/Makefile libcap-2.25.tpg/libcap/Makefile
---- libcap-2.25/libcap/Makefile 2016-01-31 00:01:41.000000000 +0000
-+++ libcap-2.25.tpg/libcap/Makefile 2016-07-26 19:54:26.603239609 +0000
-@@ -17,6 +17,7 @@
+diff --git a/libcap/Makefile b/libcap/Makefile
+index d189777..b99740f 100644
+--- a/libcap/Makefile
++++ b/libcap/Makefile
+@@ -17,6 +17,7 @@ OBJS=$(addsuffix .o, $(FILES))
MAJLIBNAME=$(LIBNAME).$(VERSION)
MINLIBNAME=$(MAJLIBNAME).$(MINOR)
GPERF_OUTPUT = _caps_output.gperf
@@ -53,7 +83,7 @@ diff -Naur libcap-2.25/libcap/Makefile libcap-2.25.tpg/libcap/Makefile
all: $(MINLIBNAME) $(STALIBNAME) libcap.pc
-@@ -35,7 +36,7 @@
+@@ -35,7 +36,7 @@ libcap.pc: libcap.pc.in
$< >$@
_makenames: _makenames.c cap_names.list.h
@@ -62,7 +92,7 @@ diff -Naur libcap-2.25/libcap/Makefile libcap-2.25.tpg/libcap/Makefile
cap_names.h: _makenames
./_makenames > cap_names.h
-@@ -57,10 +58,10 @@
+@@ -57,10 +58,10 @@ $(MINLIBNAME): $(OBJS)
ln -sf $(MAJLIBNAME) $(LIBNAME)
%.o: %.c $(INCLS)
@@ -75,23 +105,25 @@ diff -Naur libcap-2.25/libcap/Makefile libcap-2.25.tpg/libcap/Makefile
install: all
mkdir -p -m 0755 $(FAKEROOT)$(INCDIR)/sys
-diff -Naur libcap-2.25/pam_cap/Makefile libcap-2.25.tpg/pam_cap/Makefile
---- libcap-2.25/pam_cap/Makefile 2014-05-31 20:19:10.000000000 +0000
-+++ libcap-2.25.tpg/pam_cap/Makefile 2016-07-26 19:55:45.895238028 +0000
-@@ -8,6 +8,7 @@
- # does, *verify that it does*, and if you observe that it fails as
+diff --git a/pam_cap/Makefile b/pam_cap/Makefile
+index cc32fb6..6f07b6b 100644
+--- a/pam_cap/Makefile
++++ b/pam_cap/Makefile
+@@ -9,6 +9,8 @@ include ../Make.Rules
# written (and you know why it fails), email me and explain why. Thanks!
LDLIBS += -L../libcap -lcap
-+CFLAGS += -fPIC
++CFLAGS += -fPIC
++
all: pam_cap.so
$(MAKE) testcompile
-@@ -17,13 +18,13 @@
+
+@@ -17,13 +19,13 @@ install: all
install -m 0755 pam_cap.so $(FAKEROOT)$(LIBDIR)/security
pam_cap.so: pam_cap.o
- $(LD) $(LDFLAGS) -o pam_cap.so $< $(LDLIBS)
-+ $(LD) $(CFLAGS) $(LDFLAGS) -o pam_cap.so $< $(LDLIBS) -lpam
++ $(LD) $(CFLAGS) $(LDFLAGS) -o pam_cap.so $< $(LDLIBS)
pam_cap.o: pam_cap.c
- $(CC) $(CFLAGS) $(IPATH) -c $< -o $@
@@ -103,10 +135,11 @@ diff -Naur libcap-2.25/pam_cap/Makefile libcap-2.25.tpg/pam_cap/Makefile
clean:
rm -f *.o *.so testcompile *~
-diff -Naur libcap-2.25/progs/Makefile libcap-2.25.tpg/progs/Makefile
---- libcap-2.25/progs/Makefile 2016-01-31 00:01:41.000000000 +0000
-+++ libcap-2.25.tpg/progs/Makefile 2016-07-26 19:56:19.509237357 +0000
-@@ -19,7 +19,7 @@
+diff --git a/progs/Makefile b/progs/Makefile
+index c094a24..b9f0d3f 100644
+--- a/progs/Makefile
++++ b/progs/Makefile
+@@ -19,7 +19,7 @@ $(BUILD): %: %.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
%.o: %.c $(INCS)
@@ -115,3 +148,6 @@ diff -Naur libcap-2.25/progs/Makefile libcap-2.25.tpg/progs/Makefile
install: all
mkdir -p -m 0755 $(FAKEROOT)$(SBINDIR)
+--
+2.7.1
+
diff --git a/libcap-2.25-gperf.patch b/libcap-2.25-gperf.patch
new file mode 100644
index 0000000..86e930f
--- /dev/null
+++ b/libcap-2.25-gperf.patch
@@ -0,0 +1,20 @@
+update gperf call to work with gperf-3.1
+
+https://bugs.gentoo.org/604802
+
+--- a/libcap/Makefile
++++ b/libcap/Makefile
+@@ -44,11 +44,12 @@
+ ./_makenames > cap_names.h
+
+ $(GPERF_OUTPUT): cap_names.list.h
+- (printf "%b" "struct __cap_token_s { const char *name; int index; };\n%{\nconst struct __cap_token_s *__cap_lookup_name(const char *, unsigned int);\n%}\n%%\n"; \
++ (printf "%b" "struct __cap_token_s { const char *name; int index; };\n%%\n"; \
+ $(SED) -e 's:["{}]::g' -e 's:,$$::' $<) | \
+ gperf \
+ --ignore-case \
+ --language=ANSI-C \
++ --includes \
+ --readonly \
+ --null-strings \
+ --global-table \
diff --git a/libcap.spec b/libcap.spec
index e471718..3a6d82c 100644
--- a/libcap.spec
+++ b/libcap.spec
@@ -5,14 +5,16 @@
Summary: Library for getting and setting POSIX.1e capabilities
Name: libcap
Version: 2.25
-Release: 2
+Release: 3
Group: System/Kernel and hardware
License: BSD/GPLv2
Url: http://www.kernel.org/pub/linux/libs/security/linux-privs/
Source0: http://mirror.nexcess.net/kernel.org/linux/libs/security/linux-privs/libcap2/%{name}-%{version}.tar.xz
Source1: ftp://ftp.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.4/capfaq-0.2.txt
-Patch0: libcap-2.24-build-system-fixes.patch
+Patch0: libcap-2.25-build-system-fixes.patch
Patch1: libcap-2.22-no-perl.patch
+Patch2: libcap-2.25-gperf.patch
+Patch3: pam-linking.patch
BuildRequires: attr-devel
BuildRequires: pam-devel
@@ -31,6 +33,14 @@ draft 15 capabilities.
This package contains utilities to control these capabilities.
+%package docs
+Summary: Docs for %{libname}
+Group: System/Kernel and hardware
+
+%description docs
+%{name} is a library for getting and setting POSIX.1e (formerly POSIX 6)
+draft 15 capabilities.
+
%package -n pam_cap
Summary: PAM module for getting and setting POSIX.1e capabilities
Group: System/Libraries
@@ -102,7 +112,6 @@ install -m0640 pam_cap/capability.conf %{buildroot}%{_sysconfdir}/security/
rm -f %{buildroot}/%{_lib}/*.a
%files utils
-%doc CHANGELOG License README contrib
%{_sbindir}/capsh
%{_sbindir}/getcap
%{_sbindir}/getpcaps
@@ -110,6 +119,9 @@ rm -f %{buildroot}/%{_lib}/*.a
%{_mandir}/man8/getcap.8*
%{_mandir}/man8/setcap.8*
+%files docs
+%doc CHANGELOG License README contrib
+
%files -n pam_cap
%doc pam_cap/License
%attr(0640,root,root) %config(noreplace) %{_sysconfdir}/security/capability.conf
diff --git a/pam-linking.patch b/pam-linking.patch
new file mode 100644
index 0000000..46b03bc
--- /dev/null
+++ b/pam-linking.patch
@@ -0,0 +1,13 @@
+diff --git a/pam_cap/Makefile b/pam_cap/Makefile
+index 6f07b6b..d3cd14d 100644
+--- a/pam_cap/Makefile
++++ b/pam_cap/Makefile
+@@ -7,7 +7,7 @@ include ../Make.Rules
+ # that this next line does *not* require -lpam on it.) If you think it
+ # does, *verify that it does*, and if you observe that it fails as
+ # written (and you know why it fails), email me and explain why. Thanks!
+-LDLIBS += -L../libcap -lcap
++LDLIBS += -L../libcap -lcap -lpam
+
+ CFLAGS += -fPIC
+