/[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.160
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.160 2005/03/22 17:33:13 wolf31o2 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.
248 ([ "${SINGLE_PATCH}" = "yes" -o "${x/_all_}" != "${x}" -o "`eval echo \$\{x/_${ARCH}_\}`" != "${x}" ] || \ 292 ([ "${SINGLE_PATCH}" = "yes" -o "${x/_all_}" != "${x}" -o "`eval echo \$\{x/_${ARCH}_\}`" != "${x}" ] || \
249 [ "${EPATCH_FORCE}" = "yes" ]) 293 [ "${EPATCH_FORCE}" = "yes" ])
250 then 294 then
251 local count=0 295 local count=0
252 local popts="${EPATCH_OPTS}" 296 local popts="${EPATCH_OPTS}"
297 local patchname=${x##*/}
253 298
254 if [ -n "${EPATCH_EXCLUDE}" ] 299 if [ -n "${EPATCH_EXCLUDE}" ]
255 then 300 then
256 if [ "`eval echo \$\{EPATCH_EXCLUDE/${x##*/}\}`" != "${EPATCH_EXCLUDE}" ] 301 if [ "${EPATCH_EXCLUDE/${patchname}}" != "${EPATCH_EXCLUDE}" ]
257 then 302 then
258 continue 303 continue
259 fi 304 fi
260 fi 305 fi
261 306
263 then 308 then
264 if [ -n "${EPATCH_SINGLE_MSG}" ] 309 if [ -n "${EPATCH_SINGLE_MSG}" ]
265 then 310 then
266 einfo "${EPATCH_SINGLE_MSG}" 311 einfo "${EPATCH_SINGLE_MSG}"
267 else 312 else
268 einfo "Applying ${x##*/} ..." 313 einfo "Applying ${patchname} ..."
269 fi 314 fi
270 else 315 else
271 einfo " ${x##*/} ..." 316 einfo " ${patchname} ..."
272 fi 317 fi
273 318
274 echo "***** ${x##*/} *****" > ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 319 echo "***** ${patchname} *****" > ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
275 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 320 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
276 321
277 # Allow for prefix to differ ... im lazy, so shoot me :/ 322 # Allow for prefix to differ ... im lazy, so shoot me :/
278 while [ "${count}" -lt 5 ] 323 while [ "${count}" -lt 5 ]
279 do 324 do
280 # Generate some useful debug info ... 325 # Generate some useful debug info ...
281 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 326 draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
282 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 327 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
283 328
284 if [ "${PATCH_SUFFIX}" != "patch" ] 329 if [ "${PATCH_SUFFIX}" != "patch" ]
285 then 330 then
286 echo -n "PIPE_COMMAND: " >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 331 echo -n "PIPE_COMMAND: " >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
287 echo "${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 332 echo "${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
288 else 333 else
289 PATCH_TARGET="${x}" 334 PATCH_TARGET="${x}"
290 fi 335 fi
291 336
292 echo -n "PATCH COMMAND: " >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 337 echo -n "PATCH COMMAND: " >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
293 echo "patch -p${count} ${popts} < ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 338 echo "patch -p${count} ${popts} < ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
294 339
295 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 340 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
296 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 341 draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
297 342
298 if [ "${PATCH_SUFFIX}" != "patch" ] 343 if [ "${PATCH_SUFFIX}" != "patch" ]
299 then 344 then
300 if ! (${PIPE_CMD} ${x} > ${PATCH_TARGET}) >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 2>&1 345 if ! (${PIPE_CMD} ${x} > ${PATCH_TARGET}) >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/} 2>&1
301 then 346 then
302 echo 347 echo
303 eerror "Could not extract patch!" 348 eerror "Could not extract patch!"
304 #die "Could not extract patch!" 349 #die "Could not extract patch!"
305 count=5 350 count=5
306 break 351 break
307 fi 352 fi
308 fi 353 fi
309 354
310 if (cat ${PATCH_TARGET} | patch -p${count} ${popts} --dry-run -f) >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 2>&1 355 if (cat ${PATCH_TARGET} | patch -p${count} ${popts} --dry-run -f) >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/} 2>&1
311 then 356 then
312 draw_line "***** ${x##*/} *****" > ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 357 draw_line "***** ${patchname} *****" > ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
313 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 358 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
314 echo "ACTUALLY APPLYING ${x##*/} ..." >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 359 echo "ACTUALLY APPLYING ${patchname} ..." >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
315 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 360 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
316 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 361 draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
317 362
318 cat ${PATCH_TARGET} | patch -p${count} ${popts} >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 2>&1 363 cat ${PATCH_TARGET} | patch -p${count} ${popts} >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real 2>&1
319 364
320 if [ "$?" -ne 0 ] 365 if [ "$?" -ne 0 ]
321 then 366 then
322 cat ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 367 cat ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
323 echo 368 echo
324 eerror "A dry-run of patch command succeeded, but actually" 369 eerror "A dry-run of patch command succeeded, but actually"
325 eerror "applying the patch failed!" 370 eerror "applying the patch failed!"
326 #die "Real world sux compared to the dreamworld!" 371 #die "Real world sux compared to the dreamworld!"
327 count=5 372 count=5
328 fi 373 fi
329 374
330 rm -f ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 375 rm -f ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
331 376
332 break 377 break
333 fi 378 fi
334 379
335 count=$((count + 1)) 380 count=$((count + 1))
341 fi 386 fi
342 387
343 if [ "${count}" -eq 5 ] 388 if [ "${count}" -eq 5 ]
344 then 389 then
345 echo 390 echo
346 eerror "Failed Patch: ${x##*/}!" 391 eerror "Failed Patch: ${patchname} !"
392 eerror " ( ${PATCH_TARGET} )"
347 eerror 393 eerror
348 eerror "Include in your bugreport the contents of:" 394 eerror "Include in your bugreport the contents of:"
349 eerror 395 eerror
350 eerror " ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}" 396 eerror " ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}"
351 echo 397 echo
352 die "Failed Patch: ${x##*/}!" 398 die "Failed Patch: ${patchname}!"
353 fi 399 fi
354 400
355 rm -f ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 401 rm -f ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
356 402
357 eend 0 403 eend 0
358 fi 404 fi
359 done 405 done
360 if [ "${SINGLE_PATCH}" = "no" ] 406 if [ "${SINGLE_PATCH}" = "no" ]
864# name: the name that will show up in the menu 910# name: the name that will show up in the menu
865# icon: give your little like a pretty little icon ... 911# icon: give your little like a pretty little icon ...
866# this can be relative (to /usr/share/pixmaps) or 912# this can be relative (to /usr/share/pixmaps) or
867# a full path to an icon 913# a full path to an icon
868# type: what kind of application is this ? for categories: 914# type: what kind of application is this ? for categories:
869# http://www.freedesktop.org/standards/menu-spec/ 915# http://www.freedesktop.org/wiki/Standards_2fmenu_2dspec
870# path: if your app needs to startup in a specific dir 916# path: if your app needs to startup in a specific dir
871make_desktop_entry() { 917make_desktop_entry() {
872 [ -z "$1" ] && eerror "make_desktop_entry: You must specify the executable" && return 1 918 [[ -z $1 ]] && eerror "make_desktop_entry: You must specify the executable" && return 1
873 919
874 local exec="${1}" 920 local exec=${1}
875 local name="${2:-${PN}}" 921 local name=${2:-${PN}}
876 local icon="${3:-${PN}.png}" 922 local icon=${3:-${PN}.png}
877 local type="${4}" 923 local type=${4}
878 local subdir="${6}" 924 local path=${5}
879 local path="${5:-${GAMES_BINDIR}}" 925
880 if [ -z "${type}" ] 926 if [[ -z ${type} ]] ; then
881 then 927 local catmaj=${CATEGORY%%-*}
882 case ${CATEGORY} in 928 local catmin=${CATEGORY##*-}
883 "app-emulation") 929 case ${catmaj} in
884 type=Emulator 930 app)
885 subdir="Emulation" 931 case ${catmin} in
932 admin) type=System;;
933 cdr) type=DiscBurning;;
934 dicts) type=Dictionary;;
935 editors) type=TextEditor;;
936 emacs) type=TextEditor;;
937 emulation) type=Emulator;;
938 laptop) type=HardwareSettings;;
939 office) type=Office;;
940 vim) type=TextEditor;;
941 xemacs) type=TextEditor;;
942 *) type=;;
943 esac
886 ;; 944 ;;
887 "games-"*) 945
888 type=Game 946 dev)
889 subdir="Games" 947 type="Development"
890 ;; 948 ;;
891 "net-"*) 949
892 type=Network 950 games)
893 subdir="${type}" 951 [[ -z ${path} ]] && path=${GAMES_BINDIR}
952
953 case ${catmin} in
954 action) type=ActionGame;;
955 arcade) type=ArcadeGame;;
956 board) type=BoardGame;;
957 kid) type=KidsGame;;
958 emulation) type=Emulator;;
959 puzzle) type=LogicGame;;
960 rpg) type=RolePlaying;;
961 roguelike) type=RolePlaying;;
962 simulation) type=Simulation;;
963 sports) type=SportsGame;;
964 strategy) type=StrategyGame;;
965 *) type=;;
966 esac
967 type="Game;${type}"
894 ;; 968 ;;
969
970 mail)
971 type="Network;Email"
972 ;;
973
974 media)
975 case ${catmin} in
976 gfx) type=Graphics;;
977 radio) type=Tuner;;
978 sound) type=Audio;;
979 tv) type=TV;;
980 video) type=Video;;
981 *) type=;;
982 esac
983 type="AudioVideo;${type}"
984 ;;
985
986 net)
987 case ${catmin} in
988 dialup) type=Dialup;;
989 ftp) type=FileTransfer;;
990 im) type=InstantMessaging;;
991 irc) type=IRCClient;;
992 mail) type=Email;;
993 news) type=News;;
994 nntp) type=News;;
995 p2p) type=FileTransfer;;
996 *) type=;;
997 esac
998 type="Network;${type}"
999 ;;
1000
1001 sci)
1002 case ${catmin} in
1003 astro*) type=Astronomoy;;
1004 bio*) type=Biology;;
1005 calc*) type=Calculator;;
1006 chem*) type=Chemistry;;
1007 geo*) type=Geology;;
1008 math*) type=Math;;
1009 *) type=;;
1010 esac
1011 type="Science;${type}"
1012 ;;
1013
1014 www)
1015 case ${catmin} in
1016 client) type=WebBrowser;;
1017 *) type=;;
1018 esac
1019 type="Network"
1020 ;;
1021
895 *) 1022 *)
896 type= 1023 type=
897 subdir=
898 ;; 1024 ;;
899 esac 1025 esac
900 fi 1026 fi
1027
901 local desktop="${T}/${exec}.desktop" 1028 local desktop=${T}/${exec%% *}-${P}.desktop
902 1029
903echo "[Desktop Entry] 1030echo "[Desktop Entry]
904Encoding=UTF-8 1031Encoding=UTF-8
905Version=0.9.2 1032Version=0.9.2
906Name=${name} 1033Name=${name}
1434# directories and uses the intersection of the lists. 1561# directories and uses the intersection of the lists.
1435# The -u builds a list of po files found in all the 1562# The -u builds a list of po files found in all the
1436# directories and uses the union of the lists. 1563# directories and uses the union of the lists.
1437strip-linguas() { 1564strip-linguas() {
1438 local ls newls 1565 local ls newls
1439 if [ "$1" == "-i" ] || [ "$1" == "-u" ] ; then 1566 if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then
1440 local op="$1"; shift 1567 local op=$1; shift
1441 ls=" $(find "$1" -name '*.po' -printf '%f ') "; shift 1568 ls=" $(find "$1" -name '*.po' -printf '%f ') "; shift
1442 local d f 1569 local d f
1443 for d in "$@" ; do 1570 for d in "$@" ; do
1444 if [ "${op}" == "-u" ] ; then 1571 if [[ ${op} == "-u" ]] ; then
1445 newls="${ls}" 1572 newls=${ls}
1446 else 1573 else
1447 newls="" 1574 newls=""
1448 fi 1575 fi
1449 for f in $(find "$d" -name '*.po' -printf '%f ') ; do 1576 for f in $(find "$d" -name '*.po' -printf '%f ') ; do
1450 if [ "${op}" == "-i" ] ; then 1577 if [[ ${op} == "-i" ]] ; then
1451 [ "${ls/ ${f} /}" != "${ls}" ] && newls="${newls} ${f}" 1578 [[ ${ls/ ${f} /} != ${ls} ]] && newls="${newls} ${f}"
1452 else 1579 else
1453 [ "${ls/ ${f} /}" == "${ls}" ] && newls="${newls} ${f}" 1580 [[ ${ls/ ${f} /} == ${ls} ]] && newls="${newls} ${f}"
1454 fi 1581 fi
1455 done 1582 done
1456 ls="${newls}" 1583 ls=${newls}
1457 done 1584 done
1458 ls="${ls//.po}" 1585 ls=${ls//.po}
1459 else 1586 else
1460 ls="$@" 1587 ls=$@
1461 fi 1588 fi
1462 1589
1463 ls=" ${ls} " 1590 ls=" ${ls} "
1464 newls="" 1591 newls=""
1465 for f in ${LINGUAS} ; do 1592 for f in ${LINGUAS} ; do
1466 if [ "${ls/ ${f} /}" != "${ls}" ] ; then 1593 if [[ ${ls/ ${f} /} != ${ls} ]] ; then
1467 newls="${newls} ${f}" 1594 newls="${newls} ${f}"
1468 else 1595 else
1469 ewarn "Sorry, but ${PN} does not support the ${f} LINGUA" 1596 ewarn "Sorry, but ${PN} does not support the ${f} LINGUA"
1470 fi 1597 fi
1471 done 1598 done
1472 if [ -z "${newls}" ] ; then 1599 if [[ -z ${newls} ]] ; then
1473 unset LINGUAS 1600 unset LINGUAS
1474 else 1601 else
1475 export LINGUAS="${newls}" 1602 export LINGUAS=${newls:1}
1476 fi 1603 fi
1477} 1604}
1478 1605
1479# moved from kernel.eclass since they are generally useful outside of 1606# moved from kernel.eclass since they are generally useful outside of
1480# kernel.eclass -iggy (20041002) 1607# kernel.eclass -iggy (20041002)
1602 patch -p0 "${f}" "${PORTDIR}/eclass/ELT-patches/nocxx/nocxx.patch" > /dev/null 1729 patch -p0 "${f}" "${PORTDIR}/eclass/ELT-patches/nocxx/nocxx.patch" > /dev/null
1603 done 1730 done
1604 eend 0 1731 eend 0
1605} 1732}
1606 1733
1607# dopamd [ file ] [ new file ] 1734# dopamd <file> [more files]
1608# 1735#
1609# Install pam auth config file in /etc/pam.d 1736# 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() { 1737dopamd() {
1615 local pamd="$1" newpamd="${2:-$1}"
1616 [[ -z "$1" ]] && die "dopamd requires at least one argument." 1738 [[ -z $1 ]] && die "dopamd requires at least one argument"
1617 1739
1618 use pam || return 0 1740 use pam || return 0
1619 1741
1620 insinto /etc/pam.d 1742 insinto /etc/pam.d
1621 # these are the default doins options, but be explicit just in case 1743 # these are the default doins options, but be explicit just in case
1622 insopts -m 0644 -o root -g root 1744 insopts -m 0644 -o root -g root
1623 newins ${pamd} ${newpamd} || die "failed to install ${newpamd}" 1745 doins "$@" || die "failed to install $@"
1624} 1746}
1747# newpamd <old name> <new name>
1748#
1749# Install pam file <old name> as <new name> in /etc/pam.d
1750newpamd() {
1751 [[ $# -ne 2 ]] && die "newpamd requires two arguements"
1752
1753 use pam || return 0
1754
1755 insinto /etc/pam.d
1756 # these are the default doins options, but be explicit just in case
1757 insopts -m 0644 -o root -g root
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.160

  ViewVC Help
Powered by ViewVC 1.1.20