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

Diff of /eclass/eutils.eclass

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

Revision 1.144 Revision 1.162
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2005 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.144 2005/02/03 22:11:33 chriswhite Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.162 2005/03/23 12:46:11 ka0ttic 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.
32# CPU_FLAGS=(mmx mmx2 sse sse2) 32# CPU_FLAGS=(mmx mmx2 sse sse2)
33# ecpu_check CPU_FLAGS 33# ecpu_check CPU_FLAGS
34# Chris White <chriswhite@gentoo.org> (03 Feb 2005) 34# Chris White <chriswhite@gentoo.org> (03 Feb 2005)
35 35
36ecpu_check() { 36ecpu_check() {
37 # Think about changing below to: if [ "${CROSSCOMPILE}" -ne 1 -a -e "/proc/cpuinfo" ]
38 # and dropping the else if you do not plan on adding anything to that
39 # empty block ....
40 # PS: also try to add some quoting, and consider rather using ${foo} than $foo ...
41 if [ "${CROSSCOMPILE}" != "1" -a -e "/proc/cpuinfo" ]
42 then
37 CPU_FLAGS=$1 43 CPU_FLAGS=${1}
38 USER_CPU=`grep "flags" /proc/cpuinfo` 44 USER_CPU=`grep "flags" /proc/cpuinfo`
39 45
40 for flags in `seq 1 ${#CPU_FLAGS[@]}` 46 for flags in `seq 1 ${#CPU_FLAGS[@]}`
41 do 47 do
42 if has ${CPU_FLAGS[$flags - 1]} $USER_CPU && ! has ${CPU_FLAGS[$flags - 1]} $USE 48 if has ${CPU_FLAGS[${flags} - 1]} ${USER_CPU} && ! has ${CPU_FLAGS[${flags} - 1]} ${USE}
43 then 49 then
44 ewarn "Your system is ${CPU_FLAGS[$flags - 1]} capable but you don't have it enabled!" 50 ewarn "Your system is ${CPU_FLAGS[${flags} - 1]} capable but you don't have it enabled!"
45 ewarn "You might be cross compiling (in this case set CROSSCOMPILE to 1 to disable this warning." 51 ewarn "You might be cross compiling (in this case set CROSSCOMPILE to 1 to disable this warning."
46 fi 52 fi
47 53
48 if ! has ${CPU_FLAGS[$flags - 1]} $USER_CPU && has ${CPU_FLAGS[$flags -1]} $USE 54 if ! has ${CPU_FLAGS[${flags} - 1]} ${USER_CPU} && has ${CPU_FLAGS[${flags} -1]} ${USE}
49 then 55 then
50 ewarn "You have ${CPU_FLAGS[$flags - 1]} support enabled but your processor doesn't" 56 ewarn "You have ${CPU_FLAGS[${flags} - 1]} support enabled but your processor doesn't"
51 ewarn "Seem to support it! You might be cross compiling or do not have /proc filesystem" 57 ewarn "Seem to support it! You might be cross compiling or do not have /proc filesystem"
52 ewarn "enabled. If either is the case, set CROSSCOMPILE to 1 to disable this warning." 58 ewarn "enabled. If either is the case, set CROSSCOMPILE to 1 to disable this warning."
53 fi 59 fi
54 done 60 done
61 fi
55} 62}
56 63
57# Wait for the supplied number of seconds. If no argument is supplied, defaults 64# Wait for the supplied number of seconds. If no argument is supplied, defaults
58# to five seconds. If the EPAUSE_IGNORE env var is set, don't wait. If we're not 65# to five seconds. If the EPAUSE_IGNORE env var is set, don't wait. If we're not
59# outputting to a terminal, don't wait. For compatability purposes, the argument 66# outputting to a terminal, don't wait. For compatability purposes, the argument
102gen_usr_ldscript() { 109gen_usr_ldscript() {
103 local libdir="$(get_libdir)" 110 local libdir="$(get_libdir)"
104 # Just make sure it exists 111 # Just make sure it exists
105 dodir /usr/${libdir} 112 dodir /usr/${libdir}
106 113
114 while [[ $# -gt 0 ]] ; do
107 cat > "${D}/usr/${libdir}/${1}" << END_LDSCRIPT 115 cat > "${D}/usr/${libdir}/$1" <<-END_LDSCRIPT
108/* GNU ld script 116 /* GNU ld script
109 Because Gentoo have critical dynamic libraries 117 Since Gentoo has critical dynamic libraries
110 in /lib, and the static versions in /usr/lib, we 118 in /lib, and the static versions in /usr/lib,
111 need to have a "fake" dynamic lib in /usr/lib, 119 we need to have a "fake" dynamic lib in /usr/lib,
112 otherwise we run into linking problems. 120 otherwise we run into linking problems.
113 See bug #4411 on http://bugs.gentoo.org/ for 121
114 more info. */ 122 See bug http://bugs.gentoo.org/4411 for more info.
123 */
115GROUP ( /${libdir}/${1} ) 124 GROUP ( /${libdir}/$1 )
116END_LDSCRIPT 125 END_LDSCRIPT
117 fperms a+x "/usr/${libdir}/${1}" 126 fperms a+x "/usr/${libdir}/$1"
127 shift
128 done
118} 129}
119 130
120# Simple function to draw a line consisting of '=' the same length as $* 131# Simple function to draw a line consisting of '=' the same length as $*
121# 132#
122# <azarah@gentoo.org> (11 Nov 2002) 133# <azarah@gentoo.org> (11 Nov 2002)
285 ([ "${SINGLE_PATCH}" = "yes" -o "${x/_all_}" != "${x}" -o "`eval echo \$\{x/_${ARCH}_\}`" != "${x}" ] || \ 296 ([ "${SINGLE_PATCH}" = "yes" -o "${x/_all_}" != "${x}" -o "`eval echo \$\{x/_${ARCH}_\}`" != "${x}" ] || \
286 [ "${EPATCH_FORCE}" = "yes" ]) 297 [ "${EPATCH_FORCE}" = "yes" ])
287 then 298 then
288 local count=0 299 local count=0
289 local popts="${EPATCH_OPTS}" 300 local popts="${EPATCH_OPTS}"
301 local patchname=${x##*/}
290 302
291 if [ -n "${EPATCH_EXCLUDE}" ] 303 if [ -n "${EPATCH_EXCLUDE}" ]
292 then 304 then
293 if [ "`eval echo \$\{EPATCH_EXCLUDE/${x##*/}\}`" != "${EPATCH_EXCLUDE}" ] 305 if [ "${EPATCH_EXCLUDE/${patchname}}" != "${EPATCH_EXCLUDE}" ]
294 then 306 then
295 continue 307 continue
296 fi 308 fi
297 fi 309 fi
298 310
300 then 312 then
301 if [ -n "${EPATCH_SINGLE_MSG}" ] 313 if [ -n "${EPATCH_SINGLE_MSG}" ]
302 then 314 then
303 einfo "${EPATCH_SINGLE_MSG}" 315 einfo "${EPATCH_SINGLE_MSG}"
304 else 316 else
305 einfo "Applying ${x##*/} ..." 317 einfo "Applying ${patchname} ..."
306 fi 318 fi
307 else 319 else
308 einfo " ${x##*/} ..." 320 einfo " ${patchname} ..."
309 fi 321 fi
310 322
311 echo "***** ${x##*/} *****" > ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 323 echo "***** ${patchname} *****" > ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
312 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 324 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
313 325
314 # Allow for prefix to differ ... im lazy, so shoot me :/ 326 # Allow for prefix to differ ... im lazy, so shoot me :/
315 while [ "${count}" -lt 5 ] 327 while [ "${count}" -lt 5 ]
316 do 328 do
317 # Generate some useful debug info ... 329 # Generate some useful debug info ...
318 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 330 draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
319 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 331 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
320 332
321 if [ "${PATCH_SUFFIX}" != "patch" ] 333 if [ "${PATCH_SUFFIX}" != "patch" ]
322 then 334 then
323 echo -n "PIPE_COMMAND: " >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 335 echo -n "PIPE_COMMAND: " >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
324 echo "${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 336 echo "${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
325 else 337 else
326 PATCH_TARGET="${x}" 338 PATCH_TARGET="${x}"
327 fi 339 fi
328 340
329 echo -n "PATCH COMMAND: " >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 341 echo -n "PATCH COMMAND: " >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
330 echo "patch -p${count} ${popts} < ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 342 echo "patch -p${count} ${popts} < ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
331 343
332 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 344 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
333 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 345 draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
334 346
335 if [ "${PATCH_SUFFIX}" != "patch" ] 347 if [ "${PATCH_SUFFIX}" != "patch" ]
336 then 348 then
337 if ! (${PIPE_CMD} ${x} > ${PATCH_TARGET}) >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 2>&1 349 if ! (${PIPE_CMD} ${x} > ${PATCH_TARGET}) >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/} 2>&1
338 then 350 then
339 echo 351 echo
340 eerror "Could not extract patch!" 352 eerror "Could not extract patch!"
341 #die "Could not extract patch!" 353 #die "Could not extract patch!"
342 count=5 354 count=5
343 break 355 break
344 fi 356 fi
345 fi 357 fi
346 358
347 if (cat ${PATCH_TARGET} | patch -p${count} ${popts} --dry-run -f) >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 2>&1 359 if (cat ${PATCH_TARGET} | patch -p${count} ${popts} --dry-run -f) >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/} 2>&1
348 then 360 then
349 draw_line "***** ${x##*/} *****" > ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 361 draw_line "***** ${patchname} *****" > ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
350 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 362 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
351 echo "ACTUALLY APPLYING ${x##*/} ..." >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 363 echo "ACTUALLY APPLYING ${patchname} ..." >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
352 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 364 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
353 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 365 draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
354 366
355 cat ${PATCH_TARGET} | patch -p${count} ${popts} >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 2>&1 367 cat ${PATCH_TARGET} | patch -p${count} ${popts} >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real 2>&1
356 368
357 if [ "$?" -ne 0 ] 369 if [ "$?" -ne 0 ]
358 then 370 then
359 cat ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 371 cat ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
360 echo 372 echo
361 eerror "A dry-run of patch command succeeded, but actually" 373 eerror "A dry-run of patch command succeeded, but actually"
362 eerror "applying the patch failed!" 374 eerror "applying the patch failed!"
363 #die "Real world sux compared to the dreamworld!" 375 #die "Real world sux compared to the dreamworld!"
364 count=5 376 count=5
365 fi 377 fi
366 378
367 rm -f ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 379 rm -f ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
368 380
369 break 381 break
370 fi 382 fi
371 383
372 count=$((count + 1)) 384 count=$((count + 1))
378 fi 390 fi
379 391
380 if [ "${count}" -eq 5 ] 392 if [ "${count}" -eq 5 ]
381 then 393 then
382 echo 394 echo
383 eerror "Failed Patch: ${x##*/}!" 395 eerror "Failed Patch: ${patchname} !"
396 eerror " ( ${PATCH_TARGET} )"
384 eerror 397 eerror
385 eerror "Include in your bugreport the contents of:" 398 eerror "Include in your bugreport the contents of:"
386 eerror 399 eerror
387 eerror " ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}" 400 eerror " ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}"
388 echo 401 echo
389 die "Failed Patch: ${x##*/}!" 402 die "Failed Patch: ${patchname}!"
390 fi 403 fi
391 404
392 rm -f ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 405 rm -f ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
393 406
394 eend 0 407 eend 0
395 fi 408 fi
396 done 409 done
397 if [ "${SINGLE_PATCH}" = "no" ] 410 if [ "${SINGLE_PATCH}" = "no" ]
901# name: the name that will show up in the menu 914# name: the name that will show up in the menu
902# icon: give your little like a pretty little icon ... 915# icon: give your little like a pretty little icon ...
903# this can be relative (to /usr/share/pixmaps) or 916# this can be relative (to /usr/share/pixmaps) or
904# a full path to an icon 917# a full path to an icon
905# type: what kind of application is this ? for categories: 918# type: what kind of application is this ? for categories:
906# http://www.freedesktop.org/standards/menu-spec/ 919# http://www.freedesktop.org/wiki/Standards_2fmenu_2dspec
907# path: if your app needs to startup in a specific dir 920# path: if your app needs to startup in a specific dir
908make_desktop_entry() { 921make_desktop_entry() {
909 [ -z "$1" ] && eerror "make_desktop_entry: You must specify the executable" && return 1 922 [[ -z $1 ]] && eerror "make_desktop_entry: You must specify the executable" && return 1
910 923
911 local exec="${1}" 924 local exec=${1}
912 local name="${2:-${PN}}" 925 local name=${2:-${PN}}
913 local icon="${3:-${PN}.png}" 926 local icon=${3:-${PN}.png}
914 local type="${4}" 927 local type=${4}
915 local subdir="${6}" 928 local path=${5}
916 local path="${5:-${GAMES_BINDIR}}" 929
917 if [ -z "${type}" ] 930 if [[ -z ${type} ]] ; then
918 then 931 local catmaj=${CATEGORY%%-*}
919 case ${CATEGORY} in 932 local catmin=${CATEGORY##*-}
920 "app-emulation") 933 case ${catmaj} in
921 type=Emulator 934 app)
922 subdir="Emulation" 935 case ${catmin} in
936 admin) type=System;;
937 cdr) type=DiscBurning;;
938 dicts) type=Dictionary;;
939 editors) type=TextEditor;;
940 emacs) type=TextEditor;;
941 emulation) type=Emulator;;
942 laptop) type=HardwareSettings;;
943 office) type=Office;;
944 vim) type=TextEditor;;
945 xemacs) type=TextEditor;;
946 *) type=;;
947 esac
923 ;; 948 ;;
924 "games-"*) 949
925 type=Game 950 dev)
926 subdir="Games" 951 type="Development"
927 ;; 952 ;;
928 "net-"*) 953
929 type=Network 954 games)
930 subdir="${type}" 955 [[ -z ${path} ]] && path=${GAMES_BINDIR}
956
957 case ${catmin} in
958 action) type=ActionGame;;
959 arcade) type=ArcadeGame;;
960 board) type=BoardGame;;
961 kid) type=KidsGame;;
962 emulation) type=Emulator;;
963 puzzle) type=LogicGame;;
964 rpg) type=RolePlaying;;
965 roguelike) type=RolePlaying;;
966 simulation) type=Simulation;;
967 sports) type=SportsGame;;
968 strategy) type=StrategyGame;;
969 *) type=;;
970 esac
971 type="Game;${type}"
931 ;; 972 ;;
973
974 mail)
975 type="Network;Email"
976 ;;
977
978 media)
979 case ${catmin} in
980 gfx) type=Graphics;;
981 radio) type=Tuner;;
982 sound) type=Audio;;
983 tv) type=TV;;
984 video) type=Video;;
985 *) type=;;
986 esac
987 type="AudioVideo;${type}"
988 ;;
989
990 net)
991 case ${catmin} in
992 dialup) type=Dialup;;
993 ftp) type=FileTransfer;;
994 im) type=InstantMessaging;;
995 irc) type=IRCClient;;
996 mail) type=Email;;
997 news) type=News;;
998 nntp) type=News;;
999 p2p) type=FileTransfer;;
1000 *) type=;;
1001 esac
1002 type="Network;${type}"
1003 ;;
1004
1005 sci)
1006 case ${catmin} in
1007 astro*) type=Astronomoy;;
1008 bio*) type=Biology;;
1009 calc*) type=Calculator;;
1010 chem*) type=Chemistry;;
1011 geo*) type=Geology;;
1012 math*) type=Math;;
1013 *) type=;;
1014 esac
1015 type="Science;${type}"
1016 ;;
1017
1018 www)
1019 case ${catmin} in
1020 client) type=WebBrowser;;
1021 *) type=;;
1022 esac
1023 type="Network"
1024 ;;
1025
932 *) 1026 *)
933 type= 1027 type=
934 subdir=
935 ;; 1028 ;;
936 esac 1029 esac
937 fi 1030 fi
1031
938 local desktop="${T}/${exec}.desktop" 1032 local desktop=${T}/${exec%% *}-${P}.desktop
939 1033
940echo "[Desktop Entry] 1034echo "[Desktop Entry]
941Encoding=UTF-8 1035Encoding=UTF-8
942Version=0.9.2 1036Version=0.9.2
943Name=${name} 1037Name=${name}
1471# directories and uses the intersection of the lists. 1565# directories and uses the intersection of the lists.
1472# The -u builds a list of po files found in all the 1566# The -u builds a list of po files found in all the
1473# directories and uses the union of the lists. 1567# directories and uses the union of the lists.
1474strip-linguas() { 1568strip-linguas() {
1475 local ls newls 1569 local ls newls
1476 if [ "$1" == "-i" ] || [ "$1" == "-u" ] ; then 1570 if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then
1477 local op="$1"; shift 1571 local op=$1; shift
1478 ls=" $(find "$1" -name '*.po' -printf '%f ') "; shift 1572 ls=" $(find "$1" -name '*.po' -printf '%f ') "; shift
1479 local d f 1573 local d f
1480 for d in "$@" ; do 1574 for d in "$@" ; do
1481 if [ "${op}" == "-u" ] ; then 1575 if [[ ${op} == "-u" ]] ; then
1482 newls="${ls}" 1576 newls=${ls}
1483 else 1577 else
1484 newls="" 1578 newls=""
1485 fi 1579 fi
1486 for f in $(find "$d" -name '*.po' -printf '%f ') ; do 1580 for f in $(find "$d" -name '*.po' -printf '%f ') ; do
1487 if [ "${op}" == "-i" ] ; then 1581 if [[ ${op} == "-i" ]] ; then
1488 [ "${ls/ ${f} /}" != "${ls}" ] && newls="${newls} ${f}" 1582 [[ ${ls/ ${f} /} != ${ls} ]] && newls="${newls} ${f}"
1489 else 1583 else
1490 [ "${ls/ ${f} /}" == "${ls}" ] && newls="${newls} ${f}" 1584 [[ ${ls/ ${f} /} == ${ls} ]] && newls="${newls} ${f}"
1491 fi 1585 fi
1492 done 1586 done
1493 ls="${newls}" 1587 ls=${newls}
1494 done 1588 done
1495 ls="${ls//.po}" 1589 ls=${ls//.po}
1496 else 1590 else
1497 ls="$@" 1591 ls=$@
1498 fi 1592 fi
1499 1593
1500 ls=" ${ls} " 1594 ls=" ${ls} "
1501 newls="" 1595 newls=""
1502 for f in ${LINGUAS} ; do 1596 for f in ${LINGUAS} ; do
1503 if [ "${ls/ ${f} /}" != "${ls}" ] ; then 1597 if [[ ${ls/ ${f} /} != ${ls} ]] ; then
1504 newls="${newls} ${f}" 1598 newls="${newls} ${f}"
1505 else 1599 else
1506 ewarn "Sorry, but ${PN} does not support the ${f} LINGUA" 1600 ewarn "Sorry, but ${PN} does not support the ${f} LINGUA"
1507 fi 1601 fi
1508 done 1602 done
1509 if [ -z "${newls}" ] ; then 1603 if [[ -z ${newls} ]] ; then
1510 unset LINGUAS 1604 unset LINGUAS
1511 else 1605 else
1512 export LINGUAS="${newls}" 1606 export LINGUAS=${newls:1}
1513 fi 1607 fi
1514} 1608}
1515 1609
1516# moved from kernel.eclass since they are generally useful outside of 1610# moved from kernel.eclass since they are generally useful outside of
1517# kernel.eclass -iggy (20041002) 1611# kernel.eclass -iggy (20041002)
1639 patch -p0 "${f}" "${PORTDIR}/eclass/ELT-patches/nocxx/nocxx.patch" > /dev/null 1733 patch -p0 "${f}" "${PORTDIR}/eclass/ELT-patches/nocxx/nocxx.patch" > /dev/null
1640 done 1734 done
1641 eend 0 1735 eend 0
1642} 1736}
1643 1737
1644# dopamd [ file ] [ new file ] 1738# dopamd <file> [more files]
1645# 1739#
1646# Install pam auth config file in /etc/pam.d 1740# Install pam auth config file in /etc/pam.d
1647#
1648# The first argument, 'file' is required. Install as 'new file', if
1649# specified.
1650
1651dopamd() { 1741dopamd() {
1652 local pamd="$1" newpamd="${2:-$1}"
1653 [[ -z "$1" ]] && die "dopamd requires at least one argument." 1742 [[ -z $1 ]] && die "dopamd requires at least one argument"
1654 1743
1655 use pam || return 0 1744 use pam || return 0
1656 1745
1657 insinto /etc/pam.d 1746 insinto /etc/pam.d
1658 # these are the default doins options, but be explicit just in case 1747 doins "$@" || die "failed to install $@"
1659 insopts -m 0644 -o root -g root
1660 newins ${pamd} ${newpamd} || die "failed to install ${newpamd}"
1661} 1748}
1749# newpamd <old name> <new name>
1750#
1751# Install pam file <old name> as <new name> in /etc/pam.d
1752newpamd() {
1753 [[ $# -ne 2 ]] && die "newpamd requires two arguements"
1754
1755 use pam || return 0
1756
1757 insinto /etc/pam.d
1758 newins "$1" "$2" || die "failed to install $1 as $2"
1759}
1760
1761# make a wrapper script ...
1762# NOTE: this was originally games_make_wrapper, but I noticed other places where
1763# this could be used, so I have moved it here and made it not games-specific
1764# -- wolf31o2
1765# $1 == wrapper name
1766# $2 == binary to run
1767# $3 == directory to chdir before running binary
1768# $4 == extra LD_LIBRARY_PATH's (make it : delimited)
1769make_wrapper() {
1770 local wrapper=$1 bin=$2 chdir=$3 libdir=$4
1771 local tmpwrapper=$(emktemp)
1772 cat << EOF > "${tmpwrapper}"
1773#!/bin/sh
1774cd "${chdir}"
1775export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}"
1776exec ${bin} "\$@"
1777EOF
1778 chmod go+rx "${tmpwrapper}"
1779 newbin "${tmpwrapper}" "${wrapper}"
1780}

Legend:
Removed from v.1.144  
changed lines
  Added in v.1.162

  ViewVC Help
Powered by ViewVC 1.1.20