1 |
vapier 11/11/01 20:42:29 |
2 |
|
3 |
Added: libcap-2.22-build-system-fixes.patch |
4 |
Log: |
5 |
Version bump #389201 by Jack Szpot. |
6 |
|
7 |
(Portage version: 2.2.0_alpha71/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 sys-libs/libcap/files/libcap-2.22-build-system-fixes.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/libcap/files/libcap-2.22-build-system-fixes.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/libcap/files/libcap-2.22-build-system-fixes.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: libcap-2.22-build-system-fixes.patch |
16 |
=================================================================== |
17 |
From 5540f3c2a3bd70ebc8140b74ac5a0aecdbc53234 Mon Sep 17 00:00:00 2001 |
18 |
From: Mike Frysinger <vapier@g.o> |
19 |
Date: Sun, 16 Nov 2008 09:10:31 -0500 |
20 |
Subject: [PATCH] build system fixes |
21 |
|
22 |
This touches up the homebrewed build system to work much better "out of the |
23 |
box" for people. Specifically: |
24 |
- allow toolchain vars to be set via environment |
25 |
- CC / BUILD_CC / AR / RANLIB |
26 |
- CFLAGS / CPPFLAGS / LDFLAGS |
27 |
- split CPPFLAGS out of CFLAGS |
28 |
- break -fPIC out of global CFLAGS and only use where needed |
29 |
- use LDLIBS for libraries, not LDFLAGS |
30 |
|
31 |
Signed-off-by: Mike Frysinger <vapier@g.o> |
32 |
--- |
33 |
Make.Rules | 25 +++++++++++++------------ |
34 |
libcap/Makefile | 11 ++++++----- |
35 |
pam_cap/Makefile | 8 +++++--- |
36 |
progs/Makefile | 2 +- |
37 |
4 files changed, 25 insertions(+), 21 deletions(-) |
38 |
|
39 |
diff --git a/Make.Rules b/Make.Rules |
40 |
index 011aa14..6e432a6 100644 |
41 |
--- a/Make.Rules |
42 |
+++ b/Make.Rules |
43 |
@@ -44,27 +44,28 @@ MINOR=19 |
44 |
|
45 |
# Compilation specifics |
46 |
|
47 |
-KERNEL_HEADERS := $(topdir)/libcap/include |
48 |
-IPATH += -fPIC -I$(topdir)/libcap/include -I$(KERNEL_HEADERS) |
49 |
- |
50 |
-CC := gcc |
51 |
-CFLAGS := -O2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 |
52 |
-BUILD_CC := $(CC) |
53 |
-BUILD_CFLAGS := $(CFLAGS) $(IPATH) |
54 |
-AR := ar |
55 |
-RANLIB := ranlib |
56 |
+CC ?= gcc |
57 |
+CFLAGS ?= -O2 |
58 |
+BUILD_CC ?= $(CC) |
59 |
+BUILD_CFLAGS ?= $(CFLAGS) |
60 |
+AR ?= ar |
61 |
+RANLIB ?= ranlib |
62 |
DEBUG = -g #-DDEBUG |
63 |
WARNINGS=-Wall -Wwrite-strings \ |
64 |
-Wpointer-arith -Wcast-qual -Wcast-align \ |
65 |
-Wstrict-prototypes -Wmissing-prototypes \ |
66 |
-Wnested-externs -Winline -Wshadow |
67 |
LD=$(CC) -Wl,-x -shared |
68 |
-LDFLAGS := #-g |
69 |
+LDFLAGS ?= #-g |
70 |
|
71 |
-SYSTEM_HEADERS = /usr/include |
72 |
+KERNEL_HEADERS = $(topdir)/libcap/include |
73 |
+LIBCAP_CPPFLAGS = -I$(topdir)/libcap/include -I$(KERNEL_HEADERS) |
74 |
+CPPFLAGS += $(LIBCAP_CPPFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 |
75 |
+BUILD_CPPFLAGS += $(LIBCAP_CPPFLAGS) |
76 |
INCS=$(topdir)/libcap/include/sys/capability.h |
77 |
LDFLAGS += -L$(topdir)/libcap |
78 |
-CFLAGS += -Dlinux $(WARNINGS) $(DEBUG) |
79 |
+CPPFLAGS += -Dlinux |
80 |
+CFLAGS += $(WARNINGS) $(DEBUG) |
81 |
PAM_CAP := $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi) |
82 |
INDENT := $(shell if [ -n "$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi) |
83 |
DYNAMIC := $(shell if [ ! -d "$(topdir)/.git" ]; then echo yes; fi) |
84 |
diff --git a/libcap/Makefile b/libcap/Makefile |
85 |
index 4762c60..cf99523 100644 |
86 |
--- a/libcap/Makefile |
87 |
+++ b/libcap/Makefile |
88 |
@@ -16,7 +16,7 @@ FILES=cap_alloc cap_proc cap_extint cap_flag cap_text |
89 |
# no support). |
90 |
ifeq ($(LIBATTR),yes) |
91 |
FILES += cap_file |
92 |
-LDFLAGS += -lattr |
93 |
+LDLIBS += -lattr |
94 |
endif |
95 |
|
96 |
INCLS=libcap.h cap_names.h $(INCS) |
97 |
@@ -24,6 +24,7 @@ OBJS=$(addsuffix .o, $(FILES)) |
98 |
MAJLIBNAME=$(LIBNAME).$(VERSION) |
99 |
MINLIBNAME=$(MAJLIBNAME).$(MINOR) |
100 |
GPERF_OUTPUT = _caps_output.gperf |
101 |
+CFLAGS += -fPIC |
102 |
|
103 |
all: $(MINLIBNAME) $(STALIBNAME) |
104 |
|
105 |
@@ -33,7 +34,7 @@ INCLUDE_GPERF_OUTPUT = -include $(GPERF_OUTPUT) |
106 |
endif |
107 |
|
108 |
_makenames: _makenames.c cap_names.list.h |
109 |
- $(BUILD_CC) $(BUILD_CFLAGS) $< -o $@ |
110 |
+ $(BUILD_CC) $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@ |
111 |
|
112 |
cap_names.h: _makenames |
113 |
./_makenames > cap_names.h |
114 |
@@ -50,15 +51,15 @@ $(STALIBNAME): $(OBJS) |
115 |
$(RANLIB) $@ |
116 |
|
117 |
$(MINLIBNAME): $(OBJS) |
118 |
- $(LD) $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(MAJLIBNAME) -o $@ $^ |
119 |
+ $(LD) $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(MAJLIBNAME) -o $@ $^ $(LDLIBS) |
120 |
ln -sf $(MINLIBNAME) $(MAJLIBNAME) |
121 |
ln -sf $(MAJLIBNAME) $(LIBNAME) |
122 |
|
123 |
%.o: %.c $(INCLS) |
124 |
- $(CC) $(CFLAGS) $(IPATH) -c $< -o $@ |
125 |
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ |
126 |
|
127 |
cap_text.o: cap_text.c $(USE_GPERF_OUTPUT) $(INCLS) |
128 |
- $(CC) $(CFLAGS) $(IPATH) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@ |
129 |
+ $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@ |
130 |
|
131 |
install: all |
132 |
mkdir -p -m 0755 $(INCDIR)/sys |
133 |
diff --git a/pam_cap/Makefile b/pam_cap/Makefile |
134 |
index 9ca5bef..bdae933 100644 |
135 |
--- a/pam_cap/Makefile |
136 |
+++ b/pam_cap/Makefile |
137 |
@@ -9,6 +9,8 @@ include ../Make.Rules |
138 |
# written (and you know why it fails), email me and explain why. Thanks! |
139 |
LDLIBS += -L../libcap -lcap |
140 |
|
141 |
+CFLAGS += -fPIC |
142 |
+ |
143 |
all: pam_cap.so |
144 |
$(MAKE) testcompile |
145 |
|
146 |
@@ -17,13 +19,13 @@ install: all |
147 |
install -m 0755 pam_cap.so $(LIBDIR)/security |
148 |
|
149 |
pam_cap.so: pam_cap.o |
150 |
- $(LD) $(LDFLAGS) -o pam_cap.so $< $(LDLIBS) |
151 |
+ $(LD) $(CFLAGS) $(LDFLAGS) -o pam_cap.so $< $(LDLIBS) |
152 |
|
153 |
pam_cap.o: pam_cap.c |
154 |
- $(CC) $(CFLAGS) $(IPATH) -c $< -o $@ |
155 |
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ |
156 |
|
157 |
testcompile: test.c pam_cap.o |
158 |
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ -lpam -ldl $(LDLIBS) |
159 |
+ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $+ -lpam -ldl $(LDLIBS) |
160 |
|
161 |
clean: |
162 |
rm -f *.o *.so testcompile *~ |
163 |
diff --git a/progs/Makefile b/progs/Makefile |
164 |
index ef51dc6..c261f57 100644 |
165 |
--- a/progs/Makefile |
166 |
+++ b/progs/Makefile |
167 |
@@ -22,7 +22,7 @@ $(BUILD): %: %.o |
168 |
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS) |
169 |
|
170 |
%.o: %.c $(INCS) |
171 |
- $(CC) $(IPATH) $(CFLAGS) -c $< -o $@ |
172 |
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ |
173 |
|
174 |
install: all |
175 |
mkdir -p -m 0755 $(SBINDIR) |
176 |
-- |
177 |
1.7.4.rc2 |