From Fedora Project Wiki
Guidelines for Meson
This document provides best-practices for usage of The Meson Build System in packaging RPMs for Fedora. Meson is a buildsystem like automake (it generates code for make) which can generate code for some of lower-level build systems, for example ninja. It's important to use %meson prefixed macro instead of %ninja, because backend could be easily changed.
BuildRequires
You MUST add following BuildRequires:
BuildRequires: meson
RPM Macros
%__meson
-- meson executable%_vpath_srcdir
-- source directory (NOTE: you can override it using %global, default:.
)%_vpath_builddir
-- build directory (NOTE: you can override it using %global, default:%{_target_platform}
)%meson
-- function which defines CFLAGS, LDFLAGS, etc. and calls %__meson with appropriate parameters (--libdir=%{_libdir} and such)%meson_build
-- alias for%ninja_build -C %{_vpath_builddir}
%meson_install
-- alias for%ninja_install -C %{_vpath_builddir}
%meson_test
-- alias for%ninja_test -C %{_vpath_builddir}
Example RPM spec file
%global _vpath_srcdir sdk/%{name}/projects/meson Name: angelscript Version: 2.31.1 Release: 1%{?dist} Summary: Flexible cross-platform scripting library License: zlib URL: http://www.angelcode.com/angelscript/ Source: %{url}sdk/files/%{name}_%{version}.zip BuildRequires: meson BuildRequires: gcc %package devel Summary: Development libraries and header files for %{name} Requires: %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} %description devel %{summary}. %prep %autosetup -c %build %meson %meson_build %install %meson_install %check %meson_test %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %{_libdir}/lib%{name}.so.* %files devel %{_libdir}/lib%{name}.so %{_includedir}/%{name}.h