Skip to content

Commit 3e75069

Browse files
committed
ros-catkin.eclass: Fix EAPI-7 support, support cmake.eclass
Use of EAPI-7 was broken so far because cmake-utils_use is banned. Closes: https://bugs.gentoo.org/705798 Signed-off-by: Andreas Sturmlechner <[email protected]>
1 parent ebc4ea4 commit 3e75069

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

eclass/ros-catkin.eclass

+24-9
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,21 @@
1212
# Provides function for building ROS packages on Gentoo.
1313
# It supports selectively building messages, multi-python installation, live ebuilds (git only).
1414

15+
# @ECLASS-VARIABLE: CMAKE_ECLASS
16+
# @INTERNAL
17+
# @DEFAULT_UNSET
18+
# @DESCRIPTION:
19+
# Set to "cmake-utils" for EAPI 5 and 6, "cmake" for EAPI-7.
20+
1521
case "${EAPI:-0}" in
1622
0|1|2|3|4)
1723
die "EAPI='${EAPI}' is not supported"
1824
;;
25+
[56])
26+
CMAKE_ECLASS=cmake-utils
27+
;;
1928
*)
29+
CMAKE_ECLASS=cmake
2030
;;
2131
esac
2232

@@ -51,7 +61,7 @@ fi
5161
# most certainly be something pulling python anyway.
5262
PYTHON_COMPAT=( python3_6 )
5363

54-
inherit ${SCM} python-r1 cmake-utils flag-o-matic
64+
inherit ${SCM} python-r1 ${CMAKE_ECLASS} flag-o-matic
5565

5666
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
5767

@@ -134,13 +144,13 @@ HOMEPAGE="https://wiki.ros.org/${PN} ${ROS_REPO_URI}"
134144

135145
# @FUNCTION: ros-catkin_src_prepare
136146
# @DESCRIPTION:
137-
# Calls cmake-utils_src_prepare (so that PATCHES array is handled there) and initialises the workspace
147+
# Calls cmake_src_prepare (so that PATCHES array is handled there) and initialises the workspace
138148
# by installing a recursive CMakeLists.txt to handle bundles.
139149
ros-catkin_src_prepare() {
140150
# If no multibuild, just use cmake IN_SOURCE support
141151
[ -n "${CATKIN_IN_SOURCE_BUILD}" ] && export CMAKE_IN_SOURCE_BUILD=yes
142152

143-
cmake-utils_src_prepare
153+
${CMAKE_ECLASS}_src_prepare
144154

145155
if [ ! -f "${S}/CMakeLists.txt" ] ; then
146156
catkin_init_workspace || die
@@ -187,7 +197,7 @@ ros-catkin_src_configure() {
187197
fi
188198

189199
local mycmakeargs=(
190-
"$(cmake-utils_use test CATKIN_ENABLE_TESTING)"
200+
"-DCATKIN_ENABLE_TESTING=$(usex test)"
191201
"-DCATKIN_BUILD_BINARY_PACKAGE=ON"
192202
"-DCATKIN_PREFIX_PATH=${SYSROOT:-${EROOT}}/usr"
193203
"${mycatkincmakeargs[@]}"
@@ -202,15 +212,15 @@ ros-catkin_src_configure() {
202212
export CMAKE_USE_DIR="${BUILD_DIR}"
203213
fi
204214

205-
cmake-utils_src_configure "${@}"
215+
${CMAKE_ECLASS}_src_configure "${@}"
206216
}
207217

208218
# @FUNCTION: ros-catkin_src_compile
209219
# @DESCRIPTION:
210220
# Builds a catkin-based package.
211221
ros-catkin_src_compile() {
212222
ros-catkin_python_setup
213-
cmake-utils_src_compile "${@}"
223+
${CMAKE_ECLASS}_src_compile "${@}"
214224
}
215225

216226
# @FUNCTION: ros-catkin_src_test
@@ -226,8 +236,13 @@ ros-catkin_src_test() {
226236
einfo "Regenerating setup_cached.sh for tests"
227237
${PYTHON:-python} catkin_generated/generate_cached_setup.py || die
228238
fi
229-
nonfatal cmake-utils_src_make tests
230-
cmake-utils_src_test "${@}"
239+
240+
if [[ ${CMAKE_ECLASS} = cmake-utils ]]; then
241+
nonfatal cmake-utils_src_make tests
242+
else
243+
nonfatal cmake_build tests
244+
fi
245+
${CMAKE_ECLASS}_src_test "${@}"
231246
}
232247

233248
# @FUNCTION: ros-catkin_src_install
@@ -240,7 +255,7 @@ ros-catkin_src_install() {
240255
export CMAKE_USE_DIR="${BUILD_DIR}"
241256
fi
242257

243-
cmake-utils_src_install "${@}"
258+
${CMAKE_ECLASS}_src_install "${@}"
244259
if [ ! -f "${T}/.catkin_python_symlinks_generated" -a -d "${D}/${PYTHON_SCRIPTDIR}" ]; then
245260
dodir /usr/bin
246261
for i in "${D}/${PYTHON_SCRIPTDIR}"/* ; do

0 commit comments

Comments
 (0)