classes: locate packages in /opt/ros/${ROSDISTRO}

Following standard convention, place ROS/Catkin packages under the
prefix /opt/ros/${ROSDISTRO} (exported as ${ros_prefix}) rather than in
the usual ${prefix}.
This commit is contained in:
Peter S. Housel 2014-08-14 12:29:02 -07:00
parent b472e72505
commit e9ec1fc089
2 changed files with 61 additions and 9 deletions

View File

@ -7,11 +7,13 @@ inherit cmake distutils-base ros faulty-solibs
DEPENDS_prepend = "${@['catkin-native ', ''][d.getVar('BPN', True) == 'catkin']}"
EXTRA_OECMAKE_CATKIN = "\
-DCMAKE_PREFIX_PATH='${STAGING_DIR_HOST}/usr;${STAGING_DIR_NATIVE}/usr' \
-DCMAKE_PREFIX_PATH='${STAGING_DIR_HOST}${ros_prefix};${STAGING_DIR_HOST}${prefix};${STAGING_DIR_NATIVE}${ros_prefix};${STAGING_DIR_NATIVE}${prefix}' \
-DCMAKE_INSTALL_PREFIX:PATH='${ros_prefix}' \
"
EXTRA_OECMAKE_CATKIN_class-native = "\
-DCMAKE_PREFIX_PATH=${STAGING_DIR_NATIVE}/usr \
-DCMAKE_PREFIX_PATH='${ros_prefix}' \
-DCMAKE_INSTALL_PREFIX:PATH='${ros_prefix}' \
-DRT_LIBRARY=${libdir_native} \
"
@ -29,7 +31,6 @@ export BUILD_SYS
export HOST_SYS
SYSROOT_PREPROCESS_FUNCS += "catkin_sysroot_preprocess"
catkin_sysroot_preprocess () {
sysroot_stage_dir ${D}${prefix}/etc ${SYSROOT_DESTDIR}${prefix}/etc
sysroot_stage_dir ${D}${ros_sysconfdir} ${SYSROOT_DESTDIR}${ros_sysconfdir}
}

View File

@ -7,20 +7,55 @@ ROS_BPN = "${@d.getVar('BPN', True).replace('-', '_')}"
ROS_SPN ?= "${ROS_BPN}"
ROS_SP = "${ROS_SPN}-${PV}"
export ros_prefix = "/opt/ros/${ROSDISTRO}"
ros_prefix_virtclass-native = "${STAGING_DIR_NATIVE}/opt/ros/${ROSDISTRO}"
export ros_bindir = "${ros_prefix}/bin"
export ros_libdir = "${ros_prefix}/${baselib}"
export ros_libexecdir = "${ros_libdir}/${ROS_BPN}"
export ros_includedir = "${ros_prefix}/include"
export ros_datadir = "${ros_prefix}/share"
export ros_sysconfdir = "${ros_prefix}/etc"
export ros_stacksdir = "${ros_prefix}/stacks"
PREPROCESS_RELOCATE_DIRS += " \
${ros_bindir} \
${ros_libdir} \
"
PKG_CONFIG_PATH .= ":${PKG_CONFIG_DIR}:${STAGING_DIR_HOST}${ros_libdir}/pkgconfig:${STAGING_DATADIR}/pkgconfig"
PYTHON_SITEPACKAGES_DIR = "${ros_libdir}/${PYTHON_DIR}/site-packages"
export PYTHONPATH = "${STAGING_DIR_NATIVE}${PYTHON_SITEPACKAGES_DIR}"
PYTHONPATH_virtclass-native = "${PYTHON_SITEPACKAGES_DIR}"
FILES_${PN} += "\
${prefix}/etc \
${datadir}/ros/config/${ROS_BPN}.config \
${datadir}/ros/core/${ROS_BPN} \
${datadir}/${ROS_BPN} \
${ros_bindir}/* ${ros_libexecdir}/* ${ros_libdir}/lib*.so \
${PYTHON_SITEPACKAGES_DIR} \
${ros_datadir} \
${ros_sysconfdir} \
${ros_stacksdir} \
"
FILES_${PN}-dev += "\
${ros_includedir} \
${ros_libdir}/pkgconfig \
${PYTHON_SITEPACKAGES_DIR}/*.la \
${ros_datadir}/${ROS_BPN}/cmake \
${datadir}/${ROS_BPN}/cmake \
${datadir}/${ROS_BPN}/*.template \
"
FILES_${PN}-dbg += "\
${libdir}/${ROS_BPN}/.debug/* \
${ros_bindir}/.debug ${ros_libexecdir}/.debug ${ros_libdir}/.debug \
${ros_datadir}/*/bin/.debug \
${PYTHON_SITEPACKAGES_DIR}/.debug \
${PYTHON_SITEPACKAGES_DIR}/*/.debug \
${PYTHON_SITEPACKAGES_DIR}/*/*/.debug \
"
FILES_${PN}-staticdev += "\
${ros_libdir}/*.a \
${ros_libdir}/${BPN}/*.a \
"
PACKAGES += "${PN}-commonlisp"
@ -28,3 +63,19 @@ PACKAGES += "${PN}-commonlisp"
FILES_${PN}-commonlisp += " \
${datadir}/common-lisp/ \
"
SYSROOT_PREPROCESS_FUNCS += "ros_sysroot_preprocess"
ros_sysroot_preprocess () {
sysroot_stage_dir ${D}${ros_includedir} ${SYSROOT_DESTDIR}${ros_includedir}
if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
sysroot_stage_dir ${D}${ros_bindir} ${SYSROOT_DESTDIR}${ros_bindir}
sysroot_stage_dir ${D}${ros_sysconfdir} ${SYSROOT_DESTDIR}${ros_sysconfdir}
fi
if [ -d ${D}${ros_libdir} ]; then
sysroot_stage_libdir ${D}${ros_libdir} ${SYSROOT_DESTDIR}${ros_libdir}
fi
sysroot_stage_dir ${D}${ros_datadir} ${SYSROOT_DESTDIR}${ros_datadir}
if [ -d ${D}${ros_stacksdir} ]; then
sysroot_stage_dir ${D}${ros_stacksdir} ${SYSROOT_DESTDIR}${ros_stacksdir}
fi
}