From Fedora Project Wiki

Guidelines for Ninja

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

BuildRequires

You MUST add following BuildRequires:

BuildRequires: ninja-build

RPM Macros

  • %__ninja -- ninja executable (NOTE: it is /usr/bin/ninja-build)
  • %__ninja_common_opts -- common options for all commands below (for example, verbose mode and %{?_smp_mflags})
  • %ninja_build -- run default target (ninja without arugments)
  • %ninja_install -- set DESTDIR shell variable run install target within ninja
  • %ninja_test -- run test target
Custom commands
Usually it's enough to use macro above (e.g. %ninja_build vapigen -C %{_target_platform}, but if you need something more custom, don't forget to inherit %__ninja_common_opts.
For more information see source code
%{rpmmacrodir}/macros.ninja (/usr/lib/rpm/macros.d/macros.ninja)