File rcl.spec of Package rcl

%bcond_without tests
%bcond_without weak_deps

%global reponame rcl
%global subreponame rcl

%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%global __provides_exclude_from ^/opt/ros2/.*$
%global __requires_exclude_from ^/opt/ros2/.*$

Name:           rcl
Version:        3.1.4
Release:        1%{?dist}%{?release_suffix}
Summary:        ROS rcl package

License:        Apache License 2.0
%if 0%{?commit:1}
Source0:        https://github.com/ros2/%{reponame}/archive/%{commit}/%{reponame}-%{commit}.tar.gz
%else
Source0:        https://github.com/ros2/%{reponame}/archive/%{version}/%{reponame}-%{version}.tar.gz
%endif
## FIXME: We should not need the yaml lib here ...
## rcl-yaml-param-parser should have everything we need
Source1:        Findyaml.cmake
##
Patch0:         rcl-move-tracetools-into-define-guard.patch

Requires:       rcl-interfaces
# TODO: Define a -logging package
# We should not directly need to require the interface,
# ... when the logger intself already requires the interface
Requires:       rcl-logging-interface
Requires:       rcl-logging-noop
##Recommends:     rcl-logging-spdlog
Requires:       rcl-yaml-param-parser
Requires:       rcutils
Requires:       rmw
Requires:       rmw-implementation
Requires:       rosidl-runtime-c
# TODO: Define a -devel package
# Add patch file with `#ifdef NO_TRACE_TOOLS`
# Add patch file to add `#define TRACETOOLS_TRACEPOINT(...) void(0)`
##Requires:       tracetools
Requires:       ros2-workspace
BuildRequires:  ament-cmake-ros
BuildRequires:  foonathan-memory-devel
##
BuildRequires:  libyaml-devel
##
BuildRequires:  rcl-interfaces
BuildRequires:  rcl-logging-interface
BuildRequires:  rcl-logging-noop
##BuildRequires:  rcl-logging-spdlog
BuildRequires:  rcl-yaml-param-parser
BuildRequires:  rcutils
BuildRequires:  rmw-implementation
BuildRequires:  rosidl-runtime-c
##BuildRequires:  tracetools
BuildRequires:  ros2-workspace

Provides:       %{name}-devel = %{version}-%{release}
Provides:       %{name}-doc = %{version}-%{release}
Provides:       %{name}-runtime = %{version}-%{release}

%if 0%{?with_tests:0}
BuildRequires:  ament-cmake-gtest
BuildRequires:  ament-lint-auto
BuildRequires:  ament-lint-common
BuildRequires:  launch
BuildRequires:  launch-testing
BuildRequires:  launch-testing-ament-cmake
BuildRequires:  mimick-vendor
BuildRequires:  osrf-testing-tools-cpp
BuildRequires:  rcl-yaml-param-parser
BuildRequires:  rcpputils
BuildRequires:  rmw
BuildRequires:  rmw-implementation-cmake
BuildRequires:  test-msgs
BuildRequires:  tracetools
%endif

%description
The ROS client library common implementation. This package contains an API which
builds on the ROS middleware API and is optionally built upon by the other ROS
client libraries.

%global debug_package %{nil}
%prep
%if 0%{?commit:1}
%autosetup -q -n %{subreponame}
%else
##cd %{reponame}-%{version}
#autosetup -p1 -n %{reponame}-%{version}/%{subreponame}
%setup -q -n %{reponame}-%{version}
%autopatch -p1
%endif

%build
%global yaml_module_path $(dirname %{SOURCE1})

# 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 [ -f "/opt/ros2/setup.sh" ]; then . "/opt/ros2/setup.sh"; fi
#mkdir -p .obj-%{_target_platform} && cd .obj-%{_target_platform}
## TODO: Make logging configurable, best make it selectable during runtime
%cmake3 \
    -UINCLUDE_INSTALL_DIR \
    -ULIB_INSTALL_DIR \
    -USYSCONF_INSTALL_DIR \
    -USHARE_INSTALL_PREFIX \
    -ULIB_SUFFIX \
    -DCMAKE_INSTALL_PREFIX="/opt/ros2" \
    -DCMAKE_MODULE_PATH=%{yaml_module_path} \
    -DAMENT_PREFIX_PATH="/opt/ros2" \
    -DCMAKE_PREFIX_PATH="/opt/ros2" \
    -DSETUPTOOLS_DEB_LAYOUT=OFF \
    -DRCL_LOGGING_IMPLEMENTATION=rcl_logging_noop \
    -DNO_TRACE_TOOLS="True" \
    -S %{subreponame} \
%if 0%{?with_tests:0}
%else
    -DBUILD_TESTING=OFF \
%endif

#make_build
%cmake3_build

%install
# 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 [ -f "/opt/ros2/setup.sh" ]; then . "/opt/ros2/setup.sh"; fi
%if 0%{?redhat} == 8 || 0%{?centos} == 8
%make_install -C obj-%{_target_platform}
%else
%cmake3_install
%endif

%if 0%{?with_tests:0}
%check
# Look for a Makefile target with a name indicating that it runs tests
TEST_TARGET=$(%__make -qp -C .obj-%{_target_platform} | sed "s/^\(test\|check\):.*/\\1/;t f;d;:f;q0")
if [ -n "$TEST_TARGET" ]; then
# 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 [ -f "/opt/ros2/setup.sh" ]; then . "/opt/ros2/setup.sh"; fi
CTEST_OUTPUT_ON_FAILURE=1 \
    %make_build -C .obj-%{_target_platform} $TEST_TARGET || echo "RPM TESTS FAILED"
else echo "RPM TESTS SKIPPED"; fi
%endif

%files
/opt/ros2

%changelog
* Fri Dec 02 2022 Ivan Paunovic <ivanpauno@ekumenlabs.com> - 3.1.4-1
- Autogenerated by Bloom

* Thu Apr 28 2022 Ivan Paunovic <ivanpauno@ekumenlabs.com> - 3.1.3-1
- Autogenerated by Bloom

* Mon Apr 26 2021 Ivan Paunovic <ivanpauno@ekumenlabs.com> - 3.1.2-1
- Autogenerated by Bloom

* Tue Apr 20 2021 Ivan Paunovic <ivanpauno@ekumenlabs.com> - 3.1.1-2
- Autogenerated by Bloom

* Mon Apr 12 2021 Ivan Paunovic <ivanpauno@ekumenlabs.com> - 3.1.1-1
- Autogenerated by Bloom

* Tue Apr 06 2021 Ivan Paunovic <ivanpauno@ekumenlabs.com> - 3.1.0-1
- Autogenerated by Bloom

* Thu Mar 25 2021 Ivan Paunovic <ivanpauno@ekumenlabs.com> - 3.0.1-1
- Autogenerated by Bloom

* Tue Mar 23 2021 Ivan Paunovic <ivanpauno@ekumenlabs.com> - 3.0.0-1
- Autogenerated by Bloom

* Thu Mar 18 2021 Ivan Paunovic <ivanpauno@ekumenlabs.com> - 2.6.0-1
- Autogenerated by Bloom

* Mon Mar 08 2021 Ivan Paunovic <ivanpauno@ekumenlabs.com> - 2.5.2-1
- Autogenerated by Bloom

openSUSE Build Service is sponsored by