commit:     dac4dc6e2039638265ec2c678fd01af3714640ad
Author:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
AuthorDate: Thu Mar  2 09:01:03 2017 +0000
Commit:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
CommitDate: Thu Mar  2 09:17:01 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dac4dc6e

eclass/ros-catkin.eclass: Add CATKIN_IN_SOURCE_BUILD support.

 eclass/ros-catkin.eclass | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/eclass/ros-catkin.eclass b/eclass/ros-catkin.eclass
index 3daee77b563..b427e0861b8 100644
--- a/eclass/ros-catkin.eclass
+++ b/eclass/ros-catkin.eclass
@@ -32,6 +32,11 @@ EGIT_REPO_URI="${ROS_REPO_URI}"
 # Usually, a repository contains several packages, hence a typical value is:
 # ROS_SUBDIR=${PN}
 
+# @ECLASS-VARIABLE: CATKIN_IN_SOURCE_BUILD
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Set to enable in-source build.
+
 SCM=""
 if [ "${PV#9999}" != "${PV}" ] ; then
        SCM="git-r3"
@@ -140,12 +145,18 @@ HOMEPAGE="http://wiki.ros.org/${PN}";
 # Calls cmake-utils_src_prepare (so that PATCHES array is handled there) and 
initialises the workspace
 # by installing a recursive CMakeLists.txt to handle bundles.
 ros-catkin_src_prepare() {
+       # If no multibuild, just use cmake IN_SOURCE support
+       [ -n "${CATKIN_IN_SOURCE_BUILD}" ] && [ -z 
"${CATKIN_DO_PYTHON_MULTIBUILD}" ] && export CMAKE_IN_SOURCE_BUILD=yes
+
        cmake-utils_src_prepare
 
        if [ ! -f "${S}/CMakeLists.txt" ] ; then
                catkin_init_workspace || die
        fi
 
+       # If python multibuild, copy the sources
+       [ -n "${CATKIN_IN_SOURCE_BUILD}" ] && [ -n 
"${CATKIN_DO_PYTHON_MULTIBUILD}" ] && python_copy_sources
+
        # Most packages require C++11 these days. Do it here, in src_prepare so 
that
        # ebuilds can override it in src_configure.
        append-cxxflags '-std=c++11'
@@ -163,6 +174,9 @@ ros-catkin_src_configure_internal() {
                        -DPYTHON_INSTALL_DIR="${sitedir#${EPREFIX}/usr/}"
                )
                python_export PYTHON_SCRIPTDIR
+               if [ -n "${CATKIN_IN_SOURCE_BUILD}" ] ; then
+                       export CMAKE_USE_DIR="${BUILD_DIR}"
+               fi
        fi
        cmake-utils_src_configure "${@}"
 }
@@ -206,6 +220,9 @@ ros-catkin_src_configure() {
 # Builds a catkin-based package.
 ros-catkin_src_compile() {
        if [ -n "${CATKIN_DO_PYTHON_MULTIBUILD}" ] ; then
+               if [ -n "${CATKIN_IN_SOURCE_BUILD}" ] ; then
+                       export CMAKE_USE_DIR="${BUILD_DIR}"
+               fi
                python_foreach_impl cmake-utils_src_compile "${@}"
        else
                cmake-utils_src_compile "${@}"
@@ -246,6 +263,9 @@ ros-catkin_src_test() {
 # Decorator around cmake-utils_src_install to ensure python scripts are 
properly handled w.r.t. python-exec2.
 ros-catkin_src_install_with_python() {
        python_export PYTHON_SCRIPTDIR
+       if [ -n "${CATKIN_IN_SOURCE_BUILD}" ] ; then
+               export CMAKE_USE_DIR="${BUILD_DIR}"
+       fi
        cmake-utils_src_install "${@}"
        if [ ! -f "${T}/.catkin_python_symlinks_generated" -a -d 
"${D}/${PYTHON_SCRIPTDIR}" ]; then
                dodir /usr/bin

Reply via email to