1 |
mgorny 13/03/28 12:21:46 |
2 |
|
3 |
Modified: ChangeLog python-utils-r1.eclass |
4 |
Log: |
5 |
Support obtaining CFLAGS and LIBS for the Python implementation (similarly to pkg-config or python-config). |
6 |
|
7 |
Revision Changes Path |
8 |
1.756 eclass/ChangeLog |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.756&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.756&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.755&r2=1.756 |
13 |
|
14 |
Index: ChangeLog |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v |
17 |
retrieving revision 1.755 |
18 |
retrieving revision 1.756 |
19 |
diff -u -r1.755 -r1.756 |
20 |
--- ChangeLog 26 Mar 2013 13:49:39 -0000 1.755 |
21 |
+++ ChangeLog 28 Mar 2013 12:21:46 -0000 1.756 |
22 |
@@ -1,6 +1,10 @@ |
23 |
# ChangeLog for eclass directory |
24 |
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.755 2013/03/26 13:49:39 scarabeus Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.756 2013/03/28 12:21:46 mgorny Exp $ |
27 |
+ |
28 |
+ 28 Mar 2013; Michał Górny <mgorny@g.o> python-utils-r1.eclass: |
29 |
+ Support obtaining CFLAGS and LIBS for the Python implementation (similarly to |
30 |
+ pkg-config or python-config). |
31 |
|
32 |
26 Mar 2013; Tomáš Chvátal <scarabeus@g.o> obs-service.eclass: |
33 |
Fix hardcoded libexec suse path in scripts. |
34 |
|
35 |
|
36 |
|
37 |
1.20 eclass/python-utils-r1.eclass |
38 |
|
39 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-utils-r1.eclass?rev=1.20&view=markup |
40 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-utils-r1.eclass?rev=1.20&content-type=text/plain |
41 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-utils-r1.eclass?r1=1.19&r2=1.20 |
42 |
|
43 |
Index: python-utils-r1.eclass |
44 |
=================================================================== |
45 |
RCS file: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v |
46 |
retrieving revision 1.19 |
47 |
retrieving revision 1.20 |
48 |
diff -u -r1.19 -r1.20 |
49 |
--- python-utils-r1.eclass 7 Mar 2013 20:58:51 -0000 1.19 |
50 |
+++ python-utils-r1.eclass 28 Mar 2013 12:21:46 -0000 1.20 |
51 |
@@ -1,6 +1,6 @@ |
52 |
# Copyright 1999-2013 Gentoo Foundation |
53 |
# Distributed under the terms of the GNU General Public License v2 |
54 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.19 2013/03/07 20:58:51 radhermit Exp $ |
55 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.20 2013/03/28 12:21:46 mgorny Exp $ |
56 |
|
57 |
# @ECLASS: python-utils-r1 |
58 |
# @MAINTAINER: |
59 |
@@ -34,7 +34,7 @@ |
60 |
|
61 |
if [[ ! ${_PYTHON_UTILS_R1} ]]; then |
62 |
|
63 |
-inherit multilib |
64 |
+inherit multilib toolchain-funcs |
65 |
|
66 |
# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS |
67 |
# @INTERNAL |
68 |
@@ -136,6 +136,34 @@ |
69 |
# /usr/lib64/libpython2.6.so |
70 |
# @CODE |
71 |
|
72 |
+# @ECLASS-VARIABLE: PYTHON_CFLAGS |
73 |
+# @DESCRIPTION: |
74 |
+# Proper C compiler flags for building against Python. Obtained from |
75 |
+# pkg-config or python-config. |
76 |
+# |
77 |
+# Set and exported on request using python_export(). |
78 |
+# Valid only for CPython. Requires a proper build-time dependency |
79 |
+# on the Python implementation and on pkg-config. |
80 |
+# |
81 |
+# Example value: |
82 |
+# @CODE |
83 |
+# -I/usr/include/python2.7 |
84 |
+# @CODE |
85 |
+ |
86 |
+# @ECLASS-VARIABLE: PYTHON_LIBS |
87 |
+# @DESCRIPTION: |
88 |
+# Proper C compiler flags for linking against Python. Obtained from |
89 |
+# pkg-config or python-config. |
90 |
+# |
91 |
+# Set and exported on request using python_export(). |
92 |
+# Valid only for CPython. Requires a proper build-time dependency |
93 |
+# on the Python implementation and on pkg-config. |
94 |
+# |
95 |
+# Example value: |
96 |
+# @CODE |
97 |
+# -lpython2.7 |
98 |
+# @CODE |
99 |
+ |
100 |
# @ECLASS-VARIABLE: PYTHON_PKG_DEP |
101 |
# @DESCRIPTION: |
102 |
# The complete dependency on a particular Python package as a string. |
103 |
@@ -238,7 +266,7 @@ |
104 |
libname=lib${impl} |
105 |
;; |
106 |
*) |
107 |
- die "${EPYTHON} lacks a dynamic library" |
108 |
+ die "${impl} lacks a dynamic library" |
109 |
;; |
110 |
esac |
111 |
|
112 |
@@ -247,6 +275,46 @@ |
113 |
export PYTHON_LIBPATH=${path}/${libname}$(get_libname) |
114 |
debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}" |
115 |
;; |
116 |
+ PYTHON_CFLAGS) |
117 |
+ local val |
118 |
+ |
119 |
+ case "${impl}" in |
120 |
+ python2.5|python2.6) |
121 |
+ # old versions support python-config only |
122 |
+ val=$("${impl}-config" --includes) |
123 |
+ ;; |
124 |
+ python*) |
125 |
+ # python-2.7, python-3.2, etc. |
126 |
+ val=$($(tc-getPKG_CONFIG) --cflags ${impl/n/n-}) |
127 |
+ ;; |
128 |
+ *) |
129 |
+ die "${impl}: obtaining ${var} not supported" |
130 |
+ ;; |
131 |
+ esac |
132 |
+ |
133 |
+ export PYTHON_CFLAGS=${val} |
134 |
+ debug-print "${FUNCNAME}: PYTHON_CFLAGS = ${PYTHON_CFLAGS}" |
135 |
+ ;; |
136 |
+ PYTHON_LIBS) |
137 |
+ local val |
138 |
+ |
139 |
+ case "${impl}" in |
140 |
+ python2.5|python2.6) |
141 |
+ # old versions support python-config only |
142 |
+ val=$("${impl}-config" --libs) |
143 |
+ ;; |
144 |
+ python*) |
145 |
+ # python-2.7, python-3.2, etc. |
146 |
+ val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}) |
147 |
+ ;; |
148 |
+ *) |
149 |
+ die "${impl}: obtaining ${var} not supported" |
150 |
+ ;; |
151 |
+ esac |
152 |
+ |
153 |
+ export PYTHON_LIBS=${val} |
154 |
+ debug-print "${FUNCNAME}: PYTHON_LIBS = ${PYTHON_LIBS}" |
155 |
+ ;; |
156 |
PYTHON_PKG_DEP) |
157 |
local d |
158 |
case ${impl} in |
159 |
@@ -353,6 +421,40 @@ |
160 |
echo "${PYTHON_LIBPATH}" |
161 |
} |
162 |
|
163 |
+# @FUNCTION: python_get_CFLAGS |
164 |
+# @USAGE: [<impl>] |
165 |
+# @DESCRIPTION: |
166 |
+# Obtain and print the compiler flags for building against Python, |
167 |
+# for the given implementation. If no implementation is provided, |
168 |
+# ${EPYTHON} will be used. |
169 |
+# |
170 |
+# Please note that this function can be used with CPython only. |
171 |
+# It requires Python and pkg-config installed, and therefore proper |
172 |
+# build-time dependencies need be added to the ebuild. |
173 |
+python_get_CFLAGS() { |
174 |
+ debug-print-function ${FUNCNAME} "${@}" |
175 |
+ |
176 |
+ python_export "${@}" PYTHON_CFLAGS |
177 |
+ echo "${PYTHON_CFLAGS}" |
178 |
+} |
179 |
+ |
180 |
+# @FUNCTION: python_get_LIBS |
181 |
+# @USAGE: [<impl>] |
182 |
+# @DESCRIPTION: |
183 |
+# Obtain and print the compiler flags for linking against Python, |
184 |
+# for the given implementation. If no implementation is provided, |
185 |
+# ${EPYTHON} will be used. |
186 |
+# |
187 |
+# Please note that this function can be used with CPython only. |
188 |
+# It requires Python and pkg-config installed, and therefore proper |
189 |
+# build-time dependencies need be added to the ebuild. |
190 |
+python_get_LIBS() { |
191 |
+ debug-print-function ${FUNCNAME} "${@}" |
192 |
+ |
193 |
+ python_export "${@}" PYTHON_LIBS |
194 |
+ echo "${PYTHON_LIBS}" |
195 |
+} |
196 |
+ |
197 |
# @FUNCTION: _python_rewrite_shebang |
198 |
# @INTERNAL |
199 |
# @USAGE: [<EPYTHON>] <path>... |