File rmw.spec of Package rmw

%bcond_without tests
%bcond_without weak_deps

%global reponame rmw
%global subreponame rmw

%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:           rmw
Version:        3.3.1
Release:        1%{?dist}%{?release_suffix}
Summary:        ROS rmw 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

Requires:       rcutils
Requires:       rosidl-runtime-c
Requires:       ros2-workspace
BuildRequires:  ament-cmake-ros
BuildRequires:  ament-cmake-version
## Python is not perfectly used int the build chain yet
BuildRequires:  python3-devel
BuildRequires:  ament-package
#
BuildRequires:  rcutils
BuildRequires:  rosidl-runtime-c
BuildRequires:  ros2-workspace
%if 0%{?with_tests:0}
BuildRequires:  ament-cmake-gmock
BuildRequires:  ament-lint-auto
BuildRequires:  ament-lint-common
BuildRequires:  osrf-testing-tools-cpp
%endif

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

%description
Contains the ROS middleware API.

%global debug_package %{nil}
%prep
%if 0%{?commit:1}
# TODO: This line seems to be not correct ...  it is need to have always the reponame
%autosetup -p1 -n %{subreponame}
%else
%autosetup -p1 -n %{reponame}-%{version}/%{subreponame}
%endif

%build
# Needed to bootstrap since the ros_workspace package does not yet exist.
export PYTHONPATH=/opt/ros2/lib/python%{python3_version}/site-packages

# 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/ros/setup.sh" ]; then . "/opt/ros/setup.sh"; fi
#mkdir -p .obj-%{_target_platform} && cd .obj-%{_target_platform}
%cmake3 \
    -UINCLUDE_INSTALL_DIR \
    -ULIB_INSTALL_DIR \
    -USYSCONF_INSTALL_DIR \
    -USHARE_INSTALL_PREFIX \
    -ULIB_SUFFIX \
    -DCMAKE_INSTALL_PREFIX="/opt/ros2" \
    -DAMENT_PREFIX_PATH="/opt/ros2" \
    -DCMAKE_PREFIX_PATH="/opt/ros2" \
    -DSETUPTOOLS_DEB_LAYOUT=OFF \
%if 0%{?with_tests:0}
%else
    -DBUILD_TESTING=OFF \
%endif
    ..

#make_build
%cmake3_build

%install
# Needed to bootstrap since the ros_workspace package does not yet exist.
export PYTHONPATH=/opt/ros2/lib/python%{python3_version}/site-packages

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

%if 0%{?with_tests}
%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
* Mon Apr 26 2021 Ivan Paunovic <ivanpauno@ekumenlabs.com> - 3.3.1-1
- Autogenerated by Bloom

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

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

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

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

openSUSE Build Service is sponsored by