From 23fa114c18115ce818f6c5d1c1766a66bcd00305 Mon Sep 17 00:00:00 2001 From: Xenhat Hex Date: Sat, 25 Apr 2020 01:32:22 -0400 Subject: [PATCH] sys-devel/icecream: add missing files Package-Manager: Portage-2.3.89, Repoman-2.3.20 --- sys-devel/icecream/files/icecream | 43 ++++++++++ sys-devel/icecream/files/icecream-config | 69 ++++++++++++++++ sys-devel/icecream/files/icecream-create-env | 82 ++++++++++++++++++++ sys-devel/icecream/files/icecream-r2 | 44 +++++++++++ 4 files changed, 238 insertions(+) create mode 100644 sys-devel/icecream/files/icecream create mode 100644 sys-devel/icecream/files/icecream-config create mode 100644 sys-devel/icecream/files/icecream-create-env create mode 100644 sys-devel/icecream/files/icecream-r2 diff --git a/sys-devel/icecream/files/icecream b/sys-devel/icecream/files/icecream new file mode 100644 index 0000000..28e4641 --- /dev/null +++ b/sys-devel/icecream/files/icecream @@ -0,0 +1,43 @@ +#!/sbin/openrc-run +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need net +} + +start() { + local basedir=${ICECREAM_BASEDIR:-"/var/cache/icecream"} + local netname=${ICECREAM_NETNAME:+"-n ${ICECREAM_NETNAME}"} + local logfile=${ICECREAM_LOG_FILE:+"-l ${ICECREAM_LOG_FILE}"} + local nice=${ICECREAM_NICE_LEVEL:+"--nice ${ICECREAM_NICE_LEVEL}"} + local scheduler=${ICECREAM_SCHEDULER_HOST:+"-s ${ICECREAM_SCHEDULER_HOST}"} + local maxjobs=${ICECREAM_MAX_JOBS:+"-m ${ICECREAM_MAX_JOBS}"} + local verbosity=${ICECREAM_VERBOSITY:-"-v"} + + if [[ "${ICECREAM_RUN_SCHEDULER}" == "yes" ]]; then + local slogfile=${ICECREAM_SCHEDULER_LOG_FILE:-"/var/log/icecc_scheduler"} + touch ${slogfile} && chown icecream:icecream ${slogfile} + slogfile=${slogfile:+"-l ${slogfile}"} + ebegin "Starting Distributed Compiler Scheduler" + start-stop-daemon -u icecream --start --quiet --exec /usr/sbin/scheduler -- -d ${slogfile} ${netname} ${verbosity} + eend ${?} + fi + + [[ ! -d ${basedir} ]] && mkdir -p ${basedir} && chown icecream:icecream ${basedir} + ebegin "Starting Distributed Compiler Daemon" + start-stop-daemon --start --quiet --exec /usr/sbin/iceccd -- -d ${logfile} ${nice} ${scheduler} ${netname} -u icecream -b "${basedir}" ${maxjobs} ${verbosity} + eend ${?} +} + +stop() { + ebegin "Stopping Distributed Compiler Daemon" + start-stop-daemon --stop --quiet --name iceccd + eend ${?} + + if [[ "${ICECREAM_RUN_SCHEDULER}" == "yes" ]]; then + ebegin "Stopping Distributed Compiler Scheduler" + start-stop-daemon --stop --quiet --name scheduler + eend ${?} + fi +} diff --git a/sys-devel/icecream/files/icecream-config b/sys-devel/icecream/files/icecream-config new file mode 100644 index 0000000..6ed24c7 --- /dev/null +++ b/sys-devel/icecream/files/icecream-config @@ -0,0 +1,69 @@ +#!/bin/sh +# +# icecream-config - helper script for icecream and its ebuild +# +# Copyright 2003-2010 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 to make ccache-config +# and then modified by Marcus Furlong to configure icecream too. +# +# Additional features to come; this provides a starting point + +# this should be getopt'd someday (override with ICEC_QUIET=1) +ICECC_VERBOSE=1 + +icecc_echo() { + [ -z "${ICECC_QUIET}" -a -n "${ICECC_VERBOSE}" ] && echo "$*" +} + +### +# the following functions manage the icecream symlinks +# they allow the user or other scripts (namely gcc-config) to +# automatically update icecream's links when upgrading toolchains +# +icecc_remove_link() { + local t="/usr/lib/icecc/bin/${1}" + if [ -L ${t} ]; then + icecc_echo "Removing ${t}..." + rm -f "${t}" + fi +} +icecc_install_link() { + # Search the PATH for the specified compiler + # then create shadow link in /usr/lib/icecc/bin to icecc + + if [ -n "$(type -p ${1})" ]; then + # first be sure any old link is removed + ICECC_QUIET=1 icecc_remove_link "${1}" + + # then create the new link + local t="/usr/lib/icecc/bin/${1}" + icecc_echo "Creating icecream shadow link: ${t}..." + ln -s /usr/bin/icecc "${t}" + fi +} +icecc_links() { + local a + for a in gcc cc c++ g++ ; do + [ -n "${2}" ] && a="${2}-${a}" + eval "icecc_${1}_link" "${a}" + done +} + +### +# main routine + +case "${1}" in + --install-links ) + icecc_links install "${2}" + ;; + --remove-links ) + icecc_links remove "${2}" + ;; + * ) + echo "usage: ${0} {--install-links|--remove-links} [ CHOST ]" + ;; +esac + diff --git a/sys-devel/icecream/files/icecream-create-env b/sys-devel/icecream/files/icecream-create-env new file mode 100644 index 0000000..5d02631 --- /dev/null +++ b/sys-devel/icecream/files/icecream-create-env @@ -0,0 +1,82 @@ +#!/bin/sh +# +# icecream-create-env - helper script to create icecc environments(mostly for cross-compiling) +# +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 +# +# Please note, this script has been designed to work with Gentoo's crossdev, it may or may +# not work with cross-toolchains that were build differently. +# +# +# Usage: "./icecream-create-env" creates a native environment(similar to icecc --build-native) +# "./icecream-create-env prefix" creates a cross-compile environment using the cross-toolchain created by crossdev +# Example: +# "emerge crossdev && crossdev -t sparc-unknown-linux-gnu && icecream-create-env sparc-unknown-linux" + +if [ `id -u` -ne 0 ] +then + echo "Only the superuser can execute this script." + exit 1 +fi + +# param 1 = CHOST +prefix="${1}" + +if [ -z "${prefix}" ] +then + prefix="`gcc -dumpmachine`" +fi + +gccbin=`which ${prefix}-gcc 2>/dev/null` +if [ ! -e "${gccbin}" ] +then + echo "Can't find ${prefix}-gcc!" + exit 1 +fi + +gxxbin=`which ${prefix}-g++ 2>/dev/null` +if [ ! -e "${gxxbin}" ] +then + echo "Can't find ${prefix}-g++!" + exit 2 +fi + +version="`${prefix}-gcc -dumpversion`" + +tmpdir=`mktemp -d` +tmpfile=`mktemp` + +target=`gcc -dumpmachine` +if [ "x${target}" = "x${prefix}" ] +then + /usr/libexec/icecc/icecc-create-env \ + /usr/${prefix}/gcc-bin/${version}/gcc \ + /usr/${prefix}/gcc-bin/${version}/g++ \ + | tee ${tmpfile} +else + /usr/libexec/icecc/icecc-create-env \ + /usr/${target}/${prefix}/gcc-bin/${version}/${prefix}-gcc \ + /usr/${target}/${prefix}/gcc-bin/${version}/${prefix}-g++ \ + | tee ${tmpfile} +fi + +# figure out the name of the archive +icecc_envname=`grep "creating" ${tmpfile} | awk '{print $2}'` + +echo "Testing icecc environment..." +tar -x -z -f ${icecc_envname} -C ${tmpdir} +touch ${tmpdir}/empty.c +chroot ${tmpdir}/ /usr/bin/gcc -c /empty.c +tested=${?} +rm ${tmpdir}/empty.c + +if [ "${tested}" -ne 0 ] +then + echo "" + echo "Creating icecc environment failed. Please see error message(s) above! The temporary directory is: ${tmpdir}/" +else + echo "" + echo "Icecc environment has been created. It has been saved as ${icecc_envname}!" +fi + diff --git a/sys-devel/icecream/files/icecream-r2 b/sys-devel/icecream/files/icecream-r2 new file mode 100644 index 0000000..935f464 --- /dev/null +++ b/sys-devel/icecream/files/icecream-r2 @@ -0,0 +1,44 @@ +#!/sbin/openrc-run +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need net +} + +start() { + local basedir=${ICECREAM_BASEDIR:-"/var/cache/icecream"} + local netname=${ICECREAM_NETNAME:+"-n ${ICECREAM_NETNAME}"} + local logfile=${ICECREAM_LOG_FILE:+"-l ${ICECREAM_LOG_FILE}"} + local nice=${ICECREAM_NICE_LEVEL:+"--nice ${ICECREAM_NICE_LEVEL}"} + local scheduler=${ICECREAM_SCHEDULER_HOST:+"-s ${ICECREAM_SCHEDULER_HOST}"} + local maxjobs=${ICECREAM_MAX_JOBS:+"-m ${ICECREAM_MAX_JOBS}"} + local verbosity=${ICECREAM_VERBOSITY:-"-v"} + + [[ ! -d /var/log/icecream/ ]] && mkdir -p /var/log/icecream/ && chown icecream:icecream /var/log/icecream/ + if [[ "${ICECREAM_RUN_SCHEDULER}" == "yes" ]]; then + local slogfile=${ICECREAM_SCHEDULER_LOG_FILE:-"/var/log/icecc_scheduler"} + touch ${slogfile} && chown icecream:icecream ${slogfile} + slogfile=${slogfile:+"-l ${slogfile}"} + ebegin "Starting Distributed Compiler Scheduler" + start-stop-daemon -u icecream --start --quiet --exec /usr/sbin/icecc-scheduler -- -d ${slogfile} ${netname} ${verbosity} + eend ${?} + fi + + [[ ! -d ${basedir} ]] && mkdir -p ${basedir} && chown icecream:icecream ${basedir} + ebegin "Starting Distributed Compiler Daemon" + start-stop-daemon --start --quiet --exec /usr/sbin/iceccd -- -d ${logfile} ${nice} ${scheduler} ${netname} -u icecream -b "${basedir}" ${maxjobs} ${verbosity} + eend ${?} +} + +stop() { + ebegin "Stopping Distributed Compiler Daemon" + start-stop-daemon --stop --quiet --name iceccd + eend ${?} + + if [[ "${ICECREAM_RUN_SCHEDULER}" == "yes" ]]; then + ebegin "Stopping Distributed Compiler Scheduler" + start-stop-daemon --stop --quiet --name icecc-scheduler + eend ${?} + fi +}