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
commit2c24af24e0cc047ff5d02e49cbb834974524684e (patch)
tree44fd7b2e6cc9466b4c298a3d810a40647fde17d8 /eclass
parentNew ebuild for bug 453278. (diff)
downloadhistorical-2c24af24e0cc047ff5d02e49cbb834974524684e.tar.gz
historical-2c24af24e0cc047ff5d02e49cbb834974524684e.tar.bz2
historical-2c24af24e0cc047ff5d02e49cbb834974524684e.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}"