diff options
author | Andrew Morgan <morgan@kernel.org> | 2007-07-17 21:50:12 -0700 |
---|---|---|
committer | Andrew Morgan <morgan@kernel.org> | 2007-07-17 21:50:12 -0700 |
commit | 370a70fa481bb1b13e64e291dc091c45232c8a7c (patch) | |
tree | 024e8f299c65291a6541a8badb4b4818960b1d92 | |
parent | 5216fff5db51f777029b6baed7134a6bfc23c9aa (diff) | |
download | libcap-370a70fa481bb1b13e64e291dc091c45232c8a7c.tar.gz |
Support for static library creation (libcap.a) + misc
Incorporate fixes from Red Hat rpm (1.10-25).
-rw-r--r-- | Make.Rules | 3 | ||||
-rw-r--r-- | libcap/Makefile | 17 | ||||
-rw-r--r-- | libcap/include/sys/capability.h | 11 | ||||
-rw-r--r-- | progs/Makefile | 2 |
4 files changed, 25 insertions, 8 deletions
@@ -38,7 +38,8 @@ SBINDIR=$(FAKEROOT)$(exec_prefix)/sbin INCDIR=$(FAKEROOT)$(inc_prefix)/include LIBDIR=$(FAKEROOT)$(lib_prefix)/$(lib) -# common defines for libcap (suitable for 2.2.1+ Linux kernels) +# common defines for libcap +LIBTITLE=libcap VERSION=1 MINOR=95 # diff --git a/libcap/Makefile b/libcap/Makefile index 4af306b..cc5e0e8 100644 --- a/libcap/Makefile +++ b/libcap/Makefile @@ -6,20 +6,21 @@ include ../Make.Rules # # Library version # -LIBNAME=libcap.so +LIBNAME=$(LIBTITLE).so +STALIBNAME=$(LIBTITLE).a # FILES=cap_alloc cap_proc cap_extint cap_flag cap_text cap_sys # for later when there is filesystem support for cap's: -#FILES += cap_file +#FILES += cap_file INCLS=libcap.h cap_names.h $(INCS) OBJS=$(addsuffix .o, $(FILES)) MAJLIBNAME=$(LIBNAME).$(VERSION) MINLIBNAME=$(MAJLIBNAME).$(MINOR) -all: $(MINLIBNAME) +all: $(MINLIBNAME) $(STALIBNAME) _makenames: _makenames.c cap_names.sed $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ @@ -32,8 +33,12 @@ cap_names.sed: Makefile /usr/include/linux/capability.h @sed -ne '/^#define[ \t]CAP[_A-Z]\+[ \t]\+[0-9]\+/{s/^#define \([^ \t]*\)[ \t]*\([^ \t]*\)/ \{ \2, \"\1\" \},/;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/;p;}' < /usr/include/linux/capability.h | fgrep -v 0x > cap_names.sed # @sed -ne '/^#define[ \t]CAP[_A-Z]\+[ \t]\+[0-9]\+/{s/^#define CAP_\([^ \t]*\)[ \t]*\([^ \t]*\)/ \{ \2, \"\1\" \},/;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/;p;}' < /usr/include/linux/capability.h | fgrep -v 0x > cap_names.sed +$(STALIBNAME): $(OBJS) + ar rcs $(STALIBNAME) $(OBJS) + ranlib $(STALIBNAME) + $(MINLIBNAME): $(OBJS) - $(CC) -Wl,-soname -Wl,$(MAJLIBNAME) -Wl,-x -shared -o $@ $(OBJS) + $(CC) $(COPTFLAG) -Wl,-soname,$(MAJLIBNAME) -Wl,-x -shared -o $@ $(OBJS) ln -sf $(MINLIBNAME) $(MAJLIBNAME) ln -sf $(MAJLIBNAME) $(LIBNAME) @@ -47,6 +52,7 @@ install: all mkdir -p -m 0755 $(INCDIR)/sys install -m 0644 include/sys/capability.h $(INCDIR)/sys mkdir -p -m 0755 $(LIBDIR) + install -m 0644 $(STALIBNAME) $(LIBDIR)/$(MINLIBNAME) install -m 0644 $(MINLIBNAME) $(LIBDIR)/$(MINLIBNAME) ln -sf $(MINLIBNAME) $(LIBDIR)/$(MAJLIBNAME) ln -sf $(MAJLIBNAME) $(LIBDIR)/$(LIBNAME) @@ -54,7 +60,6 @@ install: all clean: $(LOCALCLEAN) - rm -f $(OBJS) $(LIBNAME)* + rm -f $(OBJS) $(LIBNAME)* $(STALIBNAME) rm -f cap_names.h cap_names.sed _makenames cd include/sys && $(LOCALCLEAN) - diff --git a/libcap/include/sys/capability.h b/libcap/include/sys/capability.h index f38f81d..736061d 100644 --- a/libcap/include/sys/capability.h +++ b/libcap/include/sys/capability.h @@ -21,6 +21,17 @@ extern "C" { */ #include <sys/types.h> +#include <stdint.h> + +/* + * Make sure we can be included from userland by preventing + * capability.h from including other kernel headers + */ +#define _LINUX_TYPES_H +#define _LINUX_FS_H + +typedef unsigned int __u32; + #include <linux/capability.h> /* diff --git a/progs/Makefile b/progs/Makefile index deb1d80..4caf90c 100644 --- a/progs/Makefile +++ b/progs/Makefile @@ -12,7 +12,7 @@ PROGS=getpcaps setpcaps execcap sucap all: $(PROGS) $(PROGS): %: %.o - $(CC) $(LDFLAGS) -o $@ $< $(LIBS) + $(CC) $(COPTFLAG) $(LDFLAGS) -o $@ $< $(LIBS) %.o: %.c $(INCS) $(CC) $(CFLAGS) -c $< -o $@ |