1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.19 2003/02/16 20:12:26 azarah Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.21 2003/02/18 20:23:20 zwelch Exp $ |
4 | # |
4 | # |
5 | # Author: Martin Schlemmer <azarah@gentoo.org> |
5 | # Author: Martin Schlemmer <azarah@gentoo.org> |
6 | # |
6 | # |
7 | # This eclass is for general purpose functions that most ebuilds |
7 | # This eclass is for general purpose functions that most ebuilds |
8 | # have to implement themselves. |
8 | # have to implement themselves. |
… | |
… | |
12 | ECLASS=eutils |
12 | ECLASS=eutils |
13 | INHERITED="$INHERITED $ECLASS" |
13 | INHERITED="$INHERITED $ECLASS" |
14 | |
14 | |
15 | newdepend "!bootstrap? ( sys-devel/patch )" |
15 | newdepend "!bootstrap? ( sys-devel/patch )" |
16 | |
16 | |
17 | DESCRIPTION="Based on the ${ECLASS} eclass" |
17 | [ -z "$DESCRIPTION" ] && DESCRIPTION="Based on the ${ECLASS} eclass" |
18 | |
18 | |
19 | # This function generate linker scripts in /usr/lib for dynamic |
19 | # This function generate linker scripts in /usr/lib for dynamic |
20 | # libs in /lib. This is to fix linking problems when you have |
20 | # libs in /lib. This is to fix linking problems when you have |
21 | # the .so in /lib, and the .a in /usr/lib. What happens is that |
21 | # the .so in /lib, and the .a in /usr/lib. What happens is that |
22 | # in some cases when linking dynamic, the .a in /usr/lib is used |
22 | # in some cases when linking dynamic, the .a in /usr/lib is used |
… | |
… | |
341 | ADMINPARAM="${ADMINPARAM/-j}" |
341 | ADMINPARAM="${ADMINPARAM/-j}" |
342 | fi |
342 | fi |
343 | |
343 | |
344 | export MAKEOPTS="`echo ${MAKEOPTS} | sed -e 's:-j *[0-9]*::g'`" |
344 | export MAKEOPTS="`echo ${MAKEOPTS} | sed -e 's:-j *[0-9]*::g'`" |
345 | |
345 | |
346 | if [ "${ARCH}" = "x86" -o "${ARCH}" = "hppa" ] |
346 | if [ "${ARCH}" = "x86" -o "${ARCH}" = "hppa" -o \ |
|
|
347 | "${ARCH}" = "arm" -o "${ARCH}" = "mips" ] |
347 | then |
348 | then |
348 | # x86 and hppa always has "processor" |
349 | # these archs will always have "[Pp]rocessor" |
349 | jobs="$((`grep -c ^processor /proc/cpuinfo` * 2))" |
350 | jobs="$((`grep -c ^[Pp]rocessor /proc/cpuinfo` * 2))" |
350 | |
351 | |
351 | elif [ "${ARCH}" = "sparc" -o "${ARCH}" = "sparc64" ] |
352 | elif [ "${ARCH}" = "sparc" -o "${ARCH}" = "sparc64" ] |
352 | then |
353 | then |
353 | # sparc always has "ncpus active" |
354 | # sparc always has "ncpus active" |
354 | jobs="$((`grep "^ncpus active" /proc/cpuinfo | sed -e "s/^.*: //"` * 2))" |
355 | jobs="$((`grep "^ncpus active" /proc/cpuinfo | sed -e "s/^.*: //"` * 2))" |
… | |
… | |
370 | then |
371 | then |
371 | jobs="$((`grep -c ^processor /proc/cpuinfo` * 2))" |
372 | jobs="$((`grep -c ^processor /proc/cpuinfo` * 2))" |
372 | else |
373 | else |
373 | jobs=2 |
374 | jobs=2 |
374 | fi |
375 | fi |
375 | elif [ "${ARCH}" = "mips" ] |
|
|
376 | then |
|
|
377 | # mips always has "processor" |
|
|
378 | jobs="$((`grep -c ^processor /proc/cpuinfo` * 2))" |
|
|
379 | |
|
|
380 | else |
376 | else |
381 | jobs="$((`grep -c ^cpu /proc/cpuinfo` * 2))" |
377 | jobs="$((`grep -c ^cpu /proc/cpuinfo` * 2))" |
382 | die "Unknown ARCH -- ${ARCH}!" |
378 | die "Unknown ARCH -- ${ARCH}!" |
383 | fi |
379 | fi |
384 | |
380 | |