public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] RFC: cmake.eclass
@ 2007-11-04 11:51 Krzysiek Pawlik
  2007-11-04 12:12 ` Donnie Berkholz
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Krzysiek Pawlik @ 2007-11-04 11:51 UTC (permalink / raw
  To: Gentoo Dev


[-- Attachment #1.1: Type: text/plain, Size: 2488 bytes --]


A little introduction: cmake is an alternative for autotools, more and more
packages are using it (and some new big ones are on the way, KDE4 for example).

I've wrote an eclass that makes writing ebuilds for such packages a little
easier - it provides an ecmake function that takes care of few needed variables,
prefix and such.

I'm open for discussion about it, the eclass currently is only in my overlay at
o.g.o. For example I've changed sys-power/ncpufreqd to use the cmake.eclass,
complete ebuild can be viewed at
http://overlays.gentoo.org/dev/nelchael/browser/sys-power/ncpufreqd/ncpufreqd-2.4.ebuild
(compare it to the in-tree version:
http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-power/ncpufreqd/ncpufreqd-2.4.ebuild?rev=1.1&view=markup
)

Following ebuilds (52 to be exact) have dev-util/cmake in {R,}DEPEND (so could
use the new eclass):

app-cdr/cdrkit-1.1.2
app-cdr/cdrkit-1.1.4
app-cdr/cdrkit-1.1.5.1
app-cdr/cdrkit-1.1.6
app-mobilephone/gammu-1.12.0
app-mobilephone/gammu-1.13.0
dev-cpp/eigen-1.0.5
dev-cpp/gccxml-0.6.0-r1
dev-cpp/gccxml-0.7.0_pre20060311
dev-db/mysql-community-5.1.14_beta-r1
dev-db/mysql-community-5.1.15_beta
dev-db/mysql-community-5.1.21_beta
dev-games/physfs-1.1.1
dev-php5/php-qt-0.1
dev-ruby/qt4-qtruby-1.4.8
dev-ruby/qt4-qtruby-1.4.9
dev-ruby/qt4-qtruby-1.4.9-r1
dev-util/dwarves-1.0_p1
dev-util/kdesvn-0.11.2
dev-util/kdesvn-0.12.1
dev-util/kdesvn-0.13.0
dev-util/kdesvn-0.14.0
games-fps/doomsday-1.9.0_beta5
games-puzzle/ksudoku-0.4
games-strategy/boson-0.13
games-strategy/hedgewars-0.9.0
games-strategy/hedgewars-0.9.0-r1
kde-misc/kbfx-0.4.9.3.1-r1
kde-misc/kgtk-0.9.1-r1
media-libs/libprojectm-1.01
media-libs/libprojectm-1.01-r1
media-plugins/libvisual-projectm-1.0
media-sound/mppenc-1.16
media-sound/musescore-0.6.1
media-sound/musescore-0.7.0.1
media-sound/rosegarden-1.5.1
net-p2p/museek+-0.1.13-r1
sci-astronomy/stellarium-0.9.0
sci-chemistry/avogadro-0.1.0
sci-chemistry/avogadro-0.2.0
sci-geosciences/marble-0.3
sci-geosciences/marble-0.4
sci-libs/vtk-5.0.3
sci-visualization/paraview-2.6.2
sys-apps/initng-0.6.10.1
sys-apps/initng-9999
sys-apps/initng-ifiles-0.1.4
sys-power/ncpufreqd-2.4
x11-themes/gtk-engines-qt-0.7_p20070327-r2
x11-themes/gtk-engines-qt-0.8
x11-themes/gtk-engines-qtcurve-0.55.0
x11-themes/qtcurve-0.55.0

-- 
Krzysiek Pawlik   <nelchael at gentoo.org>   key id: 0xBC555551
desktop-misc, desktop-dock, x86, java, apache, ppc...

[-- Attachment #1.2: cmake.eclass --]
[-- Type: text/plain, Size: 2071 bytes --]

# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

#
# Original Author: nelchael
# Purpose: Automate src_install and src_compile for packages using cmake
#

inherit toolchain-funcs multilib

EXPORT_FUNCTIONS src_compile src_install

DEPEND="${DEPEND}
	>=dev-util/cmake-2.4.6-r1"

CMAKE_BUILD_DIR="${WORKDIR}/cmake-build"

# If you want to build in source tree set CMAKE_IN_SOURCE_BUILD to anything:
[[ -n "${CMAKE_IN_SOURCE_BUILD}" ]] && CMAKE_BUILD_DIR="${S}"

#
# Prepare CMAKE_BUILD_DIR:
#	- create the directory if it's missing
#
function prepare_build_dir() {

	if [[ ! -d "${CMAKE_BUILD_DIR}" ]]; then
		mkdir -p "${CMAKE_BUILD_DIR}" \
			|| die "mkdir \"${CMAKE_BUILD_DIR}\" failed"
	fi

}

#
# Run cmake with some needed defines.
# If you want to add something use CMAKE_FLAGS.
# If you want verbose makefile set CMAKE_VERBOSE to anything.
#
function ecmake() {

	prepare_build_dir

	pushd "${CMAKE_BUILD_DIR}" > /dev/null

	[[ -n "${CMAKE_VERBOSE}" ]] && \
		CMAKE_FLAGS="-DCMAKE_VERBOSE_MAKEFILE=1 ${CMAKE_FLAGS}"

	echo "cmake -DCMAKE_CXX_COMPILER=\"$(type -P $(tc-getCXX))\" -DCMAKE_CXX_FLAGS=\"${CXXFLAGS}\" -DCMAKE_C_COMPILER=\"$(type -P $(tc-getCC))\" -DCMAKE_C_FLAGS=\"${CFLAGS}\" -DCMAKE_INSTALL_PREFIX=\"/usr\" -DLIB_INSTALL_DIR=\"/usr/$(get_libdir)\" \"${S}\" ${CMAKE_FLAGS}"

	/usr/bin/cmake \
		-DCMAKE_CXX_COMPILER="$(type -P $(tc-getCXX))" \
		-DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
		-DCMAKE_C_COMPILER="$(type -P $(tc-getCC))" \
		-DCMAKE_C_FLAGS="${CFLAGS}" \
		-DCMAKE_INSTALL_PREFIX="/usr" \
		-DLIB_INSTALL_DIR="/usr/$(get_libdir)" \
		${CMAKE_FLAGS} \
		"${S}" || die "cmake failed"

	popd > /dev/null

}

#
# Run `ecmake' and default make target.
#
cmake_src_compile() {

	ecmake

	pushd "${CMAKE_BUILD_DIR}" > /dev/null
	emake ${@} || die "emake failed"
	popd > /dev/null

}

