Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save besser82/16a247d2236a6fd37059fee57b8d4453 to your computer and use it in GitHub Desktop.
Save besser82/16a247d2236a6fd37059fee57b8d4453 to your computer and use it in GitHub Desktop.
ninja-build.spec: [PATCH] Add conditional for bootstrapping new architectures
From b151dcbd6f7953e6ce75a484bf88bad2c5065155 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
Date: Wed, 5 Feb 2020 13:34:21 +0100
Subject: [PATCH] Add conditional for bootstrapping new architectures
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The libxcrypt package may change its build-system from autotools to
mesonbuild sometime in the near future. Thus we should be able to
build a bootstrap package for ninja-build with the smallest possible
build- and runtime-dependencies.
With bootstrap enabled the only build-dependency, except for a
working compiler-toolchain, will be re2c, and there will be no
runtime-depencies needed to install the ninja-build package.
Signed-off-by: Björn Esser <besser82@fedoraproject.org>
---
ninja-build.spec | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/ninja-build.spec b/ninja-build.spec
index ce695c3..4416b47 100644
--- a/ninja-build.spec
+++ b/ninja-build.spec
@@ -1,6 +1,10 @@
+# Set to bcond_without or use --with bootstrap,
+# when bootstrapping a new architecture.
+%bcond_with bootstrap
+
Name: ninja-build
Version: 1.9.0
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: Small build system with a focus on speed
License: ASL 2.0
URL: https://ninja-build.org/
@@ -13,11 +17,15 @@ BuildRequires: python2-devel
%else
BuildRequires: python3-devel
%endif
+%if %{without bootstrap}
BuildRequires: asciidoc
BuildRequires: gtest-devel
+%endif
BuildRequires: re2c >= 0.11.3
+%if %{without bootstrap}
Requires: emacs-filesystem
Requires: vim-filesystem
+%endif
%description
Ninja is a small build system with a focus on speed. It differs from other
@@ -37,16 +45,20 @@ CFLAGS="%{optflags}" LDFLAGS="%{?__global_ldflags}" \
%endif
configure.py --bootstrap --verbose
./ninja -v all
+%if %{without bootstrap}
./ninja -v manual
+%endif
%install
# TODO: Install ninja_syntax.py?
install -Dpm0755 ninja -t %{buildroot}%{_bindir}/
+%if %{without bootstrap}
install -Dpm0644 misc/bash-completion %{buildroot}%{_datadir}/bash-completion/completions/ninja
install -Dpm0644 misc/ninja-mode.el %{buildroot}%{_datadir}/emacs/site-lisp/ninja-mode.el
install -Dpm0644 misc/ninja.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax/ninja.vim
install -Dpm0644 %{S:1} %{buildroot}%{_datadir}/vim/vimfiles/ftdetect/ninja.vim
install -Dpm0644 misc/zsh-completion %{buildroot}%{_datadir}/zsh/site-functions/_ninja
+%endif
install -Dpm0644 %{S:2} %{buildroot}%{_rpmmacrodir}/macros.ninja
# Macro should not change when we are redefining bindir
@@ -54,23 +66,33 @@ sed -i -e "/^%%__ninja /s| .*$| %{_bindir}/ninja|" %{buildroot}%{_rpmmacrodir}/m
ln -s ninja %{buildroot}%{_bindir}/ninja-build
+%if %{without bootstrap}
%check
./ninja_test --gtest_filter=-SubprocessTest.SetWithLots
+%endif
%files
%license COPYING
-%doc HACKING.md README doc/manual.html
+%doc HACKING.md README
+%if %{without bootstrap}
+%doc doc/manual.html
+%endif
%{_bindir}/ninja
%{_bindir}/ninja-build
+%if %{without bootstrap}
%{_datadir}/bash-completion/completions/ninja
%{_datadir}/emacs/site-lisp/ninja-mode.el
%{_datadir}/vim/vimfiles/syntax/ninja.vim
%{_datadir}/vim/vimfiles/ftdetect/ninja.vim
# zsh does not have a -filesystem package
%{_datadir}/zsh/
+%endif
%{rpmmacrodir}/macros.ninja
%changelog
+* Wed Feb 05 2020 Björn Esser <besser82@fedoraproject.org> - 1.9.0-5
+- Add conditional for bootstrapping new architectures
+
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
--
2.24.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment