Gentoo Archives: gentoo-commits

From: "Andreas Hüttel" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/dilfridge:master commit in: eclass/
Date: Thu, 22 Dec 2011 22:22:00
Message-Id: 723e338ca0e77329f364e324a18ec46c7c69ca18.dilfridge@gentoo
1 commit: 723e338ca0e77329f364e324a18ec46c7c69ca18
2 Author: Andreas K. Huettel (dilfridge) <mail <AT> akhuettel <DOT> de>
3 AuthorDate: Mon Dec 19 02:11:31 2011 +0000
4 Commit: Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Mon Dec 19 02:11:31 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/dilfridge.git;a=commit;h=723e338c
7
8 [eclass] Not needed anymore
9
10 ---
11 eclass/cmake-utils.eclass | 478 ---------------------------------------------
12 1 files changed, 0 insertions(+), 478 deletions(-)
13
14 diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
15 deleted file mode 100644
16 index 4515db1..0000000
17 --- a/eclass/cmake-utils.eclass
18 +++ /dev/null
19 @@ -1,478 +0,0 @@
20 -# Copyright 1999-2010 Gentoo Foundation
21 -# Distributed under the terms of the GNU General Public License v2
22 -# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.69 2011/06/27 21:11:57 abcd Exp $
23 -
24 -# @ECLASS: cmake-utils.eclass
25 -# @MAINTAINER:
26 -# kde@g.o
27 -#
28 -# @CODE
29 -# Tomáš Chvátal <scarabeus@g.o>
30 -# Maciej Mrozowski <reavertm@g.o>
31 -# (undisclosed contributors)
32 -# Original author: Zephyrus (zephyrus@××××××.it)
33 -# @CODE
34 -# @BLURB: common ebuild functions for cmake-based packages
35 -# @DESCRIPTION:
36 -# The cmake-utils eclass is base.eclass(5) wrapper that makes creating ebuilds for
37 -# cmake-based packages much easier.
38 -# It provides all inherited features (DOCS, HTML_DOCS, PATCHES) along with out-of-source
39 -# builds (default), in-source builds and an implementation of the well-known use_enable
40 -# and use_with functions for CMake.
41 -
42 -# @ECLASS-VARIABLE: WANT_CMAKE
43 -# @DESCRIPTION:
44 -# Specify if cmake-utils eclass should depend on cmake optionaly or not.
45 -# This is usefull when only part of aplication is using cmake build system.
46 -# Valid values are: always [default], optional (where the value is the useflag
47 -# used for optionality)
48 -WANT_CMAKE="${WANT_CMAKE:-always}"
49 -
50 -# @ECLASS-VARIABLE: CMAKE_MIN_VERSION
51 -# @DESCRIPTION:
52 -# Specify the minimum required CMake version. Default is 2.8.1
53 -CMAKE_MIN_VERSION="${CMAKE_MIN_VERSION:-2.8.1}"
54 -
55 -# @ECLASS-VARIABLE: CMAKE_REMOVE_MODULES
56 -# @DESCRIPTION:
57 -# Space-separated list of CMake modules that will be removed in $S during src_prepare,
58 -# in order to force packages to use the system version.
59 -CMAKE_REMOVE_MODULES="${CMAKE_REMOVE_MODULES:-FindBLAS FindLAPACK}"
60 -
61 -CMAKEDEPEND=""
62 -case ${WANT_CMAKE} in
63 - always)
64 - ;;
65 - *)
66 - IUSE+=" ${WANT_CMAKE}"
67 - CMAKEDEPEND+="${WANT_CMAKE}? ( "
68 - ;;
69 -esac
70 -inherit toolchain-funcs multilib flag-o-matic base
71 -
72 -CMAKE_EXPF="src_compile src_test src_install"
73 -case ${EAPI:-0} in
74 - 4|3|2) CMAKE_EXPF+=" src_configure" ;;
75 - 1|0) ;;
76 - *) die "Unknown EAPI, Bug eclass maintainers." ;;
77 -esac
78 -EXPORT_FUNCTIONS ${CMAKE_EXPF}
79 -
80 -: ${DESCRIPTION:="Based on the ${ECLASS} eclass"}
81 -
82 -if [[ ${PN} != cmake ]]; then
83 - CMAKEDEPEND+=">=dev-util/cmake-${CMAKE_MIN_VERSION}"
84 -fi
85 -
86 -CMAKEDEPEND+=" userland_GNU? ( >=sys-apps/findutils-4.4.0 )"
87 -
88 -[[ ${WANT_CMAKE} = always ]] || CMAKEDEPEND+=" )"
89 -
90 -DEPEND="${CMAKEDEPEND}"
91 -unset CMAKEDEPEND
92 -
93 -# Internal functions used by cmake-utils_use_*
94 -_use_me_now() {
95 - debug-print-function ${FUNCNAME} "$@"
96 -
97 - local uper capitalised x
98 - [[ -z $2 ]] && die "cmake-utils_use-$1 <USE flag> [<flag name>]"
99 - if [[ ! -z $3 ]]; then
100 - # user specified the use name so use it
101 - echo "-D$1$3=$(use $2 && echo ON || echo OFF)"
102 - else
103 - # use all various most used combinations
104 - uper=$(echo ${2} | tr '[:lower:]' '[:upper:]')
105 - capitalised=$(echo ${2} | sed 's/\<\(.\)\([^ ]*\)/\u\1\L\2/g')
106 - for x in $2 $uper $capitalised; do
107 - echo "-D$1$x=$(use $2 && echo ON || echo OFF) "
108 - done
109 - fi
110 -}
111 -_use_me_now_inverted() {
112 - debug-print-function ${FUNCNAME} "$@"
113 -
114 - local uper capitalised x
115 - [[ -z $2 ]] && die "cmake-utils_use-$1 <USE flag> [<flag name>]"
116 - if [[ ! -z $3 ]]; then
117 - # user specified the use name so use it
118 - echo "-D$1$3=$(use $2 && echo OFF || echo ON)"
119 - else
120 - # use all various most used combinations
121 - uper=$(echo ${2} | tr '[:lower:]' '[:upper:]')
122 - capitalised=$(echo ${2} | sed 's/\<\(.\)\([^ ]*\)/\u\1\L\2/g')
123 - for x in $2 $uper $capitalised; do
124 - echo "-D$1$x=$(use $2 && echo OFF || echo ON) "
125 - done
126 - fi
127 -}
128 -
129 -# @ECLASS-VARIABLE: CMAKE_BUILD_DIR
130 -# @DESCRIPTION:
131 -# Build directory where all cmake processed files should be generated.
132 -# For in-source build it's fixed to ${CMAKE_USE_DIR}.
133 -# For out-of-source build it can be overriden, by default it uses
134 -# ${WORKDIR}/${P}_build.
135 -
136 -# @ECLASS-VARIABLE: CMAKE_BUILD_TYPE
137 -# @DESCRIPTION:
138 -# Set to override default CMAKE_BUILD_TYPE. Only useful for packages
139 -# known to make use of "if (CMAKE_BUILD_TYPE MATCHES xxx)".
140 -# If about to be set - needs to be set before invoking cmake-utils_src_configure.
141 -# You usualy do *NOT* want nor need to set it as it pulls CMake default build-type
142 -# specific compiler flags overriding make.conf.
143 -: ${CMAKE_BUILD_TYPE:=Gentoo}
144 -
145 -# @ECLASS-VARIABLE: CMAKE_IN_SOURCE_BUILD
146 -# @DESCRIPTION:
147 -# Set to enable in-source build.
148 -
149 -# @ECLASS-VARIABLE: CMAKE_USE_DIR
150 -# @DESCRIPTION:
151 -# Sets the directory where we are working with cmake.
152 -# For example when application uses autotools and only one
153 -# plugin needs to be done by cmake.
154 -# By default it uses ${S}.
155 -
156 -# @ECLASS-VARIABLE: CMAKE_VERBOSE
157 -# @DESCRIPTION:
158 -# Set to enable verbose messages during compilation.
159 -
160 -# @ECLASS-VARIABLE: PREFIX
161 -# @DESCRIPTION:
162 -# Eclass respects PREFIX variable, though it's not recommended way to set
163 -# install/lib/bin prefixes.
164 -# Use -DCMAKE_INSTALL_PREFIX=... CMake variable instead.
165 -
166 -# @ECLASS-VARIABLE: CMAKE_BINARY
167 -# @DESCRIPTION:
168 -# Eclass can use different cmake binary than the one provided in by system.
169 -: ${CMAKE_BINARY:=cmake}
170 -
171 -# Determine using IN or OUT source build
172 -_check_build_dir() {
173 - : ${CMAKE_USE_DIR:=${S}}
174 - if [[ -n ${CMAKE_IN_SOURCE_BUILD} ]]; then
175 - # we build in source dir
176 - CMAKE_BUILD_DIR="${CMAKE_USE_DIR}"
177 - else
178 - : ${CMAKE_BUILD_DIR:=${WORKDIR}/${P}_build}
179 - fi
180 - echo ">>> Working in BUILD_DIR: \"$CMAKE_BUILD_DIR\""
181 -}
182 -# @FUNCTION: cmake-utils_use_with
183 -# @USAGE: <USE flag> [flag name]
184 -# @DESCRIPTION:
185 -# Based on use_with. See ebuild(5).
186 -#
187 -# `cmake-utils_use_with foo FOO` echoes -DWITH_FOO=ON if foo is enabled
188 -# and -DWITH_FOO=OFF if it is disabled.
189 -cmake-utils_use_with() { _use_me_now WITH_ "$@" ; }
190 -
191 -# @FUNCTION: cmake-utils_use_enable
192 -# @USAGE: <USE flag> [flag name]
193 -# @DESCRIPTION:
194 -# Based on use_enable. See ebuild(5).
195 -#
196 -# `cmake-utils_use_enable foo FOO` echoes -DENABLE_FOO=ON if foo is enabled
197 -# and -DENABLE_FOO=OFF if it is disabled.
198 -cmake-utils_use_enable() { _use_me_now ENABLE_ "$@" ; }
199 -
200 -# @FUNCTION: cmake-utils_use_disable
201 -# @USAGE: <USE flag> [flag name]
202 -# @DESCRIPTION:
203 -# Based on inversion of use_enable. See ebuild(5).
204 -#
205 -# `cmake-utils_use_enable foo FOO` echoes -DDISABLE_FOO=OFF if foo is enabled
206 -# and -DDISABLE_FOO=ON if it is disabled.
207 -cmake-utils_use_disable() { _use_me_now_inverted DISABLE_ "$@" ; }
208 -
209 -# @FUNCTION: cmake-utils_use_no
210 -# @USAGE: <USE flag> [flag name]
211 -# @DESCRIPTION:
212 -# Based on use_disable. See ebuild(5).
213 -#
214 -# `cmake-utils_use_no foo FOO` echoes -DNO_FOO=OFF if foo is enabled
215 -# and -DNO_FOO=ON if it is disabled.
216 -cmake-utils_use_no() { _use_me_now_inverted NO_ "$@" ; }
217 -
218 -# @FUNCTION: cmake-utils_use_want
219 -# @USAGE: <USE flag> [flag name]
220 -# @DESCRIPTION:
221 -# Based on use_enable. See ebuild(5).
222 -#
223 -# `cmake-utils_use_want foo FOO` echoes -DWANT_FOO=ON if foo is enabled
224 -# and -DWANT_FOO=OFF if it is disabled.
225 -cmake-utils_use_want() { _use_me_now WANT_ "$@" ; }
226 -
227 -# @FUNCTION: cmake-utils_use_build
228 -# @USAGE: <USE flag> [flag name]
229 -# @DESCRIPTION:
230 -# Based on use_enable. See ebuild(5).
231 -#
232 -# `cmake-utils_use_build foo FOO` echoes -DBUILD_FOO=ON if foo is enabled
233 -# and -DBUILD_FOO=OFF if it is disabled.
234 -cmake-utils_use_build() { _use_me_now BUILD_ "$@" ; }
235 -
236 -# @FUNCTION: cmake-utils_use_has
237 -# @USAGE: <USE flag> [flag name]
238 -# @DESCRIPTION:
239 -# Based on use_enable. See ebuild(5).
240 -#
241 -# `cmake-utils_use_has foo FOO` echoes -DHAVE_FOO=ON if foo is enabled
242 -# and -DHAVE_FOO=OFF if it is disabled.
243 -cmake-utils_use_has() { _use_me_now HAVE_ "$@" ; }
244 -
245 -# @FUNCTION: cmake-utils_use_use
246 -# @USAGE: <USE flag> [flag name]
247 -# @DESCRIPTION:
248 -# Based on use_enable. See ebuild(5).
249 -#
250 -# `cmake-utils_use_use foo FOO` echoes -DUSE_FOO=ON if foo is enabled
251 -# and -DUSE_FOO=OFF if it is disabled.
252 -cmake-utils_use_use() { _use_me_now USE_ "$@" ; }
253 -
254 -# @FUNCTION: cmake-utils_use
255 -# @USAGE: <USE flag> [flag name]
256 -# @DESCRIPTION:
257 -# Based on use_enable. See ebuild(5).
258 -#
259 -# `cmake-utils_use foo FOO` echoes -DFOO=ON if foo is enabled
260 -# and -DFOO=OFF if it is disabled.
261 -cmake-utils_use() { _use_me_now "" "$@" ; }
262 -
263 -# Internal function for modifying hardcoded definitions.
264 -# Removes dangerous definitions that override Gentoo settings.
265 -_modify-cmakelists() {
266 - debug-print-function ${FUNCNAME} "$@"
267 -
268 - # Only edit the files once
269 - grep -qs "<<< Gentoo configuration >>>" CMakeLists.txt && return 0
270 -
271 - # Comment out all set (<some_should_be_user_defined_variable> value)
272 - # TODO Add QA checker - inform when variable being checked for below is set in CMakeLists.txt
273 - find "${CMAKE_USE_DIR}" -name CMakeLists.txt \
274 - -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_BUILD_TYPE.*)/{s/^/#IGNORE /g}' {} + \
275 - -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_COLOR_MAKEFILE.*)/{s/^/#IGNORE /g}' {} + \
276 - -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_INSTALL_PREFIX.*)/{s/^/#IGNORE /g}' {} + \
277 - -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_VERBOSE_MAKEFILE.*)/{s/^/#IGNORE /g}' {} + \
278 - || die "${LINENO}: failed to disable hardcoded settings"
279 -
280 - # NOTE Append some useful summary here
281 - cat >> "${CMAKE_USE_DIR}"/CMakeLists.txt <<- _EOF_
282 -
283 - MESSAGE(STATUS "<<< Gentoo configuration >>>
284 - Build type \${CMAKE_BUILD_TYPE}
285 - Install path \${CMAKE_INSTALL_PREFIX}
286 - Compiler flags:
287 - C \${CMAKE_C_FLAGS}
288 - C++ \${CMAKE_CXX_FLAGS}
289 - Linker flags:
290 - Executable \${CMAKE_EXE_LINKER_FLAGS}
291 - Module \${CMAKE_MODULE_LINKER_FLAGS}
292 - Shared \${CMAKE_SHARED_LINKER_FLAGS}\n")
293 - _EOF_
294 -}
295 -
296 -enable_cmake-utils_src_configure() {
297 - debug-print-function ${FUNCNAME} "$@"
298 -
299 - local name
300 - for name in ${CMAKE_REMOVE_MODULES} ; do
301 - find "${S}" -name ${name}.cmake -exec rm -v {} +
302 - done
303 -
304 - _check_build_dir
305 -
306 - # check if CMakeLists.txt exist and if no then die
307 - if [[ ! -e ${CMAKE_USE_DIR}/CMakeLists.txt ]] ; then
308 - eerror "Unable to locate CMakeLists.txt under:"
309 - eerror "\"${CMAKE_USE_DIR}/CMakeLists.txt\""
310 - eerror "Consider not inheriting the cmake eclass."
311 - die "FATAL: Unable to find CMakeLists.txt"
312 - fi
313 -
314 - # Remove dangerous things.
315 - _modify-cmakelists
316 -
317 - # Fix xdg collision with sandbox
318 - export XDG_CONFIG_HOME="${T}"
319 -
320 - # @SEE CMAKE_BUILD_TYPE
321 - if [[ ${CMAKE_BUILD_TYPE} = Gentoo ]]; then
322 - # Handle release builds
323 - if ! has debug ${IUSE//+} || ! use debug; then
324 - append-cppflags -DNDEBUG
325 - fi
326 - fi
327 -
328 - # Prepare Gentoo override rules (set valid compiler, append CPPFLAGS)
329 - local build_rules=${T}/gentoo_rules.cmake
330 - cat > "${build_rules}" <<- _EOF_
331 - SET (CMAKE_C_COMPILER $(type -P $(tc-getCC)) CACHE FILEPATH "C compiler" FORCE)
332 - SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE)
333 - SET (CMAKE_CXX_COMPILER $(type -P $(tc-getCXX)) CACHE FILEPATH "C++ compiler" FORCE)
334 - SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE)
335 - _EOF_
336 -
337 - if use prefix; then
338 - cat >> "${build_rules}" <<- _EOF_
339 - # in Prefix we need rpath and must ensure cmake gets our default linker path
340 - # right ... except for Darwin hosts
341 - IF (NOT APPLE)
342 - SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
343 - SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)"
344 - CACHE STRING "" FORCE)
345 -
346 - ELSE ()
347 -
348 - SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX:-/usr}" CACHE STRING ""FORCE)
349 - SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
350 - SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
351 - SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "" FORCE)
352 - SET(CMAKE_INSTALL_RPATH "${EPREFIX}${PREFIX:-/usr}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE)
353 - SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE)
354 - SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}${PREFIX:-/usr}/lib" CACHE STRING "" FORCE)
355 -
356 - ENDIF (NOT APPLE)
357 - _EOF_
358 - fi
359 -
360 - # Common configure parameters (invariants)
361 - local common_config=${T}/gentoo_common_config.cmake
362 - local libdir=$(get_libdir)
363 - cat > "${common_config}" <<- _EOF_
364 - SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" FORCE)
365 - SET (CMAKE_INSTALL_LIBDIR ${libdir} CACHE PATH "Output directory for libraries")
366 - _EOF_
367 - [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> "${common_config}"
368 -
369 - # Convert mycmakeargs to an array, for backwards compatibility
370 - # Make the array a local variable since <=portage-2.1.6.x does not
371 - # support global arrays (see bug #297255).
372 - if [[ $(declare -p mycmakeargs 2>&-) != "declare -a mycmakeargs="* ]]; then
373 - local mycmakeargs_local=(${mycmakeargs})
374 - else
375 - local mycmakeargs_local=("${mycmakeargs[@]}")
376 - fi
377 -
378 - has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
379 -
380 - # Common configure parameters (overridable)
381 - # NOTE CMAKE_BUILD_TYPE can be only overriden via CMAKE_BUILD_TYPE eclass variable
382 - # No -DCMAKE_BUILD_TYPE=xxx definitions will be in effect.
383 - local cmakeargs=(
384 - --no-warn-unused-cli
385 - -C "${common_config}"
386 - -DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX:-/usr}"
387 - "${mycmakeargs_local[@]}"
388 - -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
389 - -DCMAKE_INSTALL_DO_STRIP=OFF
390 - -DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}"
391 - "${MYCMAKEARGS}"
392 - )
393 -
394 - mkdir -p "${CMAKE_BUILD_DIR}"
395 - pushd "${CMAKE_BUILD_DIR}" > /dev/null
396 - debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: mycmakeargs is ${mycmakeargs_local[*]}"
397 - echo "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}"
398 - "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}" || die "cmake failed"
399 - popd > /dev/null
400 -}
401 -
402 -enable_cmake-utils_src_compile() {
403 - debug-print-function ${FUNCNAME} "$@"
404 -
405 - has src_configure ${CMAKE_EXPF} || cmake-utils_src_configure
406 - cmake-utils_src_make "$@"
407 -}
408 -
409 -# @FUNCTION: cmake-utils_src_make
410 -# @DESCRIPTION:
411 -# Function for building the package. Automatically detects the build type.
412 -# All arguments are passed to emake.
413 -cmake-utils_src_make() {
414 - debug-print-function ${FUNCNAME} "$@"
415 -
416 - _check_build_dir
417 - pushd "${CMAKE_BUILD_DIR}" > /dev/null
418 - # first check if Makefile exist otherwise die
419 - [[ -e Makefile ]] || die "Makefile not found. Error during configure stage."
420 - if [[ -n ${CMAKE_VERBOSE} ]]; then
421 - emake VERBOSE=1 "$@" || die "Make failed!"
422 - else
423 - emake "$@" || die "Make failed!"
424 - fi
425 - popd > /dev/null
426 -}
427 -
428 -enable_cmake-utils_src_install() {
429 - debug-print-function ${FUNCNAME} "$@"
430 -
431 - _check_build_dir
432 - pushd "${CMAKE_BUILD_DIR}" > /dev/null
433 - base_src_install "$@"
434 - popd > /dev/null
435 -
436 - # Backward compatibility, for non-array variables
437 - if [[ -n "${DOCS}" ]] && [[ "$(declare -p DOCS 2>/dev/null 2>&1)" != "declare -a"* ]]; then
438 - dodoc ${DOCS} || die "dodoc failed"
439 - fi
440 - if [[ -n "${HTML_DOCS}" ]] && [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" != "declare -a"* ]]; then
441 - dohtml -r ${HTML_DOCS} || die "dohtml failed"
442 - fi
443 -}
444 -
445 -enable_cmake-utils_src_test() {
446 - debug-print-function ${FUNCNAME} "$@"
447 - local ctestargs
448 -
449 - _check_build_dir
450 - pushd "${CMAKE_BUILD_DIR}" > /dev/null
451 - [[ -e CTestTestfile.cmake ]] || { echo "No tests found. Skipping."; return 0 ; }
452 -
453 - [[ -n ${TEST_VERBOSE} ]] && ctestargs="--extra-verbose --output-on-failure"
454 - ctest ${ctestargs} "$@" || die "Tests failed."
455 - popd > /dev/null
456 -}
457 -
458 -# @FUNCTION: cmake-utils_src_configure
459 -# @DESCRIPTION:
460 -# General function for configuring with cmake. Default behaviour is to start an
461 -# out-of-source build.
462 -cmake-utils_src_configure() {
463 - _execute_optionaly "src_configure" "$@"
464 -}
465 -
466 -# @FUNCTION: cmake-utils_src_compile
467 -# @DESCRIPTION:
468 -# General function for compiling with cmake. Default behaviour is to check for
469 -# EAPI and respectively to configure as well or just compile.
470 -# Automatically detects the build type. All arguments are passed to emake.
471 -cmake-utils_src_compile() {
472 - _execute_optionaly "src_compile" "$@"
473 -}
474 -
475 -# @FUNCTION: cmake-utils_src_install
476 -# @DESCRIPTION:
477 -# Function for installing the package. Automatically detects the build type.
478 -cmake-utils_src_install() {
479 - _execute_optionaly "src_install" "$@"
480 -}
481 -
482 -# @FUNCTION: cmake-utils_src_test
483 -# @DESCRIPTION:
484 -# Function for testing the package. Automatically detects the build type.
485 -cmake-utils_src_test() {
486 - _execute_optionaly "src_test" "$@"
487 -}
488 -
489 -# Optionally executes phases based on WANT_CMAKE variable/USE flag.
490 -_execute_optionaly() {
491 - local phase="$1" ; shift
492 - if [[ ${WANT_CMAKE} = always ]]; then
493 - enable_cmake-utils_${phase} "$@"
494 - else
495 - use ${WANT_CMAKE} && enable_cmake-utils_${phase} "$@"
496 - fi
497 -}