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

Diff of /eclass/eutils.eclass

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

Revision 1.97 Revision 1.100
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 Gentoo Foundation
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.97 2004/08/31 09:05:24 lv Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.100 2004/09/12 07:16:45 mr_bones_ 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.
13INHERITED="$INHERITED $ECLASS" 13INHERITED="$INHERITED $ECLASS"
14 14
15DEPEND="!bootstrap? ( sys-devel/patch )" 15DEPEND="!bootstrap? ( sys-devel/patch )"
16 16
17DESCRIPTION="Based on the ${ECLASS} eclass" 17DESCRIPTION="Based on the ${ECLASS} eclass"
18
19# Wait for the supplied number of seconds. If no argument is supplied, defaults
20# to five seconds. If the EPAUSE_IGNORE env var is set, don't wait. If we're not
21# outputting to a terminal, don't wait. For compatability purposes, the argument
22# must be an integer greater than zero.
23# Bug 62950, Ciaran McCreesh <ciaranm@gentoo.org> (05 Sep 2004)
24epause() {
25 if [ -z "$EPAUSE_IGNORE" ] && [ -t 1 ] ; then
26 sleep ${1:-5}
27 fi
28}
29
30# Beep the specified number of times (defaults to five). If our output
31# is not a terminal, don't beep. If the EBEEP_IGNORE env var is set,
32# don't beep.
33# Bug 62950, Ciaran McCreesh <ciaranm@gentoo.org> (05 Sep 2004)
34ebeep() {
35 local n
36 if [ -z "$EBEEP_IGNORE" ] && [ -t 1 ] ; then
37 for ((n=1 ; n <= ${1:-5} ; n++)) ; do
38 echo -ne "\a"
39 sleep 0.1 &>/dev/null ; sleep 0,1 &>/dev/null
40 echo -ne "\a"
41 sleep 1
42 done
43 fi
44}
18 45
19# This function simply returns the desired lib directory. With portage 46# This function simply returns the desired lib directory. With portage
20# 2.0.51, we now have support for installing libraries to lib32/lib64 47# 2.0.51, we now have support for installing libraries to lib32/lib64
21# to accomidate the needs of multilib systems. It's no longer a good idea 48# to accomidate the needs of multilib systems. It's no longer a good idea
22# to assume all libraries will end up in lib. Replace any (sane) instances 49# to assume all libraries will end up in lib. Replace any (sane) instances
376# This function return true if we are using the NPTL pthreads 403# This function return true if we are using the NPTL pthreads
377# implementation. 404# implementation.
378# 405#
379# <azarah@gentoo.org> (06 March 2003) 406# <azarah@gentoo.org> (06 March 2003)
380# 407#
381
382have_NPTL() { 408have_NPTL() {
383
384 cat > ${T}/test-nptl.c <<-"END" 409 cat > ${T}/test-nptl.c <<-"END"
385 #define _XOPEN_SOURCE 410 #define _XOPEN_SOURCE
386 #include <unistd.h> 411 #include <unistd.h>
387 #include <stdio.h> 412 #include <stdio.h>
388 413
506# vapier@gentoo.org 531# vapier@gentoo.org
507# 532#
508# Takes just 1 parameter (the directory to create tmpfile in) 533# Takes just 1 parameter (the directory to create tmpfile in)
509mymktemp() { 534mymktemp() {
510 local topdir="$1" 535 local topdir="$1"
511 536
512 [ -z "${topdir}" ] && topdir=/tmp 537 [ -z "${topdir}" ] && topdir=/tmp
513 if [ "`which mktemp 2>/dev/null`" ] 538 if [ "`which mktemp 2>/dev/null`" ]
514 then 539 then
515 mktemp -p ${topdir} 540 mktemp -p ${topdir}
516 else 541 else
524# used in enewuser()/enewgroup() 549# used in enewuser()/enewgroup()
525# Joe Jezak <josejx@gmail.com> and usata@gentoo.org 550# Joe Jezak <josejx@gmail.com> and usata@gentoo.org
526# 551#
527# egetent(database, key) 552# egetent(database, key)
528egetent() { 553egetent() {
529 if [ "${ARCH}" == "macos" ] ; then 554 if [ "${ARCH}" == "macos" ] ; then
530 case "$2" in 555 case "$2" in
531 *[!0-9]*) # Non numeric 556 *[!0-9]*) # Non numeric
532 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }" 557 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }"
533 ;; 558 ;;
534 *) # Numeric 559 *) # Numeric
651 676
652 # handle extra and add the user 677 # handle extra and add the user
653 local eextra="$@" 678 local eextra="$@"
654 local oldsandbox="${SANDBOX_ON}" 679 local oldsandbox="${SANDBOX_ON}"
655 export SANDBOX_ON="0" 680 export SANDBOX_ON="0"
656 if [ "${ARCH}" == "macos" ]; 681 if [ "${ARCH}" == "macos" ];
657 then 682 then
658 ### Make the user 683 ### Make the user
659 if [ -z "${eextra}" ] 684 if [ -z "${eextra}" ]
660 then 685 then
661 dscl . create /users/${euser} uid ${euid} 686 dscl . create /users/${euser} uid ${euid}
754 opts="${opts} ${eextra}" 779 opts="${opts} ${eextra}"
755 780
756 # add the group 781 # add the group
757 local oldsandbox="${SANDBOX_ON}" 782 local oldsandbox="${SANDBOX_ON}"
758 export SANDBOX_ON="0" 783 export SANDBOX_ON="0"
759 if [ "${ARCH}" == "macos" ]; 784 if [ "${ARCH}" == "macos" ];
760 then 785 then
761 if [ ! -z "${eextra}" ]; 786 if [ ! -z "${eextra}" ];
762 then 787 then
763 einfo "Extra options are not supported on macos yet" 788 einfo "Extra options are not supported on macos yet"
764 einfo "Please report the ebuild along with the info below" 789 einfo "Please report the ebuild along with the info below"
765 einfo "eextra: ${eextra}" 790 einfo "eextra: ${eextra}"
766 die "Required function missing" 791 die "Required function missing"
767 fi 792 fi
768 793
769 # If we need the next available 794 # If we need the next available
770 case ${egid} in 795 case ${egid} in
771 *[!0-9]*) # Non numeric 796 *[!0-9]*) # Non numeric
772 for egid in `jot 898 101`; do 797 for egid in `jot 898 101`; do
773 [ -z "`egetent group ${egid}`" ] && break 798 [ -z "`egetent group ${egid}`" ] && break
774 done 799 done
775 esac 800 esac
776 dscl . create /groups/${egroup} gid ${egid} 801 dscl . create /groups/${egroup} gid ${egid}
777 dscl . create /groups/${egroup} passwd '*' 802 dscl . create /groups/${egroup} passwd '*'
778 else 803 else
779 groupadd ${opts} ${egroup} || die "enewgroup failed" 804 groupadd ${opts} ${egroup} || die "enewgroup failed"
780 fi 805 fi
781 export SANDBOX_ON="${oldsandbox}" 806 export SANDBOX_ON="${oldsandbox}"
782} 807}
816 local exec="${1}" 841 local exec="${1}"
817 local name="${2:-${PN}}" 842 local name="${2:-${PN}}"
818 local icon="${3:-${PN}.png}" 843 local icon="${3:-${PN}.png}"
819 local type="${4}" 844 local type="${4}"
820 local subdir="${6}" 845 local subdir="${6}"
821 local path="${5:-${GAMES_PREFIX}}" 846 local path="${5:-${GAMES_BINDIR}}"
822 if [ -z "${type}" ] 847 if [ -z "${type}" ]
823 then 848 then
824 case ${CATEGORY} in 849 case ${CATEGORY} in
825 "app-emulation") 850 "app-emulation")
826 type=Emulator 851 type=Emulator
849Type=Application 874Type=Application
850Comment=${DESCRIPTION} 875Comment=${DESCRIPTION}
851Exec=${exec} 876Exec=${exec}
852Path=${path} 877Path=${path}
853Icon=${icon} 878Icon=${icon}
854Categories=Application;${type};" > ${desktop} 879Categories=Application;${type};" > "${desktop}"
855 880
856 if [ -d "/usr/share/applications" ] 881 if [ -d "/usr/share/applications" ]
857 then 882 then
858 insinto /usr/share/applications 883 insinto /usr/share/applications
859 doins ${desktop} 884 doins "${desktop}"
860 fi 885 fi
861 886
862 #if [ -d "/usr/share/gnome/apps" ] 887 #if [ -d "/usr/share/gnome/apps" ]
863 #then 888 #then
864 # insinto /usr/share/gnome/apps/Games 889 # insinto /usr/share/gnome/apps/Games
875 #fi 900 #fi
876 901
877 if [ -d "/usr/share/applnk" ] 902 if [ -d "/usr/share/applnk" ]
878 then 903 then
879 insinto /usr/share/applnk/${subdir} 904 insinto /usr/share/applnk/${subdir}
880 doins ${desktop} 905 doins "${desktop}"
881 fi 906 fi
882 907
883 return 0 908 return 0
884} 909}
885 910
1291 read 1316 read
1292 fi 1317 fi
1293 done 1318 done
1294} 1319}
1295 1320
1296# Make sure that LINGUAS only contains languages that 1321# Make sure that LINGUAS only contains languages that
1297# a package can support 1322# a package can support
1298# 1323#
1299# usage: strip-linguas <allow LINGUAS> 1324# usage: strip-linguas <allow LINGUAS>
1300# strip-linguas -i <directories of .po files> 1325# strip-linguas -i <directories of .po files>
1301# strip-linguas -u <directories of .po files> 1326# strip-linguas -u <directories of .po files>
1302# 1327#
1303# The first form allows you to specify a list of LINGUAS. 1328# The first form allows you to specify a list of LINGUAS.
1304# The -i builds a list of po files found in all the 1329# The -i builds a list of po files found in all the
1305# directories and uses the intersection of the lists. 1330# directories and uses the intersection of the lists.
1306# The -u builds a list of po files found in all the 1331# The -u builds a list of po files found in all the
1307# directories and uses the union of the lists. 1332# directories and uses the union of the lists.
1308strip-linguas() { 1333strip-linguas() {
1309 local ls newls 1334 local ls newls
1310 if [ "$1" == "-i" ] || [ "$1" == "-u" ] ; then 1335 if [ "$1" == "-i" ] || [ "$1" == "-u" ] ; then
1311 local op="$1"; shift 1336 local op="$1"; shift

Legend:
Removed from v.1.97  
changed lines
  Added in v.1.100

  ViewVC Help
Powered by ViewVC 1.1.20