#
# Change to build directory and run `make install'.
#
cmake_src_install() {

	pushd "${CMAKE_BUILD_DIR}" > /dev/null
	make DESTDIR="${D}" install || die "make install failed"
	popd > /dev/null

}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-dev] RFC: cmake.eclass
  2007-11-04 11:51 [gentoo-dev] RFC: cmake.eclass Krzysiek Pawlik
@ 2007-11-04 12:12 ` Donnie Berkholz
  2007-11-04 12:34   ` Krzysiek Pawlik
       [not found] ` <200711041420.38049.philantrop@gentoo.org>
  2007-11-04 14:01 ` Marijn Schouten (hkBst)
  2 siblings, 1 reply; 8+ messages in thread
From: Donnie Berkholz @ 2007-11-04 12:12 UTC (permalink / raw
  To: gentoo-dev

On 12:51 Sun 04 Nov     , Krzysiek Pawlik wrote:
> A little introduction: cmake is an alternative for autotools, more and more
> packages are using it (and some new big ones are on the way, KDE4 for example).
> 
> I've wrote an eclass that makes writing ebuilds for such packages a little
> easier - it provides an ecmake function that takes care of few needed variables,
> prefix and such.

Great! When's the scons one coming? =)

> # Copyright 1999-2007 Gentoo Foundation
> # Distributed under the terms of the GNU General Public License v2
> # $Header: $
> 
> #
> # Original Author: nelchael
> # Purpose: Automate src_install and src_compile for packages using cmake
> #

This would be a great opportunity to start using real eclass 
documentation (e.g. that found in eutils.eclass) so we can autogenerate 
a useful manpage on how to use it.

> # If you want to build in source tree set CMAKE_IN_SOURCE_BUILD to anything:
> [[ -n "${CMAKE_IN_SOURCE_BUILD}" ]] && CMAKE_BUILD_DIR="${S}"

Why would I want to do that? Some documentation would help.

> function ecmake() {

Why are some functions declared with 'function' and others not?

> 		-DCMAKE_CXX_COMPILER="$(type -P $(tc-getCXX))" \

Why the 'type -P' bit?

> 	make DESTDIR="${D}" install || die "make install failed"

Does emake work?

Thanks,
Donnie
-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-dev] RFC: cmake.eclass
  2007-11-04 12:12 ` Donnie Berkholz
@ 2007-11-04 12:34   ` Krzysiek Pawlik
  0 siblings, 0 replies; 8+ messages in thread
From: Krzysiek Pawlik @ 2007-11-04 12:34 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 1444 bytes --]

