dev-qt/qtx11extras: stable 5.14.2 for ppc, bug #719732
[gentoo.git] / dev-util / catkin / catkin-0.7.17.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 SCM=""
7 if [ "${PV#9999}" != "${PV}" ] ; then
8         SCM="git-r3"
9         EGIT_REPO_URI="https://github.com/ros/catkin"
10 fi
11
12 PYTHON_COMPAT=( python3_6 pypy3 )
13
14 inherit ${SCM} cmake-utils python-r1
15
16 DESCRIPTION="Cmake macros and associated python code used to build some parts of ROS"
17 HOMEPAGE="http://wiki.ros.org/catkin"
18 if [ "${PV#9999}" != "${PV}" ] ; then
19         SRC_URI=""
20         KEYWORDS=""
21 else
22         SRC_URI="https://github.com/ros/catkin/archive/${PV}.tar.gz -> ${P}.tar.gz"
23         KEYWORDS="~amd64 ~arm"
24 fi
25
26 LICENSE="BSD"
27 SLOT="0"
28 IUSE="test"
29 RESTRICT="!test? ( test )"
30 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
31
32 RDEPEND="
33         ${PYTHON_DEPS}
34         dev-python/catkin_pkg[${PYTHON_USEDEP}]
35         dev-python/empy[${PYTHON_USEDEP}]
36         dev-util/cmake
37 "
38 DEPEND="${RDEPEND}
39         test? ( dev-python/nose[${PYTHON_USEDEP}] dev-python/mock[${PYTHON_USEDEP}] )"
40
41 PATCHES=(
42         "${FILESDIR}/tests.patch"
43         "${FILESDIR}/distutils.patch"
44         "${FILESDIR}/catkin_prefix_path.patch"
45         "${FILESDIR}/gnuinstalldirs.patch"
46         "${FILESDIR}/catkin_prefix_path_util_py_v2.patch"
47         "${FILESDIR}/package_xml.patch"
48         "${FILESDIR}/etc.patch"
49         "${FILESDIR}/sitedir.patch"
50 )
51
52 src_prepare() {
53         # fix libdir
54         sed -i \
55                 -e 's:LIBEXEC_DESTINATION lib:LIBEXEC_DESTINATION libexec:' \
56                 -e 's:}/lib:}/${CMAKE_INSTALL_LIBDIR}:' \
57                 -e 's:DESTINATION lib):DESTINATION ${CMAKE_INSTALL_LIBDIR}):' \
58                 -e 's:DESTINATION lib/:DESTINATION ${CMAKE_INSTALL_LIBDIR}/:' \
59                 -e 's:PYTHON_INSTALL_DIR lib:PYTHON_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}:' \
60                 cmake/*.cmake || die
61         cmake-utils_src_prepare
62 }
63
64 catkin_src_configure_internal() {
65         local sitedir="$(python_get_sitedir)"
66         mycmakeargs+=(
67                 -DPYTHON_EXECUTABLE="${PYTHON}"
68                 -DPYTHON_INSTALL_DIR="${sitedir#${EPREFIX}/usr/}"
69         )
70         python_export PYTHON_SCRIPTDIR
71         cmake-utils_src_configure
72 }
73
74 src_configure() {
75         export PYTHONPATH="${S}/python"
76         local mycmakeargs=(
77                 "$(cmake-utils_use test CATKIN_ENABLE_TESTING)"
78                 "-DCATKIN_BUILD_BINARY_PACKAGE=ON"
79                 )
80         python_foreach_impl catkin_src_configure_internal
81 }
82
83 src_compile() {
84         python_foreach_impl cmake-utils_src_compile
85 }
86
87 src_test() {
88         unset PYTHON_SCRIPTDIR
89         python_foreach_impl cmake-utils_src_test
90 }
91
92 catkin_src_install_internal() {
93         python_export PYTHON_SCRIPTDIR
94         cmake-utils_src_install
95         if [ ! -f "${T}/.catkin_python_symlinks_generated" ]; then
96                 dodir /usr/bin
97                 for i in "${D}/${PYTHON_SCRIPTDIR}"/* ; do
98                         dosym ../lib/python-exec/python-exec2 "/usr/bin/${i##*/}"
99                 done
100                 touch "${T}/.catkin_python_symlinks_generated"
101         fi
102 }
103
104 src_install() {
105         python_foreach_impl catkin_src_install_internal
106
107         doenvd "${FILESDIR}/40catkin"
108
109         # needed to be considered as a workspace
110         touch "${ED}/usr/.catkin"
111 }
112
113 pkg_postinst() {
114         ewarn "Starting from version 0.7.1-r2, dev-util/catkin changed the"
115         ewarn "installation path for package.xml files on Gentoo."
116         ewarn "In order for ROS to work properly, you will need to reinstall ROS"
117         ewarn "packages that have it installed in the old location:"
118         ewarn "         emerge -1O /usr/share/*/package.xml"
119         ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=595004 for more details."
120 }