From Fedora Project Wiki
(One intermediate revision by the same user not shown)
Line 14: Line 14:
  
 
* <code>%__meson</code> -- meson executable
 
* <code>%__meson</code> -- meson executable
* <code>%__sourcedir</code> -- source directory ('''NOTE''': you can override it using <tt>%global</tt>, default: <code>.</code>)
+
* <code>%_vpath_srcedir</code> -- source directory ('''NOTE''': you can override it using <tt>%global</tt>, default: <code>.</code>)
* <code>%__builddir</code> -- build directory ('''NOTE''': you can override it using <tt>%global</tt>, default: <code>%{_target_platform}</code>)
+
* <code>%_vpath_builddir</code> -- build directory ('''NOTE''': you can override it using <tt>%global</tt>, default: <code>%{_target_platform}</code>)
* <code>%__meson_ninja_opts</code> -- options which will be passed to ninja
 
 
* <code>%meson</code> -- function which defines CFLAGS, LDFLAGS, etc. and calls %__meson with appropriate parameters (<tt>--libdir=%{_libdir}</tt> and such)
 
* <code>%meson</code> -- function which defines CFLAGS, LDFLAGS, etc. and calls %__meson with appropriate parameters (<tt>--libdir=%{_libdir}</tt> and such)
 
* <code>%meson_build</code> -- alias for <code>%ninja_build -C %{__builddir}</code>
 
* <code>%meson_build</code> -- alias for <code>%ninja_build -C %{__builddir}</code>
Line 27: Line 26:
  
 
<pre>
 
<pre>
%global __sourcedir sdk/%{name}/projects/meson
+
%global _vpath_srcdir sdk/%{name}/projects/meson
  
 
Name:          angelscript
 
Name:          angelscript

Revision as of 16:31, 13 December 2016

Guidelines for Meson

This document provides best-practices for usage of ninja in packaging RPMs for Fedora.

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 %{__builddir}
  • %meson_install -- alias for %ninja_install -C %{__builddir}
  • %meson_test -- alias for %ninja_test -C %{__builddir}
Idea.png
For more information see source code
%{rpmmacrodir}/macros.ninja (/usr/lib/rpm/macros.d/macros.ninja)

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