Name:           ninja
Version:        1.11.1
Release:        1%{?_dist_release}
Summary:        A small build system with a focus on speed
Summary(ja):    スピードを重視した小さなビルドシステム
Group:          programming
Vendor:         Project Vine
Distribution:   Vine Linux

License:        ASL 2.0
URL:            https://ninja-build.org/
Source0:        https://github.com/martine/ninja/archive/v%{version}.tar.gz#/ninja-%{version}.tar.gz
Source1:        macros.ninja
Source2:        ninja.vim

BuildRequires:  asciidoc
BuildRequires:  gtest-devel
BuildRequires:  python3-rpm-macros
BuildRequires:  python3-devel
BuildRequires:  re2c >= 0.11.3

%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 vim
Summary:     macros and syntax files of ninja for vim
Summary(ja): VIM用のninjaマクロ・文法ファイル
Group:       programming
Requires:    vim-common

%description vim
 This package contains macros and syntax files of ninja for vim.


%debug_package


%prep
%setup -qn ninja-%{version}


%build
CFLAGS="%{optflags}" LDFLAGS="%{?__global_ldflags}" \
%{__python3} configure.py --bootstrap --verbose
./ninja -v manual
./ninja -v ninja_test


%install
# TODO: Install ninja_syntax.py?
mkdir -p %{buildroot}/{%{_bindir},%{_datadir}/bash-completion/completions,%{_datadir}/emacs/site-lisp,%{_datadir}/vim/vimfiles/syntax,%{_datadir}/vim/vimfiles/ftdetect,%{_datadir}/zsh/site-functions}

install -pm755 ninja %{buildroot}%{_bindir}/ninja
ln -sf ninja %{buildroot}%{_bindir}/ninja-build
install -pm644 misc/bash-completion %{buildroot}%{_datadir}/bash-completion/completions/ninja-bash-completion
install -pm644 misc/ninja-mode.el %{buildroot}%{_datadir}/emacs/site-lisp/ninja-mode.el
install -pm644 misc/ninja.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax/ninja.vim
install -pm644 %{SOURCE2} %{buildroot}%{_datadir}/vim/vimfiles/ftdetect/ninja.vim
install -pm644 misc/zsh-completion %{buildroot}%{_datadir}/zsh/site-functions/_ninja

install -Dpm644 %{SOURCE1} %{buildroot}%{_rpmmacrodir}/macros.ninja


%check
# workaround possible too low default limits
ulimit -n 4096 && ulimit -u 4096
./ninja_test


%files
%license COPYING
%doc README.md doc/manual.html
%{_rpmmacrodir}/macros.ninja
%{_bindir}/ninja
%{_bindir}/ninja-build
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/ninja-bash-completion
%{_datadir}/emacs/site-lisp/ninja-mode.el
# zsh does not have a -filesystem package
%{_datadir}/zsh/

%files vim
%{_datadir}/vim/vimfiles/syntax/ninja.vim
%{_datadir}/vim/vimfiles/ftdetect/ninja.vim


%changelog
* Wed Aug 31 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.11.1-1
- new upstream release.

* Mon May 16 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.11.0-1
- new upstream release.

* Wed Mar 24 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.10.2-1
- new upstream release.

* Sun Apr 19 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.10.0-1
- new upstream release.

* Mon Sep 18 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.7.2-1
- updated to 1.7.2.
- added rpmmacros.
- added a subpackage ninja-vim.

* Thu Jun 30 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.7.1-1
- updated to 1.7.1.

* Mon Jan 18 2016 Daisuke SUZUKI <daisuke@vinelinux.org> 1.6.0-1
- update to 1.6.0
- remove R: vim, emacsen
  (TODO: vim or el should be splitted to subpackage)
- add ninja-build symlink to compatible with other rpm distros.

* Thu Jun 12 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.4.0-1
- initial build for Vine Linux

* Wed Nov 20 2013 Ben Boeckel <mathstuf@gmail.com> - 1.4.0-1
- Update to 1.4.0

* Sun Nov  3 2013 Ville Skyttä <ville.skytta@iki.fi> - 1.3.4-4
- Use special %%doc to install all docs (#994005).

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Fri Jun 21 2013 Dan Horák <dan[at]danny.cz> - 1.3.4-2
- workaround possible too low limits for number of processes and open files,
  fixes build on ppc/ppc64 and s390(x)

* Sun Jun 09 2013 Ben Boeckel <mathstuf@gmail.com> - 1.3.4-1
- Update to 1.3.4
- Run test suite

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Sun Nov 04 2012 Ben Boeckel <mathstuf@gmail.com> - 1.0.0-1
- Update to 1.0.0

* Thu Jul 19 2012 Ben Boeckel <mathstuf@gmail.com> - 0-0.6.20120719git5dc55a3
- Update to new snapshot

* Mon Jul 09 2012 Ben Boeckel <mathstuf@gmail.com> - 0-0.5.20120709gitb90d038
- Preserve timestamps on install
- Install as ninja-build to avoid conflicts with the ninja IRC package
- Update snapshot

* Tue Jun 19 2012 Ben Boeckel <mathstuf@gmail.com> - 0-0.4.20120605git54553d3
- Add an ftdetect file for ninja
- Fix zsh-stuff directory ownership

* Thu Jun 07 2012 Ben Boeckel <mathstuf@gmail.com> - 0-0.3.20120605git54553d3
- Add a Group tag

* Tue Jun 05 2012 Ben Boeckel <mathstuf@gmail.com> - 0-0.2.20120605git54553d3
- Update to new snapshot

* Fri Mar 30 2012 Ben Boeckel <mathstuf@gmail.com> - 0-0.1.20120330gitabd33d5
- Initial package
