Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] New eclass: cmake-utils.eclass
Date: Sun, 09 Sep 2007 20:53:55
Message-Id: 200709091644.36550.vapier@gentoo.org
In Reply to: [gentoo-dev] New eclass: cmake-utils.eclass by "Wulf C. Krueger"
1 On Sunday 09 September 2007, Wulf C. Krueger wrote:
2 > KDE4's build system is based on CMake and seeing that more and more KDE
3 > and non-KDE applications are using it, we have created a new
4 > cmake-utils.eclass [3] which allows for easier implementation of ebuilds
5 > for those applications.
6
7 * you've got pointless quoting in [[ ... ]]
8 * use portage e* funcs instead of your own "echo !!!"
9 * have incorrectly used functions die instead of echo
10 * i think the maintainer comment warning is a left over copy & paste
11 * you inherit eutils but i dont think you use it
12 * dont document internal functions and use a _ prefix (common_configure_code)
13 * dont pollute env (mycmakeargs) ... might be better if your
14 common_configure_code echoed the output and then do:
15 common_configure_code() {
16 if has debug ${IUSE} && use debug; then
17 echo -DCMAKE_BUILD_TYPE=debug
18 fi
19 echo -DCMAKE_C_COMPILER=$(type -P $(tc-getCC))
20 echo -DCMAKE_CXX_COMPILER=$(type -P $(tc-getCXX))
21 echo -DCMAKE_INSTALL_PREFIX=${PREFIX:-/usr}
22 echo -DLIB_SUFFIX=$(get_libdir| sed 's/lib//')
23 }
24 local mycmakeargs=$(common_configure_code)
25
26 * those use_with/use_enable could be shrunk ...
27 _use_me_now() {
28 debug-print-function $FUNCNAME $*
29 [[ -z $2 ]] && die "cmake-utils_use_with <USE flag> [<flag name>]"
30 echo "-D$1_${3:-$2}=$(use $2 && echo ON || echo OFF)"
31 }
32 cmake-utils_use_with() { _use_me_now WITH "$@" ; }
33 cmake-utils_use_enable() { _use_me_now ENABLE "$@" ; }
34 -mike

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] New eclass: cmake-utils.eclass "Wulf C. Krueger" <philantrop@g.o>