1 |
pva 08/09/10 08:20:06 |
2 |
|
3 |
Modified: ccc.eclass |
4 |
Log: |
5 |
Make eclass-manpages ready, bug #210793, thank mren for report. |
6 |
|
7 |
Revision Changes Path |
8 |
1.19 eclass/ccc.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/ccc.eclass?rev=1.19&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/ccc.eclass?rev=1.19&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/ccc.eclass?r1=1.18&r2=1.19 |
13 |
|
14 |
Index: ccc.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/ccc.eclass,v |
17 |
retrieving revision 1.18 |
18 |
retrieving revision 1.19 |
19 |
diff -u -r1.18 -r1.19 |
20 |
--- ccc.eclass 11 Jul 2005 15:08:06 -0000 1.18 |
21 |
+++ ccc.eclass 10 Sep 2008 08:20:05 -0000 1.19 |
22 |
@@ -1,12 +1,16 @@ |
23 |
-# Copyright 1999-2004 Gentoo Foundation |
24 |
+# Copyright 1999-2008 Gentoo Foundation |
25 |
# Distributed under the terms of the GNU General Public License v2 |
26 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/ccc.eclass,v 1.18 2005/07/11 15:08:06 swegener Exp $ |
27 |
-# |
28 |
-# Authors: Tavis Ormandy <taviso@g.o> |
29 |
-# Aron Griffis <agriffis@g.o> |
30 |
-# |
31 |
-# functions to make ebuilds more ccc friendly. |
32 |
-# |
33 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/ccc.eclass,v 1.19 2008/09/10 08:20:05 pva Exp $ |
34 |
+ |
35 |
+# @ECLASS: ccc.eclass |
36 |
+# @MAINTAINER: |
37 |
+# ??? |
38 |
+# |
39 |
+# Authors: |
40 |
+# Tavis Ormandy <taviso@g.o> |
41 |
+# Aron Griffis <agriffis@g.o> |
42 |
+# @BLURB: functions to make ebuilds more ccc friendly. |
43 |
+ |
44 |
# 16/6/2003 - Added otsify() |
45 |
# 18/6/2003 - regex tweaks. |
46 |
# 22/7/2003 - newdepend |
47 |
@@ -17,84 +21,6 @@ |
48 |
# define this to make this eclass noisy. |
49 |
#DEBUG_CCC_ECLASS=1 |
50 |
|
51 |
-# |
52 |
-#### hide-restrict-arr #### |
53 |
-# Scan for and replace __restrict_arr with a ccc |
54 |
-# supported equivalent. |
55 |
-# |
56 |
-# you might see an error like this if you need this: |
57 |
-# |
58 |
-# cc: Error: regexec.c, line 209: In the definition of the function "regexec", |
59 |
-# the promoted type of pmatch is incompatible with the type of the corresponding |
60 |
-# parameter in a prior declaration. (promotmatch) |
61 |
-# regmatch_t pmatch[]; |
62 |
-# ---------------^ |
63 |
-# |
64 |
-#### replace-cc-hardcode #### |
65 |
-# Look for common cc hardcodes in Makefiles. |
66 |
-# |
67 |
-#### replace-cxx-hardcode #### |
68 |
-# Look for common cxx hardcodes in Makefiles. |
69 |
-# |
70 |
-#### is-ccc #### |
71 |
-# Returns success if dec compiler is being used. |
72 |
-# |
73 |
-# example: |
74 |
-# |
75 |
-# is-ccc && hide-restrict-arr |
76 |
-# |
77 |
-#### is-cxx #### |
78 |
-# Returns success if dec c++ compiler is being used. |
79 |
-# |
80 |
-#### replace-ccc-g #### |
81 |
-# Try to replace -g with -g3 |
82 |
-# |
83 |
-#### ccc-elf-check </path/to/binary> #### |
84 |
-# Return success if binary was compiled with ccc |
85 |
-# |
86 |
-# example: |
87 |
-# if ! is-ccc; then |
88 |
-# ccc-elf-check /usr/lib/libglib.a && \ |
89 |
-# append-ldflags -lots |
90 |
-# fi |
91 |
-# |
92 |
-# NOTE: i think the binary and shared library detection |
93 |
-# is pretty safe, but the archive detection may not |
94 |
-# be as reliable. |
95 |
-#### create-so </usr/lib/library.a> <library.so> #### |
96 |
-# Make the shared library (.so) specified from the archive (.a) |
97 |
-# specified. LDFLAGS will be honoured. if you need a different |
98 |
-# `soname` (DT_SONAME) from the shared lib filename, you will have |
99 |
-# to do it manually ;) |
100 |
-# |
101 |
-# example: |
102 |
-# is-ccc && \ |
103 |
-# create-so /usr/lib/libcoolstuff.a libcoolstuff.so.${PV} |
104 |
-# dosym /usr/lib/libcoolstuff.so.${PV} /usr/lib/libcoolstuff.so |
105 |
-# |
106 |
-# NOTE: -lots will be used by default, this is ccc.eclass after all :) |
107 |
-# NOTE: .${PV} is optional, of course. |
108 |
-# NOTE: dolib.so will manage installation |
109 |
-#### append-ldflags <flag> #### |
110 |
-#### is-ldflag <flag> #### |
111 |
-#### filter-ldflags <flag> #### |
112 |
-# flag-o-matic doesnt provide LDFLAGS utilities. |
113 |
-# Some replacements for ccc porting. These functions |
114 |
-# mimic the flag-o-matic equivalents, look in there for |
115 |
-# documentation. |
116 |
-# |
117 |
-#### otsify <archive> #### |
118 |
-# Add the functions from libots to <archive>, this means |
119 |
-# that if you use gcc to build an application that links with |
120 |
-# <archive>, you wont need -lots. |
121 |
-# Use this on libraries that you want maximum performance from, |
122 |
-# but might not be using ccc when linking against it (eg zlib, openssl, etc) |
123 |
-# |
124 |
-# example: |
125 |
-# is-ccc && otsify ${S}/libz.a |
126 |
-# |
127 |
-#### |
128 |
-# |
129 |
|
130 |
ccc-fixup() |
131 |
{ |
132 |
@@ -122,6 +48,19 @@ |
133 |
done |
134 |
} |
135 |
|
136 |
+# @FUNCTION: hide-restrict-arr |
137 |
+# @DESCRIPTION: |
138 |
+# Scan for and replace __restrict_arr with a ccc |
139 |
+# supported equivalent. |
140 |
+# |
141 |
+# You might see an error like this if you need this: |
142 |
+# @CODE |
143 |
+# cc: Error: regexec.c, line 209: In the definition of the function "regexec", |
144 |
+# the promoted type of pmatch is incompatible with the type of the corresponding |
145 |
+# parameter in a prior declaration. (promotmatch) |
146 |
+# regmatch_t pmatch[]; |
147 |
+# ---------------^ |
148 |
+# @CODE |
149 |
hide-restrict-arr() |
150 |
{ |
151 |
# __restrict_arr causes trouble with ccc, __restrict |
152 |
@@ -135,6 +74,9 @@ |
153 |
xargs | ccc-fixup 's#\(\[__restrict\)_arr\]#\1\]#g' |
154 |
} |
155 |
|
156 |
+# @FUNCTION: replace-cc-hardcode |
157 |
+# @DESCRIPTION: |
158 |
+# Look for common cc hardcodes in Makefiles. |
159 |
replace-cc-hardcode() |
160 |
{ |
161 |
# lots of developers hardcode gcc into their |
162 |
@@ -144,6 +86,9 @@ |
163 |
xargs | ccc-fixup "s#^\(CC.*=\).*g\?cc#\1${CC:-gcc}#g" |
164 |
} |
165 |
|
166 |
+# @FUNCTION: replace-cxx-hardcode |
167 |
+# @DESCRIPTION: |
168 |
+# Look for common cxx hardcodes in Makefiles. |
169 |
replace-cxx-hardcode() |
170 |
{ |
171 |
# lots of developers hardcode g++ into thier |
172 |
@@ -152,18 +97,29 @@ |
173 |
xargs | ccc-fixup "s#^\(CXX.*=\).*[gc]\{1\}++#\1${CXX:-g++}#g" |
174 |
} |
175 |
|
176 |
+# @FUNCTION: is-ccc |
177 |
+# @RETURN: Returns success if dec compiler is being used. |
178 |
+# @DESCRIPTION: |
179 |
+# example: |
180 |
+# |
181 |
+# is-ccc && hide-restrict-arr |
182 |
is-ccc() |
183 |
{ |
184 |
# return true if ccc is being used. |
185 |
[ "${ARCH}:`basename ${CC:-gcc}`" == "alpha:ccc" ] |
186 |
} |
187 |
|
188 |
+# @FUNCTION: is-cxx |
189 |
+# @RETURN: Returns success if dec c++ compiler is being used. |
190 |
is-cxx() |
191 |
{ |
192 |
# return true if cxx is being used |
193 |
[ "${ARCH}:`basename ${CXX:-g++}`" == "alpha:cxx" ] |
194 |
} |
195 |
|
196 |
+# @FUNCTION: replace-ccc-g |
197 |
+# @DESCRIPTION: |
198 |
+# Try to replace -g with -g3 |
199 |
replace-ccc-g() |
200 |
{ |
201 |
# -g will stop ccc/cxx performing optimisation |
202 |
@@ -174,6 +130,20 @@ |
203 |
# FIXME: my eyes! it burns! |
204 |
} |
205 |
|
206 |
+# @FUNCTION: ccc-elf-check |
207 |
+# @RETURN: Return success if binary was compiled with ccc |
208 |
+# @DESCRIPTION: |
209 |
+# example: |
210 |
+# @CODE |
211 |
+# if ! is-ccc; then |
212 |
+# ccc-elf-check /usr/lib/libglib.a && \ |
213 |
+# append-ldflags -lots |
214 |
+# fi |
215 |
+# @CODE |
216 |
+# |
217 |
+# NOTE: i think the binary and shared library detection |
218 |
+# is pretty safe, but the archive detection may not |
219 |
+# be as reliable. |
220 |
ccc-elf-check() |
221 |
{ |
222 |
# check if argument is a ccc created executable. |
223 |
@@ -203,6 +173,24 @@ |
224 |
return 1 |
225 |
} |
226 |
|
227 |
+# @FUNCTION: create-so |
228 |
+# @USAGE: < /usr/lib/library.a > < library.so > |
229 |
+# @DESCRIPTION: |
230 |
+# Make the shared library (.so) specified from the archive (.a) |
231 |
+# specified. LDFLAGS will be honoured. if you need a different |
232 |
+# `soname` (DT_SONAME) from the shared lib filename, you will have |
233 |
+# to do it manually ;) |
234 |
+# |
235 |
+# example: |
236 |
+# @CODE |
237 |
+# is-ccc && \ |
238 |
+# create-so /usr/lib/libcoolstuff.a libcoolstuff.so.${PV} |
239 |
+# dosym /usr/lib/libcoolstuff.so.${PV} /usr/lib/libcoolstuff.so |
240 |
+# @CODE |
241 |
+# |
242 |
+# NOTE: -lots will be used by default, this is ccc.eclass after all :) |
243 |
+# NOTE: .${PV} is optional, of course. |
244 |
+# NOTE: dolib.so will manage installation |
245 |
create-so() |
246 |
{ |
247 |
# some applications check for .so, but ccc wont |
248 |
@@ -221,6 +209,10 @@ |
249 |
dolib.so ${T}/${2##*/} |
250 |
} |
251 |
|
252 |
+# @FUNCTION: append-ldflags |
253 |
+# @USAGE: < flag > |
254 |
+# @DESCRIPTION: |
255 |
+# Append <flag> to the current LDFLAGS |
256 |
append-ldflags() |
257 |
{ |
258 |
LDFLAGS="${LDFLAGS} ${1}" |
259 |
@@ -239,6 +231,9 @@ |
260 |
# done |
261 |
#} |
262 |
|
263 |
+# @FUNCTION: is-ldflags |
264 |
+# @USAGE: < flag > |
265 |
+# @RETURN: Return code 0 if <flag> is in LDFLAGS, else return code 1 |
266 |
is-ldflags() { |
267 |
local x |
268 |
for x in ${LDFLAGS} |
269 |
@@ -251,6 +246,13 @@ |
270 |
return 1 |
271 |
} |
272 |
|
273 |
+# @FUNCTION: filter-ldflags |
274 |
+# @USAGE: < flag > |
275 |
+# @DESCRIPTION: |
276 |
+# flag-o-matic doesnt provide LDFLAGS utilities. |
277 |
+# Some replacements for ccc porting. These functions |
278 |
+# mimic the flag-o-matic equivalents, look in there for |
279 |
+# documentation. |
280 |
filter-ldflags() |
281 |
{ |
282 |
for x in ${1} |
283 |
@@ -259,6 +261,18 @@ |
284 |
done |
285 |
} |
286 |
|
287 |
+# @FUNCTION: otsify |
288 |
+# @USAGE: < archive > |
289 |
+# @DESCRIPTION: |
290 |
+# Add the functions from libots to <archive>, this means |
291 |
+# that if you use gcc to build an application that links with |
292 |
+# <archive>, you wont need -lots. |
293 |
+# Use this on libraries that you want maximum performance from, |
294 |
+# but might not be using ccc when linking against it (eg zlib, openssl, etc) |
295 |
+# |
296 |
+# example: |
297 |
+# |
298 |
+# is-ccc && otsify ${S}/libz.a |
299 |
otsify() |
300 |
{ |
301 |
[ "$DEBUG_CCC_ECLASS" ] && local ar_args="v" |