diff options
Diffstat (limited to 'dev-util/ccache/files')
-rw-r--r-- | dev-util/ccache/files/ccache-3.1.10-size-on-disk.patch | 21 | ||||
-rw-r--r-- | dev-util/ccache/files/ccache-3.3-size-on-disk.patch | 21 | ||||
-rw-r--r-- | dev-util/ccache/files/ccache-config-3 | 97 |
3 files changed, 139 insertions, 0 deletions
diff --git a/dev-util/ccache/files/ccache-3.1.10-size-on-disk.patch b/dev-util/ccache/files/ccache-3.1.10-size-on-disk.patch new file mode 100644 index 000000000000..5e502912bfa2 --- /dev/null +++ b/dev-util/ccache/files/ccache-3.1.10-size-on-disk.patch @@ -0,0 +1,21 @@ +https://bugs.gentoo.org/56178 + +stick to the size of files on disk rather than their byte size. +this func is only used for stats management, so this should be safe. + +--- a/util.c ++++ b/util.c +@@ -845,12 +845,7 @@ file_size(struct stat *st) + #ifdef _WIN32 + return (st->st_size + 1023) & ~1023; + #else +- size_t size = st->st_blocks * 512; +- if ((size_t)st->st_size > size) { +- /* probably a broken stat() call ... */ +- size = (st->st_size + 1023) & ~1023; +- } +- return size; ++ return st->st_blocks * 512; + #endif + } + diff --git a/dev-util/ccache/files/ccache-3.3-size-on-disk.patch b/dev-util/ccache/files/ccache-3.3-size-on-disk.patch new file mode 100644 index 000000000000..e4e2ff8c6477 --- /dev/null +++ b/dev-util/ccache/files/ccache-3.3-size-on-disk.patch @@ -0,0 +1,21 @@ +https://bugs.gentoo.org/56178 + +stick to the size of files on disk rather than their byte size. +this func is only used for stats management, so this should be safe. + +--- a/util.c ++++ b/util.c +@@ -845,12 +845,7 @@ file_size(struct stat *st) + #ifdef _WIN32 + return (st->st_size + 1023) & ~1023; + #else +- size_t size = st->st_blocks * 512; +- if ((size_t)st->st_size > size) { +- // Probably a broken stat() call... +- size = (st->st_size + 1023) & ~1023; +- } +- return size; ++ return st->st_blocks * 512; + #endif + } + diff --git a/dev-util/ccache/files/ccache-config-3 b/dev-util/ccache/files/ccache-config-3 new file mode 100644 index 000000000000..7f604f0016ef --- /dev/null +++ b/dev-util/ccache/files/ccache-config-3 @@ -0,0 +1,97 @@ +#!/bin/sh +# +# ccache-config - helper script for ccache and its ebuild +# +# Copyright 2003-2014 Superlucidity Services, LLC +# Copyright 2013-2014 Gentoo Foundation +# This program licensed under the GNU GPL version 2. +# +# This script developed by Zachary T Welch at Superlucidity Services, LLC +# it was cloned from the distcc-config script +# +# Additional features to come; this provides a starting point + +EPREFIX='' + +. "${EPREFIX}"/lib/gentoo/functions.sh 2>/dev/null || { + ebegin() { echo " * $* ..."; } + eend() { + local r=${1:-$?} + [ ${r} -eq 0 ] && echo " [ OK ]" || echo " [ !! ]" + return $r + } +} + +LIBDIR="lib" + +# this should be getopt'd someday (override with CC_QUIET=1) +CC_VERBOSE=1 +unset _CC_QUIET +c_quiet() { + [ -n "${CC_QUIET:-${_CC_QUIET}}" ] || [ -z "${CC_VERBOSE}" ] +} + +c_ebegin() { c_quiet || ebegin "$@" ; } +c_eend() { c_quiet || eend "$@" ; } + +### +# the following functions manage the ccache symlinks +# they allow the user or other scripts (namely gcc-config) to +# automatically update ccache's links when upgrading toolchains +# +cc_path() { + echo ${ROOT%/}${EPREFIX}/usr/${LIBDIR}/ccache/bin/$1 +} +cc_remove_link() { + local t=$(cc_path "$1") + if [ -L ${t} ]; then + c_ebegin "Removing ${t}" + rm -f "${t}" + c_eend + + # Trim the empty dir if possible. #517242 + t=${t%/*} + if rmdir "${t}" 2>/dev/null; then + rmdir "${t%/*}" 2>/dev/null + fi + : + fi +} +cc_install_link() { + # Search the PATH for the specified compiler + # then create shadow link in /usr/lib/ccache/bin to ccache + + if command -v "$1" >/dev/null ; then + # first be sure any old link is removed + _CC_QUIET=1 + cc_remove_link "$1" + unset _CC_QUIET + + # then create the new link + local t=$(cc_path "$1") + c_ebegin "Creating ccache shadow link ${t}" + mkdir -p -m 0755 "${t%/*}" && ln -s "${EPREFIX}"/usr/bin/ccache "${t}" + c_eend + fi +} +cc_links() { + local a + for a in gcc cc c++ g++ icc icpc clang clang++ ; do + "cc_${1}_link" "${2}${2:+-}${a}" + done +} + +### +# main routine + +case $1 in + --install-links ) + cc_links install "$2" + ;; + --remove-links ) + cc_links remove "$2" + ;; + * ) + echo "usage: $0 {--install-links|--remove-links} [ CHOST ]" + ;; +esac |