/[gentoo-x86]/eclass/cmake-utils.eclass
Gentoo

Diff of /eclass/cmake-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.96 Revision 1.97
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2013 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.96 2013/06/14 21:13:43 creffett Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.97 2013/07/01 23:30:26 creffett Exp $
4 4
5# @ECLASS: cmake-utils.eclass 5# @ECLASS: cmake-utils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# kde@gentoo.org 7# kde@gentoo.org
8# @AUTHOR: 8# @AUTHOR:
10# Maciej Mrozowski <reavertm@gentoo.org> 10# Maciej Mrozowski <reavertm@gentoo.org>
11# (undisclosed contributors) 11# (undisclosed contributors)
12# Original author: Zephyrus (zephyrus@mirach.it) 12# Original author: Zephyrus (zephyrus@mirach.it)
13# @BLURB: common ebuild functions for cmake-based packages 13# @BLURB: common ebuild functions for cmake-based packages
14# @DESCRIPTION: 14# @DESCRIPTION:
15# The cmake-utils eclass is base.eclass(5) wrapper that makes creating ebuilds for 15# The cmake-utils eclass makes creating ebuilds for cmake-based packages much easier.
16# cmake-based packages much easier.
17# It provides all inherited features (DOCS, HTML_DOCS, PATCHES) along with out-of-source 16# It provides all inherited features (DOCS, HTML_DOCS, PATCHES) along with out-of-source
18# builds (default), in-source builds and an implementation of the well-known use_enable 17# builds (default), in-source builds and an implementation of the well-known use_enable
19# and use_with functions for CMake. 18# and use_with functions for CMake.
20 19
21if [[ ${___ECLASS_ONCE_CMAKE_UTILS} != "recur -_+^+_- spank" ]] ; then 20if [[ ${___ECLASS_ONCE_CMAKE_UTILS} != "recur -_+^+_- spank" ]] ; then
58 *) 57 *)
59 IUSE+=" ${WANT_CMAKE}" 58 IUSE+=" ${WANT_CMAKE}"
60 CMAKEDEPEND+="${WANT_CMAKE}? ( " 59 CMAKEDEPEND+="${WANT_CMAKE}? ( "
61 ;; 60 ;;
62esac 61esac
63inherit toolchain-funcs multilib flag-o-matic base 62inherit toolchain-funcs multilib flag-o-matic eutils
64 63
65CMAKE_EXPF="src_compile src_test src_install" 64CMAKE_EXPF="src_compile src_test src_install"
66case ${EAPI:-0} in 65case ${EAPI:-0} in
67 2|3|4|5) CMAKE_EXPF+=" src_prepare src_configure" ;; 66 2|3|4|5) CMAKE_EXPF+=" src_prepare src_configure" ;;
68 1|0) eqawarn "${CATEGORY}/${PF}: EAPI 0 and 1 support is now deprecated." 67 1|0) eerror "cmake-utils no longer supports EAPI 0-1." && die
69 eqawarn "If you are the package maintainer, please" 68 ;;
70 eqawarn "update this package to a newer EAPI."
71 eqawarn "Support for EAPI 0-1 for 'cmake-utils.eclass'"
72 eqawarn "will be dropped at the beginning of July."
73 ;;
74
75 *) die "Unknown EAPI, Bug eclass maintainers." ;; 69 *) die "Unknown EAPI, bug eclass maintainers." ;;
76esac 70esac
77EXPORT_FUNCTIONS ${CMAKE_EXPF} 71EXPORT_FUNCTIONS ${CMAKE_EXPF}
78 72
79case ${CMAKE_MAKEFILE_GENERATOR} in 73case ${CMAKE_MAKEFILE_GENERATOR} in
80 emake) 74 emake)
256# @FUNCTION: cmake-utils_use_find_package 250# @FUNCTION: cmake-utils_use_find_package
257# @USAGE: <USE flag> [flag name] 251# @USAGE: <USE flag> [flag name]
258# @DESCRIPTION: 252# @DESCRIPTION:
259# Based on use_enable. See ebuild(5). 253# Based on use_enable. See ebuild(5).
260# 254#
261# `cmake-utils_use_find_package foo FOO` echoes -DCMAKE_DISABLE_FIND_PACKAGE=OFF 255# `cmake-utils_use_find_package foo LibFoo` echoes -DCMAKE_DISABLE_FIND_PACKAGE_LibFoo=OFF
262# if foo is enabled and -DCMAKE_DISABLE_FIND_PACKAGE=ON if it is disabled. 256# if foo is enabled and -DCMAKE_DISABLE_FIND_PACKAGE_LibFoo=ON if it is disabled.
263# This can be used to make find_package optional (since cmake-2.8.6). 257# This can be used to make find_package optional (since cmake-2.8.6).
264cmake-utils_use_find_package() { _use_me_now_inverted CMAKE_DISABLE_FIND_PACKAGE_ "$@" ; } 258cmake-utils_use_find_package() { _use_me_now_inverted CMAKE_DISABLE_FIND_PACKAGE_ "$@" ; }
265 259
266# @FUNCTION: cmake-utils_use_disable 260# @FUNCTION: cmake-utils_use_disable
267# @USAGE: <USE flag> [flag name] 261# @USAGE: <USE flag> [flag name]
360} 354}
361 355
362enable_cmake-utils_src_prepare() { 356enable_cmake-utils_src_prepare() {
363 debug-print-function ${FUNCNAME} "$@" 357 debug-print-function ${FUNCNAME} "$@"
364 358
365 base_src_prepare 359 debug-print "$FUNCNAME: PATCHES=$PATCHES"
360
361 pushd "${S}" > /dev/null
362 [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
363
364 debug-print "$FUNCNAME: applying user patches"
365 epatch_user
366
367 popd > /dev/null
368
366} 369}
367 370
368# @VARIABLE: mycmakeargs 371# @VARIABLE: mycmakeargs
369# @DEFAULT_UNSET 372# @DEFAULT_UNSET
370# @DESCRIPTION: 373# @DESCRIPTION:
550enable_cmake-utils_src_install() { 553enable_cmake-utils_src_install() {
551 debug-print-function ${FUNCNAME} "$@" 554 debug-print-function ${FUNCNAME} "$@"
552 555
553 _check_build_dir 556 _check_build_dir
554 pushd "${BUILD_DIR}" > /dev/null 557 pushd "${BUILD_DIR}" > /dev/null
555
556 DESTDIR="${D}" ${CMAKE_MAKEFILE_GENERATOR} install "$@" || die "died running ${CMAKE_MAKEFILE_GENERATOR} install" 558 DESTDIR="${D}" ${CMAKE_MAKEFILE_GENERATOR} install "$@" || die "died running ${CMAKE_MAKEFILE_GENERATOR} install"
557 base_src_install_docs
558
559 popd > /dev/null 559 popd > /dev/null
560
561 pushd "${S}" > /dev/null
562 #Install docs, copied from base_src_install_docs
563 local x
564
565 if [[ "$(declare -p DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then
566 for x in "${DOCS[@]}"; do
567 debug-print "$FUNCNAME: docs: creating document from ${x}"
568 dodoc "${x}" || die "dodoc failed"
569 done
570 fi
571 if [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then
572 for x in "${HTML_DOCS[@]}"; do
573 debug-print "$FUNCNAME: docs: creating html document from ${x}"
574 dohtml -r "${x}" || die "dohtml failed"
575 done
576 fi
560 577
561 # Backward compatibility, for non-array variables 578 # Backward compatibility, for non-array variables
562 if [[ -n "${DOCS}" ]] && [[ "$(declare -p DOCS 2>/dev/null 2>&1)" != "declare -a"* ]]; then 579 if [[ -n "${DOCS}" ]] && [[ "$(declare -p DOCS 2>/dev/null 2>&1)" != "declare -a"* ]]; then
563 dodoc ${DOCS} || die "dodoc failed" 580 dodoc ${DOCS} || die "dodoc failed"
564 fi 581 fi
565 if [[ -n "${HTML_DOCS}" ]] && [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" != "declare -a"* ]]; then 582 if [[ -n "${HTML_DOCS}" ]] && [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" != "declare -a"* ]]; then
566 dohtml -r ${HTML_DOCS} || die "dohtml failed" 583 dohtml -r ${HTML_DOCS} || die "dohtml failed"
567 fi 584 fi
585
586 popd > /dev/null
568} 587}
569 588
570enable_cmake-utils_src_test() { 589enable_cmake-utils_src_test() {
571 debug-print-function ${FUNCNAME} "$@" 590 debug-print-function ${FUNCNAME} "$@"
572 591

Legend:
Removed from v.1.96  
changed lines
  Added in v.1.97

  ViewVC Help
Powered by ViewVC 1.1.20