From c5043054117220de7c192b2ad6944d55052f7289 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Fri, 18 Nov 2022 19:05:06 +0100 Subject: [PATCH 1/3] fix missing whitespace --- bloom/generators/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bloom/generators/README.md b/bloom/generators/README.md index 181d998b..90b17cb0 100644 --- a/bloom/generators/README.md +++ b/bloom/generators/README.md @@ -12,4 +12,4 @@ Bloom now supports different build types by inspecting the `build_type` tag in p Templates for a build type are stored in subdirectories of the platform's templates directory named for the build type. As an example the templates for the `ament_cmake` build type for debian packages is stored in [bloom/generators/debian/templates/ament_cmake](debian/templates/ament_cmake). -To add support for a new build type create a new templates subdirectory for it in your target platform's `templates` directory, and add any necessary supporting code to the generator for build type specific substitutions.For examples search for "Build-type specific substitutions" in [bloom/generators/debian/generator.py](debian/generator.py). +To add support for a new build type create a new templates subdirectory for it in your target platform's `templates` directory, and add any necessary supporting code to the generator for build type specific substitutions. For examples search for "Build-type specific substitutions" in [bloom/generators/debian/generator.py](debian/generator.py). From 07872a8dff49afd27efc039f9ca401b3b51ac1d1 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Fri, 18 Nov 2022 19:07:18 +0100 Subject: [PATCH 2/3] add debian meson template --- bloom/generators/debian/generator.py | 2 + .../debian/templates/meson/changelog.em | 7 +++ .../debian/templates/meson/compat.em | 1 + .../debian/templates/meson/control.em | 14 +++++ .../debian/templates/meson/copyright.em | 11 ++++ .../debian/templates/meson/gbp.conf.em | 3 ++ .../debian/templates/meson/rules.em | 52 +++++++++++++++++++ .../debian/templates/meson/source/format.em | 1 + .../debian/templates/meson/source/options.em | 6 +++ 9 files changed, 97 insertions(+) create mode 100644 bloom/generators/debian/templates/meson/changelog.em create mode 100644 bloom/generators/debian/templates/meson/compat.em create mode 100644 bloom/generators/debian/templates/meson/control.em create mode 100644 bloom/generators/debian/templates/meson/copyright.em create mode 100644 bloom/generators/debian/templates/meson/gbp.conf.em create mode 100755 bloom/generators/debian/templates/meson/rules.em create mode 100644 bloom/generators/debian/templates/meson/source/format.em create mode 100644 bloom/generators/debian/templates/meson/source/options.em diff --git a/bloom/generators/debian/generator.py b/bloom/generators/debian/generator.py index e78c08b8..c1abe493 100644 --- a/bloom/generators/debian/generator.py +++ b/bloom/generators/debian/generator.py @@ -389,6 +389,8 @@ def generate_substitutions_from_package( pass elif build_type == 'cmake': pass + elif build_type == 'meson': + pass elif build_type == 'ament_cmake': pass elif build_type == 'ament_python': diff --git a/bloom/generators/debian/templates/meson/changelog.em b/bloom/generators/debian/templates/meson/changelog.em new file mode 100644 index 00000000..35859090 --- /dev/null +++ b/bloom/generators/debian/templates/meson/changelog.em @@ -0,0 +1,7 @@ +@[for change_version, change_date, changelog, main_name, main_email in changelogs]@(Package) (@(change_version)@(DebianInc)@(Distribution)) @(Distribution); urgency=high + +@(changelog) + + -- @(main_name) <@(main_email)> @(change_date) + +@[end for] diff --git a/bloom/generators/debian/templates/meson/compat.em b/bloom/generators/debian/templates/meson/compat.em new file mode 100644 index 00000000..7a87216d --- /dev/null +++ b/bloom/generators/debian/templates/meson/compat.em @@ -0,0 +1 @@ +@(debhelper_version) diff --git a/bloom/generators/debian/templates/meson/control.em b/bloom/generators/debian/templates/meson/control.em new file mode 100644 index 00000000..1b0f263d --- /dev/null +++ b/bloom/generators/debian/templates/meson/control.em @@ -0,0 +1,14 @@ +Source: @(Package) +Section: misc +Priority: optional +Maintainer: @(Maintainer) +Build-Depends: debhelper (>= @(debhelper_version).0.0), @(', '.join(BuildDepends)) +Homepage: @(Homepage) +Standards-Version: 4.6.0 + +Package: @(Package) +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, @(', '.join(Depends)) +@[if Conflicts]Conflicts: @(', '.join(Conflicts))@\n@[end if]@ +@[if Replaces]Replaces: @(', '.join(Replaces))@\n@[end if]@ +Description: @(Description) diff --git a/bloom/generators/debian/templates/meson/copyright.em b/bloom/generators/debian/templates/meson/copyright.em new file mode 100644 index 00000000..bc82fd5d --- /dev/null +++ b/bloom/generators/debian/templates/meson/copyright.em @@ -0,0 +1,11 @@ +Format: Bloom subset of https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: @(Name) +@[if BugTracker]Upstream-Contact: @(BugTracker)@\n@[end if]@ +@[if Source]Source: @(Source)@\n@[end if]@ +@[for License, Text in Licenses]@ + +Files: See file headers in repository for details +Copyright: See package copyright in source code for details +License: @(License) + @(Text) +@[end for]@ diff --git a/bloom/generators/debian/templates/meson/gbp.conf.em b/bloom/generators/debian/templates/meson/gbp.conf.em new file mode 100644 index 00000000..ad24a164 --- /dev/null +++ b/bloom/generators/debian/templates/meson/gbp.conf.em @@ -0,0 +1,3 @@ +[git-buildpackage] +upstream-tag=@(release_tag) +upstream-tree=tag diff --git a/bloom/generators/debian/templates/meson/rules.em b/bloom/generators/debian/templates/meson/rules.em new file mode 100755 index 00000000..f19cc754 --- /dev/null +++ b/bloom/generators/debian/templates/meson/rules.em @@ -0,0 +1,52 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 +# TODO: remove the LDFLAGS override. It's here to avoid esoteric problems +# of this sort: +# https://code.ros.org/trac/ros/ticket/2977 +# https://code.ros.org/trac/ros/ticket/3842 +export LDFLAGS= +export PKG_CONFIG_PATH=@(InstallationPrefix)/lib/pkgconfig +# Explicitly enable -DNDEBUG, see: +# https://github.com/ros-infrastructure/bloom/issues/327 +export DEB_CXXFLAGS_MAINT_APPEND=-DNDEBUG + +# Solve shlibdeps errors in REP136 packages that use GNUInstallDirs: +export DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) + +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) + +%: + dh $@@ -v --buildsystem=meson --builddirectory=.obj-$(DEB_HOST_GNU_TYPE) + +override_dh_auto_configure: + if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi && \ + dh_auto_configure -- \ + --prefix="@(InstallationPrefix)" \ + --cmake-prefix-path="@(InstallationPrefix)" \ + --libdir=lib \ + --libexecdir=lib + +override_dh_auto_build: + if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi && \ + dh_auto_build + +override_dh_auto_test: + echo -- Running tests. Even if one of them fails the build is not canceled. + if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi && \ + dh_auto_test || true + +override_dh_shlibdeps: + if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi && \ + dh_shlibdeps -l$(CURDIR)/debian/@(Package)/@(InstallationPrefix)/lib/:$(CURDIR)/debian/@(Package)/@(InstallationPrefix)/lib/${DEB_HOST_MULTIARCH} + +override_dh_auto_install: + if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi && \ + dh_auto_install diff --git a/bloom/generators/debian/templates/meson/source/format.em b/bloom/generators/debian/templates/meson/source/format.em new file mode 100644 index 00000000..9666bf41 --- /dev/null +++ b/bloom/generators/debian/templates/meson/source/format.em @@ -0,0 +1 @@ +3.0 (@(format)) diff --git a/bloom/generators/debian/templates/meson/source/options.em b/bloom/generators/debian/templates/meson/source/options.em new file mode 100644 index 00000000..8c4c78b0 --- /dev/null +++ b/bloom/generators/debian/templates/meson/source/options.em @@ -0,0 +1,6 @@ +@[if format and format == 'quilt']@ +# Automatically add upstream changes to the quilt overlay. +# http://manpages.ubuntu.com/manpages/trusty/man1/dpkg-source.1.html +# This supports reusing the orig.tar.gz for debian increments. +auto-commit +@[end if] From 434f77faf0c210d1da2e151e922fa71b59e3471c Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Sun, 22 Jan 2023 14:30:26 +0100 Subject: [PATCH 3/3] add rpm meson template --- bloom/generators/rpm/generator.py | 2 + .../rpm/templates/meson/template.spec.em | 80 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 bloom/generators/rpm/templates/meson/template.spec.em diff --git a/bloom/generators/rpm/generator.py b/bloom/generators/rpm/generator.py index 6b7194c4..5424d90d 100644 --- a/bloom/generators/rpm/generator.py +++ b/bloom/generators/rpm/generator.py @@ -276,6 +276,8 @@ def generate_substitutions_from_package( pass elif build_type == 'cmake': pass + elif build_type == 'meson': + pass elif build_type == 'ament_cmake': pass elif build_type == 'ament_python': diff --git a/bloom/generators/rpm/templates/meson/template.spec.em b/bloom/generators/rpm/templates/meson/template.spec.em new file mode 100644 index 00000000..07bd1e94 --- /dev/null +++ b/bloom/generators/rpm/templates/meson/template.spec.em @@ -0,0 +1,80 @@ +%bcond_without tests +%bcond_without weak_deps + +%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') +%global __provides_exclude_from ^@(InstallationPrefix)/.*$ +%global __requires_exclude_from ^@(InstallationPrefix)/.*$ + +Name: @(Package) +Version: @(Version) +Release: @(RPMInc)%{?dist}%{?release_suffix} +Summary: ROS @(Name) package + +License: @(License) +@[if Homepage and Homepage != '']URL: @(Homepage)@\n@[end if]@ +Source0: %{name}-%{version}.tar.gz +@[if NoArch]@\nBuildArch: noarch@\n@[end if]@ + +@[for p in Depends]Requires: @p@\n@[end for]@ +@[for p in BuildDepends]BuildRequires: @p@\n@[end for]@ +@[for p in Conflicts]Conflicts: @p@\n@[end for]@ +@[for p in Replaces]Obsoletes: @p@\n@[end for]@ +@[for p in Provides]Provides: @p@\n@[end for]@ +@[if TestDepends]@\n%if 0%{?with_tests} +@[for p in TestDepends]BuildRequires: @p@\n@[end for]@ +%endif@\n@[end if]@ +@[if Supplements]@\n%if 0%{?with_weak_deps} +@[for p in Supplements]Supplements: @p@\n@[end for]@ +%endif@\n@[end if]@ + +%description +@(Description) + +%prep +%autosetup -p1 + +%build +# override macro +%define __meson_auto_features auto +# 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 "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi +# call meson executable instead of using the 'meson' macro to use default paths +%__meson setup \ + --prefix="@(InstallationPrefix)" \ + --cmake-prefix-path="@(InstallationPrefix)" \ + --libdir=lib \ + --libexecdir=lib \ + %{_vpath_builddir} +%meson_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 "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi +%meson_install + +%if 0%{?with_tests} +%check +# Look for a Makefile target with a name indicating that it runs tests +TEST_TARGET=$(%__ninja -C %{_vpath_builddir} -t targets | 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 "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi +%meson_test || echo "RPM TESTS FAILED" +else echo "RPM TESTS SKIPPED"; fi +%endif + +%files +@[for lf in LicenseFiles]%license @lf@\n@[end for]@ +@(InstallationPrefix) + +%changelog@ +@[for change_version, (change_date, main_name, main_email) in changelogs] +* @(change_date) @(main_name) <@(main_email)> - @(change_version) +- Autogenerated by Bloom +@[end for]