From 4ee1f4b9f2050cfb55926d7adf1f48aa4dae254b Mon Sep 17 00:00:00 2001 From: Fabian Poggenhans Date: Sun, 18 Sep 2022 19:34:32 +0000 Subject: [PATCH] Set CMAKE_INSTALL_LIBDIR=lib in debian/control for ROS1 packages Newer debhelper versions will set CMAKE_INSTALL_LIBDIR=lib/. This will cause packages that use GNUInstallDirs to install to this location instead of lib and can confuse ROS tools. closes #642 --- bloom/generators/debian/generator.py | 5 +++++ bloom/generators/debian/templates/catkin/rules.em | 3 +++ bloom/generators/debian/templates/cmake/rules.em | 2 ++ 3 files changed, 10 insertions(+) diff --git a/bloom/generators/debian/generator.py b/bloom/generators/debian/generator.py index 6e1a9af3..4a85dc56 100644 --- a/bloom/generators/debian/generator.py +++ b/bloom/generators/debian/generator.py @@ -83,6 +83,8 @@ from bloom.packages import get_package_data +from bloom.rosdistro_api import get_distribution_type + from bloom.util import code from bloom.util import to_unicode from bloom.util import execute_command @@ -344,6 +346,9 @@ def generate_substitutions_from_package( data['Package'] = sanitize_package_name(package.name) # Installation prefix data['InstallationPrefix'] = installation_prefix + # ROS version + ros_distro_type = get_distribution_type(ros_distro) + data['RosVersion'] = int(ros_distro_type[3:]) # Resolve dependencies evaluate_package_conditions(package, ros_distro) depends = [ diff --git a/bloom/generators/debian/templates/catkin/rules.em b/bloom/generators/debian/templates/catkin/rules.em index 276329db..58e36a77 100755 --- a/bloom/generators/debian/templates/catkin/rules.em +++ b/bloom/generators/debian/templates/catkin/rules.em @@ -30,9 +30,12 @@ override_dh_auto_configure: # In case we're installing to a non-standard location, look for a setup.sh # in the install tree that was dropped by catkin, and source it. It will # set things like CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH. + # Note that CMAKE_INSTALL_LIBDIR is set to lib/ by default, but + # only affects packages that use GNUInstallDirs. if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi && \ dh_auto_configure -- \ -DCATKIN_BUILD_BINARY_PACKAGE="1" \ + -DCMAKE_INSTALL_LIBDIR="lib" \ -DCMAKE_INSTALL_PREFIX="@(InstallationPrefix)" \ -DCMAKE_PREFIX_PATH="@(InstallationPrefix)" \ $(BUILD_TESTING_ARG) diff --git a/bloom/generators/debian/templates/cmake/rules.em b/bloom/generators/debian/templates/cmake/rules.em index 284a0714..362e915b 100755 --- a/bloom/generators/debian/templates/cmake/rules.em +++ b/bloom/generators/debian/templates/cmake/rules.em @@ -33,9 +33,11 @@ override_dh_auto_configure: # In case we're installing to a non-standard location, look for a setup.sh # in the install tree and source it. It will set things like # CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH. +@[if RosDistro == 1] # CMAKE_INSTALL_LIBDIR is set for packages that use GNUInstallDirs.@[end if] if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi && \ dh_auto_configure -- \ -DCMAKE_INSTALL_PREFIX="@(InstallationPrefix)" \ +@[if RosDistro == 1] -DCMAKE_INSTALL_LIBDIR="lib" \@[end if] -DCMAKE_PREFIX_PATH="@(InstallationPrefix)" \ $(BUILD_TESTING_ARG)