public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Krzysiek Pawlik <nelchael@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Wulf C. Krueger" <philantrop@gentoo.org>
Subject: Re: [gentoo-dev] RFC: cmake.eclass
Date: Sun, 04 Nov 2007 15:09:47 +0100	[thread overview]
Message-ID: <472DD2AB.4040605@gentoo.org> (raw)
In-Reply-To: <472DC97D.7000504@gentoo.org>


[-- 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 --]

  reply	other threads:[~2007-11-04 14:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2007-11-04 14:35       ` Wulf C. Krueger
2007-11-04 14:01 ` Marijn Schouten (hkBst)
2007-11-04 14:07   ` Krzysiek Pawlik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=472DD2AB.4040605@gentoo.org \
    --to=nelchael@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=philantrop@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox