Skip to content

Commit

Permalink
dev-util/catkin: initial import. ebuild by me.
Browse files Browse the repository at this point in the history
Package-Manager: portage-2.2.20.1
  • Loading branch information
aballier committed Sep 17, 2015
1 parent 1b54c03 commit 46e2e14
Show file tree
Hide file tree
Showing 7 changed files with 304 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev-util/catkin/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DIST catkin-0.6.14.tar.gz 197628 SHA256 0ca265803be8a2c1b6036d67ed63505551f4bbc02fa6cb8180dc3167b9f3afc9 SHA512 e2aec7bfbef0f103d96c71408917823cd80e205c021bcd78c018eb2aaaabff04bc268f661ada52963929726e0a986115cbe2c4d791cfa4542a20f7841cd74372 WHIRLPOOL 18a4173b5536da3ec6f7395c39f382b03d173e878b81ffef7d224d2828d6930099a74e08a6299b09a68bd56de87e4be225a735cc8a423b8a0b810cd92b1a5e1d
95 changes: 95 additions & 0 deletions dev-util/catkin/catkin-0.6.14.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5

SCM=""
if [ "${PV#9999}" != "${PV}" ] ; then
SCM="git-r3"
EGIT_REPO_URI="http://github.com/ros/catkin"
fi

PYTHON_COMPAT=( python{2_7,3_3,3_4} )

inherit ${SCM} cmake-utils python-r1 python-utils-r1

DESCRIPTION="Cmake macros and associated python code used to build some parts of ROS"
HOMEPAGE="http://wiki.ros.org/catkin"
if [ "${PV#9999}" != "${PV}" ] ; then
SRC_URI=""
KEYWORDS=""
else
SRC_URI="http://github.com/ros/catkin/archive/${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~amd64 ~arm"
fi

LICENSE="BSD"
SLOT="0"
IUSE="test"

RDEPEND="
dev-python/catkin_pkg[${PYTHON_USEDEP}]
dev-python/empy[${PYTHON_USEDEP}]
"
DEPEND="${RDEPEND}
test? ( dev-python/nose[${PYTHON_USEDEP}] dev-python/mock[${PYTHON_USEDEP}] )"

PATCHES=(
"${FILESDIR}/tests.patch"
"${FILESDIR}/distutils.patch"
"${FILESDIR}/catkin_prefix_path.patch"
)

src_prepare() {
# fix libdir
sed -i \
-e 's:LIBEXEC_DESTINATION lib:LIBEXEC_DESTINATION libexec:' \
-e 's:}/lib:}/${CMAKE_INSTALL_LIBDIR}:' \
-e 's:DESTINATION lib):DESTINATION ${CMAKE_INSTALL_LIBDIR}):' \
-e 's:DESTINATION lib/:DESTINATION ${CMAKE_INSTALL_LIBDIR}/:' \
-e 's:PYTHON_INSTALL_DIR lib:PYTHON_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}:' \
cmake/*.cmake || die
cmake-utils_src_prepare
}

catkin_src_configure_internal() {
mycmakeargs+=( -DPYTHON_EXECUTABLE="${PYTHON}" )
python_export PYTHON_SCRIPTDIR
cmake-utils_src_configure
}

src_configure() {
local mycmakeargs=(
"$(cmake-utils_use test CATKIN_ENABLE_TESTING)"
"-DCATKIN_BUILD_BINARY_PACKAGE=ON"
)
python_foreach_impl catkin_src_configure_internal
}

src_compile() {
python_foreach_impl cmake-utils_src_compile
}

src_test() {
unset PYTHON_SCRIPTDIR
python_foreach_impl cmake-utils_src_test
}

catkin_src_install_internal() {
python_export PYTHON_SCRIPTDIR
cmake-utils_src_install
if [ ! -f "${T}/.catkin_python_symlinks_generated" ]; then
dodir /usr/bin
for i in "${D}/${PYTHON_SCRIPTDIR}"/* ; do
dosym ../lib/python-exec/python-exec2 "/usr/bin/${i##*/}" || die
done
touch "${T}/.catkin_python_symlinks_generated"
fi
}

src_install() {
python_foreach_impl catkin_src_install_internal
# needed to be considered as a workspace
touch "${ED}/usr/.catkin"
}
95 changes: 95 additions & 0 deletions dev-util/catkin/catkin-9999.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5

SCM=""
if [ "${PV#9999}" != "${PV}" ] ; then
SCM="git-r3"
EGIT_REPO_URI="http://github.com/ros/catkin"
fi

PYTHON_COMPAT=( python{2_7,3_3,3_4} )

inherit ${SCM} cmake-utils python-r1 python-utils-r1

