Gentoo Archives: gentoo-commits

From: "Wulf Krueger (philantrop)" <philantrop@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: cmake-utils.eclass
Date: Thu, 06 Dec 2007 20:40:25
Message-Id: E1J0NW9-0006IU-73@stork.gentoo.org
1 philantrop 07/12/06 20:40:21
2
3 Modified: cmake-utils.eclass
4 Log:
5 Minor enhancements.
6
7 Revision Changes Path
8 1.3 eclass/cmake-utils.eclass
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/cmake-utils.eclass?rev=1.3&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/cmake-utils.eclass?rev=1.3&content-type=text/plain
12 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/cmake-utils.eclass?r1=1.2&r2=1.3
13
14 Index: cmake-utils.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v
17 retrieving revision 1.2
18 retrieving revision 1.3
19 diff -u -r1.2 -r1.3
20 --- cmake-utils.eclass 11 Nov 2007 20:02:11 -0000 1.2
21 +++ cmake-utils.eclass 6 Dec 2007 20:40:20 -0000 1.3
22 @@ -1,6 +1,6 @@
23 # Copyright 1999-2007 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.2 2007/11/11 20:02:11 philantrop Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.3 2007/12/06 20:40:20 philantrop Exp $
27
28 # @ECLASS: cmake-utils.eclass
29 # @MAINTAINER:
30 @@ -33,25 +33,43 @@
31 # @FUNCTION: cmake-utils_use_with
32 # @USAGE: <USE flag> [flag name]
33 # @DESCRIPTION:
34 -# Based on use_with. See ebuild.sh
35 +# Based on use_with. See ebuild(5).
36 +#
37 +# `cmake-utils_use_with foo FOO` echoes -DWITH_FOO=ON if foo is enabled
38 +# and -DWITH_FOO=OFF if it is disabled.
39 cmake-utils_use_with() { _use_me_now WITH "$@" ; }
40
41 # @FUNCTION: cmake-utils_use_enable
42 # @USAGE: <USE flag> [flag name]
43 # @DESCRIPTION:
44 -# Based on use_enable. See ebuild.sh
45 +# Based on use_enable. See ebuild(5).
46 +#
47 +# `cmake-utils_use_enable foo FOO` echoes -DENABLE_FOO=ON if foo is enabled
48 +# and -DENABLE_FOO=OFF if it is disabled.
49 cmake-utils_use_enable() { _use_me_now ENABLE "$@" ; }
50
51 # @FUNCTION: cmake-utils_use_want
52 # @USAGE: <USE flag> [flag name]
53 # @DESCRIPTION:
54 -# Based on use_enable. See ebuild.sh
55 +# Based on use_enable. See ebuild(5).
56 +#
57 +# `cmake-utils_use_want foo FOO` echoes -DWANT_FOO=ON if foo is enabled
58 +# and -DWANT_FOO=OFF if it is disabled.
59 cmake-utils_use_want() { _use_me_now WANT "$@" ; }
60
61 +# @FUNCTION: cmake-utils_has
62 +# @USAGE: <USE flag> [flag name]
63 +# @DESCRIPTION:
64 +# Based on use_enable. See ebuild(5).
65 +#
66 +# `cmake-utils_has foo FOO` echoes -DHAVE_FOO=ON if foo is enabled
67 +# and -DHAVE_FOO=OFF if it is disabled.
68 +cmake-utils_has() { _use_me_now HAVE "$@" ; }
69 +
70 # @FUNCTION: cmake-utils_src_compile
71 # @DESCRIPTION:
72 # General function for compiling with cmake. Default behaviour is to start an
73 -# out-of-source build
74 +# out-of-source build. All arguments are passed to cmake-utils_src_make.
75 cmake-utils_src_compile() {
76 debug-print-function $FUNCNAME $*
77
78 @@ -60,7 +78,7 @@
79 else
80 cmake-utils_src_configureout
81 fi
82 - cmake-utils_src_make
83 + cmake-utils_src_make "$@"
84 }
85
86 # @FUNCTION: cmake-utils_src_configurein
87 @@ -70,7 +88,7 @@
88 cmake-utils_src_configurein() {
89 debug-print-function $FUNCNAME $*
90
91 - local cmakeargs="${mycmakeargs} $(_common_configure_code)"
92 + local cmakeargs="$(_common_configure_code) ${mycmakeargs}"
93
94 debug-print "$LINENO $ECLASS $FUNCNAME: mycmakeargs is $cmakeargs"
95 cmake ${cmakeargs} . || die "Cmake failed"
96 @@ -83,7 +101,7 @@
97 cmake-utils_src_configureout() {
98 debug-print-function $FUNCNAME $*
99
100 - local cmakeargs="${mycmakeargs} $(_common_configure_code)"
101 + local cmakeargs="$(_common_configure_code) ${mycmakeargs}"
102 mkdir -p "${WORKDIR}"/${PN}_build
103 pushd "${WORKDIR}"/${PN}_build > /dev/null
104
105 @@ -96,8 +114,10 @@
106 # Internal use only. Common configuration options for all types of builds.
107 _common_configure_code() {
108 local tmp_libdir=$(get_libdir)
109 - if has debug ${IUSE} && use debug; then
110 - echo -DCMAKE_BUILD_TYPE=debug
111 + if has debug ${IUSE//+} && use debug; then
112 + echo -DCMAKE_BUILD_TYPE=Debug
113 + else
114 + echo -DCMAKE_BUILD_TYPE=Release
115 fi
116 echo -DCMAKE_C_COMPILER=$(type -P $(tc-getCC))
117 echo -DCMAKE_CXX_COMPILER=$(type -P $(tc-getCXX))
118 @@ -110,6 +130,8 @@
119 # @FUNCTION: cmake-utils_src_make
120 # @DESCRIPTION:
121 # Function for building the package. Automatically detects the build type.
122 +# All arguments are passed to emake:
123 +# "cmake-utils_src_make -j1" can be used to work around parallel make issues.
124 cmake-utils_src_make() {
125 debug-print-function $FUNCNAME $*
126
127 @@ -119,9 +141,9 @@
128 pushd "${WORKDIR}"/${PN}_build > /dev/null
129 fi
130 if ! [[ -z ${CMAKE_COMPILER_VERBOSE} ]]; then
131 - emake VERBOSE=1 || die "Make failed!"
132 + emake VERBOSE=1 "$@" || die "Make failed!"
133 else
134 - emake || die "Make failed!"
135 + emake "$@" || die "Make failed!"
136 fi
137 if [[ -d ${WORKDIR}/${PN}_build ]]; then
138 popd > /dev/null
139
140
141
142 --
143 gentoo-commits@g.o mailing list