From Fedora Project Wiki

(Cleanup as promised in https://fedorahosted.org/fpc/ticket/655)
(Outdated page.)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:Fedora Packaging Guidelines for Meson}}
{{DISPLAYTITLE:Fedora Packaging Guidelines for Meson}}
<div style="float: right; margin-left: 0.5em" class="toclimit-2">__TOC__</div>
<div style="float: right; margin-left: 0.5em" class="toclimit-2">__TOC__</div>
{{admon/warning | This is an old copy of a packaging guideline, preserved here in the wiki while we complete the transition to the Fedora documentation system.  The current version is located at https://docs.fedoraproject.org/en-US/packaging-guidelines/Meson/ .  Please update your bookmarks.}}


This document provides best practices for the usage of [http://mesonbuild.com/ the Meson build system] in Fedora packages. Meson is a build system (similar to automake) which can generate code for other lower-level build systems.  For example, it can generate code for [https://ninja-build.org/ ninja].  When packaging software which builds using Meson it's important to use the <code>%meson</code> macros instead of <code>%ninja</code> or other lower-level build system macros directly.  The backend used by Meson could change.
This document provides best practices for the usage of [http://mesonbuild.com/ the Meson build system] in Fedora packages. Meson is a build system (similar to automake) which can generate code for other lower-level build systems.  For example, it can generate code for [https://ninja-build.org/ ninja].  When packaging software which builds using Meson it's important to use the <code>%meson</code> macros instead of <code>%ninja</code> or other lower-level build system macros directly.  The backend used by Meson could change.
Line 17: Line 20:


;<code>%meson</code>
;<code>%meson</code>
: Defines CFLAGS, LDFLAGS, etc. and calls %__meson with appropriate parameters (<tt>--libdir=%{_libdir}</tt> and such)
: Defines CFLAGS, LDFLAGS, etc. and calls %__meson with appropriate parameters (<tt>--libdir=%{_libdir}</tt> and such). You can pass <tt>-Doption=value</tt> to this macro in order to set options for the buildsystem.
;<code>%meson_build</code>
;<code>%meson_build</code>
: An alias for <code>%ninja_build -C %{_vpath_builddir}</code>
: An alias for <code>%ninja_build -C %{_vpath_builddir}</code>
Line 83: Line 86:
%{_includedir}/%{name}.h
%{_includedir}/%{name}.h
</pre>
</pre>
[[Category:Packaging guidelines]]

Latest revision as of 20:49, 8 November 2018

Warning.png
This is an old copy of a packaging guideline, preserved here in the wiki while we complete the transition to the Fedora documentation system. The current version is located at https://docs.fedoraproject.org/en-US/packaging-guidelines/Meson/ . Please update your bookmarks.


This document provides best practices for the usage of the Meson build system in Fedora packages. Meson is a build system (similar to automake) which can generate code for other lower-level build systems. For example, it can generate code for ninja. When packaging software which builds using Meson it's important to use the %meson macros instead of %ninja or other lower-level build system macros directly. The backend used by Meson could change.

Build Dependencies

You MUST add following BuildRequires:

BuildRequires: meson

Available Macros

You will generally make use of these in your specs:

%meson
Defines CFLAGS, LDFLAGS, etc. and calls %__meson with appropriate parameters (--libdir=%{_libdir} and such). You can pass -Doption=value to this macro in order to set options for the buildsystem.
%meson_build
An alias for %ninja_build -C %{_vpath_builddir}
%meson_install
An alias for %ninja_install -C %{_vpath_builddir}
%meson_test
An alias for %ninja_test -C %{_vpath_builddir}

It is rarely necessary (but permissible) to use or alter these:

%_vpath_srcdir
Path (relative to the build directory) where the sources to be built are located (default: .)
%_vpath_builddir
Path (relative to the build directory) where the The build directory (default: %{_target_platform})
%__meson
The path to the meson executable
Idea.png
For more information see the source
%{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
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