summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2013-03-11 00:13:16 +0000
committerMike Frysinger <vapier@gentoo.org>2013-03-11 00:13:16 +0000
commitde3ae79444c3837bc5d2d85d2b51194ab8a123f3 (patch)
treeac9df3d6a9d2b5b0fcd55105972796b395272db7 /eclass
parentNew ebuild for bug 453278. (diff)
downloadgentoo-2-de3ae79444c3837bc5d2d85d2b51194ab8a123f3.tar.gz
gentoo-2-de3ae79444c3837bc5d2d85d2b51194ab8a123f3.tar.bz2
gentoo-2-de3ae79444c3837bc5d2d85d2b51194ab8a123f3.zip
make_wrapper: optimize output slightly in common cases by omitting dead code
Diffstat (limited to 'eclass')
-rw-r--r--eclass/eutils.eclass32
1 files changed, 18 insertions, 14 deletions
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index 752aed3e7e62..c3d988c6d433 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.413 2013/03/09 18:18:09 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.414 2013/03/11 00:13:16 vapier Exp $
# @ECLASS: eutils.eclass
# @MAINTAINER:
@@ -1292,21 +1292,25 @@ epunt_cxx() {
make_wrapper() {
local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5
local tmpwrapper=$(emktemp)
- # We don't want to quote ${bin} so that people can pass complex
- # things as $bin ... "./someprog --args"
- cat << EOF > "${tmpwrapper}"
-#!/bin/sh
-cd "${chdir:-.}"
-if [ -n "${libdir}" ] ; then
- if [ "\${LD_LIBRARY_PATH+set}" = "set" ] ; then
- export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}"
- else
- export LD_LIBRARY_PATH="${libdir}"
+
+ (
+ echo '#!/bin/sh'
+ [[ -n ${chdir} ]] && printf 'cd "%s"\n' "${chdir}"
+ if [[ -n ${libdir} ]] ; then
+ cat <<-EOF
+ if [ "\${LD_LIBRARY_PATH+set}" = "set" ] ; then
+ export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}"
+ else
+ export LD_LIBRARY_PATH="${libdir}"
+ fi
+ EOF
fi
-fi
-exec ${bin} "\$@"
-EOF
+ # We don't want to quote ${bin} so that people can pass complex
+ # things as ${bin} ... "./someprog --args"
+ printf 'exec %s "$@"\n' "${bin}"
+ ) > "${tmpwrapper}"
chmod go+rx "${tmpwrapper}"
+
if [[ -n ${path} ]] ; then
(
exeinto "${path}"