.gear/0001-Fix-build-on-GCC13.patch | 37 +++++ .gear/ccache.spec | 169 +++++++++++++++++++++ .gear/rules | 4 + .../tags/f6b8f152a79052eb930c17eed7cb20e8c7892608 | 22 +++ .gear/tags/list | 1 + ccache.filetrigger | 5 + update-ccache-symlinks.py | 125 +++++++++++++++ 7 files changed, 363 insertions(+) diff --git a/.gear/0001-Fix-build-on-GCC13.patch b/.gear/0001-Fix-build-on-GCC13.patch new file mode 100644 index 00000000..4f6f813a --- /dev/null +++ b/.gear/0001-Fix-build-on-GCC13.patch @@ -0,0 +1,37 @@ +From b3e29911ab2cc0e6012fae8d937b33f19918b4a0 Mon Sep 17 00:00:00 2001 +From: Artyom Bystrov +Date: Tue, 11 Jul 2023 13:05:08 +0300 +Subject: [PATCH] Fix build on GCC13 + +--- + src/Stat.hpp | 1 + + src/util/TextTable.hpp | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/src/Stat.hpp b/src/Stat.hpp +index 2f56214a..c4196b4f 100644 +--- a/src/Stat.hpp ++++ b/src/Stat.hpp +@@ -25,6 +25,7 @@ + + #include + #include ++#include + + #ifdef _WIN32 + # ifndef S_IFIFO +diff --git a/src/util/TextTable.hpp b/src/util/TextTable.hpp +index 05c0e0e5..5c91865c 100644 +--- a/src/util/TextTable.hpp ++++ b/src/util/TextTable.hpp +@@ -20,6 +20,7 @@ + + #include + #include ++#include + + namespace util { + +-- +2.33.8 + diff --git a/.gear/ccache.spec b/.gear/ccache.spec new file mode 100644 index 00000000..196a4ab1 --- /dev/null +++ b/.gear/ccache.spec @@ -0,0 +1,169 @@ +%define _unpackaged_files_terminate_build 1 + +Name: ccache +Version: 4.6 +Release: alt3 + +Summary: Compiler cache +License: GPLv3+ +Group: Development/Tools + +Url: http://ccache.dev/ +# Source-git: https://github.com/ccache/ccache.git +Source: %name-%version.tar +Patch: %name-%version-alt.patch +Patch1: 0001-Fix-build-on-GCC13.patch + +BuildRequires: asciidoctor +BuildRequires: cmake +BuildRequires: gcc-c++ +BuildRequires: libhiredis-devel +BuildRequires: libzstd-devel +BuildRequires: rpm-build-python3 + +%description +ccache is a compiler cache. It acts as a caching pre-processor to +C/C++ compilers, using the -E compiler switch and a hash to detect +when a compilation can be satisfied from cache. This often results +in a 5 to 10 times speedup in common compilations. + +%prep +%setup +%patch -p1 +%patch1 -p1 + +%build +%cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo +%cmake_build + +%install +%cmakeinstall_std +mkdir -p -m755 %buildroot%prefix/lib/ccache +mkdir -p -m755 %buildroot%prefix/lib/rpm +mkdir -p -m755 %buildroot%_sbindir +install -p -m 0755 update-ccache-symlinks.py %buildroot%_sbindir/update-ccache-symlinks +install -p -m 0755 ccache.filetrigger %buildroot%prefix/lib/rpm + + +mkdir -p %buildroot%_sysconfdir/buildreqs/packages/ignore.d +cat > %buildroot%_sysconfdir/buildreqs/packages/ignore.d/%name << EOF +%name +EOF + +%files +%doc LICENSE.adoc README.md GPL-3.0.txt +%doc doc +%_man1dir/ccache.1* +%_bindir/ccache +%_sbindir/update-ccache-symlinks +%_sysconfdir/buildreqs/packages/ignore.d/* +# XXX: don't change this to %_lib, please! +%dir %prefix/lib/ccache +%prefix/lib/rpm/ccache.filetrigger + +%changelog +* Tue Jul 11 2023 Artyom Bystrov 4.6-alt3 +- Fix build on GCC13 + +* Sat Apr 22 2023 Vitaly Lipatov 4.6-alt2 +- ccache.filetrigger: replace egrep with grep -E + +* Wed Mar 23 2022 Alexey Sheplyakov 4.6-alt1 +- new version 4.6 +- in particular solves .incbin false positive + +* Tue Nov 23 2021 Alexey Sheplyakov 4.5-alt2 +- automatically create/update symlinks in /usr/lib/ccache + +* Mon Nov 15 2021 Alexey Sheplyakov 4.5-alt1 +- new version 4.5 + +* Sun Mar 29 2020 Vitaly Lipatov 3.7.8-alt1 +- new version 3.7.8 (with rpmrb script) + +* Wed Feb 12 2020 Michael Shigorin 3.7.7-alt2 +- fix doc knob (manpage depends on it now too) +- minor spec cleanup + +* Sat Feb 08 2020 Vitaly Lipatov 3.7.7-alt1 +- new version 3.7.7 (with rpmrb script) +- fix URL, fix Source URL +- disable doc build + +* Fri Aug 10 2018 Aleksei Nikiforov 3.4.2-alt2 +- Set ccache version info (Closes: #33939). + +* Thu May 03 2018 Aleksei Nikiforov 3.4.2-alt1 +- Updated to upstream version 3.4.2. + +* Wed Nov 30 2016 Evgeny Sinelnikov 3.3.3-alt1 +- Detects usage of `.incbin` assembler directives in the source code + and avoids caching such compilations. + +* Fri Oct 07 2016 Evgeny Sinelnikov 3.3.2-alt1 +- Update to latest release +- Enabled -Werror compiler flag during merge with v3.3.2 + +* Wed Aug 29 2012 Eugeny A. Rostovtsev (REAL) 3.0.1-alt1.1 +- Disabled -Werror compiler flag + +* Sat Jul 17 2010 Andrey Rahmatullin 3.0.1-alt1 +- 3.0.1 + +* Mon Jun 21 2010 Andrey Rahmatullin 3.0-alt2 +- 3.0 +- rename back to ccache +- remove obsoletes/provides for ccache-bte + +* Fri May 14 2010 Andrey Rahmatullin 3.0-alt1.pre1 +- 3.0pre1 + +* Wed Mar 31 2010 Andrey Rahmatullin 3.0-alt1.pre0 +- package 3.0pre0 as ccache3 + +* Mon Sep 08 2008 Andrey Rahmatullin 2.4-alt3 +- add Debian patches: + + respect LDFLAGS when linking + + use utimes(2) instead of utime(2) when possible + + zlib compression of cache, enabled by default + + --long-options + + don't cache compilations with profiling on + + fix dependencies when using -o + + fix hyphens in the manpage + + add CACHEDIR.TAG support + + improve LRU-based cache cleanup + + don't try to use caching when HOME is unset + + check for errors when setting cache limits + + behave more reliably when the cache is on NFS +- spec fixes + +* Tue Oct 04 2005 Vitaly Lipatov 2.4-alt2 +- fix bug #2910 + +* Sun Nov 07 2004 Vitaly Lipatov 2.4-alt1 +- new version + +* Fri Jul 23 2004 Vitaly Lipatov 2.3-alt1 +- new version +- patch adopted + +* Wed Oct 22 2003 Alexey Tourbin 1.9-alt3.3 +- fixed segfault in env-alt.patch (introduced by ab in 1.9-alt3) + +* Thu Oct 16 2003 Stanislav Ievlev 1.9-alt3.2 +- removed bte subpackage: ccache now supported by gcc_wrapper + +* Mon Jan 06 2003 Alexander Bokovoy 1.9-alt3.1 +- Fix dependency loop for post-install and pre-uninstall scriptlets + +* Sun Nov 24 2002 Alexander Bokovoy 1.9-alt3 +- Update CC/CXX environment patch to better fit BTE + +* Wed Oct 23 2002 Alexander Bokovoy 1.9-alt2 +- Integrate BTE support + +* Thu Oct 10 2002 Victor Forsyuk 1.9-alt1 +- Add ignore.d files for buildreq. + +* Wed May 29 2002 Victor Forsyuk 1.9-alt0.1 +- Initial build for Sysiphus. diff --git a/.gear/rules b/.gear/rules new file mode 100644 index 00000000..beba9a80 --- /dev/null +++ b/.gear/rules @@ -0,0 +1,4 @@ +spec: .gear/ccache.spec +tar: v@version@:. +diff: v@version@:. . name=@name@-@version@-alt.patch +copy: .gear/*.patch \ No newline at end of file diff --git a/.gear/tags/f6b8f152a79052eb930c17eed7cb20e8c7892608 b/.gear/tags/f6b8f152a79052eb930c17eed7cb20e8c7892608 new file mode 100644 index 00000000..d349f9e4 --- /dev/null +++ b/.gear/tags/f6b8f152a79052eb930c17eed7cb20e8c7892608 @@ -0,0 +1,22 @@ +object 19fb17ce8f3cf44a2de2019028b3449f04766741 +type commit +tag v4.6 +tagger Joel Rosdahl 1645992222 +0100 + +ccache version 4.6 +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCAAdFiEEWpOacaRnks9XhmpRmW3aB1WUrbgFAmIb2R4ACgkQmW3aB1WU +rbiifBAAmgLQpXBrT8zfiFkpQSI0lyjBjIrfk4WKHzxeS/B35fb+Oc+ST3kWNlVB +uqYaTM+HBkjVDcJp/azSkv+JgvO2+WXp4eAH8rVdFjlbpDv39iUk+aALnMpv0iPh +5ZqNluxDDN0iEMzUy7NHcRZo6NWiNmMRmc0plPTVL53oonIMdOIwoZJYw3ZaIcCK +P8yxxUG1SMap1O+dSP/EYaAuT5gamEu1/4nYYKystAB0MUpMnqlfwDnDkpEz8MqQ +YStGGKs6WBpeQBuvXYVeOuz1A6+eNv1AkWUbLIgQEZdi8Y2tHeyvkkclJd3ebGmx +KGseleWSCCTeB2hmiRfIlcFWgP3VwLjKqmCPFN7AZ+mXLQsafu12F5uRnWODivj1 +Imi9Upm+y/zu221c46zcpE7519zCfTSjSIbH6hXedDN6TgdNA8CePr55HiMsPSeL +i4F0VdEVwPYAs+LhcNb1XCLSEuVP4FYkV4fL/hMEAZrmsW8tCj7BxJ4Xqy/uKZvb +PUAIAKWLcNcGsdRJcPmxqgEAqt7bDcSLjHsWoMzPfBXUiiPx9wL+VJOtaiJ5SBuG +QyL+iyvfeLGST7a/EnCpu1/XKqW3+LBryT6miB8ZD0BdlkoZSvjDWa4EDWSLcOtq +8q2QdpPTpXpPVL3rYCt6u77e6VClvOBWTKnjs+6pUQNBbbMp1dQ= +=pMFk +-----END PGP SIGNATURE----- diff --git a/.gear/tags/list b/.gear/tags/list new file mode 100644 index 00000000..2fc74013 --- /dev/null +++ b/.gear/tags/list @@ -0,0 +1 @@ +f6b8f152a79052eb930c17eed7cb20e8c7892608 v4.6 diff --git a/ccache.filetrigger b/ccache.filetrigger new file mode 100755 index 00000000..e898e7c1 --- /dev/null +++ b/ccache.filetrigger @@ -0,0 +1,5 @@ +#!/bin/sh + +if grep -E -sq '^/usr/libexec/gcc/|^/usr/lib64/gcc/|^/usr/lib/gcc/|^/usr/lib/llvm-[^/]+/bin/|^/usr/sbin/update-ccache-symlinks$'; then + /usr/sbin/update-ccache-symlinks || : +fi diff --git a/update-ccache-symlinks.py b/update-ccache-symlinks.py new file mode 100755 index 00000000..c5069ece --- /dev/null +++ b/update-ccache-symlinks.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python3 + +import argparse +import logging +import os +import stat +import re + +MASQUERADE_DIR = "/usr/lib/ccache" + +GCC_LIBEXEC_DIRS = ( + '/usr/lib/gcc', # Debian native GCC compilers + '/usr/lib/gcc-cross', # Debian GCC cross-compilers + '/usr/libexec/gcc', # rpm-based distros +) + +TOOL_PATH = '/usr/bin/ccache' + + +def sloppy_listdir(thedir): + try: + return os.listdir(thedir) + except FileNotFoundError: + pass + except NotADirectoryError: + pass + return [] + + +def scan_symlinks(thedir): + links = set() + for name in os.listdir(thedir): + path = os.path.join(thedir, name) + if os.path.islink(path): + if os.access(path, os.X_OK): + links.add(name) + else: + logging.debug('scan_symlinks: removing stale link "%s"', path) + os.unlink(path) + return links + + +def update_symlinks(thedir, old_symlinks=None, new_symlinks=None, dest=TOOL_PATH): + for link in old_symlinks: + path = os.path.join(thedir, link) + if link not in new_symlinks: + os.unlink(path) + logging.debug('update_symlinks: rm %s', path) + for link in new_symlinks: + path = os.path.join(thedir, link) + if link not in old_symlinks: + os.symlink(dest, path) + logging.debug('update_symlinks: ln -s %s %s', dest, path) + + +class CompilerLinksUpdater(object): + def __init__(self, masquerade_dir=MASQUERADE_DIR, tool_path=TOOL_PATH): + self.masquerade_dir = masquerade_dir + self.tool_path = tool_path + self.old_symlinks = set() + self.new_symlinks = set() + + def consider(self, name): + if os.access(f"/usr/bin/{name}", os.X_OK): + self.new_symlinks.add(name) + logging.debug('consider: %s', name) + + def consider_gcc(self, prefix, suffix=""): + self.consider(f"{prefix}gcc{suffix}") + self.consider(f"{prefix}g++{suffix}") + + def scan_gcc_libexec(self, gcc_dir): + for gnu_host in sloppy_listdir(gcc_dir): + self.consider_gcc(f"{gnu_host}-") + for version in sloppy_listdir(gcc_dir + "/" + gnu_host): + self.consider_gcc("", f"-{version}") + self.consider_gcc(f"{gnu_host}-", f"-{version}") + + def consider_clang(self, suffix): + self.consider(f"clang{suffix}") + self.consider(f"clang++{suffix}") + + def scan_clang(self): + self.consider_clang("") + for ent in os.listdir("/usr/lib"): + if ent.startswith("llvm-"): + version = ent.split("-")[1] + if '.' in version: + version = version.split('.')[0] + self.consider_clang(f"-{version}") + + def run(self): + os.makedirs(self.masquerade_dir, exist_ok=True) + self.old_symlinks = scan_symlinks(self.masquerade_dir) + + for x in ("cc", "c++", "c89", "c99"): + self.consider(x) + for x in ("", "c89-", "c99-"): + self.consider_gcc(x) + + for gcc_dir in GCC_LIBEXEC_DIRS: + self.scan_gcc_libexec(gcc_dir) + + self.scan_clang() + update_symlinks(self.masquerade_dir, self.old_symlinks, + self.new_symlinks, dest=self.tool_path) + +def main(): + parser = argparse.ArgumentParser(description='Update ccache symlink directory') + parser.add_argument('-v', '--verbose', action='count', default=0) + parser.add_argument('-d', '--masquerade-dir', default=MASQUERADE_DIR, + help=f'manage symlinks in this directory (default: {MASQUERADE_DIR})') + parser.add_argument('-t', '--tool', default=TOOL_PATH, + help=f'Symlink target (default: {TOOL_PATH})') + args = parser.parse_args() + level = logging.DEBUG if args.verbose > 0 else logging.INFO + format='%(levelname)s:update-ccache-symlinks: %(message)s' + logging.basicConfig(format=format, level=level) + upd = CompilerLinksUpdater(masquerade_dir=args.masquerade_dir, + tool_path=args.tool) + upd.run() + + +if __name__ == '__main__': + main()