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

Diff of /eclass/eutils.eclass

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

Revision 1.24 Revision 1.27
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.24 2003/03/03 21:27:15 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.27 2003/03/10 08:49:05 vapier 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.
318 then 318 then
319 einfo "Done with patching" 319 einfo "Done with patching"
320 fi 320 fi
321} 321}
322 322
323# This function return true if we are using the NPTL pthreads
324# implementation.
325#
326# <azarah@gentoo.org> (06 March 2003)
327#
328
329have_NPTL() {
330
331 cat > ${T}/test-nptl.c <<-"END"
332 #define _XOPEN_SOURCE
333 #include <unistd.h>
334 #include <stdio.h>
335
336 int main()
337 {
338 char buf[255];
339 char *str = buf;
340
341 confstr(_CS_GNU_LIBPTHREAD_VERSION, str, 255);
342 if (NULL != str) {
343 printf("%s\n", str);
344 if (NULL != strstr(str, "NPTL"))
345 return 0;
346 }
347
348 return 1;
349 }
350 END
351
352 einfon "Checking for _CS_GNU_LIBPTHREAD_VERSION support in glibc ... "
353 if gcc -o ${T}/nptl ${T}/test-nptl.c &> /dev/null
354 then
355 echo "yes"
356 einfon "Checking what PTHREADS implementation we have ... "
357 if ${T}/nptl
358 then
359 return 0
360 else
361 return 1
362 fi
363 else
364 echo "no"
365 fi
366
367 return 1
368}
369
323# This function check how many cpu's are present, and then set 370# This function check how many cpu's are present, and then set
324# -j in MAKEOPTS accordingly. 371# -j in MAKEOPTS accordingly.
325# 372#
326# Thanks to nall <nall@gentoo.org> for this. 373# Thanks to nall <nall@gentoo.org> for this.
327# 374#
403# enewuser(username, uid, shell, homedir, groups, extra options) 450# enewuser(username, uid, shell, homedir, groups, extra options)
404# 451#
405# Default values if you do not specify any: 452# Default values if you do not specify any:
406# username: REQUIRED ! 453# username: REQUIRED !
407# uid: next available (see useradd(8)) 454# uid: next available (see useradd(8))
455# note: pass -1 to get default behavior
408# shell: /bin/false 456# shell: /bin/false
409# homedir: /dev/null 457# homedir: /dev/null
410# groups: none 458# groups: none
411# extra: comment of 'added by portage for ${PN}' 459# extra: comment of 'added by portage for ${PN}'
412enewuser() { 460enewuser() {
433 # options to pass to useradd 481 # options to pass to useradd
434 local opts="" 482 local opts=""
435 483
436 # handle uid 484 # handle uid
437 local euid="$1"; shift 485 local euid="$1"; shift
438 if [ ! -z "${euid}" ] ; then 486 if [ ! -z "${euid}" ] && [ "${euid}" != "-1" ] ; then
439 if [ ${euid} -gt 0 ] ; then 487 if [ ${euid} -gt 0 ] ; then
440 opts="${opts} -u ${euid}" 488 opts="${opts} -u ${euid}"
441 else 489 else
442 eerror "Userid given but is not greater than 0 !" 490 eerror "Userid given but is not greater than 0 !"
443 die "${euid} is not a valid UID" 491 die "${euid} is not a valid UID"
574# 622#
575# edos2unix(file, <more files>...) 623# edos2unix(file, <more files>...)
576edos2unix() { 624edos2unix() {
577 for f in $@ ; do 625 for f in $@ ; do
578 cp ${f} ${T}/ 626 cp ${f} ${T}/
579 sed 's/\r$//' ${T}/${f}.old > ${f} 627 sed 's/\r$//' ${T}/${f} > ${f}
580 done 628 done
581} 629}

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.27

  ViewVC Help
Powered by ViewVC 1.1.20