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

Diff of /eclass/eutils.eclass

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

Revision 1.143 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.143 2005/01/26 16:19:12 ka0ttic 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.
14INHERITED="$INHERITED $ECLASS" 14INHERITED="$INHERITED $ECLASS"
15 15
16DEPEND="!bootstrap? ( sys-devel/patch )" 16DEPEND="!bootstrap? ( sys-devel/patch )"
17 17
18DESCRIPTION="Based on the ${ECLASS} eclass" 18DESCRIPTION="Based on the ${ECLASS} eclass"
19
20# ecpu_check
21# Usage:
22#
23# ecpu_check array_of_cpu_flags
24#
25# array_of_cpu_flags - An array of cpu flags to check against USE flags
26#
27# Checks user USE related cpu flags against /proc/cpuinfo. If user enables a
28# cpu flag that is not supported in their processor flags, it will warn the
29# user if CROSSCOMPILE is not set to 1 ( because cross compile users are
30# obviously using different cpu flags than their own cpu ). Examples:
31#
32# CPU_FLAGS=(mmx mmx2 sse sse2)
33# ecpu_check CPU_FLAGS
34# Chris White <chriswhite@gentoo.org> (03 Feb 2005)
35
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
43 CPU_FLAGS=${1}
44 USER_CPU=`grep "flags" /proc/cpuinfo`
45
46 for flags in `seq 1 ${#CPU_FLAGS[@]}`
47 do
48 if has ${CPU_FLAGS[${flags} - 1]} ${USER_CPU} && ! has ${CPU_FLAGS[${flags} - 1]} ${USE}
49 then
50 ewarn "Your system is ${CPU_FLAGS[${flags} - 1]} capable but you don't have it enabled!"
51 ewarn "You might be cross compiling (in this case set CROSSCOMPILE to 1 to disable this warning."
52 fi
53
54 if ! has ${CPU_FLAGS[${flags} - 1]} ${USER_CPU} && has ${CPU_FLAGS[${flags} -1]} ${USE}
55 then
56 ewarn "You have ${CPU_FLAGS[${flags} - 1]} support enabled but your processor doesn't"
57 ewarn "Seem to support it! You might be cross compiling or do not have /proc filesystem"
58 ewarn "enabled. If either is the case, set CROSSCOMPILE to 1 to disable this warning."
59 fi
60 done
61 fi
62}
19 63
20# 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
21# 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
22# 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
23# must be an integer greater than zero. 67# must be an integer greater than zero.
65gen_usr_ldscript() { 109gen_usr_ldscript() {
66 local libdir="$(get_libdir)" 110 local libdir="$(get_libdir)"
67 # Just make sure it exists 111 # Just make sure it exists
68 dodir /usr/${libdir} 112 dodir /usr/${libdir}
69 113
114 while [[ $# -gt 0 ]] ; do
70 cat > "${D}/usr/${libdir}/${1}" << END_LDSCRIPT 115 cat > "${D}/usr/${libdir}/$1" <<-END_LDSCRIPT
71/* GNU ld script 116 /* GNU ld script
72 Because Gentoo have critical dynamic libraries 117 Since Gentoo has critical dynamic libraries
73 in /lib, and the static versions in /usr/lib, we 118 in /lib, and the static versions in /usr/lib,
74 need to have a "fake" dynamic lib in /usr/lib, 119 we need to have a "fake" dynamic lib in /usr/lib,
75 otherwise we run into linking problems. 120 otherwise we run into linking problems.
76 See bug #4411 on http://bugs.gentoo.org/ for 121
77 more info. */ 122 See bug http://bugs.gentoo.org/4411 for more info.
123 */
78GROUP ( /${libdir}/${1} ) 124 GROUP ( /${libdir}/$1 )
79END_LDSCRIPT 125 END_LDSCRIPT
80 fperms a+x "/usr/${libdir}/${1}" 126 fperms a+x "/usr/${libdir}/$1"
127 shift
128 done
81} 129}
82 130
83# 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 $*
84# 132#
85# <azarah@gentoo.org> (11 Nov 2002) 133# <azarah@gentoo.org> (11 Nov 2002)
248 ([ "${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}" ] || \
249 [ "${EPATCH_FORCE}" = "yes" ]) 297 [ "${EPATCH_FORCE}" = "yes" ])
250 then 298 then
251 local count=0 299 local count=0
252 local popts="${EPATCH_OPTS}" 300 local popts="${EPATCH_OPTS}"
301 local patchname=${x##*/}
253 302
254 if [ -n "${EPATCH_EXCLUDE}" ] 303 if [ -n "${EPATCH_EXCLUDE}" ]
255 then 304 then
256 if [ "`eval echo \$\{EPATCH_EXCLUDE/${x##*/}\}`" != "${EPATCH_EXCLUDE}" ] 305 if [ "${EPATCH_EXCLUDE/${patchname}}" != "${EPATCH_EXCLUDE}" ]
257 then 306 then
258 continue 307 continue
259 fi 308 fi
260 fi 309 fi
261 310
263 then 312 then
264 if [ -n "${EPATCH_SINGLE_MSG}" ] 313 if [ -n "${EPATCH_SINGLE_MSG}" ]
265 then 314 then
266 einfo "${EPATCH_SINGLE_MSG}" 315 einfo "${EPATCH_SINGLE_MSG}"
267 else 316 else
268 einfo "Applying ${x##*/} ..." 317 einfo "Applying ${patchname} ..."
269 fi 318 fi
270 else 319 else
271 einfo " ${x##*/} ..." 320 einfo " ${patchname} ..."
272 fi 321 fi
273 322
274 echo "***** ${x##*/} *****" > ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 323 echo "***** ${patchname} *****" > ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
275 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 324 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
276 325
277 # Allow for prefix to differ ... im lazy, so shoot me :/ 326 # Allow for prefix to differ ... im lazy, so shoot me :/
278 while [ "${count}" -lt 5 ] 327 while [ "${count}" -lt 5 ]
279 do 328 do
280 # Generate some useful debug info ... 329 # Generate some useful debug info ...
281 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 330 draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
282 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 331 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
283 332
284 if [ "${PATCH_SUFFIX}" != "patch" ] 333 if [ "${PATCH_SUFFIX}" != "patch" ]
285 then 334 then
286 echo -n "PIPE_COMMAND: " >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 335 echo -n "PIPE_COMMAND: " >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
287 echo "${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 336 echo "${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
288 else 337 else
289 PATCH_TARGET="${x}" 338 PATCH_TARGET="${x}"
290 fi 339 fi
291 340
292 echo -n "PATCH COMMAND: " >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 341 echo -n "PATCH COMMAND: " >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
293 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##*/}
294 343
295 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 344 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
296 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 345 draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
297 346
298 if [ "${PATCH_SUFFIX}" != "patch" ] 347 if [ "${PATCH_SUFFIX}" != "patch" ]
299 then 348 then
300 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
301 then 350 then
302 echo 351 echo
303 eerror "Could not extract patch!" 352 eerror "Could not extract patch!"
304 #die "Could not extract patch!" 353 #die "Could not extract patch!"
305 count=5 354 count=5
306 break 355 break
307 fi 356 fi
308 fi 357 fi
309 358
310 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
311 then 360 then
312 draw_line "***** ${x##*/} *****" > ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 361 draw_line "***** ${patchname} *****" > ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
313 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 362 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
314 echo "ACTUALLY APPLYING ${x##*/} ..." >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 363 echo "ACTUALLY APPLYING ${patchname} ..." >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
315 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 364 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
316 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 365 draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
317 366
318 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
319 368
320 if [ "$?" -ne 0 ] 369 if [ "$?" -ne 0 ]
321 then 370 then
322 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##*/}
323 echo 372 echo
324 eerror "A dry-run of patch command succeeded, but actually" 373 eerror "A dry-run of patch command succeeded, but actually"
325 eerror "applying the patch failed!" 374 eerror "applying the patch failed!"
326 #die "Real world sux compared to the dreamworld!" 375 #die "Real world sux compared to the dreamworld!"
327 count=5 376 count=5
328 fi 377 fi
329 378
330 rm -f ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 379 rm -f ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
331 380
332 break 381 break
333 fi 382 fi
334 383
335 count=$((count + 1)) 384 count=$((count + 1))
341 fi 390 fi
342 391
343 if [ "${count}" -eq 5 ] 392 if [ "${count}" -eq 5 ]
344 then 393 then
345 echo 394 echo
346 eerror "Failed Patch: ${x##*/}!" 395 eerror "Failed Patch: ${patchname} !"
396 eerror " ( ${PATCH_TARGET} )"
347 eerror 397 eerror
348 eerror "Include in your bugreport the contents of:" 398 eerror "Include in your bugreport the contents of:"
349 eerror 399 eerror
350 eerror " ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}" 400 eerror " ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}"
351 echo 401 echo
352 die "Failed Patch: ${x##*/}!" 402 die "Failed Patch: ${patchname}!"
353 fi 403 fi
354 404
355 rm -f ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 405 rm -f ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
356 406
357 eend 0 407 eend 0
358 fi 408 fi
359 done 409 done
360 if [ "${SINGLE_PATCH}" = "no" ] 410 if [ "${SINGLE_PATCH}" = "no" ]
864# name: the name that will show up in the menu 914# name: the name that will show up in the menu
865# icon: give your little like a pretty little icon ... 915# icon: give your little like a pretty little icon ...
866# this can be relative (to /usr/share/pixmaps) or 916# this can be relative (to /usr/share/pixmaps) or
867# a full path to an icon 917# a full path to an icon
868# type: what kind of application is this ? for categories: 918# type: what kind of application is this ? for categories:
869# http://www.freedesktop.org/standards/menu-spec/ 919# http://www.freedesktop.org/wiki/Standards_2fmenu_2dspec
870# path: if your app needs to startup in a specific dir 920# path: if your app needs to startup in a specific dir
871make_desktop_entry() { 921make_desktop_entry() {
872 [ -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
873 923
874 local exec="${1}" 924 local exec=${1}
875 local name="${2:-${PN}}" 925 local name=${2:-${PN}}
876 local icon="${3:-${PN}.png}" 926 local icon=${3:-${PN}.png}
877 local type="${4}" 927 local type=${4}
878 local subdir="${6}" 928 local path=${5}
879 local path="${5:-${GAMES_BINDIR}}" 929
880 if [ -z "${type}" ] 930 if [[ -z ${type} ]] ; then
881 then 931 local catmaj=${CATEGORY%%-*}
882 case ${CATEGORY} in 932 local catmin=${CATEGORY##*-}
883 "app-emulation") 933 case ${catmaj} in
884 type=Emulator 934 app)
885 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
886 ;; 948 ;;
887 "games-"*) 949
888 type=Game 950 dev)
889 subdir="Games" 951 type="Development"
890 ;; 952 ;;
891 "net-"*) 953
892 type=Network 954 games)
893 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}"
894 ;; 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
895 *) 1026 *)
896 type= 1027 type=
897 subdir=
898 ;; 1028 ;;
899 esac 1029 esac
900 fi 1030 fi
1031
901 local desktop="${T}/${exec}.desktop" 1032 local desktop=${T}/${exec%% *}-${P}.desktop
902 1033
903echo "[Desktop Entry] 1034echo "[Desktop Entry]
904Encoding=UTF-8 1035Encoding=UTF-8
905Version=0.9.2 1036Version=0.9.2
906Name=${name} 1037Name=${name}
1434# directories and uses the intersection of the lists. 1565# directories and uses the intersection of the lists.
1435# 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
1436# directories and uses the union of the lists. 1567# directories and uses the union of the lists.
1437strip-linguas() { 1568strip-linguas() {
1438 local ls newls 1569 local ls newls
1439 if [ "$1" == "-i" ] || [ "$1" == "-u" ] ; then 1570 if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then
1440 local op="$1"; shift 1571 local op=$1; shift
1441 ls=" $(find "$1" -name '*.po' -printf '%f ') "; shift 1572 ls=" $(find "$1" -name '*.po' -printf '%f ') "; shift
1442 local d f 1573 local d f
1443 for d in "$@" ; do 1574 for d in "$@" ; do
1444 if [ "${op}" == "-u" ] ; then 1575 if [[ ${op} == "-u" ]] ; then
1445 newls="${ls}" 1576 newls=${ls}
1446 else 1577 else
1447 newls="" 1578 newls=""
1448 fi 1579 fi
1449 for f in $(find "$d" -name '*.po' -printf '%f ') ; do 1580 for f in $(find "$d" -name '*.po' -printf '%f ') ; do
1450 if [ "${op}" == "-i" ] ; then 1581 if [[ ${op} == "-i" ]] ; then
1451 [ "${ls/ ${f} /}" != "${ls}" ] && newls="${newls} ${f}" 1582 [[ ${ls/ ${f} /} != ${ls} ]] && newls="${newls} ${f}"
1452 else 1583 else
1453 [ "${ls/ ${f} /}" == "${ls}" ] && newls="${newls} ${f}" 1584 [[ ${ls/ ${f} /} == ${ls} ]] && newls="${newls} ${f}"
1454 fi 1585 fi
1455 done 1586 done
1456 ls="${newls}" 1587 ls=${newls}
1457 done 1588 done
1458 ls="${ls//.po}" 1589 ls=${ls//.po}
1459 else 1590 else
1460 ls="$@" 1591 ls=$@
1461 fi 1592 fi
1462 1593
1463 ls=" ${ls} " 1594 ls=" ${ls} "
1464 newls="" 1595 newls=""
1465 for f in ${LINGUAS} ; do 1596 for f in ${LINGUAS} ; do
1466 if [ "${ls/ ${f} /}" != "${ls}" ] ; then 1597 if [[ ${ls/ ${f} /} != ${ls} ]] ; then
1467 newls="${newls} ${f}" 1598 newls="${newls} ${f}"
1468 else 1599 else
1469 ewarn "Sorry, but ${PN} does not support the ${f} LINGUA" 1600 ewarn "Sorry, but ${PN} does not support the ${f} LINGUA"
1470 fi 1601 fi
1471 done 1602 done
1472 if [ -z "${newls}" ] ; then 1603 if [[ -z ${newls} ]] ; then
1473 unset LINGUAS 1604 unset LINGUAS
1474 else 1605 else
1475 export LINGUAS="${newls}" 1606 export LINGUAS=${newls:1}
1476 fi 1607 fi
1477} 1608}
1478 1609
1479# moved from kernel.eclass since they are generally useful outside of 1610# moved from kernel.eclass since they are generally useful outside of
1480# kernel.eclass -iggy (20041002) 1611# kernel.eclass -iggy (20041002)
1602 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
1603 done 1734 done
1604 eend 0 1735 eend 0
1605} 1736}
1606 1737
1607# dopamd [ file ] [ new file ] 1738# dopamd <file> [more files]
1608# 1739#
1609# Install pam auth config file in /etc/pam.d 1740# Install pam auth config file in /etc/pam.d
1610#
1611# The first argument, 'file' is required. Install as 'new file', if
1612# specified.
1613
1614dopamd() { 1741dopamd() {
1615 local pamd="$1" newpamd="${2:-$1}"
1616 [[ -z "$1" ]] && die "dopamd requires at least one argument." 1742 [[ -z $1 ]] && die "dopamd requires at least one argument"
1617 1743
1618 use pam || return 0 1744 use pam || return 0
1619 1745
1620 insinto /etc/pam.d 1746 insinto /etc/pam.d
1621 # these are the default doins options, but be explicit just in case 1747 doins "$@" || die "failed to install $@"
1622 insopts -m 0644 -o root -g root
1623 newins ${pamd} ${newpamd} || die "failed to install ${newpamd}"
1624} 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.143  
changed lines
  Added in v.1.162

  ViewVC Help
Powered by ViewVC 1.1.20