1 |
commit: dac4dc6e2039638265ec2c678fd01af3714640ad |
2 |
Author: Alexis Ballier <aballier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Mar 2 09:01:03 2017 +0000 |
4 |
Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Mar 2 09:17:01 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dac4dc6e |
7 |
|
8 |
eclass/ros-catkin.eclass: Add CATKIN_IN_SOURCE_BUILD support. |
9 |
|
10 |
eclass/ros-catkin.eclass | 20 ++++++++++++++++++++ |
11 |
1 file changed, 20 insertions(+) |
12 |
|
13 |
diff --git a/eclass/ros-catkin.eclass b/eclass/ros-catkin.eclass |
14 |
index 3daee77b563..b427e0861b8 100644 |
15 |
--- a/eclass/ros-catkin.eclass |
16 |
+++ b/eclass/ros-catkin.eclass |
17 |
@@ -32,6 +32,11 @@ EGIT_REPO_URI="${ROS_REPO_URI}" |
18 |
# Usually, a repository contains several packages, hence a typical value is: |
19 |
# ROS_SUBDIR=${PN} |
20 |
|
21 |
+# @ECLASS-VARIABLE: CATKIN_IN_SOURCE_BUILD |
22 |
+# @DEFAULT_UNSET |
23 |
+# @DESCRIPTION: |
24 |
+# Set to enable in-source build. |
25 |
+ |
26 |
SCM="" |
27 |
if [ "${PV#9999}" != "${PV}" ] ; then |
28 |
SCM="git-r3" |
29 |
@@ -140,12 +145,18 @@ HOMEPAGE="http://wiki.ros.org/${PN}" |
30 |
# Calls cmake-utils_src_prepare (so that PATCHES array is handled there) and initialises the workspace |
31 |
# by installing a recursive CMakeLists.txt to handle bundles. |
32 |
ros-catkin_src_prepare() { |
33 |
+ # If no multibuild, just use cmake IN_SOURCE support |
34 |
+ [ -n "${CATKIN_IN_SOURCE_BUILD}" ] && [ -z "${CATKIN_DO_PYTHON_MULTIBUILD}" ] && export CMAKE_IN_SOURCE_BUILD=yes |
35 |
+ |
36 |
cmake-utils_src_prepare |
37 |
|
38 |
if [ ! -f "${S}/CMakeLists.txt" ] ; then |
39 |
catkin_init_workspace || die |
40 |
fi |
41 |
|
42 |
+ # If python multibuild, copy the sources |
43 |
+ [ -n "${CATKIN_IN_SOURCE_BUILD}" ] && [ -n "${CATKIN_DO_PYTHON_MULTIBUILD}" ] && python_copy_sources |
44 |
+ |
45 |
# Most packages require C++11 these days. Do it here, in src_prepare so that |
46 |
# ebuilds can override it in src_configure. |
47 |
append-cxxflags '-std=c++11' |
48 |
@@ -163,6 +174,9 @@ ros-catkin_src_configure_internal() { |
49 |
-DPYTHON_INSTALL_DIR="${sitedir#${EPREFIX}/usr/}" |
50 |
) |
51 |
python_export PYTHON_SCRIPTDIR |
52 |
+ if [ -n "${CATKIN_IN_SOURCE_BUILD}" ] ; then |
53 |
+ export CMAKE_USE_DIR="${BUILD_DIR}" |
54 |
+ fi |
55 |
fi |
56 |
cmake-utils_src_configure "${@}" |
57 |
} |
58 |
@@ -206,6 +220,9 @@ ros-catkin_src_configure() { |
59 |
# Builds a catkin-based package. |
60 |
ros-catkin_src_compile() { |
61 |
if [ -n "${CATKIN_DO_PYTHON_MULTIBUILD}" ] ; then |
62 |
+ if [ -n "${CATKIN_IN_SOURCE_BUILD}" ] ; then |
63 |
+ export CMAKE_USE_DIR="${BUILD_DIR}" |
64 |
+ fi |
65 |
python_foreach_impl cmake-utils_src_compile "${@}" |
66 |
else |
67 |
cmake-utils_src_compile "${@}" |
68 |
@@ -246,6 +263,9 @@ ros-catkin_src_test() { |
69 |
# Decorator around cmake-utils_src_install to ensure python scripts are properly handled w.r.t. python-exec2. |
70 |
ros-catkin_src_install_with_python() { |
71 |
python_export PYTHON_SCRIPTDIR |
72 |
+ if [ -n "${CATKIN_IN_SOURCE_BUILD}" ] ; then |
73 |
+ export CMAKE_USE_DIR="${BUILD_DIR}" |
74 |
+ fi |
75 |
cmake-utils_src_install "${@}" |
76 |
if [ ! -f "${T}/.catkin_python_symlinks_generated" -a -d "${D}/${PYTHON_SCRIPTDIR}" ]; then |
77 |
dodir /usr/bin |