From Fedora Project Wiki
Line 1: Line 1:
= Guidelines for Meson =
= Guidelines for Meson =


This document provides best-practices for usage of [http://mesonbuild.com/ 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 low-level buildsystems, primary one is [https://ninja-build.org/ ninja] (but you should not care since macro does everything for you).
This document provides best-practices for usage of [http://mesonbuild.com/ 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 [https://ninja-build.org/ ninja]. It's important to use %meson prefixed macro instead of %ninja, because backend could be easily changed.


== BuildRequires ==
== BuildRequires ==

Revision as of 17:35, 15 December 2016

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_srcedir -- 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}
Idea.png
For more information see source code
%{rpmmacrodir}/macros.meson (/usr/lib/rpm/macros.d/macros.meson)

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

%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