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

Diff of /eclass/eutils.eclass

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

Revision 1.413 Revision 1.414
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2013 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.413 2013/03/09 18:18:09 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.414 2013/03/11 00:13:16 vapier Exp $
4 4
5# @ECLASS: eutils.eclass 5# @ECLASS: eutils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org 7# base-system@gentoo.org
8# @BLURB: many extra (but common) functions that are used in ebuilds 8# @BLURB: many extra (but common) functions that are used in ebuilds
1290# first optionally setting LD_LIBRARY_PATH to the colon-delimited 1290# first optionally setting LD_LIBRARY_PATH to the colon-delimited
1291# libpaths followed by optionally changing directory to chdir. 1291# libpaths followed by optionally changing directory to chdir.
1292make_wrapper() { 1292make_wrapper() {
1293 local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5 1293 local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5
1294 local tmpwrapper=$(emktemp) 1294 local tmpwrapper=$(emktemp)
1295
1296 (
1297 echo '#!/bin/sh'
1298 [[ -n ${chdir} ]] && printf 'cd "%s"\n' "${chdir}"
1299 if [[ -n ${libdir} ]] ; then
1300 cat <<-EOF
1301 if [ "\${LD_LIBRARY_PATH+set}" = "set" ] ; then
1302 export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}"
1303 else
1304 export LD_LIBRARY_PATH="${libdir}"
1305 fi
1306 EOF
1307 fi
1295 # We don't want to quote ${bin} so that people can pass complex 1308 # We don't want to quote ${bin} so that people can pass complex
1296 # things as $bin ... "./someprog --args" 1309 # things as ${bin} ... "./someprog --args"
1310 printf 'exec %s "$@"\n' "${bin}"
1297 cat << EOF > "${tmpwrapper}" 1311 ) > "${tmpwrapper}"
1298#!/bin/sh
1299cd "${chdir:-.}"
1300if [ -n "${libdir}" ] ; then
1301 if [ "\${LD_LIBRARY_PATH+set}" = "set" ] ; then
1302 export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}"
1303 else
1304 export LD_LIBRARY_PATH="${libdir}"
1305 fi
1306fi
1307exec ${bin} "\$@"
1308EOF
1309 chmod go+rx "${tmpwrapper}" 1312 chmod go+rx "${tmpwrapper}"
1313
1310 if [[ -n ${path} ]] ; then 1314 if [[ -n ${path} ]] ; then
1311 ( 1315 (
1312 exeinto "${path}" 1316 exeinto "${path}"
1313 newexe "${tmpwrapper}" "${wrapper}" 1317 newexe "${tmpwrapper}" "${wrapper}"
1314 ) || die 1318 ) || die

Legend:
Removed from v.1.413  
changed lines
  Added in v.1.414

  ViewVC Help
Powered by ViewVC 1.1.20