Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/ccache/
Date: Fri, 11 Jun 2021 22:51:45
Message-Id: 1623451897.e2e19839d429095acc15c6591d680498e1ae3597.slyfox@gentoo
1 commit: e2e19839d429095acc15c6591d680498e1ae3597
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 11 22:51:28 2021 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 11 22:51:37 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e2e19839
7
8 dev-util/ccache: add USE=static-c++ which embeds libstdc++
9
10 To ease building gcc with ccache we need to handle the case of
11 LD_PRELOAD=./inplace/libstdc++.so injected by gcc's build system.
12
13 USE=static-c++ uses -static-libstdc++ for it.
14
15 Reported-by: Mihai Moldovan
16 Bug: https://bugs.gentoo.org/761220
17 Package-Manager: Portage-3.0.19, Repoman-3.0.3
18 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
19
20 dev-util/ccache/ccache-4.3-r1.ebuild | 89 ++++++++++++++++++++++++++++++++++++
21 dev-util/ccache/metadata.xml | 3 ++
22 2 files changed, 92 insertions(+)
23
24 diff --git a/dev-util/ccache/ccache-4.3-r1.ebuild b/dev-util/ccache/ccache-4.3-r1.ebuild
25 new file mode 100644
26 index 00000000000..1410477f616
27 --- /dev/null
28 +++ b/dev-util/ccache/ccache-4.3-r1.ebuild
29 @@ -0,0 +1,89 @@
30 +# Copyright 1999-2021 Gentoo Authors
31 +# Distributed under the terms of the GNU General Public License v2
32 +
33 +EAPI=7
34 +
35 +inherit cmake toolchain-funcs
36 +
37 +DESCRIPTION="fast compiler cache"
38 +HOMEPAGE="https://ccache.dev/"
39 +SRC_URI="https://github.com/ccache/ccache/releases/download/v${PV}/ccache-${PV}.tar.xz"
40 +
41 +LICENSE="GPL-3 LGPL-3"
42 +SLOT="0"
43 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
44 +IUSE="static-c++ test"
45 +
46 +DEPEND=""
47 +RDEPEND="${DEPEND}
48 + app-arch/zstd:0=
49 + dev-util/shadowman
50 + sys-apps/gentoo-functions
51 +"
52 +# clang-specific tests use dev-libs/elfutils to compare objects for equality.
53 +# Let's pull in the dependency unconditionally.
54 +DEPEND+="
55 + test? ( dev-libs/elfutils )
56 +"
57 +BDEPEND="
58 + app-text/asciidoc
59 +"
60 +
61 +RESTRICT="!test? ( test )"
62 +
63 +DOCS=( doc/{AUTHORS,MANUAL,NEWS}.adoc CONTRIBUTING.md README.md )
64 +
65 +PATCHES=(
66 + "${FILESDIR}"/${PN}-3.5-nvcc-test.patch
67 + "${FILESDIR}"/${PN}-4.0-objdump.patch
68 + "${FILESDIR}"/${PN}-4.1-avoid-run-user.patch
69 +)
70 +
71 +src_prepare() {
72 + cmake_src_prepare
73 +
74 + sed \
75 + -e "/^EPREFIX=/s:'':'${EPREFIX}':" \
76 + "${FILESDIR}"/ccache-config-3 > ccache-config || die
77 +
78 + # mainly used in tests
79 + tc-export CC OBJDUMP
80 +
81 + # Avoid dependency on libstdc++.so. Useful for cases when
82 + # we would like to use ccache to build older gcc which injects
83 + # into ccache locally built (possibly outdated) libstdc++
84 + # See bug #761220 for examples.
85 + #
86 + # Ideally gcc should not use LD_PRELOAD to avoid this type of failures.
87 + use static-c++ && append-ldflags -static-libstdc++
88 +}
89 +
90 +src_configure() {
91 + local mycmakeargs=(
92 + -DUSE_CCACHE=OFF
93 + -DUSE_FASTER_LINKER=OFF
94 + -DZSTD_FROM_INTERNET=OFF
95 + )
96 +
97 + cmake_src_configure
98 +}
99 +
100 +src_install() {
101 + cmake_src_install
102 +
103 + dobin ccache-config
104 + insinto /usr/share/shadowman/tools
105 + newins - ccache <<<"${EPREFIX}/usr/lib/ccache/bin"
106 +}
107 +
108 +pkg_prerm() {
109 + if [[ -z ${REPLACED_BY_VERSION} && ${ROOT:-/} == / ]] ; then
110 + eselect compiler-shadow remove ccache
111 + fi
112 +}
113 +
114 +pkg_postinst() {
115 + if [[ ${ROOT:-/} == / ]]; then
116 + eselect compiler-shadow update ccache
117 + fi
118 +}
119
120 diff --git a/dev-util/ccache/metadata.xml b/dev-util/ccache/metadata.xml
121 index e27519ca728..f673d3c5836 100644
122 --- a/dev-util/ccache/metadata.xml
123 +++ b/dev-util/ccache/metadata.xml
124 @@ -5,6 +5,9 @@
125 <email>toolchain@g.o</email>
126 <name>Gentoo Toolchain Project</name>
127 </maintainer>
128 + <use>
129 + <flag name="static-c++">Avoid dynamic dependency on gcc's libstdc++.</flag>
130 + </use>
131 <longdescription lang="en">
132 ccache acts as a caching pre-processor to C/C++ compilers, improving
133 compilation time when recompiling previously compiled source.