mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-08-24 18:58:08 -07:00
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
101 lines
2.2 KiB
Bash
101 lines
2.2 KiB
Bash
#!/bin/sh
|
|
#
|
|
# ccache-config - helper script for ccache and its ebuild
|
|
#
|
|
# Copyright 2003-2014 Superlucidity Services, LLC
|
|
# 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
|
|
|
|
. /etc/init.d/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%/}/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 [ -n "$(type -p ${1})" ]; 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 /usr/bin/ccache "${t}"
|
|
c_eend
|
|
fi
|
|
}
|
|
cc_links() {
|
|
local a
|
|
for a in gcc cc c++ g++ ; do
|
|
if [ -n "${2}" ] ; then
|
|
# gcc-config doesnt install ${CHOST}-cc, so until
|
|
# it does, don't install a ccache symlink for it
|
|
[ "${a}" = "cc" ] && continue
|
|
a="${2}-${a}"
|
|
fi
|
|
"cc_${1}_link" "${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
|