Donnie Berkholz wrote:
>> I've wrote an eclass that makes writing ebuilds for such packages a little
>> easier - it provides an ecmake function that takes care of few needed variables,
>> prefix and such.
> 
> Great! When's the scons one coming? =)

I don't know scons ;)

>> #
>> # Original Author: nelchael
>> # Purpose: Automate src_install and src_compile for packages using cmake
>> #
> 
> This would be a great opportunity to start using real eclass 
> documentation (e.g. that found in eutils.eclass) so we can autogenerate 
> a useful manpage on how to use it.

Done.

>> # If you want to build in source tree set CMAKE_IN_SOURCE_BUILD to anything:
>> [[ -n "${CMAKE_IN_SOURCE_BUILD}" ]] && CMAKE_BUILD_DIR="${S}"
> 
> Why would I want to do that? Some documentation would help.

Added: some packages refuse to build out of source, so it may be needed in some
cases.

>> function ecmake() {
> 
> Why are some functions declared with 'function' and others not?

Fixed: added '^function '

>> 		-DCMAKE_CXX_COMPILER="$(type -P $(tc-getCXX))" \
> 
> Why the 'type -P' bit?

To get the full path to $CC and $CXX

>> 	make DESTDIR="${D}" install || die "make install failed"
> 
> Does emake work?

It should -> fixed.

Attached is new version and a diff to previous.

-- 
Krzysiek Pawlik   <nelchael at gentoo.org>   key id: 0xBC555551
desktop-misc, desktop-dock, x86, java, apache, ppc...

[-- Attachment #1.2: cmake.eclass --]
[-- Type: text/plain, Size: 2553 bytes --]

# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: cmake.eclass
# @MAINTAINER:
# nelchael@gentoo.org
# @BLURB: wrap cmake
# @DESCRIPTION:
# The cmake eclass contains functions wrapping cmake to ease its usage in
# ebuilds. It allows both out of source and in source builds.

inherit toolchain-funcs multilib

EXPORT_FUNCTIONS src_compile src_install

DEPEND="${DEPEND}
	>=dev-util/cmake-2.4.6-r1"

CMAKE_BUILD_DIR="${WORKDIR}/cmake-build"

# Some packages don't build out of source, so if you want to build in source
# tree set CMAKE_IN_SOURCE_BUILD to anything before inheriting cmake.eclass:
[[ -n "${CMAKE_IN_SOURCE_BUILD}" ]] && CMAKE_BUILD_DIR="${S}"

# @FUNCTION: prepare_build_dir
# @USAGE:
# @DESCRIPTION:
# Create the build directory if it doesn't exist, this function should not be
# used outside of this eclass.
function prepare_build_dir() {

	if [[ ! -d "${CMAKE_BUILD_DIR}" ]]; then
		mkdir -p "${CMAKE_BUILD_DIR}" \
			|| die "mkdir \"${CMAKE_BUILD_DIR}\" failed"
	fi

}

# @FUNCTION: ecmake
# @USAGE:
# @DESCRIPTION:
# Run cmake to prepare makefiles, also prepares the build directory.
function ecmake() {

	prepare_build_dir

	pushd "${CMAKE_BUILD_DIR}" > /dev/null

	[[ -n "${CMAKE_VERBOSE}" ]] && \
		CMAKE_FLAGS="-DCMAKE_VERBOSE_MAKEFILE=1 ${CMAKE_FLAGS}"

	echo "cmake -DCMAKE_CXX_COMPILER=\"$(type -P $(tc-getCXX))\" -DCMAKE_CXX_FLAGS=\"${CXXFLAGS}\" -DCMAKE_C_COMPILER=\"$(type -P $(tc-getCC))\" -DCMAKE_C_FLAGS=\"${CFLAGS}\" -DCMAKE_INSTALL_PREFIX=\"/usr\" -DLIB_INSTALL_DIR=\"/usr/$(get_libdir)\" \"${S}\" ${CMAKE_FLAGS}"

	/usr/bin/cmake \
		-DCMAKE_CXX_COMPILER="$(type -P $(tc-getCXX))" \
		-DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
		-DCMAKE_C_COMPILER="$(type -P $(tc-getCC))" \
		-DCMAKE_C_FLAGS="${CFLAGS}" \
		-DCMAKE_INSTALL_PREFIX="/usr" \
		-DLIB_INSTALL_DIR="/usr/$(get_libdir)" \
		${CMAKE_FLAGS} \
		"${S}" || die "cmake failed"

	popd > /dev/null

}

# @FUNCTION: cmake_src_compile
# @USAGE: <make arguments>
# @DESCRIPTION:
# Default src_compile for ebuilds using cmake, runs `ecmake' and then `emake'.
function cmake_src_compile() {

	ecmake

	pushd "${CMAKE_BUILD_DIR}" > /dev/null
	emake ${@} || die "emake failed"
	popd > /dev/null

}

# @FUNCTION: cmake_src_install
# @USAGE:
# @DESCRIPTION:
# Default src_install for ebuilds using cmake, runs `emake install' in build
# directory.
function cmake_src_install() {

	pushd "${CMAKE_BUILD_DIR}" > /dev/null
	emake DESTDIR="${D}" install || die "make install failed"
	popd > /dev/null

}

[-- Attachment #1.3: cmake.eclass.diff --]
[-- Type: text/plain, Size: 2455 bytes --]

Index: cmake.eclass
===================================================================
--- cmake.eclass	(revision 285)
+++ cmake.eclass	(working copy)
@@ -2,10 +2,13 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: $
 
-#
-# Original Author: nelchael
-# Purpose: Automate src_install and src_compile for packages using cmake
-#
+# @ECLASS: cmake.eclass
+# @MAINTAINER:
+# nelchael@gentoo.org
+# @BLURB: wrap cmake
+# @DESCRIPTION:
+# The cmake eclass contains functions wrapping cmake to ease its usage in
+# ebuilds. It allows both out of source and in source builds.
 
 inherit toolchain-funcs multilib
 
@@ -16,13 +19,15 @@
 
 CMAKE_BUILD_DIR="${WORKDIR}/cmake-build"
 
-# If you want to build in source tree set CMAKE_IN_SOURCE_BUILD to anything:
+# Some packages don't build out of source, so if you want to build in source
+# tree set CMAKE_IN_SOURCE_BUILD to anything before inheriting cmake.eclass:
 [[ -n "${CMAKE_IN_SOURCE_BUILD}" ]] && CMAKE_BUILD_DIR="${S}"
 
-#
-# Prepare CMAKE_BUILD_DIR:
-#	- create the directory if it's missing
-#
+# @FUNCTION: prepare_build_dir
+# @USAGE:
+# @DESCRIPTION:
+# Create the build directory if it doesn't exist, this function should not be
+# used outside of this eclass.
 function prepare_build_dir() {
 
 	if [[ ! -d "${CMAKE_BUILD_DIR}" ]]; then
@@ -32,11 +37,10 @@
 
 }
 
-#
-# Run cmake with some needed defines.
-# If you want to add something use CMAKE_FLAGS.
-# If you want verbose makefile set CMAKE_VERBOSE to anything.
-#
+# @FUNCTION: ecmake
+# @USAGE:
+# @DESCRIPTION:
+# Run cmake to prepare makefiles, also prepares the build directory.
 function ecmake() {
 
 	prepare_build_dir
@@ -62,10 +66,11 @@
 
 }
 
-#
-# Run `ecmake' and default make target.
-#
-cmake_src_compile() {
+# @FUNCTION: cmake_src_compile
+# @USAGE: <make arguments>
+# @DESCRIPTION:
+# Default src_compile for ebuilds using cmake, runs `ecmake' and then `emake'.
+function cmake_src_compile() {
 
 	ecmake
 
@@ -75,13 +80,15 @@
 
 }
 
-#
-# Change to build directory and run `make install'.
-#
-cmake_src_install() {
+# @FUNCTION: cmake_src_install
+# @USAGE:
+# @DESCRIPTION:
+# Default src_install for ebuilds using cmake, runs `emake install' in build
+# directory.
+function cmake_src_install() {
 
 	pushd "${CMAKE_BUILD_DIR}" > /dev/null
-	make DESTDIR="${D}" install || die "make install failed"
+	emake DESTDIR="${D}" install || die "make install failed"
 	popd > /dev/null
 
 }

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-dev] RFC: cmake.eclass
       [not found] ` <200711041420.38049.philantrop@gentoo.org>
@ 2007-11-04 13:30   ` Krzysiek Pawlik
  2007-11-04 14:09     ` Krzysiek Pawlik
  0 siblings, 1 reply; 8+ messages in thread
From: Krzysiek Pawlik @ 2007-11-04 13:30 UTC (permalink / raw
  To: Wulf C. Krueger, Gentoo Dev

[-- Attachment #1: Type: text/plain, Size: 953 bytes --]

Wulf C. Krueger wrote:
> KDE4 will make use of cmake-utils.eclass we wrote because

Why call it cmake-utils?

> - we need use_enable- and use_with-like functions for cmake (makes ebuilds 
> easier to read)

Could be done.

> - in-source and out-of-source build support

Got it too :)

> - we need LIB_SUFFIX support

Could be added easily.

> - our KDE4 eclasses rely on it.

Not in tree yet.

> You might want to take a look at it. It's in the tree. I don't really 
> think we need two implementations.

I think so too. I've got few suggestions:

 * in cmake-utils_src_make():
   emake ${@} - it would allow something like this:

    cmake-utils_src_make -j1

 * if you `cd' into build directory - *please* return to ${S} -> use pushd/popd.

Last thing: please reply to gentoo-dev too :)

-- 
Krzysiek Pawlik   <nelchael at gentoo.org>   key id: 0xBC555551
desktop-misc, desktop-dock, x86, java, apache, ppc...


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-dev] RFC: cmake.eclass
  2007-11-04 11:51 [gentoo-dev] RFC: cmake.eclass Krzysiek Pawlik
  2007-11-04 12:12 ` Donnie Berkholz
       [not found] ` <200711041420.38049.philantrop@gentoo.org>
@ 2007-11-04 14:01 ` Marijn Schouten (hkBst)
  2007-11-04 14:07   ` Krzysiek Pawlik
  2 siblings, 1 reply; 8+ messages in thread
From: Marijn Schouten (hkBst) @ 2007-11-04 14:01 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Krzysiek Pawlik wrote:
> A little introduction: cmake is an alternative for autotools, more and more
> packages are using it (and some new big ones are on the way, KDE4 for example).
> 
> I've wrote an eclass that makes writing ebuilds for such packages a little
> easier - it provides an ecmake function that takes care of few needed variables,
> prefix and such.

I'm a bit confused now. Both this eclass and the recently submitted
cmake-utils.eclass seem to handle CMake-based packages. Can someone clarify?

Marijn

- --
Marijn Schouten (hkBst), Gentoo Lisp project
<http://www.gentoo.org/proj/en/lisp/>, #gentoo-lisp on FreeNode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHLdC/p/VmCx0OL2wRAqkvAKCamrr4efE6byCFxKV3+FktlTdEtwCgsXGZ
k+2A7Ib+BnfNw7wAa+//INg=
=BV6f
-----END PGP SIGNATURE-----
-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-dev] RFC: cmake.eclass
  2007-11-04 14:01 ` Marijn Schouten (hkBst)
@ 2007-11-04 14:07   ` Krzysiek Pawlik
  0 siblings, 0 replies; 8+ messages in thread
From: Krzysiek Pawlik @ 2007-11-04 14:07 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 416 bytes --]

