dev-util/ninja: sync keywords in live ebuild
[gentoo.git] / dev-util / catkin / catkin-9999.ebuild
1 # Copyright 1999-2019 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=( python{2_7,3_5,3_6} pypy{,3} )
13
14 inherit ${SCM} cmake-utils python-r1 python-utils-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 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
30
31 RDEPEND="
32         ${PYTHON_DEPS}
33         dev-python/catkin_pkg[${PYTHON_USEDEP}]
34         dev-python/empy[${PYTHON_USEDEP}]
35         dev-util/cmake
36 "
37 DEPEND="${RDEPEND}
38         test? ( dev-python/nose[${PYTHON_USEDEP}] dev-python/mock[${PYTHON_USEDEP}] )"
39
40 PATCHES=(
41         "${FILESDIR}/tests.patch"
42         "${FILESDIR}/distutils.patch"
43         "${FILESDIR}/catkin_prefix_path.patch"
44         "${FILESDIR}/gnuinstalldirs.patch"
45         "${FILESDIR}/catkin_prefix_path_util_py_v2.patch"
46         "${FILESDIR}/package_xml.patch"
47         "${FILESDIR}/etc.patch"
48         "${FILESDIR}/sitedir.patch"
49 )
50
51 src_prepare() {
52         # fix libdir
53         sed -i \
54                 -e 's:LIBEXEC_DESTINATION lib:LIBEXEC_DESTINATION libexec:' \
55                 -e 's:}/lib:}/${CMAKE_INSTALL_LIBDIR}:' \
56                 -e 's:DESTINATION lib):DESTINATION ${CMAKE_INSTALL_LIBDIR}):' \
57                 -e 's:DESTINATION lib/:DESTINATION ${CMAKE_INSTALL_LIBDIR}/:' \
58                 -e 's:PYTHON_INSTALL_DIR lib:PYTHON_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}:' \
59                 cmake/*.cmake || die
60         cmake-utils_src_prepare
61 }
62
63 catkin_src_configure_internal() {
64         local sitedir="$(python_get_sitedir)"
65         mycmakeargs+=(
66                 -DPYTHON_EXECUTABLE="${PYTHON}"
67                 -DPYTHON_INSTALL_DIR="${sitedir#${EPREFIX}/usr/}"
68         )
69         python_export PYTHON_SCRIPTDIR
70         cmake-utils_src_configure
71 }
72
73 src_configure() {
74         export PYTHONPATH="${S}/python"
75         local mycmakeargs=(
76                 "$(cmake-utils_use test CATKIN_ENABLE_TESTING)"
77                 "-DCATKIN_BUILD_BINARY_PACKAGE=ON"
78                 )
79         python_foreach_impl catkin_src_configure_internal
80 }
81
82 src_compile() {
83         python_foreach_impl cmake-utils_src_compile
84 }
85
86 src_test() {
87         unset PYTHON_SCRIPTDIR
88         python_foreach_impl cmake-utils_src_test
89 }
90
91 catkin_src_install_internal() {
92         python_export PYTHON_SCRIPTDIR
93         cmake-utils_src_install
94         if [ ! -f "${T}/.catkin_python_symlinks_generated" ]; then
95                 dodir /usr/bin
96                 for i in "${D}/${PYTHON_SCRIPTDIR}"/* ; do
97                         dosym ../lib/python-exec/python-exec2 "/usr/bin/${i##*/}" || die
98                 done
99                 touch "${T}/.catkin_python_symlinks_generated"
100         fi
101 }
102
103 src_install() {
104         python_foreach_impl catkin_src_install_internal
105
106         doenvd "${FILESDIR}/40catkin"
107
108         # needed to be considered as a workspace
109         touch "${ED}/usr/.catkin"
110 }
111
112 pkg_postinst() {
113         ewarn "Starting from version 0.7.1-r2, dev-util/catkin changed the"
114         ewarn "installation path for package.xml files on Gentoo."
115         ewarn "In order for ROS to work properly, you will need to reinstall ROS"
116         ewarn "packages that have it installed in the old location:"
117         ewarn "         emerge -1O /usr/share/*/package.xml"
118         ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=595004 for more details."
119 }