1 |
reavertm 10/05/27 02:44:14 |
2 |
|
3 |
Modified: cmake-utils.eclass |
4 |
Log: |
5 |
- use DOCS and HTML_DOCS support from base.eclass (arrays), provide backward compatibility code |
6 |
- remove documentation of internal functions so that only relevant and public API is in manual |
7 |
|
8 |
Revision Changes Path |
9 |
1.52 eclass/cmake-utils.eclass |
10 |
|
11 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/cmake-utils.eclass?rev=1.52&view=markup |
12 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/cmake-utils.eclass?rev=1.52&content-type=text/plain |
13 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/cmake-utils.eclass?r1=1.51&r2=1.52 |
14 |
|
15 |
Index: cmake-utils.eclass |
16 |
=================================================================== |
17 |
RCS file: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v |
18 |
retrieving revision 1.51 |
19 |
retrieving revision 1.52 |
20 |
diff -u -r1.51 -r1.52 |
21 |
--- cmake-utils.eclass 30 Apr 2010 23:58:47 -0000 1.51 |
22 |
+++ cmake-utils.eclass 27 May 2010 02:44:14 -0000 1.52 |
23 |
@@ -1,6 +1,6 @@ |
24 |
# Copyright 1999-2010 Gentoo Foundation |
25 |
# Distributed under the terms of the GNU General Public License v2 |
26 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.51 2010/04/30 23:58:47 abcd Exp $ |
27 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.52 2010/05/27 02:44:14 reavertm Exp $ |
28 |
|
29 |
# @ECLASS: cmake-utils.eclass |
30 |
# @MAINTAINER: |
31 |
@@ -8,17 +8,17 @@ |
32 |
# |
33 |
# @CODE |
34 |
# Tomáš Chvátal <scarabeus@g.o> |
35 |
-# Maciej Mrozowski <reavertm@×××××.com> |
36 |
+# Maciej Mrozowski <reavertm@g.o> |
37 |
# (undisclosed contributors) |
38 |
# Original author: Zephyrus (zephyrus@××××××.it) |
39 |
# @CODE |
40 |
# @BLURB: common ebuild functions for cmake-based packages |
41 |
# @DESCRIPTION: |
42 |
-# The cmake-utils eclass contains functions that make creating ebuilds for |
43 |
+# The cmake-utils eclass is base.eclass(5) wrapper that makes creating ebuilds for |
44 |
# cmake-based packages much easier. |
45 |
-# Its main features are support of out-of-source builds as well as in-source |
46 |
-# builds and an implementation of the well-known use_enable and use_with |
47 |
-# functions for CMake. |
48 |
+# It provides all inherited features (DOCS, HTML_DOCS, PATCHES) along with out-of-source |
49 |
+# builds (default), in-source builds and an implementation of the well-known use_enable |
50 |
+# and use_with functions for CMake. |
51 |
|
52 |
# @ECLASS-VARIABLE: WANT_CMAKE |
53 |
# @DESCRIPTION: |
54 |
@@ -101,14 +101,6 @@ |
55 |
fi |
56 |
} |
57 |
|
58 |
-# @ECLASS-VARIABLE: DOCS |
59 |
-# @DESCRIPTION: |
60 |
-# Documents passed to dodoc command. |
61 |
- |
62 |
-# @ECLASS-VARIABLE: HTML_DOCS |
63 |
-# @DESCRIPTION: |
64 |
-# Documents passed to dohtml command. |
65 |
- |
66 |
# @ECLASS-VARIABLE: PREFIX |
67 |
# @DESCRIPTION: |
68 |
# Eclass respects PREFIX variable, though it's not recommended way to set |
69 |
@@ -132,8 +124,6 @@ |
70 |
# specific compiler flags overriding make.conf. |
71 |
: ${CMAKE_BUILD_TYPE:=Gentoo} |
72 |
|
73 |
-# @FUNCTION: _check_build_dir |
74 |
-# @DESCRIPTION: |
75 |
# Determine using IN or OUT source build |
76 |
_check_build_dir() { |
77 |
# @ECLASS-VARIABLE: CMAKE_USE_DIR |
78 |
@@ -263,10 +253,6 @@ |
79 |
_EOF_ |
80 |
} |
81 |
|
82 |
-# @FUNCTION: enable_cmake-utils_src_configure |
83 |
-# @DESCRIPTION: |
84 |
-# General function for configuring with cmake. Default behaviour is to start an |
85 |
-# out-of-source build. |
86 |
enable_cmake-utils_src_configure() { |
87 |
debug-print-function ${FUNCNAME} "$@" |
88 |
|
89 |
@@ -357,10 +343,6 @@ |
90 |
popd > /dev/null |
91 |
} |
92 |
|
93 |
-# @FUNCTION: enable_cmake-utils_src_compile |
94 |
-# @DESCRIPTION: |
95 |
-# General function for compiling with cmake. Default behaviour is to check for |
96 |
-# EAPI and respectively to configure as well or just compile. |
97 |
enable_cmake-utils_src_compile() { |
98 |
debug-print-function ${FUNCNAME} "$@" |
99 |
|
100 |
@@ -387,25 +369,23 @@ |
101 |
popd &> /dev/null |
102 |
} |
103 |
|
104 |
-# @FUNCTION: enable_cmake-utils_src_install |
105 |
-# @DESCRIPTION: |
106 |
-# Function for installing the package. Automatically detects the build type. |
107 |
enable_cmake-utils_src_install() { |
108 |
debug-print-function ${FUNCNAME} "$@" |
109 |
|
110 |
_check_build_dir |
111 |
pushd "${CMAKE_BUILD_DIR}" &> /dev/null |
112 |
- emake install DESTDIR="${D}" || die "Make install failed" |
113 |
+ base_src_install |
114 |
popd &> /dev/null |
115 |
|
116 |
- # Manual document installation |
117 |
- [[ -n "${DOCS}" ]] && { dodoc ${DOCS} || die "dodoc failed" ; } |
118 |
- [[ -n "${HTML_DOCS}" ]] && { dohtml -r ${HTML_DOCS} || die "dohtml failed" ; } |
119 |
+ # Backward compatibility, for non-array variables |
120 |
+ if [[ -n "${DOCS}" ]] && [[ "$(declare -p DOCS 2>/dev/null 2>&1)" != "declare -a"* ]]; then |
121 |
+ dodoc ${DOCS} || die "dodoc failed" |
122 |
+ fi |
123 |
+ if [[ -n "${HTML_DOCS}" ]] && [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" != "declare -a"* ]]; then |
124 |
+ dohtml -r ${HTML_DOCS} || die "dohtml failed" |
125 |
+ fi |
126 |
} |
127 |
|
128 |
-# @FUNCTION: enable_cmake-utils_src_test |
129 |
-# @DESCRIPTION: |
130 |
-# Function for testing the package. Automatically detects the build type. |
131 |
enable_cmake-utils_src_test() { |
132 |
debug-print-function ${FUNCNAME} "$@" |
133 |
|
134 |
@@ -428,40 +408,38 @@ |
135 |
popd &> /dev/null |
136 |
} |
137 |
|
138 |
-## Wrappers for calls bellow this line |
139 |
# @FUNCTION: cmake-utils_src_configure |
140 |
# @DESCRIPTION: |
141 |
-# Wrapper for detection if we want to run enable_ prefixed function with same name |
142 |
-# unconditionaly or only when some useflag is enabled. |
143 |
+# General function for configuring with cmake. Default behaviour is to start an |
144 |
+# out-of-source build. |
145 |
cmake-utils_src_configure() { |
146 |
_execute_optionaly "src_configure" "$@" |
147 |
} |
148 |
|
149 |
# @FUNCTION: cmake-utils_src_compile |
150 |
# @DESCRIPTION: |
151 |
-# Wrapper for detection if we want to run enable_ prefixed function with same name |
152 |
-# unconditionaly or only when some useflag is enabled. |
153 |
+# General function for compiling with cmake. Default behaviour is to check for |
154 |
+# EAPI and respectively to configure as well or just compile. |
155 |
+# Automatically detects the build type. All arguments are passed to emake. |
156 |
cmake-utils_src_compile() { |
157 |
_execute_optionaly "src_compile" "$@" |
158 |
} |
159 |
|
160 |
# @FUNCTION: cmake-utils_src_install |
161 |
# @DESCRIPTION: |
162 |
-# Wrapper for detection if we want to run enable_ prefixed function with same name |
163 |
-# unconditionaly or only when some useflag is enabled. |
164 |
+# Function for installing the package. Automatically detects the build type. |
165 |
cmake-utils_src_install() { |
166 |
_execute_optionaly "src_install" "$@" |
167 |
} |
168 |
|
169 |
# @FUNCTION: cmake-utils_src_test |
170 |
# @DESCRIPTION: |
171 |
-# Wrapper for detection if we want to run enable_ prefixed function with same name |
172 |
-# unconditionaly or only when some useflag is enabled. |
173 |
+# Function for testing the package. Automatically detects the build type. |
174 |
cmake-utils_src_test() { |
175 |
_execute_optionaly "src_test" "$@" |
176 |
} |
177 |
|
178 |
- |
179 |
+# Optionally executes phases based on WANT_CMAKE variable/USE flag. |
180 |
_execute_optionaly() { |
181 |
local phase="$1" ; shift |
182 |
if [[ ${WANT_CMAKE} = always ]]; then |