Marijn Schouten (hkBst) wrote:
> I'm a bit confused now. Both this eclass and the recently submitted
> cmake-utils.eclass seem to handle CMake-based packages. Can someone clarify?

Yes: I've missed the discussion about cmake-utils.eclass - my version
(cmake.eclass) is not needed.

-- 
Krzysiek Pawlik   <nelchael at gentoo.org>   key id: 0xBC555551
desktop-misc, desktop-dock, x86, java, apache, ppc...


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-dev] RFC: cmake.eclass
  2007-11-04 13:30   ` Krzysiek Pawlik
@ 2007-11-04 14:09     ` Krzysiek Pawlik
  2007-11-04 14:35       ` Wulf C. Krueger
  0 siblings, 1 reply; 8+ messages in thread
From: Krzysiek Pawlik @ 2007-11-04 14:09 UTC (permalink / raw
  To: gentoo-dev; +Cc: Wulf C. Krueger


[-- Attachment #1.1: Type: text/plain, Size: 343 bytes --]


Wulf: check this patch to cmake-utils.eclass - it used pushd/popd, adds
CMAKE_IN_SOURCE_BUILD in cmake-utils_src_compile and defines LIB_INSTALL_DIR
(cmake-utils will be used by other packages besides KDE too).

-- 
Krzysiek Pawlik   <nelchael at gentoo.org>   key id: 0xBC555551
desktop-misc, desktop-dock, x86, java, apache, ppc...

[-- Attachment #1.2: cmake-utils.eclass.patch --]
[-- Type: text/plain, Size: 2746 bytes --]

Index: cmake-utils.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v
retrieving revision 1.1
diff -u -r1.1 cmake-utils.eclass
--- cmake-utils.eclass	4 Nov 2007 13:17:35 -0000	1.1
+++ cmake-utils.eclass	4 Nov 2007 14:08:01 -0000
@@ -49,7 +49,11 @@
 cmake-utils_src_compile() {
 	debug-print-function $FUNCNAME $*
 
-	cmake-utils_src_configureout
+	if [[ -n "${CMAKE_IN_SOURCE_BUILD}" ]]; then
+		cmake-utils_src_configurein
+	else
+		cmake-utils_src_configureout
+	fi
 	cmake-utils_src_make
 }
 
@@ -74,11 +78,13 @@
 	debug-print-function $FUNCNAME $*
 
 	local cmakeargs="${mycmakeargs} $(_common_configure_code)"
-	mkdir "${WORKDIR}"/${PN}_build
-	cd "${WORKDIR}"/${PN}_build
+	mkdir -p "${WORKDIR}"/${PN}_build
+	pushd "${WORKDIR}"/${PN}_build > /dev/null
 
 	debug-print "$LINENO $ECLASS $FUNCNAME: mycmakeargs is $cmakeargs"
 	cmake ${cmakeargs} "${S}" || die "Cmake failed"
+
+	popd > /dev/null
 }
 
 # Internal use only. Common configuration options for all types of builds.
@@ -91,6 +97,7 @@
 	echo -DCMAKE_CXX_COMPILER=$(type -P $(tc-getCXX))
 	echo -DCMAKE_INSTALL_PREFIX=${PREFIX:-/usr}
 	echo -DLIB_SUFFIX=${tmp_libdir/lib}
+	echo -DLIB_INSTALL_DIR=${tmp_libdir}
 	[[ -n ${CMAKE_NO_COLOR} ]] && echo -DCMAKE_COLOR_MAKEFILE=OFF
 }
 
@@ -103,12 +110,15 @@
 	# 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;
+		pushd "${WORKDIR}"/${PN}_build > /dev/null
 	fi
 	if ! [[ -z ${CMAKE_COMPILER_VERBOSE} ]]; then
-		emake VERBOSE=1 || die "Make failed!";
+		emake VERBOSE=1 || die "Make failed!"
 	else
-		emake || die "Make failed!";
+		emake || die "Make failed!"
+	fi
+	if [[ -d ${WORKDIR}/${PN}_build ]]; then
+		popd > /dev/null
 	fi
 }
 
@@ -121,9 +131,12 @@
 	# 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;
+		pushd "${WORKDIR}"/${PN}_build > /dev/null
 	fi
 	emake install DESTDIR="${D}" || die "Make install failed"
+	if [[ -d  ${WORKDIR}/${PN}_build ]]; then
+		popd > /dev/null
+	fi
 }
 
 # @FUNCTION: cmake-utils_src_test
@@ -135,7 +148,7 @@
 	# 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
+		pushd "${WORKDIR}"/${PN}_build > /dev/null
 	fi
 	# Standard implementation of src_test
 	if emake -j1 check -n &> /dev/null; then
@@ -151,4 +164,7 @@
 	else
 		einfo ">>> Test phase [none]: ${CATEGORY}/${PF}"
 	fi
+	if [[ -d  ${WORKDIR}/${PN}_build ]]; then
+		popd > /dev/null
+	fi
 }

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-dev] RFC: cmake.eclass
  2007-11-04 14:09     ` Krzysiek Pawlik
