From 0abd45bba4f42cb6077f2632078616c037377b2a Mon Sep 17 00:00:00 2001 From: Sergey Cherevko Date: Thu, 22 Feb 2024 12:10:57 +0300 Subject: [PATCH] import gn-2077-2.20231220git5e19d2fb166f.el8 --- .gitignore | 1 + .gn.metadata | 1 + SOURCES/gn-0153d369-no-O3.patch | 14 ++ SOURCES/last_commit_position.h | 9 + SOURCES/update-version | 101 +++++++++ SPECS/gn.spec | 375 ++++++++++++++++++++++++++++++++ 6 files changed, 501 insertions(+) create mode 100644 .gitignore create mode 100644 .gn.metadata create mode 100644 SOURCES/gn-0153d369-no-O3.patch create mode 100644 SOURCES/last_commit_position.h create mode 100755 SOURCES/update-version create mode 100644 SPECS/gn.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3926b6b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/gn-5e19d2fb166f.tar.gz diff --git a/.gn.metadata b/.gn.metadata new file mode 100644 index 0000000..42090e5 --- /dev/null +++ b/.gn.metadata @@ -0,0 +1 @@ +cbc0c5402e1f2877b68b8770a68752f47551d1a2 SOURCES/gn-5e19d2fb166f.tar.gz diff --git a/SOURCES/gn-0153d369-no-O3.patch b/SOURCES/gn-0153d369-no-O3.patch new file mode 100644 index 0000000..13a4820 --- /dev/null +++ b/SOURCES/gn-0153d369-no-O3.patch @@ -0,0 +1,14 @@ +diff -Naur gn-0153d369bbccc908f4da4993b1ba82728055926a-original/build/gen.py gn-0153d369bbccc908f4da4993b1ba82728055926a/build/gen.py +--- gn-0153d369bbccc908f4da4993b1ba82728055926a-original/build/gen.py 2021-09-27 14:58:14.000000000 -0400 ++++ gn-0153d369bbccc908f4da4993b1ba82728055926a/build/gen.py 2021-09-27 15:59:42.330405195 -0400 +@@ -344,10 +344,8 @@ + cflags.extend(['-O0', '-g']) + else: + cflags.append('-DNDEBUG') +- cflags.append('-O3') + if options.no_strip: + cflags.append('-g') +- ldflags.append('-O3') + # Use -fdata-sections and -ffunction-sections to place each function + # or data item into its own section so --gc-sections can eliminate any + # unused functions and data items. diff --git a/SOURCES/last_commit_position.h b/SOURCES/last_commit_position.h new file mode 100644 index 0000000..1eb41de --- /dev/null +++ b/SOURCES/last_commit_position.h @@ -0,0 +1,9 @@ +// Generated by build/gen.py. + +#ifndef OUT_LAST_COMMIT_POSITION_H_ +#define OUT_LAST_COMMIT_POSITION_H_ + +#define LAST_COMMIT_POSITION_NUM 2077 +#define LAST_COMMIT_POSITION "2077 (5e19d2fb166f)" + +#endif // OUT_LAST_COMMIT_POSITION_H_ diff --git a/SOURCES/update-version b/SOURCES/update-version new file mode 100755 index 0000000..68ca726 --- /dev/null +++ b/SOURCES/update-version @@ -0,0 +1,101 @@ +#!/bin/sh +set -o errexit +set -o nounset + +REPO='https://gn.googlesource.com/gn' + +# Validate the argument +COMMIT='' +if [ "$#" = '1' ] +then + if echo "$1" | grep -E '^[[:xdigit:]]{40}$' >/dev/null + then + COMMIT="$1" + fi +elif [ "$#" = '0' ] +then + COMMIT='main' +fi +if [ -z "${COMMIT}" ] +then + cat 1>&2 <&2 </dev/null +then + check_equal_commits "${COMMIT}" +fi + +tmpd="$(mktemp -d)" +trap "rm -rf '${tmpd}'" INT TERM EXIT + +cd "${tmpd}" +git clone 'https://gn.googlesource.com/gn' +cd gn +if ! echo "${COMMIT}" | grep -E '^[[:xdigit:]]{40}$' >/dev/null +then + COMMIT="$(git rev-parse "${COMMIT}")" + check_equal_commits "${COMMIT}" +fi +git checkout "${COMMIT}" +python3 './build/gen.py' +cp -vp './out/last_commit_position.h' "${SRCDIR}/" + +cd "${SRCDIR}" + +# Modify the spec file +POSITION="$( + awk ' + $1 == "#define" && $2 == "LAST_COMMIT_POSITION_NUM" { + print $3; exit + }' 'last_commit_position.h' +)" + +sed -r -i \ + -e 's/(%global[[:blank:]]+commit[[:blank:]]+)[[:xdigit:]]{40}[[:blank:]]*$/\1'"${COMMIT}/" \ + -e 's/(%global[[:blank:]]+access[[:blank:]]+)[[:digit:]]{8}[[:blank:]]*$/\1'"$( + date -u '+%Y%m%d' + )/" \ + -e 's/(Version:[[:blank:]]+)[[:digit:]]+[[:blank:]]*$/\1'"${POSITION}/" \ + "${SPEC}" + +# Download the new tarball +spectool --get-files --directory "${SRCDIR}" "${SPEC}" + +# Update the local git repo and upload the new source tarball +fedpkg new-sources "$( + spectool --list-files "${SPEC}" | + grep -E '^Source0:' | + sed -r 's|.*/||' +)" +fedpkg commit -m "Update to version ${POSITION}" +git add 'last_commit_position.h' gn.spec + +# vim: tw=78 ts=2 sw=2 sts=2 et ai nojs diff --git a/SPECS/gn.spec b/SPECS/gn.spec new file mode 100644 index 0000000..53835b0 --- /dev/null +++ b/SPECS/gn.spec @@ -0,0 +1,375 @@ +## 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 +# distribution’s 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 +- Rebuilt for MSVSphere 8.9 + +* Wed Dec 20 2023 Benjamin A. Beasley - 2077-2.20231220git5e19d2fb166f +- Allow warnings in the build + +* Wed Dec 20 2023 Benjamin A. Beasley - 2077-1.20231220git5e19d2fb166f +- Update to version 2077 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1953-10.20211205gite0afadf7 +- Indicate dirs. in files list with trailing slashes + +* Wed Dec 20 2023 Benjamin A. Beasley - 1953-9.20211205gite0afadf7 +- Convert License to SPDX + +* Wed Dec 20 2023 Benjamin A. Beasley - 1953-8.20211205gite0afadf7 +- Add patch upstream status for gn-0153d369-no-O3.patch + +* Wed Dec 20 2023 Benjamin A. Beasley - 1953-5.20211205gite0afadf7 +- Improve handling of bundled ICU components + +* Wed Dec 20 2023 Benjamin A. Beasley - 1953-4.20211205gite0afadf7 +- BR emacs-common for RPM macros + +* Wed Dec 20 2023 Benjamin A. Beasley - 1953-3.20211205gite0afadf7 +- Drop even the emacs-nox BR + +* Wed Dec 20 2023 Benjamin A. Beasley - 1953-2.20211205gite0afadf7 +- BR emacs-nox instead of full emacs + +* Wed Dec 20 2023 Benjamin A. Beasley - 1953-1.20211205gite0afadf7 +- Update to version 1953 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1951-2.20211128gitb7903130 +- Drop BR on python3, redundant with python3-devel + +* Wed Dec 20 2023 Benjamin A. Beasley - 1951-1.20211128gitb7903130 +- Update to version 1951 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1945-1.20211119git4aa9bdfa +- Update to version 1945 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1944-1.20211116git18512455 +- Update to version 1944 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1943-2.20211107git90294ccd +- Drop “gcc cleanup” patch (finally upstreamed) + +* Wed Dec 20 2023 Benjamin A. Beasley - 1943-1.20211107git90294ccd +- Update to version 1943 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1942-1.20211102git8926696a +- Update to version 1942 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1939-2.20211018git693f9fb8 +- Use %%%%python3 macro instead of %%%%__python3 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1939-1.20211018git693f9fb8 +- Update to version 1939 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1938-3.20210927git0153d369 +- Reduce macro indirection in the spec file + +* Wed Dec 20 2023 Benjamin A. Beasley - 1938-2.20210927git0153d369 +- Correctly stop overriding optimization flags + +* Wed Dec 20 2023 Benjamin A. Beasley - 1938-1.20210927git0153d369 +- Update to version 1938 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1937-1.20210919gitde86ec41 +- Update to version 1937 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1936-1.20210911git07e2e1b9 +- Update to version 1936 (Fix typos in README.md) + +* Wed Dec 20 2023 Benjamin A. Beasley - 1935-1.20210906git46b572ce +- Update to version 1935 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1934-1.20210812git69ec4fca +- Update to version 1934 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1931-1.20210803giteea3906f +- Update to version 1931 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1929-2.20210720gitd565aa3e +- Drop workarounds for F32 and EPEL7 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1929-1.20210720gitd565aa3e +- Update to version 1929 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1924-1.20210708git24e2f7df +- Update to version 1924 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1921-1.20210627git4d207c94 +- Update to version 1921 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1920-2.20210623gitd924640c +- Stop overriding optimization flags + +* Wed Dec 20 2023 Benjamin A. Beasley - 1920-1.20210623gitd924640c +- Update to 1920 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1919-1.20210622gite9b84332 +- Update to version 1919 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1916-1.20210616gitd2dce752 +- Update to version 1916 + +* Wed Dec 20 2023 Benjamin A. Beasley - 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 - 1910-1.20210511git39a87c0b +- Update to version 1910 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1898-2.20210502git6771ce56 +- s/master/main/ (thanks, upstream!) + +* Wed Dec 20 2023 Benjamin A. Beasley - 1898-1.20210502git6771ce56 +- Update to version 1898 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1897-1.20210410gitdba01723 +- Update to version 1897 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1896-1.20210406gita95c8a3c +- Update to version 1896 + +* Wed Dec 20 2023 Benjamin A. Beasley - 1894-7.20210329gitb2e3d862 +- Do not use %%exclude for unpackaged files (RPM 4.17 compatibility) + +* Mon Sep 27 2021 Benjamin A. Beasley - 1894-6.20210329gitb2e3d862 +- Correctly stop overriding optimization flags + +* Mon Mar 29 2021 Benjamin A. Beasley - 1894-4.20210329gitb2e3d862 +- Update to version 1894 + +* Wed Mar 17 2021 Benjamin A. Beasley - 1893-3.20210314git64b3b940 +- Stop installing xemacs plugins + (https://fedoraproject.org/wiki/Changes/Deprecate_xemacs) + +* Wed Mar 17 2021 Benjamin A. Beasley - 1893-2.20210314git64b3b940 +- Improved source URL based on package review feedback + +* Mon Mar 1 2021 Benjamin A. Beasley - 1893-1.20210314git64b3b940 +- Update to version 1893 + +* Mon Mar 1 2021 Benjamin A. Beasley - 1891-1.20210127gitdfcbc6fe +- Update to version 1891 + +* Sun Jan 3 2021 Benjamin A. Beasley - 1884-1.20210127git94bda7cc +- Update to version 1884 + +* Sun Jan 3 2021 Benjamin A. Beasley - 1876-1.20210103git0d67e272 +- Update to version 1876 + +* Sat Dec 19 2020 Benjamin A. Beasley - 1875-1.20201219git4e260f1d +- Initial spec file +