Initial package

epel8
Benjamin A. Beasley 4 years ago
parent af3b7dfc34
commit 4e3126d81c

1
.gitignore vendored

@ -0,0 +1 @@
/64b3b9401c1c3ed5f3c43c1cac00b91f83597ab8.tar.gz

@ -0,0 +1,45 @@
diff -up chromium-84.0.4147.105/tools/gn/src/gn/err.h.gn-gcc-cleanup chromium-84.0.4147.105/tools/gn/src/gn/err.h
--- chromium-84.0.4147.105/tools/gn/src/gn/err.h.gn-gcc-cleanup 2020-08-01 10:04:57.354719575 -0400
+++ chromium-84.0.4147.105/tools/gn/src/gn/err.h 2020-08-01 10:04:51.653974728 -0400
@@ -55,7 +55,7 @@ class Err {
const std::string& help_text = std::string());
Err(const Err& other);
-
+ Err& operator=(const Err& other) = default;
~Err();
bool has_error() const { return has_error_; }
diff -up chromium-84.0.4147.105/tools/gn/src/gn/label_pattern.h.gn-gcc-cleanup chromium-84.0.4147.105/tools/gn/src/gn/label_pattern.h
--- chromium-84.0.4147.105/tools/gn/src/gn/label_pattern.h.gn-gcc-cleanup 2020-08-01 10:24:18.405934036 -0400
+++ chromium-84.0.4147.105/tools/gn/src/gn/label_pattern.h 2020-08-01 10:24:56.664265755 -0400
@@ -33,6 +33,7 @@ class LabelPattern {
const std::string_view& name,
const Label& toolchain_label);
LabelPattern(const LabelPattern& other);
+ LabelPattern& operator=(const LabelPattern& other) = default;
~LabelPattern();
// Converts the given input string to a pattern. This does special stuff
diff -up chromium-84.0.4147.105/tools/gn/src/gn/substitution_list.h.gn-gcc-cleanup chromium-84.0.4147.105/tools/gn/src/gn/substitution_list.h
--- chromium-84.0.4147.105/tools/gn/src/gn/substitution_list.h.gn-gcc-cleanup 2020-08-01 10:04:51.721971684 -0400
+++ chromium-84.0.4147.105/tools/gn/src/gn/substitution_list.h 2020-08-01 10:04:51.765969715 -0400
@@ -15,6 +15,7 @@ class SubstitutionList {
public:
SubstitutionList();
SubstitutionList(const SubstitutionList& other);
+ SubstitutionList& operator=(const SubstitutionList& other) = default;
~SubstitutionList();
bool Parse(const Value& value, Err* err);
diff -up chromium-84.0.4147.105/tools/gn/src/gn/substitution_pattern.h.gn-gcc-cleanup chromium-84.0.4147.105/tools/gn/src/gn/substitution_pattern.h
--- chromium-84.0.4147.105/tools/gn/src/gn/substitution_pattern.h.gn-gcc-cleanup 2020-08-01 10:04:51.637975444 -0400
+++ chromium-84.0.4147.105/tools/gn/src/gn/substitution_pattern.h 2020-08-01 10:04:57.305721767 -0400
@@ -35,6 +35,7 @@ class SubstitutionPattern {
SubstitutionPattern();
SubstitutionPattern(const SubstitutionPattern& other);
+ SubstitutionPattern& operator=(const SubstitutionPattern& other) = default;
~SubstitutionPattern();
// Parses the given string and fills in the pattern. The pattern must only

@ -0,0 +1,215 @@
# 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
%global commit 64b3b9401c1c3ed5f3c43c1cac00b91f83597ab8
%global access 20210314
%global shortcommit %(echo %{commit} | cut -b -8)
Version: 1893
Release: 1.%{access}git%{shortcommit}%{?dist}
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://%{name}.googlesource.com/%{name}
Source0: %{url}/+archive/%{commit}.tar.gz
# Generated using script update-version:
Source1: last_commit_position.h
Source2: update-version
# Clean up compiler warnings on gcc/g++:
Patch0: https://src.fedoraproject.org/rpms/chromium/raw/ce30313f5e4af121140c037bf026453355534f24/f/chromium-84.0.4147.105-gn-gcc-cleanup.patch
# The python3_pkgversion macro is required for EPEL; see
# https://fedoraproject.org/wiki/PackagingDrafts:Python3EPEL. On Fedora (and
# EPEL8) it simply expands to “3”.
BuildRequires: python%{python3_pkgversion}
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: ninja-build
BuildRequires: gcc-c++
BuildRequires: /usr/bin/pathfix.py
%if %{with html_docs}
BuildRequires: pandoc
BuildRequires: parallel
%endif
BuildRequires: help2man
Requires: vim-filesystem
Requires: python%{python3_pkgversion}
Provides: vim-%{name} = %{version}-%{release}
BuildRequires: emacs
Requires: emacs-filesystem >= %{_emacs_version}
Provides: emacs-%{name} = %{version}-%{release}
BuildRequires: xemacs
Requires: xemacs-filesystem >= %{_xemacs_version}
Provides: xemacs-%{name} = %{version}-%{release}
%description
GN is a meta-build system that generates build files for Ninja.
%package doc
Summary: Documentation for GN
BuildArch: noarch
%description doc
The %{name}-doc package contains detailed documentation for GN.
%prep
%autosetup -c -n %{name}-%{commit} -p3
# 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 .
# On EPEL7, we would have to work around the missing py3_shebang_fix macro, but
# the package would not build anyway because it requires C++17 support.
%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
# 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="%{name} $(./out/%{name} --version)" \
--no-info \
./out/%{name} |
# 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/%{name}.1
%install
install -d '%{buildroot}%{_bindir}'
install -t '%{buildroot}%{_bindir}' -p out/%{name}
install -d '%{buildroot}%{_datadir}/vim/vimfiles'
cp -vrp misc/vim/* '%{buildroot}%{_datadir}/vim/vimfiles'
%py_byte_compile %{__python3} '%{buildroot}%{_datadir}/vim/vimfiles/%{name}-format.py'
for dir in '%{_emacs_sitestartdir}' '%{_xemacs_sitestartdir}'
do
install -d "%{buildroot}${dir}"
install -t "%{buildroot}${dir}" -p -m 0644 misc/emacs/*.el
done
install -d '%{buildroot}%{_mandir}/man1'
install -t '%{buildroot}%{_mandir}/man1' -m 0644 -p out/%{name}.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}/%{name}
%{_mandir}/man1/%{name}.1*
%exclude %{_datadir}/vim/vimfiles/README.*
%{_datadir}/vim/vimfiles/%{name}-format.py
%{_datadir}/vim/vimfiles/autoload/%{name}.vim
%{_datadir}/vim/vimfiles/ftdetect/%{name}filetype.vim
%{_datadir}/vim/vimfiles/ftplugin/%{name}.vim
%{_datadir}/vim/vimfiles/syntax/%{name}.vim
%{_emacs_sitestartdir}/%{name}-mode.el
%{_xemacs_sitestartdir}/%{name}-mode.el
%files doc
%license LICENSE
%doc AUTHORS
%doc OWNERS
%doc README*.md
%if %{with html_docs}
%doc README*.html
%endif
%doc docs
%doc examples
%doc infra
%doc tools
%changelog
* 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

@ -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 1893
#define LAST_COMMIT_POSITION "1893 (64b3b940)"
#endif // OUT_LAST_COMMIT_POSITION_H_

@ -0,0 +1 @@
SHA512 (64b3b9401c1c3ed5f3c43c1cac00b91f83597ab8.tar.gz) = 982cf5f89b00c07a5cd15ff4535bc209bb6329657dd1506e64333565b0b464ae68094160f8fe7da85695bcf7ed8cf2b520c56c9c4b93cc93faa6a8f65cdc4666

@ -0,0 +1,79 @@
#!/bin/sh
set -o errexit
set -o nounset
set -o xtrace
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='master'
fi
if [ -z "${COMMIT}" ]
then
cat 1>&2 <<EOF
Usage: $0 [COMMIT]
Parameters:
COMMIT - full commit hash from upstream git (${REPO});
otherwise the latest commit in master is used
EOF
exit 1
fi
# Generate the version header
SRCDIR="$(cd "$(dirname "$0")"; pwd)"
SPEC="${SRCDIR}/gn.spec"
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}")"
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
git add 'last_commit_position.h' gn.spec
fedpkg new-sources "$(
spectool --list-files "${SPEC}" |
grep -E '^Source0:' |
sed -r 's|.*/||'
)"
# vim: tw=78 ts=2 sw=2 sts=2 et ai nojs
Loading…
Cancel
Save