summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2020-11-22 20:57:12 +0000
committerSergei Trofimovich <slyfox@gentoo.org>2020-11-22 20:57:23 +0000
commit7158e6d5be786b4e656beea266330943fe2243d1 (patch)
tree0ecea4a79bf3b157110f89cb36ad0c0e299323ad /dev-util
parentsys-apps/systemd-tmpfiles: ppc stable, bug #755983 (diff)
downloadgentoo-7158e6d5be786b4e656beea266330943fe2243d1.tar.gz
gentoo-7158e6d5be786b4e656beea266330943fe2243d1.tar.bz2
gentoo-7158e6d5be786b4e656beea266330943fe2243d1.zip
dev-util/ccache: bump up to 4.1
Among other things it should fix inconsistent handling of `-fcolor-diagnostics` in compiler and linker drivers noticed by Mihai Moldovan. Closes: https://bugs.gentoo.org/751463 Package-Manager: Portage-3.0.10, Repoman-3.0.2 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'dev-util')
-rw-r--r--dev-util/ccache/Manifest1
-rw-r--r--dev-util/ccache/ccache-4.1.ebuild108
-rw-r--r--dev-util/ccache/files/ccache-4.1-atomic.patch23
-rw-r--r--dev-util/ccache/files/ccache-4.1-avoid-run-user.patch18
4 files changed, 150 insertions, 0 deletions
diff --git a/dev-util/ccache/Manifest b/dev-util/ccache/Manifest
index 9db6c02c4c05..35ac993d8d47 100644
--- a/dev-util/ccache/Manifest
+++ b/dev-util/ccache/Manifest
@@ -1,2 +1,3 @@
DIST ccache-3.7.12.tar.xz 354684 BLAKE2B b0b1028ede8206622c4b563cdc1351bdbe49ac11aa92d405c778af91db5bac029f7331371ef0a55bc3b1c7a0b60fbc5711277e048481bf0f4ad4b1be8acd3495 SHA512 0eb47869f86d36b3e5fad0d5073973f0444f3efe23fd14469a9e05154ea219228443098b1c5e4a8a0c5c78b4bfa7623735b50ebd6b8b4d0626766061850d6a62
DIST ccache-4.0.tar.xz 383264 BLAKE2B ef4ca19860e2a0d313354cbd59a9eff441e86663820e8233dcf4b45a008ffa330b4a4c22eb11f3c6a7a98950d7d247034e60eb71c84ec4471f60fa19591651bd SHA512 1e55767bc2919109ae3c9b74f0adcd518e7e11df45c3981b2e9f8b04a780f9730457eeef1df137c65ab20e0959600c5317f06b58ffb82f5806c7c9f6cc305715
+DIST ccache-4.1.tar.xz 389240 BLAKE2B 265ed6cd9602a04db0fadf63266d0fe1e78a74c69a27f05854a287e4048934d6afd63e71987bc525217782075c1a158601c400f3418caa0eb9730f34275bd08c SHA512 e80075eeea3fef8215de0a793e02381bfb59d7e74237fa34a49306047c60f0de0e678396ad3a9e5d86d3ad2aa21bbe29c7f0055f06b3ba2470f6895ce2eedd7b
diff --git a/dev-util/ccache/ccache-4.1.ebuild b/dev-util/ccache/ccache-4.1.ebuild
new file mode 100644
index 000000000000..a783943f868b
--- /dev/null
+++ b/dev-util/ccache/ccache-4.1.ebuild
@@ -0,0 +1,108 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake toolchain-funcs
+
+DESCRIPTION="fast compiler cache"
+HOMEPAGE="https://ccache.dev/"
+SRC_URI="https://github.com/ccache/ccache/releases/download/v${PV}/ccache-${PV}.tar.xz"
+
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+IUSE="test"
+
+DEPEND=""
+RDEPEND="${DEPEND}
+ dev-util/shadowman
+ sys-apps/gentoo-functions"
+# clang-specific tests use dev-libs/elfutils to compare objects for equality.
+# Let's pull in the dependency unconditionally.
+DEPEND+="
+ test? ( dev-libs/elfutils )
+"
+BDEPEND="
+ app-text/asciidoc
+"
+
+RESTRICT="!test? ( test )"
+
+DOCS=( doc/{AUTHORS,MANUAL,NEWS}.adoc CONTRIBUTING.md README.md )
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.5-nvcc-test.patch
+ "${FILESDIR}"/${PN}-4.0-objdump.patch
+ "${FILESDIR}"/${PN}-4.1-avoid-run-user.patch
+ "${FILESDIR}"/${PN}-4.1-atomic.patch
+)
+
+# ccache does not do it automatically. TODO: fix upstream
+need_latomic() {
+ # test if -latomic is needed and helps. -latomic is needed
+ # at least on ppc32. Use bit of inodeCache.cpp test.
+ cat >"${T}"/a-test.cc <<-EOF
+ #include <atomic>
+ #include <cstdint>
+ std::atomic<std::int64_t> a;
+ int main() { return a.load() == 0; }
+ EOF
+
+ local cxx_cmd=(
+ $(tc-getCXX)
+ $CXXFLAGS
+ $LDFLAGS
+ "${T}"/a-test.cc
+ -o "${T}"/a-test
+ )
+
+ einfo "${cxx_cmd[@]}"
+ "${cxx_cmd[@]}" && return 1
+
+ einfo "Trying to add -latomic"
+ einfo "${cxx_cmd[@]}"
+ cxx_cmd+=(-latomic)
+ "${cxx_cmd[@]}" && return 0
+
+ return 1
+}
+
+src_prepare() {
+ cmake_src_prepare
+
+ sed \
+ -e "/^EPREFIX=/s:'':'${EPREFIX}':" \
+ "${FILESDIR}"/ccache-config-3 > ccache-config || die
+
+ # mainly used in tests
+ tc-export CC OBJDUMP
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DLINK_WITH_ATOMIC=$(need_latomic && echo YES || echo NO)
+ )
+ cmake_src_configure
+}
+
+src_install() {
+ # TODO: install manpage: https://github.com/ccache/ccache/issues/684
+ cmake_src_install
+
+ dobin ccache-config
+ insinto /usr/share/shadowman/tools
+ newins - ccache <<<"${EPREFIX}/usr/lib/ccache/bin"
+}
+
+pkg_prerm() {
+ if [[ -z ${REPLACED_BY_VERSION} && ${ROOT:-/} == / ]] ; then
+ eselect compiler-shadow remove ccache
+ fi
+}
+
+pkg_postinst() {
+ if [[ ${ROOT:-/} == / ]]; then
+ eselect compiler-shadow update ccache
+ fi
+}
diff --git a/dev-util/ccache/files/ccache-4.1-atomic.patch b/dev-util/ccache/files/ccache-4.1-atomic.patch
new file mode 100644
index 000000000000..dc48c4a5c896
--- /dev/null
+++ b/dev-util/ccache/files/ccache-4.1-atomic.patch
@@ -0,0 +1,23 @@
+powerpc, sparc and many other 32-bit arches need
+explicit libatomic for atd::atomic primitives..
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -67,12 +67,18 @@ if(WIN32)
+ endif()
+ endif()
+
++option(LINK_WITH_ATOMIC "Add 'atomic' if needed" OFF)
++set(atomic_lib "")
++if(LINK_WITH_ATOMIC)
++ set(atomic_lib "atomic")
++endif()
++
+ set(THREADS_PREFER_PTHREAD_FLAG ON)
+ find_package(Threads REQUIRED)
+ target_link_libraries(
+ ccache_lib
+ PRIVATE standard_settings standard_warnings ZSTD::ZSTD
+- Threads::Threads third_party_lib)
++ Threads::Threads third_party_lib ${atomic_lib})
+
+ target_include_directories(ccache_lib PRIVATE ${CMAKE_BINARY_DIR} .)
diff --git a/dev-util/ccache/files/ccache-4.1-avoid-run-user.patch b/dev-util/ccache/files/ccache-4.1-avoid-run-user.patch
new file mode 100644
index 000000000000..be7db76ecbf0
--- /dev/null
+++ b/dev-util/ccache/files/ccache-4.1-avoid-run-user.patch
@@ -0,0 +1,18 @@
+Gentoo's sandbox does not whitelist this path by default yet.
+TODO: bug link.
+
+Until we have a sandbox whitelisting the path let's rely on ccache's default.
+--- a/src/Config.cpp
++++ b/src/Config.cpp
+@@ -885,11 +885,5 @@ Config::check_key_tables_consistency()
+ std::string
+ Config::default_temporary_dir(const std::string& cache_dir)
+ {
+-#ifdef HAVE_GETEUID
+- std::string user_tmp_dir = FMT("/run/user/{}", geteuid());
+- if (Stat::stat(user_tmp_dir).is_directory()) {
+- return user_tmp_dir + "/ccache-tmp";
+- }
+-#endif
+ return cache_dir + "/tmp";
+ }