From 8e4067f8b1c89ed780de4b4da0e123ef9495f587 Mon Sep 17 00:00:00 2001 From: tigro Date: Sat, 1 Jul 2023 15:17:46 +0300 Subject: [PATCH] import gn-1953-7.20211205gite0afadf7.el9 --- .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 | 351 ++++++++++++++++++++++++++++++++ 6 files changed, 477 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..c919d7d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/gn-e0afadf7.tar.gz diff --git a/.gn.metadata b/.gn.metadata new file mode 100644 index 0000000..cfbc7a4 --- /dev/null +++ b/.gn.metadata @@ -0,0 +1 @@ +286fc32e3e1b5ca6c6177fe7d49c0c01ae86df43 SOURCES/gn-e0afadf7.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..d71ef29 --- /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 1953 +#define LAST_COMMIT_POSITION "1953 (e0afadf7)" + +#endif // OUT_LAST_COMMIT_POSITION_H_ diff --git a/SOURCES/update-version b/SOURCES/update-version new file mode 100755 index 0000000..b9d74fe --- /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|.*/||' +)" +git add 'last_commit_position.h' gn.spec +fedpkg commit -m "Update to version ${POSITION}" + +# 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..e343a59 --- /dev/null +++ b/SPECS/gn.spec @@ -0,0 +1,351 @@ +## 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 +# distribution’s 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 +* Sat Jul 01 2023 Arkady L. Shane - 1953-7.20211205gite0afadf7 +- Rebuilt for MSVSphere 9.2 + +* Sun May 01 2022 Benjamin A. Beasley 1953-7.20211205gite0afadf7 +- Improve handling of bundled ICU components + +* Sun May 01 2022 Benjamin A. Beasley 1953-6.20211205gite0afadf7 +- Stop numbering patches + +* Sun May 01 2022 Benjamin A. Beasley 1953-5.20211205gite0afadf7 +- BR emacs-common for RPM macros + +* Sun May 01 2022 Benjamin A. Beasley 1953-4.20211205gite0afadf7 +- Drop even the emacs-nox BR + +* Sun May 01 2022 Benjamin A. Beasley 1953-3.20211205gite0afadf7 +- BR emacs-nox instead of full emacs + +* Mon Dec 06 2021 Benjamin A. Beasley 1953-2.20211205gite0afadf7 +- Disable HTML docs in EPEL9 for now + +* Sun Dec 05 2021 Benjamin A. Beasley 1953-1.20211205gite0afadf7 +- Update to version 1953 + +* Fri Dec 03 2021 Benjamin A. Beasley 1951-2.20211128gitb7903130 +- Drop BR on python3, redundant with python3-devel + +* Sun Nov 28 2021 Benjamin A. Beasley 1951-1.20211128gitb7903130 +- Update to version 1951 + +* Fri Nov 19 2021 Benjamin A. Beasley 1945-1.20211119git4aa9bdfa +- Update to version 1945 + +* Tue Nov 16 2021 Benjamin A. Beasley 1944-1.20211116git18512455 +- Update to version 1944 + +* Sun Nov 07 2021 Benjamin A. Beasley 1943-2.20211107git90294ccd +- Drop “gcc cleanup” patch (finally upstreamed) + +* Sun Nov 07 2021 Benjamin A. Beasley 1943-1.20211107git90294ccd +- Update to version 1943 + +* Tue Nov 02 2021 Benjamin A. Beasley 1942-1.20211102git8926696a +- Update to version 1942 + +* Mon Oct 25 2021 Benjamin A. Beasley 1939-2.20211018git693f9fb8 +- Use %%python3 macro instead of %%__python3 + +* Mon Oct 18 2021 Benjamin A. Beasley 1939-1.20211018git693f9fb8 +- Update to version 1939 + +* Mon Sep 27 2021 Benjamin A. Beasley 1938-3.20210927git0153d369 +- Reduce macro indirection in the spec file + +* Mon Sep 27 2021 Benjamin A. Beasley 1938-2.20210927git0153d369 +- Correctly stop overriding optimization flags + +* Mon Sep 27 2021 Benjamin A. Beasley 1938-1.20210927git0153d369 +- Update to version 1938 + +* Sun Sep 19 2021 Benjamin A. Beasley 1937-1.20210919gitde86ec41 +- Update to version 1937 + +* Sat Sep 11 2021 Benjamin A. Beasley 1936-1.20210911git07e2e1b9 +- Update to version 1936 (Fix typos in README.md) + +* Mon Sep 06 2021 Benjamin A. Beasley 1935-1.20210906git46b572ce +- Update to version 1935 + +* Thu Aug 12 2021 Benjamin A. Beasley 1934-1.20210812git69ec4fca +- Update to version 1934 + +* Tue Aug 03 2021 Benjamin A. Beasley 1931-1.20210803giteea3906f +- Update to version 1931 + +* Thu Jul 22 2021 Fedora Release Engineering 1929-3.20210720gitd565aa3e +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Tue Jul 20 2021 Benjamin A. Beasley 1929-2.20210720gitd565aa3e +- Drop workarounds for F32 and EPEL + +* Tue Jul 20 2021 Benjamin A. Beasley 1929-1.20210720gitd565aa3e +- Update to version 1929 + +* Thu Jul 08 2021 Benjamin A. Beasley - 1924-1.20210708git24e2f7df +- Update to version 1924 + +* Sun Jun 27 2021 Benjamin A. Beasley - 1921-1.20210627git4d207c94 +- Update to version 1921 + +* Wed Jun 23 2021 Benjamin A. Beasley - 1920-1.20210623gitd924640c +- Update to version 1920 +- Stop overriding optimization flags + +* Tue Jun 22 2021 Benjamin A. Beasley - 1919-1.20210622gite9b84332 +- Update to version 1919 + +* Wed Jun 16 2021 Benjamin A. Beasley - 1916-1.20210616gitd2dce752 +- Update to version 1916 + +* Tue May 11 2021 Benjamin A. Beasley - 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 - 1910-1.20210511git39a87c0b +- Update to version 1910 + +* Sun May 02 2021 Benjamin A. Beasley - 1898-1.20210502git6771ce56 +- Update to version 1898 + +* Sat Apr 10 2021 Benjamin A. Beasley - 1897-1.20210410gitdba01723 +- Update to version 1897 + +* Tue Apr 06 2021 Benjamin A. Beasley - 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 - 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 +