|
| 1 | +%bcond_without tests |
| 2 | +%bcond_without weak_deps |
| 3 | + |
| 4 | +%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') |
| 5 | +%global __provides_exclude_from ^@(InstallationPrefix)/.*$ |
| 6 | +%global __requires_exclude_from ^@(InstallationPrefix)/.*$ |
| 7 | + |
| 8 | +Name: @(Package) |
| 9 | +Version: @(Version) |
| 10 | +Release: @(RPMInc)%{?dist}%{?release_suffix} |
| 11 | +Summary: ROS @(Name) package |
| 12 | + |
| 13 | +License: @(License) |
| 14 | +@[if Homepage and Homepage != '']URL: @(Homepage)@\n@[end if]@ |
| 15 | +Source0: %{name}-%{version}.tar.gz |
| 16 | +@[if NoArch]@\nBuildArch: noarch@\n@[end if]@ |
| 17 | + |
| 18 | +@[for p in Depends]Requires: @p@\n@[end for]@ |
| 19 | +@[for p in BuildDepends]BuildRequires: @p@\n@[end for]@ |
| 20 | +@[for p in Conflicts]Conflicts: @p@\n@[end for]@ |
| 21 | +@[for p in Replaces]Obsoletes: @p@\n@[end for]@ |
| 22 | +@[for p in Provides]Provides: @p@\n@[end for]@ |
| 23 | +@[if TestDepends]@\n%if 0%{?with_tests} |
| 24 | +@[for p in TestDepends]BuildRequires: @p@\n@[end for]@ |
| 25 | +%endif@\n@[end if]@ |
| 26 | +@[if Supplements]@\n%if 0%{?with_weak_deps} |
| 27 | +@[for p in Supplements]Supplements: @p@\n@[end for]@ |
| 28 | +%endif@\n@[end if]@ |
| 29 | + |
| 30 | +%description |
| 31 | +@(Description) |
| 32 | + |
| 33 | +%prep |
| 34 | +%autosetup -p1 |
| 35 | + |
| 36 | +%build |
| 37 | +# In case we're installing to a non-standard location, look for a setup.sh |
| 38 | +# in the install tree and source it. It will set things like |
| 39 | +# CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH. |
| 40 | +if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi |
| 41 | +mkdir -p .obj-%{_target_platform} && cd .obj-%{_target_platform} |
| 42 | +%cmake3 \ |
| 43 | + -UINCLUDE_INSTALL_DIR \ |
| 44 | + -ULIB_INSTALL_DIR \ |
| 45 | + -USYSCONF_INSTALL_DIR \ |
| 46 | + -USHARE_INSTALL_PREFIX \ |
| 47 | + -ULIB_SUFFIX \ |
| 48 | + -DCMAKE_INSTALL_PREFIX="@(InstallationPrefix)" \ |
| 49 | + -DAMENT_PREFIX_PATH="@(InstallationPrefix)" \ |
| 50 | + -DCMAKE_PREFIX_PATH="@(InstallationPrefix)" \ |
| 51 | + -DSETUPTOOLS_DEB_LAYOUT=OFF \ |
| 52 | +%if !0%{?with_tests} |
| 53 | + -DBUILD_TESTING=OFF \ |
| 54 | +%endif |
| 55 | + .. |
| 56 | + |
| 57 | +%make_build |
| 58 | + |
| 59 | +%install |
| 60 | +# In case we're installing to a non-standard location, look for a setup.sh |
| 61 | +# in the install tree and source it. It will set things like |
| 62 | +# CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH. |
| 63 | +if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi |
| 64 | +%make_install -C .obj-%{_target_platform} |
| 65 | + |
| 66 | +%if 0%{?with_tests} |
| 67 | +%check |
| 68 | +# Look for a Makefile target with a name indicating that it runs tests |
| 69 | +TEST_TARGET=$(%__make -qp -C .obj-%{_target_platform} | sed "s/^\(test\|check\):.*/\\1/;t f;d;:f;q0") |
| 70 | +if [ -n "$TEST_TARGET" ]; then |
| 71 | +# In case we're installing to a non-standard location, look for a setup.sh |
| 72 | +# in the install tree and source it. It will set things like |
| 73 | +# CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH. |
| 74 | +if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi |
| 75 | +CTEST_OUTPUT_ON_FAILURE=1 \ |
| 76 | + %make_build -C .obj-%{_target_platform} $TEST_TARGET || echo "RPM TESTS FAILED" |
| 77 | +else echo "RPM TESTS SKIPPED"; fi |
| 78 | +%endif |
| 79 | + |
| 80 | +%files |
| 81 | +@[for lf in LicenseFiles]%license @lf@\n@[end for]@ |
| 82 | +@(InstallationPrefix) |
| 83 | + |
| 84 | +%changelog@ |
| 85 | +@[for change_version, (change_date, main_name, main_email) in changelogs] |
| 86 | +* @(change_date) @(main_name) <@(main_email)> - @(change_version) |
| 87 | +- Autogenerated by Bloom |
| 88 | +@[end for] |
0 commit comments