DESCRIPTION="Cmake macros and associated python code used to build some parts of ROS"
HOMEPAGE="http://wiki.ros.org/catkin"
if [ "${PV#9999}" != "${PV}" ] ; then
SRC_URI=""
KEYWORDS=""
else
SRC_URI="http://github.com/ros/catkin/archive/${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~amd64 ~arm"
fi

LICENSE="BSD"
SLOT="0"
IUSE="test"

RDEPEND="
dev-python/catkin_pkg[${PYTHON_USEDEP}]
dev-python/empy[${PYTHON_USEDEP}]
"
DEPEND="${RDEPEND}
test? ( dev-python/nose[${PYTHON_USEDEP}] dev-python/mock[${PYTHON_USEDEP}] )"

PATCHES=(
"${FILESDIR}/tests.patch"
"${FILESDIR}/distutils.patch"
"${FILESDIR}/catkin_prefix_path.patch"
)

src_prepare() {
# fix libdir
sed -i \
-e 's:LIBEXEC_DESTINATION lib:LIBEXEC_DESTINATION libexec:' \
-e 's:}/lib:}/${CMAKE_INSTALL_LIBDIR}:' \
-e 's:DESTINATION lib):DESTINATION ${CMAKE_INSTALL_LIBDIR}):' \
-e 's:DESTINATION lib/:DESTINATION ${CMAKE_INSTALL_LIBDIR}/:' \
-e 's:PYTHON_INSTALL_DIR lib:PYTHON_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}:' \
cmake/*.cmake || die
cmake-utils_src_prepare
}

catkin_src_configure_internal() {
mycmakeargs+=( -DPYTHON_EXECUTABLE="${PYTHON}" )
python_export PYTHON_SCRIPTDIR
cmake-utils_src_configure
}

src_configure() {
local mycmakeargs=(
"$(cmake-utils_use test CATKIN_ENABLE_TESTING)"
"-DCATKIN_BUILD_BINARY_PACKAGE=ON"
)
python_foreach_impl catkin_src_configure_internal
}

src_compile() {
python_foreach_impl cmake-utils_src_compile
}

src_test() {
unset PYTHON_SCRIPTDIR
python_foreach_impl cmake-utils_src_test
}

catkin_src_install_internal() {
python_export PYTHON_SCRIPTDIR
cmake-utils_src_install
if [ ! -f "${T}/.catkin_python_symlinks_generated" ]; then
dodir /usr/bin
for i in "${D}/${PYTHON_SCRIPTDIR}"/* ; do
dosym ../lib/python-exec/python-exec2 "/usr/bin/${i##*/}" || die
done
touch "${T}/.catkin_python_symlinks_generated"
fi
}

src_install() {
python_foreach_impl catkin_src_install_internal
# needed to be considered as a workspace
touch "${ED}/usr/.catkin"
}
55 changes: 55 additions & 0 deletions dev-util/catkin/files/catkin_prefix_path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Allow CATKIN_PREFIX_PATH to override/complement CMAKE_PREFIX_PATH.
This serves two goals: when SYSROOT!=/, CMAKE_PREFIX_PATH is the same as when
SYSROOT=/ but we need to find packages in SYSROOT/CMAKE_PREFIX_PATH.

Moreover, this allows to set CATKIN_PREFIX_PATH in global environment so that
ROS packages are properly configured without needed to source a shellrc file in
every shell session. This can't be done with CMAKE_PREFIX_PATH which is way too
generic.

Index: catkin-0.6.9/cmake/all.cmake
===================================================================
--- catkin-0.6.9.orig/cmake/all.cmake
+++ catkin-0.6.9/cmake/all.cmake
@@ -52,7 +52,11 @@ set(CMAKE_PREFIX_PATH_AS_IS ${CMAKE_PREF

# list of unique catkin workspaces based on CMAKE_PREFIX_PATH
set(CATKIN_WORKSPACES "")
-foreach(path ${CMAKE_PREFIX_PATH})
+if(NOT DEFINED CATKIN_PREFIX_PATH)
+ set(CATKIN_PREFIX_PATH ${CMAKE_PREFIX_PATH})
+endif()
+
+foreach(path ${CATKIN_PREFIX_PATH})
if(EXISTS "${path}/.catkin")
list(FIND CATKIN_WORKSPACES ${path} _index)
if(_index EQUAL -1)
Index: catkin-0.6.11/python/catkin/workspace.py
===================================================================
--- catkin-0.6.11.orig/python/catkin/workspace.py
+++ catkin-0.6.11/python/catkin/workspace.py
@@ -44,7 +44,7 @@ def get_workspaces():
"""
# get all cmake prefix paths
env_name = 'CMAKE_PREFIX_PATH'
- paths = [path for path in os.environ.get(env_name, '').split(os.pathsep) if path]
+ paths = [path for path in os.environ.get(env_name, '').split(os.pathsep) + os.environ.get('CATKIN_PREFIX_PATH', '').split(os.pathsep) if path]
# remove non-workspace paths
workspaces = [path for path in paths if os.path.isfile(os.path.join(path, CATKIN_MARKER_FILE))]
return workspaces
Index: catkin-0.6.9/cmake/catkinConfig.cmake.in
===================================================================
--- catkin-0.6.9.orig/cmake/catkinConfig.cmake.in
+++ catkin-0.6.9/cmake/catkinConfig.cmake.in
@@ -64,6 +64,11 @@ if(catkin_FIND_COMPONENTS)

# get search paths from CMAKE_PREFIX_PATH (which includes devel space)
set(paths "")
+ foreach(path ${CATKIN_PREFIX_PATH})
+ if(IS_DIRECTORY ${path}/share/${component}/cmake)
+ list(APPEND paths ${path}/share/${component}/cmake)
+ endif()
+ endforeach()
foreach(path ${CMAKE_PREFIX_PATH})
if(IS_DIRECTORY ${path}/share/${component}/cmake)
list(APPEND paths ${path}/share/${component}/cmake)
13 changes: 13 additions & 0 deletions dev-util/catkin/files/distutils.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Allow to install scripts in PYTHON_SCRIPTDIR.
Needed for Gentoo multi-python support.

Index: catkin-0.6.11/cmake/templates/python_distutils_install.sh.in
===================================================================
--- catkin-0.6.11.orig/cmake/templates/python_distutils_install.sh.in
+++ catkin-0.6.11/cmake/templates/python_distutils_install.sh.in
@@ -25,4 +25,4 @@ cd "@INSTALL_CMD_WORKING_DIRECTORY@"
build --build-base "@CMAKE_CURRENT_BINARY_DIR@" \
install \
$DESTDIR_ARG \
- @SETUPTOOLS_ARG_EXTRA@ --prefix="@CMAKE_INSTALL_PREFIX@" --install-scripts="@CMAKE_INSTALL_PREFIX@/@CATKIN_GLOBAL_BIN_DESTINATION@"
+ @SETUPTOOLS_ARG_EXTRA@ --prefix="@CMAKE_INSTALL_PREFIX@" --install-scripts="${PYTHON_SCRIPTDIR:-@CMAKE_INSTALL_PREFIX@/@CATKIN_GLOBAL_BIN_DESTINATION@}"
40 changes: 40 additions & 0 deletions dev-util/catkin/files/tests.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Fix tests.
Allow them to run even with CATKIN_BUILD_BINARY_PACKAGE set.

Index: catkin-0.6.9/cmake/test/tests.cmake
===================================================================
--- catkin-0.6.9.orig/cmake/test/tests.cmake
+++ catkin-0.6.9/cmake/test/tests.cmake
@@ -40,9 +40,6 @@ if(DEFINED CATKIN_ENABLE_TESTING AND NOT
return()
endif()

-# do not enable ctest's on the farm, since they are automatically executed by the current rules files
-# and since the tests have not been build rostests would hang forever
-if(NOT CATKIN_BUILD_BINARY_PACKAGE)
# do not enable ctest's for dry packages, since they have a custom test target which must not be overwritten
if(NOT ROSBUILD_init_called)
message(STATUS "Call enable_testing()")
@@ -50,9 +47,6 @@ if(NOT CATKIN_BUILD_BINARY_PACKAGE)
else()
message(STATUS "Skip enable_testing() for dry packages")
endif()
-else()
- message(STATUS "Skip enable_testing() when building binary package")
-endif()

# allow overriding CATKIN_TEST_RESULTS_DIR when explicitly passed to CMake as a command line argument
if(DEFINED CATKIN_TEST_RESULTS_DIR)
Index: catkin-9999/test/utils.py
===================================================================
--- catkin-9999.orig/test/utils.py
+++ catkin-9999/test/utils.py
@@ -189,6 +189,8 @@ class AbstractCatkinWorkspaceTest(unitte
prefix_path = self.installdir
args += ["-DCMAKE_PREFIX_PATH=%s" % (prefix_path)]

+ args += ["-DCMAKE_INSTALL_LIBDIR=lib"]
+
if not os.path.isdir(this_builddir):
os.makedirs(this_builddir)
cmd = ["cmake", this_srcdir] + args
5 changes: 5 additions & 0 deletions dev-util/catkin/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>ros</herd>
</pkgmetadata>

0 comments on commit 46e2e14

Please sign in to comment.