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/SPECS/gn.spec

376 lines
13 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.3.5)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 2;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec
# 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
# 7. Commit the changes
#
# See https://gn.googlesource.com/gn/+log for the latest changes.
%global commit 5e19d2fb166fbd4f6f32147fbb2f497091a54ad8
%global access 20231220
%global shortcommit %(c='%{commit}'; echo "${c:0:12}")
Version: 2077
Release: %autorelease -s %{access}git%{shortcommit}
Summary: Meta-build system that generates build files for Ninja
# 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.
#
# 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:
# gdb -ex 'set pagination off' -ex 'info sources' gn | grep -F gn_test.cc
License: BSD-3-Clause AND Unicode AND ICU
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; not sent upstream because this is
# intentional on their part
Patch0: 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
# We need to set CC and CXX explicitly before Fedora 33, including on the EPELs.
CC='gcc'; export CC
CXX='g++'; export CXX
AR='gcc-ar'; export AR
%set_build_flags
# Treating warnings as errors is too strict for downstream builds.
#
# 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 \
--allow-warnings \
--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
* Thu Feb 22 2024 Sergey Cherevko <s.cherevko@msvsphere-os.ru>
- Rebuilt for MSVSphere 8.9
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 2077-2.20231220git5e19d2fb166f
- Allow warnings in the build
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 2077-1.20231220git5e19d2fb166f
- Update to version 2077
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1953-10.20211205gite0afadf7
- Indicate dirs. in files list with trailing slashes
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1953-9.20211205gite0afadf7
- Convert License to SPDX
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1953-8.20211205gite0afadf7
- Add patch upstream status for gn-0153d369-no-O3.patch
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1953-5.20211205gite0afadf7
- Improve handling of bundled ICU components
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1953-4.20211205gite0afadf7
- BR emacs-common for RPM macros
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1953-3.20211205gite0afadf7
- Drop even the emacs-nox BR
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1953-2.20211205gite0afadf7
- BR emacs-nox instead of full emacs
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1953-1.20211205gite0afadf7
- Update to version 1953
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1951-2.20211128gitb7903130
- Drop BR on python3, redundant with python3-devel
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1951-1.20211128gitb7903130
- Update to version 1951
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1945-1.20211119git4aa9bdfa
- Update to version 1945
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1944-1.20211116git18512455
- Update to version 1944
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1943-2.20211107git90294ccd
- Drop “gcc cleanup” patch (finally upstreamed)
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1943-1.20211107git90294ccd
- Update to version 1943
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1942-1.20211102git8926696a
- Update to version 1942
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1939-2.20211018git693f9fb8
- Use %%%%python3 macro instead of %%%%__python3
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1939-1.20211018git693f9fb8
- Update to version 1939
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1938-3.20210927git0153d369
- Reduce macro indirection in the spec file
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1938-2.20210927git0153d369
- Correctly stop overriding optimization flags
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1938-1.20210927git0153d369
- Update to version 1938
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1937-1.20210919gitde86ec41
- Update to version 1937
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1936-1.20210911git07e2e1b9
- Update to version 1936 (Fix typos in README.md)
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1935-1.20210906git46b572ce
- Update to version 1935
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1934-1.20210812git69ec4fca
- Update to version 1934
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1931-1.20210803giteea3906f
- Update to version 1931
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1929-2.20210720gitd565aa3e
- Drop workarounds for F32 and EPEL7
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1929-1.20210720gitd565aa3e
- Update to version 1929
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1924-1.20210708git24e2f7df
- Update to version 1924
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1921-1.20210627git4d207c94
- Update to version 1921
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1920-2.20210623gitd924640c
- Stop overriding optimization flags
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1920-1.20210623gitd924640c
- Update to 1920
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1919-1.20210622gite9b84332
- Update to version 1919
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1916-1.20210616gitd2dce752
- Update to version 1916
* Wed Dec 20 2023 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
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1910-1.20210511git39a87c0b
- Update to version 1910
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1898-2.20210502git6771ce56
- s/master/main/ (thanks, upstream!)
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1898-1.20210502git6771ce56
- Update to version 1898
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1897-1.20210410gitdba01723
- Update to version 1897
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1896-1.20210406gita95c8a3c
- Update to version 1896
* Wed Dec 20 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1894-7.20210329gitb2e3d862
- Do not use %%exclude for unpackaged files (RPM 4.17 compatibility)
* Mon Sep 27 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1894-6.20210329gitb2e3d862
- Correctly stop overriding optimization flags
* 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