Skip to content

Commit dd483c0

Browse files
add rpm meson template
1 parent 47de336 commit dd483c0

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

bloom/generators/rpm/generator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ def generate_substitutions_from_package(
281281
pass
282282
elif build_type == 'cmake':
283283
pass
284+
elif build_type == 'meson':
285+
pass
284286
elif build_type == 'ament_cmake':
285287
pass
286288
elif build_type == 'ament_python':
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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+
# override macro
38+
%define __meson_auto_features auto
39+
# In case we're installing to a non-standard location, look for a setup.sh
40+
# in the install tree and source it. It will set things like
41+
# CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH.
42+
if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi
43+
%meson
44+
%meson_build
45+
46+
%install
47+
# In case we're installing to a non-standard location, look for a setup.sh
48+
# in the install tree and source it. It will set things like
49+
# CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH.
50+
if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi
51+
%meson_install -C %{_target_platform}
52+
53+
%if 0%{?with_tests}
54+
%check
55+
# Look for a Makefile target with a name indicating that it runs tests
56+
TEST_TARGET=$(%__make -qp -C %{_target_platform} | sed "s/^\(test\|check\):.*/\\1/;t f;d;:f;q0")
57+
if [ -n "$TEST_TARGET" ]; then
58+
# In case we're installing to a non-standard location, look for a setup.sh
59+
# in the install tree and source it. It will set things like
60+
# CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH.
61+
if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi
62+
CTEST_OUTPUT_ON_FAILURE=1 \
63+
%meson_test -C %{_target_platform} $TEST_TARGET || echo "RPM TESTS FAILED"
64+
else echo "RPM TESTS SKIPPED"; fi
65+
%endif
66+
67+
%files
68+
@[for lf in LicenseFiles]%license @lf@\n@[end for]@
69+
@(InstallationPrefix)
70+
71+
%changelog@
72+
@[for change_version, (change_date, main_name, main_email) in changelogs]
73+
* @(change_date) @(main_name) <@(main_email)> - @(change_version)
74+
- Autogenerated by Bloom
75+
@[end for]

0 commit comments

Comments
 (0)