Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index International Gentoo Users Forum italiano (Italian) Risorse italiane (documentazione e tools)
  • Search

[SCRIPT] dmake -- distcc make

Forum riservato alla documentazione in italiano.

Moderator: ago

Post Reply
  • Print view
Advanced search
1 post • Page 1 of 1
Author
Message
drizztbsd
Retired Dev
Retired Dev
User avatar
Posts: 278
Joined: Sun Nov 21, 2004 10:58 pm
Location: Cesano Maderno
Contact:
Contact drizztbsd
Website

[SCRIPT] dmake -- distcc make

  • Quote

Post by drizztbsd » Fri Jan 26, 2007 2:51 pm

Oggi mi sono fatto uno script per gestire comodamente la compilazione con distcc
Le features sono le seguenti:
  • Utilizza di ccache e/o distcc automaticamente se rilevati
  • Supporto cross-distcc
  • Supporto porte diverse da quelle standard e numero jobs
L'unico problema per ora è che devi usare la sintassi col numero jobs (host/num o host:port/num)

Code: Select all

#!/bin/bash
# Copyright 2007 Timothy Redaelli <drizzt@gentoo.org>
# Distributed under the terms of the GNU General Public License v2

einfo() {
	echo -e " \e[32;01m*\e[0m $*"
}

ewarn() {
	echo -e " \e[33;01m*\e[0m $*" >&2
}

CHOST=$(gcc -v 2>&1 | awk '/^Target: /{print $2}')
export AS="/usr/${CHOST}/bin/as"
export LD="/usr/${CHOST}/bin/ld"

if type ccache &>/dev/null; then
	einfo ccache detected
	export PATH="/usr/lib/ccache/bin/:$PATH"
	export CC="/usr/lib/ccache/bin/${CHOST}-gcc"
	export CXX="/usr/lib/ccache/bin/${CHOST}-g++"
fi

if type distcc &>/dev/null; then
	einfo distcc detected
	if [[ -z "$DISTCC_HOSTS" ]]; then
		for i in $(</etc/distcc/hosts); do
			ip=${i%/*}
			port=${ip#*:}
			[[ "${port}" = "${ip}" ]] && port=3632 || ip=${ip%:*}
			if ( > "/dev/tcp/${ip}/${port}" ) 2>/dev/null || [[ ${ip} = localhost ]]; then
				DISTCC_HOSTS="${DISTCC_HOSTS} ${i}"
			else
				ewarn "${ip}:${port} is not available."
			fi
		done
	fi
    if [[ "${DISTCC_HOSTS}" ]]; then
        export DISTCC_HOSTS=${DISTCC_HOSTS}
        MAKEOPTS="-j$(($(for i in ${DISTCC_HOSTS}; do echo -n ${i#*/}+; done ; echo 0)))"
	if type ccache &>/dev/null; then 
		export CCACHE_PREFIX="distcc"
	else
		export PATH="/usr/lib/distcc/bin/:$PATH"
		export CC="/usr/lib/distcc/bin/${CHOST}-gcc"
		export CXX="/usr/lib/distcc/bin/${CHOST}-g++"
	fi
        einfo "I'm using distcc with \"${DISTCC_HOSTS}\""
    fi
fi

make -e ${MAKEOPTS} $*
Per gli host usare distcc-config
Gentoo/Alt lead
Gentoo/*BSD and Gentoo/FreeBSD deputy lead
Paludis contributor
Top
Post Reply
  • Print view
1 post • Page 1 of 1

Return to “Risorse italiane (documentazione e tools)”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic