File ninja.spec of Package ninja

%define realname ninja
%define realver  1.11.1
%define srcext   tar.gz

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

%if 0%{?rhel} >= 8
%define python /usr/libexec/platform-python
%else
%define python %{_bindir}/python3
%endif

# Common info
Name:          %{realname}
Version:       %{realver}
Release:       %{?extraver:0.}1%{?dist}
License:       Apache-2.0
Group:         Development/Tools/Building
URL:           https://ninja-build.org/
Summary:       A small build system with a focus on speed

# Build-time parameters
%if 0%{?rhel} >= 8
BuildRequires: platform-python
%else
BuildRequires: python3%{?suse_version:-base}
%endif
BuildRequires: gcc-c++
BuildRequires: asciidoc libxslt%{?suse_version:-tools}
BuildRequires: doxygen
BuildRoot:     %{_tmppath}/%{name}-root
Source:        https://codeload.github.com/ninja-build/ninja/%{srcext}/refs/tags/v%{realver}#/%{realname}-%{realver}%{?extraver}.%{srcext}

%description
Ninja is a small build system with a focus on speed. It differs from other build
systems in two major respects: it is designed to have its input files generated
by a higher-level build system, and it is designed to run builds as fast
as possible.

%package doc
Group:         Documentation/HTML
Summary:       Documentation for ninja build tool
BuildArch:     noarch

%description doc
HTML documentation for ninja build tool.

%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
%__sed -ri '1 s|^#!/usr/bin/env python.*|#!%{python}|' configure.py

%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags} %{?cxx11abi}"
export LDFLAGS="-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,now -Wl,-z,relro"
%if 0%{?rhel} >= 8
%{__sed} -ri '1 s|^.+$|#!%{_libexecdir}/platform-python|' configure.py
%endif
./configure.py --bootstrap
./ninja manual
./ninja doxygen

%install
%{__install} -D -m0755 ninja %{buildroot}%{_bindir}/ninja

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%doc COPYING README.md doc/manual.html
%{_bindir}/*

%files doc
%defattr(-,root,root)
%doc doc/doxygen/html/*.html doc/doxygen/html/*.png doc/doxygen/html/*.css
%if 0%{?suse_version} || 0%{?rhel} >= 7
%doc doc/doxygen/html/*.js
%endif

%changelog
openSUSE Build Service is sponsored by