/[gentoo-x86]/eclass/eutils.eclass
Gentoo

Diff of /eclass/eutils.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.9 Revision 1.13
1# Copyright 1999-2002 Gentoo Technologies, Inc. 1# Copyright 1999-2002 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# Author: Martin Schlemmer <azarah@gentoo.org> 3# Author: Martin Schlemmer <azarah@gentoo.org>
4# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.9 2002/12/01 15:48:27 azarah Exp $ 4# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.13 2003/01/17 08:08:48 azarah Exp $
5# This eclass is for general purpose functions that most ebuilds 5# This eclass is for general purpose functions that most ebuilds
6# have to implement themselves. 6# have to implement themselves.
7# 7#
8# NB: If you add anything, please comment it! 8# NB: If you add anything, please comment it!
9 9
10ECLASS=eutils 10ECLASS=eutils
11INHERITED="$INHERITED $ECLASS" 11INHERITED="$INHERITED $ECLASS"
12 12
13newdepend sys-devel/patch 13newdepend "!bootstrap? ( sys-devel/patch )"
14 14
15DESCRIPTION="Based on the ${ECLASS} eclass" 15DESCRIPTION="Based on the ${ECLASS} eclass"
16 16
17# This function generate linker scripts in /usr/lib for dynamic 17# This function generate linker scripts in /usr/lib for dynamic
18# libs in /lib. This is to fix linking problems when you have 18# libs in /lib. This is to fix linking problems when you have
154 local EPATCH_SOURCE="$1/*.${EPATCH_SUFFIX}" 154 local EPATCH_SOURCE="$1/*.${EPATCH_SUFFIX}"
155 else 155 else
156 if [ ! -d ${EPATCH_SOURCE} ] 156 if [ ! -d ${EPATCH_SOURCE} ]
157 then 157 then
158 echo 158 echo
159 eerror "Cannot find \$EPATCH_SOURCE!" 159 eerror "Cannot find \$EPATCH_SOURCE! Value for \$EPATCH_SOURCE is:"
160 eerror
161 eerror " ${EPATCH_SOURCE}"
160 echo 162 echo
161 die "Cannot find \$EPATCH_SOURCE!" 163 die "Cannot find \$EPATCH_SOURCE!"
162 fi 164 fi
163 165
164 local EPATCH_SOURCE="${EPATCH_SOURCE}/*.${EPATCH_SUFFIX}" 166 local EPATCH_SOURCE="${EPATCH_SOURCE}/*.${EPATCH_SUFFIX}"
309 then 311 then
310 einfo "Done with patching" 312 einfo "Done with patching"
311 fi 313 fi
312} 314}
313 315
316# This function check how many cpu's are present, and then set
317# -j in MAKEOPTS accordingly.
318#
319# Thanks to nall <nall@gentoo.org> for this.
320#
321get_number_of_jobs() {
322 local jobs=0
323
324 if [ ! -r /proc/cpuinfo ]
325 then
326 return 1
327 fi
328
329 export MAKEOPTS="`echo ${MAKEOPTS} | sed -e 's:-j[0-9]*::g'`"
330
331 if [ "${ARCH}" = "x86" ]
332 then
333 # x86 always has "processor"
334 jobs="$((`grep -c ^processor /proc/cpuinfo` * 2))"
335
336 elif [ "${ARCH}" = "sparc" -o "${ARCH}" = "sparc64" ]
337 then
338 # sparc always has "ncpus active"
339 jobs="$((`grep "^ncpus active" /proc/cpuinfo | sed -e "s/^.*: //"` * 2))"
340
341 elif [ "${ARCH}" = "alpha" ]
342 then
343 # alpha has "cpus active", but only when compiled with SMP
344 if [ "`grep -c "^cpus active" /proc/cpuinfo`" -eq 1 ]
345 then
346 jobs="$((`grep "^cpus active" /proc/cpuinfo | sed -e "s/^.*: //"` * 2))"
347 else
348 jobs=2
349 fi
350
351 elif [ "${ARCH}" = "ppc" ]
352 then
353 # ppc has "processor", but only when compiled with SMP
354 if [ "`grep -c "^processor" /proc/cpuinfo`" -eq 1 ]
355 then
356 jobs="$((`grep -c ^processor /proc/cpuinfo` * 2))"
357 else
358 jobs=2
359 fi
360 elif [ "${ARCH}" = "mips" ]
361 then
362 # mips always has "processor"
363 jobs="$((`grep -c ^processor /proc/cpuinfo` * 2))"
364
365 else
366 jobs="$((`grep -c ^cpu /proc/cpuinfo` * 2))"
367 die "Unknown ARCH -- ${ARCH}!"
368 fi
369
370 # Make sure the number is valid ...
371 if [ "${jobs}" -lt 1 ]
372 then
373 jobs=1
374 fi
375
376 export MAKEOPTS="${MAKEOPTS} -j${jobs}"
377}
378

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.13

  ViewVC Help
Powered by ViewVC 1.1.20