| 1 | # Copyright 1999-2005 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.163 2005/03/26 06:33:16 eradicator Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.164 2005/03/30 14:12:25 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. |
| … | |
… | |
| 1763 | # -- wolf31o2 |
1763 | # -- wolf31o2 |
| 1764 | # $1 == wrapper name |
1764 | # $1 == wrapper name |
| 1765 | # $2 == binary to run |
1765 | # $2 == binary to run |
| 1766 | # $3 == directory to chdir before running binary |
1766 | # $3 == directory to chdir before running binary |
| 1767 | # $4 == extra LD_LIBRARY_PATH's (make it : delimited) |
1767 | # $4 == extra LD_LIBRARY_PATH's (make it : delimited) |
|
|
1768 | # $5 == path for wrapper |
| 1768 | make_wrapper() { |
1769 | make_wrapper() { |
| 1769 | local wrapper=$1 bin=$2 chdir=$3 libdir=$4 |
1770 | local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5 |
| 1770 | local tmpwrapper=$(emktemp) |
1771 | local tmpwrapper=$(emktemp) |
| 1771 | cat << EOF > "${tmpwrapper}" |
1772 | cat << EOF > "${tmpwrapper}" |
| 1772 | #!/bin/sh |
1773 | #!/bin/sh |
| 1773 | cd "${chdir}" |
1774 | cd "${chdir}" |
| 1774 | export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}" |
1775 | export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}" |
| 1775 | exec ${bin} "\$@" |
1776 | exec ${bin} "\$@" |
| 1776 | EOF |
1777 | EOF |
| 1777 | chmod go+rx "${tmpwrapper}" |
1778 | chmod go+rx "${tmpwrapper}" |
|
|
1779 | if [ -n "${5}" ] |
|
|
1780 | then |
|
|
1781 | exeinto ${5} |
|
|
1782 | newexe "${tmpwrapper}" "${wrapper}" |
|
|
1783 | else |
| 1778 | newbin "${tmpwrapper}" "${wrapper}" |
1784 | newbin "${tmpwrapper}" "${wrapper}" |
|
|
1785 | fi |
| 1779 | } |
1786 | } |