Contents of /trunk/libcap/patches/1.10-python.patch
Parent Directory | Revision Log
Revision 144 -
(show annotations)
(download)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 2796 byte(s)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 2796 byte(s)
-import
1 | diff -ur libcap-1.10.orig/libcap/Makefile libcap-1.10/libcap/Makefile |
2 | --- libcap-1.10.orig/libcap/Makefile 2003-09-29 22:26:56.856116136 -0400 |
3 | +++ libcap-1.10/libcap/Makefile 2003-09-29 22:31:06.204209464 -0400 |
4 | @@ -33,6 +33,7 @@ |
5 | # Library version |
6 | # |
7 | LIBNAME=libcap |
8 | +PYTHONMODNAME=libcapmodule.so |
9 | # |
10 | |
11 | FILES=cap_alloc cap_proc cap_extint cap_flag cap_text cap_sys |
12 | @@ -46,7 +47,11 @@ |
13 | MAJLIBNAME=$(LIBNAME).so.$(VERSION) |
14 | MINLIBNAME=$(MAJLIBNAME).$(MINOR) |
15 | |
16 | +ifdef PYTHON |
17 | +all: $(MINLIBNAME) $(LIBNAME).a $(PYTHONMODNAME) |
18 | +else |
19 | all: $(MINLIBNAME) $(LIBNAME).a |
20 | +endif |
21 | |
22 | _makenames: _makenames.c cap_names.sed |
23 | $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ |
24 | @@ -66,6 +71,15 @@ |
25 | ln -sf $(MINLIBNAME) $(MAJLIBNAME) |
26 | ln -sf $(MAJLIBNAME) $(LIBNAME).so |
27 | |
28 | +libcap_wrap.c: include/sys/capability.h |
29 | + swig -python -o libcap_wrap.c include/sys/capability.h |
30 | + |
31 | +libcap_wrap.o: libcap_wrap.c |
32 | + $(CC) $(CFLAGS) -fPIC -c $< -o $@ |
33 | + |
34 | +$(PYTHONMODNAME): $(LOBJS) libcap_wrap.o |
35 | + $(LD) -x -shared -o $@ libcap_wrap.o $(LOBJS) |
36 | + |
37 | %.o: %.c $(INCLS) |
38 | $(CC) $(CFLAGS) -c $< -o $@ |
39 | |
40 | @@ -82,10 +93,15 @@ |
41 | ln -sf $(MINLIBNAME) $(LIBDIR)/$(MAJLIBNAME) |
42 | ln -sf $(MAJLIBNAME) $(LIBDIR)/$(LIBNAME).so |
43 | -/sbin/ldconfig |
44 | +ifdef PYTHON |
45 | + mkdir -p $(PYTHONMODDIR) |
46 | + install -m 0644 $(PYTHONMODNAME) $(PYTHONMODDIR)/$(PYTHONMODNAME) |
47 | + install -m 0644 libcap.py $(PYTHONMODDIR)/ |
48 | +endif |
49 | |
50 | clean: |
51 | $(LOCALCLEAN) |
52 | rm -f $(OBJS) $(LOBJS) $(LIBNAME).a $(LIBNAME).so* |
53 | - rm -f cap_names.h cap_names.sed _makenames |
54 | + rm -f cap_names.h cap_names.sed _makenames libcap_wrap.c |
55 | cd include/sys && $(LOCALCLEAN) |
56 | |
57 | diff -ur libcap-1.10.orig/libcap/include/sys/capability.h libcap-1.10/libcap/include/sys/capability.h |
58 | --- libcap-1.10.orig/libcap/include/sys/capability.h 2003-09-29 22:26:56.856116136 -0400 |
59 | +++ libcap-1.10/libcap/include/sys/capability.h 2003-09-29 22:29:07.457261744 -0400 |
60 | @@ -15,12 +15,23 @@ |
61 | extern "C" { |
62 | #endif |
63 | |
64 | +#ifdef SWIG |
65 | +%module libcap |
66 | +#endif |
67 | + |
68 | /* |
69 | * This file complements the kernel file by providing prototype |
70 | * information for the user library. |
71 | */ |
72 | |
73 | +#ifdef SWIG |
74 | +%{ |
75 | +#include <sys/types.h> |
76 | +#include "libcap.h" |
77 | +%} |
78 | +#else |
79 | #include <sys/types.h> |
80 | +#endif |
81 | /* |
82 | * This is <linux/capability.h> |
83 | * |
84 | @@ -354,10 +365,12 @@ |
85 | int cap_clear(cap_t); |
86 | |
87 | /* libcap/cap_file.c */ |
88 | +#ifndef SWIG |
89 | cap_t cap_get_fd(int); |
90 | cap_t cap_get_file(const char *); |
91 | int cap_set_fd(int, cap_t); |
92 | int cap_set_file(const char *, cap_t); |
93 | +#endif |
94 | |
95 | /* libcap/cap_proc.c */ |
96 | cap_t cap_get_proc(void); |
97 | @@ -377,6 +390,7 @@ |
98 | * if the following _POSIX_SOURCE is _undefined_ |
99 | */ |
100 | |
101 | +#ifndef SWIG |
102 | #if !defined(_POSIX_SOURCE) |
103 | |
104 | extern int capset(cap_user_header_t header, cap_user_data_t data); |
105 | @@ -386,6 +400,7 @@ |
106 | extern char const *_cap_names[]; |
107 | |
108 | #endif /* !defined(_POSIX_SOURCE) */ |
109 | +#endif |
110 | |
111 | #ifdef __cplusplus |
112 | } |