You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gn/gn.spec

349 lines
12 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

## START: Set by rpmautospec
## (rpmautospec version 0.2.5)
%define autorelease(e:s:pb:) %{?-p:0.}%{lua:
release_number = 7;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{?dist}
## END: Set by rpmautospec
# Build HTML docs from markdown using pandoc?
# Currently, neither pandoc nor parallel is available in EPEL9.
%bcond_with 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
# 7. Commit the changes
#
# See https://gn.googlesource.com/gn/+log for the latest changes.
%global commit e0afadf7a743d5b14737bd454df45d5f1caf0d23
%global access 20211205
%global shortcommit %(echo %{commit} | cut -b -8)
Version: 1953
Release: %autorelease -s %{access}git%{shortcommit}
Summary: Meta-build system that generates build files for Ninja
# BSD except for src/base/third_party/icu/, which is (Unicode and MIT); note
# that the “ICU License” is MIT,
# https://fedoraproject.org/wiki/Licensing:MIT#Modern_style_.28ICU_Variant.29
#
# Note that src/util/test/gn_test.cc, which is licensed ASL 2.0, does not
# contribute to the installed RPM, only to the gn_unittests executable; you may
# verify this with:
# gdb -ex 'set pagination off' -ex 'info sources' gn | grep -F gn_test.cc
License: BSD and Unicode and MIT
URL: https://gn.googlesource.com/gn
Source0: %{url}/+archive/%{commit}.tar.gz#/gn-%{shortcommit}.tar.gz
# Generated using script update-version:
Source1: last_commit_position.h
Source2: update-version
# Stop overriding optimization flags
Patch: gn-0153d369-no-O3.patch
BuildRequires: python3-devel
BuildRequires: ninja-build
BuildRequires: gcc-c++
# For RPM macros:
BuildRequires: emacs-common
%if %{with html_docs}
BuildRequires: pandoc
BuildRequires: parallel
%endif
BuildRequires: help2man
Requires: vim-filesystem
Requires: python3
Provides: vim-gn = %{version}-%{release}
Requires: emacs-filesystem >= %{_emacs_version}
Provides: emacs-gn = %{version}-%{release}
# 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
%description
GN is a meta-build system that generates build files for Ninja.
%package doc
Summary: Documentation for GN
BuildArch: noarch
%description doc
The gn-doc package contains detailed documentation for GN.
%prep
%autosetup -c -n gn-%{commit} -p1
# 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
# distributions build flags.
%{python3} build/gen.py \
--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}' \
--version-string="gn $(./out/gn --version)" \
--no-info \
./out/gn |
# 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/' \
-e 's/\[([^]]+)\]/\\fI[\1]\\fR/g' > out/gn.1
%install
install -t '%{buildroot}%{_bindir}' -D -p out/gn
install -d '%{buildroot}%{_datadir}/vim/vimfiles'
cp -vrp misc/vim/* '%{buildroot}%{_datadir}/vim/vimfiles'
find '%{buildroot}%{_datadir}/vim/vimfiles' \
-type f -name 'README.*' -print -delete
%py_byte_compile %{python3} '%{buildroot}%{_datadir}/vim/vimfiles/gn-format.py'
install -t '%{buildroot}%{_emacs_sitestartdir}' -D -p -m 0644 misc/emacs/*.el
install -t '%{buildroot}%{_mandir}/man1' -D -m 0644 -p out/gn.1
%check
out/gn_unittests
# Verify consistency of the version header with the spec file
grep -E '^#define[[:blank:]]+LAST_COMMIT_POSITION_NUM[[:blank:]]+'\
'%{version}[[:blank:]]*' \
'out/last_commit_position.h' >/dev/null
grep -E '^#define[[:blank:]]+LAST_COMMIT_POSITION[[:blank:]]+'\
'"%{version} \(%{shortcommit}\)"[[:blank:]]*' \
'out/last_commit_position.h' >/dev/null
%files
%license LICENSE
%{_bindir}/gn
%{_mandir}/man1/gn.1*
%{_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
%{_emacs_sitestartdir}/gn-mode.el
%files doc
%license LICENSE src/base/third_party/icu/README.chromium
%doc AUTHORS
%doc OWNERS
%doc README*.md
%if %{with html_docs}
%doc README*.html
%endif
%doc docs
%doc examples
%doc infra
%doc tools
%changelog
* Sun May 01 2022 Benjamin A. Beasley <code@musicinmybrain.net> 1953-7.20211205gite0afadf7
- Improve handling of bundled ICU components
* Sun May 01 2022 Benjamin A. Beasley <code@musicinmybrain.net> 1953-6.20211205gite0afadf7
- Stop numbering patches
* Sun May 01 2022 Benjamin A. Beasley <code@musicinmybrain.net> 1953-5.20211205gite0afadf7
- BR emacs-common for RPM macros
* Sun May 01 2022 Benjamin A. Beasley <code@musicinmybrain.net> 1953-4.20211205gite0afadf7
- Drop even the emacs-nox BR
* Sun May 01 2022 Benjamin A. Beasley <code@musicinmybrain.net> 1953-3.20211205gite0afadf7
- BR emacs-nox instead of full emacs
* Mon Dec 06 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1953-2.20211205gite0afadf7
- Disable HTML docs in EPEL9 for now
* Sun Dec 05 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1953-1.20211205gite0afadf7
- Update to version 1953
* Fri Dec 03 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1951-2.20211128gitb7903130
- Drop BR on python3, redundant with python3-devel
* Sun Nov 28 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1951-1.20211128gitb7903130
- Update to version 1951
* Fri Nov 19 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1945-1.20211119git4aa9bdfa
- Update to version 1945
* Tue Nov 16 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1944-1.20211116git18512455
- Update to version 1944
* Sun Nov 07 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1943-2.20211107git90294ccd
- Drop “gcc cleanup” patch (finally upstreamed)
* Sun Nov 07 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1943-1.20211107git90294ccd
- Update to version 1943
* Tue Nov 02 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1942-1.20211102git8926696a
- Update to version 1942
* Mon Oct 25 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1939-2.20211018git693f9fb8
- Use %%python3 macro instead of %%__python3
* Mon Oct 18 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1939-1.20211018git693f9fb8
- Update to version 1939
* Mon Sep 27 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1938-3.20210927git0153d369
- Reduce macro indirection in the spec file
* Mon Sep 27 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1938-2.20210927git0153d369
- Correctly stop overriding optimization flags
* Mon Sep 27 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1938-1.20210927git0153d369
- Update to version 1938
* Sun Sep 19 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1937-1.20210919gitde86ec41
- Update to version 1937
* Sat Sep 11 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1936-1.20210911git07e2e1b9
- Update to version 1936 (Fix typos in README.md)
* Mon Sep 06 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1935-1.20210906git46b572ce
- Update to version 1935
* Thu Aug 12 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1934-1.20210812git69ec4fca
- Update to version 1934
* Tue Aug 03 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1931-1.20210803giteea3906f
- Update to version 1931
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> 1929-3.20210720gitd565aa3e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jul 20 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1929-2.20210720gitd565aa3e
- Drop workarounds for F32 and EPEL
* Tue Jul 20 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1929-1.20210720gitd565aa3e
- Update to version 1929
* Thu Jul 08 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1924-1.20210708git24e2f7df
- Update to version 1924
* Sun Jun 27 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1921-1.20210627git4d207c94
- Update to version 1921
* Wed Jun 23 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1920-1.20210623gitd924640c
- Update to version 1920
- Stop overriding optimization flags
* Tue Jun 22 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1919-1.20210622gite9b84332
- Update to version 1919
* Wed Jun 16 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1916-1.20210616gitd2dce752
- Update to version 1916
* Tue May 11 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1910-2.20210511git39a87c0b
- Rebase chromium-84.0.4147.105-gn-gcc-cleanup.patch as
gn-39a87c0b-gcc-cleanup.patch
* Tue May 11 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1910-1.20210511git39a87c0b
- Update to version 1910
* Sun May 02 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1898-1.20210502git6771ce56
- Update to version 1898
* Sat Apr 10 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1897-1.20210410gitdba01723
- Update to version 1897
* Tue Apr 06 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1896-1.20210406gita95c8a3c
- Update to version 1896
- Do not use %%exclude for unpackaged files (RPM 4.17 compatibility)
* Mon Mar 29 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1894-4.20210329gitb2e3d862
- Update to version 1894
* Wed Mar 17 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1893-3.20210314git64b3b940
- Stop installing xemacs plugins
(https://fedoraproject.org/wiki/Changes/Deprecate_xemacs)
* Wed Mar 17 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1893-2.20210314git64b3b940
- Improved source URL based on package review feedback
* Mon Mar 1 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1893-1.20210314git64b3b940
- Update to version 1893
* Mon Mar 1 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1891-1.20210127gitdfcbc6fe
- Update to version 1891
* Sun Jan 3 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1884-1.20210127git94bda7cc
- Update to version 1884
* Sun Jan 3 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1876-1.20210103git0d67e272
- Update to version 1876
* Sat Dec 19 2020 Benjamin A. Beasley <code@musicinmybrain.net> - 1875-1.20201219git4e260f1d
- Initial spec file