@ 2007-11-04 14:35       ` Wulf C. Krueger
  0 siblings, 0 replies; 8+ messages in thread
From: Wulf C. Krueger @ 2007-11-04 14:35 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 389 bytes --]

Hello Krzysiek!

On Sunday, 04. November 2007 15:09:47 Krzysiek Pawlik wrote:
> Wulf: check this patch to cmake-utils.eclass - it used pushd/popd, adds
> CMAKE_IN_SOURCE_BUILD in cmake-utils_src_compile and defines
> LIB_INSTALL_DIR (cmake-utils will be used by other packages besides KDE
> too).

Thanks, looks good. I'll do some testing and apply it.

-- 
Best regards, Wulf

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-11-04 14:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-04 11:51 [gentoo-dev] RFC: cmake.eclass Krzysiek Pawlik
2007-11-04 12:12 ` Donnie Berkholz
2007-11-04 12:34   ` Krzysiek Pawlik
     [not found] ` <200711041420.38049.philantrop@gentoo.org>
2007-11-04 13:30   ` Krzysiek Pawlik
2007-11-04 14:09     ` Krzysiek Pawlik
2007-11-04 14:35       ` Wulf C. Krueger
2007-11-04 14:01 ` Marijn Schouten (hkBst)
2007-11-04 14:07   ` Krzysiek Pawlik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox