From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1IofMD-0005OF-WC for garchives@archives.gentoo.org; Sun, 04 Nov 2007 13:17:42 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.14.1/8.14.0) with SMTP id lA4DHcC3023405; Sun, 4 Nov 2007 13:17:38 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by robin.gentoo.org (8.14.1/8.14.0) with ESMTP id lA4DHbGU023374 for ; Sun, 4 Nov 2007 13:17:38 GMT Received: from stork.gentoo.org (stork.gentoo.org [64.127.104.133]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id A020A64E64 for ; Sun, 4 Nov 2007 13:17:37 +0000 (UTC) Received: from philantrop by stork.gentoo.org with local (Exim 4.60) (envelope-from ) id 1IofM8-0000g9-Gk for gentoo-commits@lists.gentoo.org; Sun, 04 Nov 2007 13:17:36 +0000 From: "Wulf Krueger (philantrop)" To: gentoo-commits@lists.gentoo.org Reply-To: gentoo-dev@lists.gentoo.org, philantrop@gentoo.org Subject: [gentoo-commits] gentoo-x86 commit in eclass: cmake-utils.eclass X-VCS-Repository: gentoo-x86 X-VCS-Files: cmake-utils.eclass X-VCS-Directories: eclass X-VCS-Committer: philantrop X-VCS-Committer-Name: Wulf Krueger Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Message-Id: Sender: Wulf Krueger Date: Sun, 04 Nov 2007 13:17:36 +0000 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@gentoo.org X-Archives-Salt: fd155ff8-729f-4fef-ab09-989175e30014 X-Archives-Hash: 45a60d8a31253d3f9b6f4871d4f3a97a philantrop 07/11/04 13:17:36 Added: cmake-utils.eclass Log: New cmake-utils.eclass providing functions for the cmake build system with all requested fixes after the review on gentoo-dev. Revision Changes Path 1.1 eclass/cmake-utils.eclass file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/cmake-utils.eclass?rev=1.1&view=markup plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/cmake-utils.eclass?rev=1.1&content-type=text/plain Index: cmake-utils.eclass =================================================================== # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.1 2007/11/04 13:17:35 philantrop Exp $ # @ECLASS: cmake-utils.eclass # @MAINTAINER: # kde@gentoo.org # @BLURB: common ebuild functions for cmake-based packages # @DESCRIPTION: # The cmake-utils eclass contains functions that make creating ebuilds for # cmake-based packages much easier. # Its main features are support of out-of-source builds as well as in-source # builds and an implementation of the well-known use_enable and use_with # functions for CMake. # Original author: Zephyrus (zephyrus@mirach.it) inherit toolchain-funcs multilib DESCRIPTION="Based on the ${ECLASS} eclass" DEPEND="dev-util/cmake" EXPORT_FUNCTIONS src_compile src_test src_install # Internal function use by cmake-utils_use_with and cmake-utils_use_enable _use_me_now() { debug-print-function $FUNCNAME $* [[ -z $2 ]] && die "cmake-utils_use-$1 []" echo "-D$1_${3:-$2}=$(use $2 && echo ON || echo OFF)" } # @FUNCTION: cmake-utils_use_with # @USAGE: [flag name] # @DESCRIPTION: # Based on use_with. See ebuild.sh cmake-utils_use_with() { _use_me_now WITH "$@" ; } # @FUNCTION: cmake-utils_use_enable # @USAGE: [flag name] # @DESCRIPTION: # Based on use_enable. See ebuild.sh cmake-utils_use_enable() { _use_me_now ENABLE "$@" ; } # @FUNCTION: cmake-utils_src_compile # @DESCRIPTION: # General function for compiling with cmake. Default behaviour is to start an # out-of-source build cmake-utils_src_compile() { debug-print-function $FUNCNAME $* cmake-utils_src_configureout cmake-utils_src_make } # @FUNCTION: cmake-utils_src_configurein # @DESCRIPTION: # Function for software that requires configure and building in the source # directory. cmake-utils_src_configurein() { debug-print-function $FUNCNAME $* local cmakeargs="${mycmakeargs} $(_common_configure_code)" debug-print "$LINENO $ECLASS $FUNCNAME: mycmakeargs is $cmakeargs" cmake ${cmakeargs} . || die "Cmake failed" } # @FUNCTION: cmake-utils_src_configureout # @DESCRIPTION: # Function for software that requires configure and building outside the source # tree - default. cmake-utils_src_configureout() { debug-print-function $FUNCNAME $* local cmakeargs="${mycmakeargs} $(_common_configure_code)" mkdir "${WORKDIR}"/${PN}_build cd "${WORKDIR}"/${PN}_build debug-print "$LINENO $ECLASS $FUNCNAME: mycmakeargs is $cmakeargs" cmake ${cmakeargs} "${S}" || die "Cmake failed" } # Internal use only. Common configuration options for all types of builds. _common_configure_code() { local tmp_libdir=$(get_libdir) if has debug ${IUSE} && use debug; then echo -DCMAKE_BUILD_TYPE=debug fi echo -DCMAKE_C_COMPILER=$(type -P $(tc-getCC)) echo -DCMAKE_CXX_COMPILER=$(type -P $(tc-getCXX)) echo -DCMAKE_INSTALL_PREFIX=${PREFIX:-/usr} echo -DLIB_SUFFIX=${tmp_libdir/lib} [[ -n ${CMAKE_NO_COLOR} ]] && echo -DCMAKE_COLOR_MAKEFILE=OFF } # @FUNCTION: cmake-utils_src_make # @DESCRIPTION: # Function for building the package. Automatically detects the build type. cmake-utils_src_make() { debug-print-function $FUNCNAME $* # At this point we can automatically check if it's an out-of-source or an # in-source build if [[ -d ${WORKDIR}/${PN}_build ]]; then cd "${WORKDIR}"/${PN}_build; fi if ! [[ -z ${CMAKE_COMPILER_VERBOSE} ]]; then emake VERBOSE=1 || die "Make failed!"; else emake || die "Make failed!"; fi } # @FUNCTION: cmake-utils_src_install # @DESCRIPTION: # Function for installing the package. Automatically detects the build type. cmake-utils_src_install() { debug-print-function $FUNCNAME $* # At this point we can automatically check if it's an out-of-source or an # in-source build if [[ -d ${WORKDIR}/${PN}_build ]]; then cd "${WORKDIR}"/${PN}_build; fi emake install DESTDIR="${D}" || die "Make install failed" } # @FUNCTION: cmake-utils_src_test # @DESCRIPTION: # Function for testing the package. Automatically detects the build type. cmake-utils_src_test() { debug-print-function $FUNCNAME $* # At this point we can automatically check if it's an out-of-source or an # in-source build if [[ -d ${WORKDIR}/${PN}_build ]]; then cd "${WORKDIR}"/${PN}_build fi # Standard implementation of src_test if emake -j1 check -n &> /dev/null; then einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" if ! emake -j1 check; then die "Make check failed. See above for details." fi elif emake -j1 test -n &> /dev/null; then einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" if ! emake -j1 test; then die "Make test failed. See above for details." fi else einfo ">>> Test phase [none]: ${CATEGORY}/${PF}" fi } -- gentoo-commits@gentoo.org mailing list