virtual/perl-Parse-CPAN-Meta: keyword ~riscv
[gentoo.git] / dev-util / ccache / ccache-3.5.1a.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit readme.gentoo-r1
7
8 DESCRIPTION="fast compiler cache"
9 HOMEPAGE="https://ccache.samba.org/"
10 SRC_URI="https://www.samba.org/ftp/ccache/${P}.tar.xz"
11
12 LICENSE="GPL-3"
13 SLOT="0"
14 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd"
15 IUSE=""
16
17 DEPEND="app-arch/xz-utils
18         sys-libs/zlib"
19 RDEPEND="${DEPEND}
20         dev-util/shadowman
21         sys-apps/gentoo-functions"
22
23 PATCHES=(
24         "${FILESDIR}"/${PN}-3.4-size-on-disk.patch #456178
25         "${FILESDIR}"/${PN}-3.5-nvcc-test.patch
26 )
27
28 S=${WORKDIR}/${P%a} # 3.5.1a->3.5.1, bug #674516
29
30 src_prepare() {
31         default
32
33         # make sure we always use system zlib
34         rm -rf src/zlib || die
35         sed \
36                 -e "/^EPREFIX=/s:'':'${EPREFIX}':" \
37                 "${FILESDIR}"/ccache-config-3 > ccache-config || die
38 }
39
40 src_compile() {
41         emake V=1
42 }
43
44 src_test() {
45         emake check V=1
46 }
47
48 src_install() {
49         DOCS=( doc/{AUTHORS,MANUAL,NEWS}.adoc CONTRIBUTING.md README.md )
50         default
51
52         dobin ccache-config
53         insinto /usr/share/shadowman/tools
54         newins - ccache <<<'/usr/lib/ccache/bin'
55
56         DOC_CONTENTS="
57 To use ccache with **non-Portage** C compiling, add
58 ${EPREFIX}/usr/lib/ccache/bin to the beginning of your path, before ${EPREFIX}/usr/bin.
59 Portage 2.0.46-r11+ will automatically take advantage of ccache with
60 no additional steps.  If this is your first install of ccache, type
61 something like this to set a maximum cache size of 2GB:\\n
62 # ccache -M 2G\\n
63 If you are upgrading from an older version than 3.x you should clear all of your caches like so:\\n
64 # CCACHE_DIR='${CCACHE_DIR:-${PORTAGE_TMPDIR}/ccache}' ccache -C\\n
65 ccache now supports sys-devel/clang and dev-lang/icc, too!"
66
67         readme.gentoo_create_doc
68 }
69
70 pkg_prerm() {
71         if [[ -z ${REPLACED_BY_VERSION} && ${ROOT:-/} == / ]] ; then
72                 eselect compiler-shadow remove ccache
73         fi
74 }
75
76 pkg_postinst() {
77         if [[ ${ROOT:-/} == / ]]; then
78                 eselect compiler-shadow update ccache
79         fi
80
81         # nuke broken symlinks from previous versions that shouldn't exist
82         rm -rf "${EROOT}"/usr/lib/ccache.backup || die
83
84         readme.gentoo_print_elog
85 }