diff options
Diffstat (limited to 'dev-util/ccache/ccache-3.1.ebuild')
-rw-r--r-- | dev-util/ccache/ccache-3.1.ebuild | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/dev-util/ccache/ccache-3.1.ebuild b/dev-util/ccache/ccache-3.1.ebuild new file mode 100644 index 00000000..a590907e --- /dev/null +++ b/dev-util/ccache/ccache-3.1.ebuild @@ -0,0 +1,126 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header $ + +EAPI="3" + +inherit multilib +RESTRICT="mirror" + +DESCRIPTION="fast compiler cache" +HOMEPAGE="http://ccache.samba.org/" +MY_P="${P/_/}" +SRC_URI="http://samba.org/ftp/ccache/${MY_P}.tar.bz2" +S="${WORKDIR}/${MY_P}" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="colorgcc +defaults doc" + +DEPEND="sys-libs/zlib" +RDEPEND="${DEPEND} + colorgcc? ( dev-util/colorgcc )" + +do_links() { + local a b + for a in gcc c++ g++ + do for b in "${CHOST}"- '' + do dosym "${EROOT%/}/usr/bin/ccache" \ + "${EPREFIX%/}/usr/$(get_libdir)/ccache/bin/${b}${a}" + done + done +} + +src_prepare() { + # The "ar" test is broken in ccache-3.1 (this is fixed in later versions) + sed -i -e \ + 's/^if test -z "$ac_ct_AR"; then/if test -z "$AR"; then/' \ + "${S}"/configure || die +} + +src_install() { + local colorgcc_config + colorgcc_config='' + if use colorgcc + then echo "#!${EPREFIX}/usr/bin/perl +\$0=\$ARGV[0];shift(@ARGV);require('${EPREFIX}/usr/bin/colorgcc');" \ + >color-gcc + dobin color-gcc || die + colorgcc_config=" +# CCACHE_PREFIX=\"${EPREFIX}/usr/bin/color-gcc\"" + fi + if use defaults + then echo '# Do not edit this file. +# If you want to remove a variable, you should remove this whole file by +# reemerging ccache with USE=-defaults +# If you want to set (additional) variables, do that in /etc/env.d/99ccache +CCACHE_SLOPPINESS="file_macro,time_macros,include_file_mtime" +CCACHE_COMPRESS=1'"${colorgcc_config}" >98ccache + doenvd 98ccache || die + fi + dobin ccache || die + doman ccache.1 || die + dodoc README.txt NEWS.txt AUTHORS.txt || die + if use doc + then # Manual.{txt,html} is the same content as the manpage + dodoc MANUAL.txt + dohtml README.html NEWS.html AUTHORS.html MANUAL.html + fi + + diropts -m0755 + dodir "${EPREFIX%/}/usr/$(get_libdir)/ccache/bin" + keepdir "${EPREFIX%/}/usr/$(get_libdir)/ccache/bin" + + dobin "${FILESDIR}"/ccache-config || die +} + +pkg_preinst() { + if [ "${ROOT}" = "/" ] + then einfo "Scanning for compiler front-ends..." + do_links + else ewarn "Install is incomplete; you must run the following commands:" + ewarn " # ccache-config --install-links" + ewarn " # ccache-config --install-links ${CHOST}" + ewarn "after booting or chrooting to ${ROOT} to complete installation." + fi +} + +pkg_postinst() { + local i + # nuke broken symlinks from previous versions that shouldn't exist + for i in cc "${CHOST}"-cc + do test -L "${ROOT}/usr/$(get_libdir)/ccache/bin/${i}" && \ + rm -rf -- "${ROOT}/usr/$(get_libdir)/ccache/bin/${i}" + done + test -d "${ROOT}/usr/$(get_libdir)/ccache.backup" && \ + rm -rf -- "${ROOT}/usr/$(get_libdir)/ccache.backup" + + elog "To use ccache with **non-Portage** C compiling, add" + elog "/usr/$(get_libdir)/ccache/bin to the beginning of your path, before /usr/bin." + elog "Portage can will automatically take advantage of ccache if you use" + elog "FEATURES=ccache" + elog "If this is your first install of ccache, type something like this" + elog "to set a maximum cache size of 4GB:" + elog " CCACHE_DIR=\"${CCACHE_DIR:-${PORTAGE_TMPDIR}/ccache}\"ccache -M 4G" + elog + elog "If you are upgrading from an older version than 3.x you should run" + elog " CCACHE_DIR=\"${CCACHE_DIR:-${PORTAGE_TMPDIR}/ccache}\" ccache -C" + if use defaults + then elog + elog "Observe that some default choices are made in /etc/env.d/98ccache" + fi + if use colorgcc + then elog + elog "To use dev-util/colorgcc with ccache you can" + elog " export CCACHE_PREFIX=\"${EPREFIX}/usr/bin/color-gcc\"" + fi + + case "${PORTAGE_TMPDIR}/portage/*" in + "${CCACHE_BASEDIR:-none}"/*) :;; + *) + ewarn "To make optimal use of ccache with portage, please set" + ewarn " CCACHE_BASEDIR=\"\${PORTAGE_TMPDIR}/portage\"" + ewarn "in your /etc/make.conf";; + esac +} |