2021-03-17 14:46:27 +00:00
|
|
|
|
# Build HTML docs from markdown using pandoc?
|
|
|
|
|
%bcond_without html_docs
|
|
|
|
|
|
|
|
|
|
Name: gn
|
|
|
|
|
# Upstream uses the number of commits in the git history as the version number.
|
|
|
|
|
# See gn --version, which outputs something like “1874 (2b683eff)”. The commit
|
|
|
|
|
# position and short commit hash in this string come from “git describe HEAD
|
|
|
|
|
# --match initial-commit”; see build/gen.py. This means that a complete git
|
|
|
|
|
# checkout is required to establish the version number; the information is not
|
|
|
|
|
# in the tarball! This is terribly inconvenient. See
|
|
|
|
|
# https://bugs.chromium.org/p/gn/issues/detail?id=3.
|
|
|
|
|
#
|
|
|
|
|
# As a result, it is necessary to use our custom update-version script,
|
|
|
|
|
# supplying the new full commit hash as the sole argument or providing no
|
|
|
|
|
# arguments to select the latest commit. This will:
|
|
|
|
|
# 1. Clone the git repository from the Internet (a substantial download)
|
|
|
|
|
# 2. Run build/gen.py to generate last_commit_position.h, the header with
|
|
|
|
|
# version information, and copy it into the same directory as the script
|
|
|
|
|
# 3. Modify the commit and access macros and the Version field in this spec
|
|
|
|
|
# file.
|
|
|
|
|
# 4. Download the source tarball (spectool -g)
|
|
|
|
|
# 5. Update the sources (fedpkg new-sources %%{commit}.tar.gz)
|
|
|
|
|
# 6. Stage all changes in git
|
2021-07-20 20:45:44 +00:00
|
|
|
|
# 7. Commit the changes
|
2021-06-22 19:54:51 +00:00
|
|
|
|
#
|
|
|
|
|
# See https://gn.googlesource.com/gn/+log for the latest changes.
|
2022-09-20 13:28:42 +00:00
|
|
|
|
%global commit cc28efe62ef0c2fb32455f414a29c4a55bb7fbc4
|
2022-07-14 15:23:51 +00:00
|
|
|
|
%global access 20220714
|
|
|
|
|
%global shortcommit %(echo '%{commit}' | cut -b -12)
|
2022-09-20 13:28:42 +00:00
|
|
|
|
%global position 2064
|
2022-05-01 13:55:48 +00:00
|
|
|
|
Version: %{position}^%{access}git%{shortcommit}
|
|
|
|
|
Release: %autorelease
|
2021-03-17 14:46:27 +00:00
|
|
|
|
Summary: Meta-build system that generates build files for Ninja
|
|
|
|
|
|
2022-08-03 19:15:43 +00:00
|
|
|
|
# The entire source is BSD-3-Clause, except:
|
|
|
|
|
# - src/base/third_party/icu/ is (Unicode AND ICU); see
|
|
|
|
|
# src/base/third_party/icu/LICENSE and also the header comment in
|
|
|
|
|
# src/base/third_party/icu/icu_utf.h.
|
2021-03-17 14:46:27 +00:00
|
|
|
|
#
|
2022-08-03 19:15:43 +00:00
|
|
|
|
# Note that src/util/test/gn_test.cc, which is licensed Apache-2.0, does not
|
|
|
|
|
# contribute to the binary RPMs, only to the gn_unittests executable, which is
|
|
|
|
|
# not installed; you may verify this with:
|
2021-03-17 14:46:27 +00:00
|
|
|
|
# gdb -ex 'set pagination off' -ex 'info sources' gn | grep -F gn_test.cc
|
2022-08-04 17:08:39 +00:00
|
|
|
|
License: BSD-3-Clause AND Unicode AND ICU
|
2021-09-27 20:02:41 +00:00
|
|
|
|
URL: https://gn.googlesource.com/gn
|
|
|
|
|
Source0: %{url}/+archive/%{commit}.tar.gz#/gn-%{shortcommit}.tar.gz
|
2021-03-17 14:46:27 +00:00
|
|
|
|
# Generated using script update-version:
|
|
|
|
|
Source1: last_commit_position.h
|
|
|
|
|
Source2: update-version
|
|
|
|
|
|
2022-05-02 20:30:40 +00:00
|
|
|
|
# Stop overriding optimization flags; not sent upstream because this is
|
|
|
|
|
# intentional on their part
|
2022-04-16 12:24:05 +00:00
|
|
|
|
Patch: gn-0153d369-no-O3.patch
|
2021-03-17 14:46:27 +00:00
|
|
|
|
|
2021-07-20 20:51:11 +00:00
|
|
|
|
BuildRequires: python3-devel
|
2021-03-17 14:46:27 +00:00
|
|
|
|
BuildRequires: ninja-build
|
|
|
|
|
BuildRequires: gcc-c++
|
|
|
|
|
|
2022-02-12 04:29:00 +00:00
|
|
|
|
# For RPM macros:
|
|
|
|
|
BuildRequires: emacs-common
|
|
|
|
|
|
2021-03-17 14:46:27 +00:00
|
|
|
|
%if %{with html_docs}
|
|
|
|
|
BuildRequires: pandoc
|
|
|
|
|
BuildRequires: parallel
|
|
|
|
|
%endif
|
|
|
|
|
BuildRequires: help2man
|
|
|
|
|
|
|
|
|
|
Requires: vim-filesystem
|
2021-07-20 20:51:11 +00:00
|
|
|
|
Requires: python3
|
2021-09-27 20:02:41 +00:00
|
|
|
|
Provides: vim-gn = %{version}-%{release}
|
2021-03-17 14:46:27 +00:00
|
|
|
|
|
|
|
|
|
Requires: emacs-filesystem >= %{_emacs_version}
|
2021-09-27 20:02:41 +00:00
|
|
|
|
Provides: emacs-gn = %{version}-%{release}
|
2021-03-17 14:46:27 +00:00
|
|
|
|
|
2022-04-30 12:45:02 +00:00
|
|
|
|
# src/base/third_party/icu/icu_utf.h:
|
|
|
|
|
#
|
|
|
|
|
# This file has the relevant components from ICU copied to handle basic
|
|
|
|
|
# UTF8/16/32 conversions. Components are copied from umachine.h, utf.h,
|
|
|
|
|
# utf8.h, and utf16.h into icu_utf.h.
|
|
|
|
|
#
|
|
|
|
|
# The forked, bundled ICU components are copied from Chromium. Because of the
|
|
|
|
|
# downstream changes (primarily, changing namespaces and symbol prefixes),
|
|
|
|
|
# there is no clear path to unbundling.
|
|
|
|
|
#
|
|
|
|
|
# See src/base/third_party/icu/README.chromium, from which the version number
|
|
|
|
|
# is taken.
|
|
|
|
|
Provides: bundled(icu) = 60
|
2021-03-17 14:46:27 +00:00
|
|
|
|
|
|
|
|
|
%description
|
|
|
|
|
GN is a meta-build system that generates build files for Ninja.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%package doc
|
|
|
|
|
Summary: Documentation for GN
|
|
|
|
|
BuildArch: noarch
|
|
|
|
|
|
|
|
|
|
%description doc
|
2021-09-27 20:02:41 +00:00
|
|
|
|
The gn-doc package contains detailed documentation for GN.
|
2021-03-17 14:46:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%prep
|
2021-09-27 20:02:41 +00:00
|
|
|
|
%autosetup -c -n gn-%{commit} -p1
|
2021-03-17 14:46:27 +00:00
|
|
|
|
|
|
|
|
|
# Use pre-generated last_commit_position.h.
|
|
|
|
|
mkdir -p ./out
|
|
|
|
|
cp -vp '%{SOURCE1}' ./out
|
|
|
|
|
|
|
|
|
|
# Copy and rename vim extensions readme for use in the main documentation
|
|
|
|
|
# directory.
|
|
|
|
|
cp -vp misc/vim/README.md README-vim.md
|
|
|
|
|
|
|
|
|
|
# Fix shebangs in examples and such.
|
|
|
|
|
%py3_shebang_fix .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%build
|
|
|
|
|
AR='gcc-ar'; export AR
|
|
|
|
|
%set_build_flags
|
|
|
|
|
# Both --use-icf and --use-lto add compiler flags that only work with clang++,
|
|
|
|
|
# not with g++. We do get LTO on Fedora anyway, since we respect the
|
|
|
|
|
# distribution’s build flags.
|
2021-10-25 22:18:46 +00:00
|
|
|
|
%{python3} build/gen.py \
|
2021-03-17 14:46:27 +00:00
|
|
|
|
--no-last-commit-position \
|
|
|
|
|
--no-strip \
|
|
|
|
|
--no-static-libstdc++
|
|
|
|
|
ninja -C out -v
|
|
|
|
|
|
|
|
|
|
%if %{with html_docs}
|
|
|
|
|
# There is a script, misc/help_as_html.py, that generates some HTML help, but
|
|
|
|
|
# pandoc does a better job and we can cover more Markdown sources.
|
|
|
|
|
find . -type f -name '*.md' | parallel -v pandoc -o '{.}.html' '{}'
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
help2man \
|
|
|
|
|
--name='%{summary}' \
|
2021-09-27 20:02:41 +00:00
|
|
|
|
--version-string="gn $(./out/gn --version)" \
|
2021-03-17 14:46:27 +00:00
|
|
|
|
--no-info \
|
2021-09-27 20:02:41 +00:00
|
|
|
|
./out/gn |
|
2021-03-17 14:46:27 +00:00
|
|
|
|
# Clean up a couple of stray binary bytes in the help output
|
|
|
|
|
tr -d '\302\240' |
|
|
|
|
|
# Format the entries within the sections as tagged paragraphs, and italicise
|
|
|
|
|
# [placeholders in square brackets].
|
|
|
|
|
sed -r -e 's/(^[[:alnum:]_]+:)/.TP\n.B \1\n/' \
|
2021-09-27 20:02:41 +00:00
|
|
|
|
-e 's/\[([^]]+)\]/\\fI[\1]\\fR/g' > out/gn.1
|
2021-03-17 14:46:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%install
|
2021-09-27 20:02:41 +00:00
|
|
|
|
install -t '%{buildroot}%{_bindir}' -D -p out/gn
|
2021-03-17 14:46:27 +00:00
|
|
|
|
|
|
|
|
|
install -d '%{buildroot}%{_datadir}/vim/vimfiles'
|
|
|
|
|
cp -vrp misc/vim/* '%{buildroot}%{_datadir}/vim/vimfiles'
|
2021-04-06 15:40:40 +00:00
|
|
|
|
find '%{buildroot}%{_datadir}/vim/vimfiles' \
|
2021-04-06 15:55:51 +00:00
|
|
|
|
-type f -name 'README.*' -print -delete
|
2021-10-25 22:18:46 +00:00
|
|
|
|
%py_byte_compile %{python3} '%{buildroot}%{_datadir}/vim/vimfiles/gn-format.py'
|
2021-03-17 14:46:27 +00:00
|
|
|
|
|
2021-07-20 20:51:11 +00:00
|
|
|
|
install -t '%{buildroot}%{_emacs_sitestartdir}' -D -p -m 0644 misc/emacs/*.el
|
2021-03-17 14:46:27 +00:00
|
|
|
|
|
2021-09-27 20:02:41 +00:00
|
|
|
|
install -t '%{buildroot}%{_mandir}/man1' -D -m 0644 -p out/gn.1
|
2021-03-17 14:46:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%check
|
|
|
|
|
out/gn_unittests
|
|
|
|
|
|
|
|
|
|
# Verify consistency of the version header with the spec file
|
|
|
|
|
grep -E '^#define[[:blank:]]+LAST_COMMIT_POSITION_NUM[[:blank:]]+'\
|
2022-05-01 13:55:48 +00:00
|
|
|
|
'%{position}[[:blank:]]*' \
|
2021-03-17 14:46:27 +00:00
|
|
|
|
'out/last_commit_position.h' >/dev/null
|
|
|
|
|
grep -E '^#define[[:blank:]]+LAST_COMMIT_POSITION[[:blank:]]+'\
|
2022-05-01 13:55:48 +00:00
|
|
|
|
'"%{position} \(%{shortcommit}\)"[[:blank:]]*' \
|
2021-03-17 14:46:27 +00:00
|
|
|
|
'out/last_commit_position.h' >/dev/null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%files
|
|
|
|
|
%license LICENSE
|
2021-09-27 20:02:41 +00:00
|
|
|
|
%{_bindir}/gn
|
2021-03-17 14:46:27 +00:00
|
|
|
|
|
2021-09-27 20:02:41 +00:00
|
|
|
|
%{_mandir}/man1/gn.1*
|
2021-03-17 14:46:27 +00:00
|
|
|
|
|
2021-09-27 20:02:41 +00:00
|
|
|
|
%{_datadir}/vim/vimfiles/gn-format.py
|
|
|
|
|
%{_datadir}/vim/vimfiles/autoload/gn.vim
|
|
|
|
|
%{_datadir}/vim/vimfiles/ftdetect/gnfiletype.vim
|
|
|
|
|
%{_datadir}/vim/vimfiles/ftplugin/gn.vim
|
|
|
|
|
%{_datadir}/vim/vimfiles/syntax/gn.vim
|
2021-03-17 14:46:27 +00:00
|
|
|
|
|
2021-09-27 20:02:41 +00:00
|
|
|
|
%{_emacs_sitestartdir}/gn-mode.el
|
2021-03-17 14:46:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%files doc
|
2022-04-30 12:45:02 +00:00
|
|
|
|
%license LICENSE src/base/third_party/icu/README.chromium
|
2021-03-17 14:46:27 +00:00
|
|
|
|
%doc AUTHORS
|
|
|
|
|
%doc OWNERS
|
|
|
|
|
%doc README*.md
|
|
|
|
|
%if %{with html_docs}
|
|
|
|
|
%doc README*.html
|
|
|
|
|
%endif
|
|
|
|
|
%doc docs
|
|
|
|
|
%doc examples
|
|
|
|
|
%doc infra
|
|
|
|
|
%doc tools
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%changelog
|
2021-07-20 20:45:44 +00:00
|
|
|
|
%autochangelog
|