* makeWrapper: --add-flags to add extra flags to the command being

wrapped.

svn path=/nixpkgs/trunk/; revision=12091
This commit is contained in:
Eelco Dolstra 2008-06-14 20:45:58 +00:00
parent 4ea9f7ca5d
commit 91258d9884

View File

@ -2,6 +2,7 @@ makeWrapper() {
local original=$1
local wrapper=$2
local params varName value command separator n fileNames
local flagsBefore flags
ensureDir "$(dirname $wrapper)"
@ -57,9 +58,15 @@ makeWrapper() {
echo "export $varName=\$$varName\${$varName:+$separator}$(cat $fileName)" >> $wrapper
done
fi
if test "$p" = "--add-flags"; then
flags=${params[$((n + 1))]}
n=$((n + 1))
flagsBefore="$flagsBefore $flags"
fi
done
echo "exec \"$original\" \"\$@\"" >> $wrapper
echo "exec \"$original\" $flagsBefore \"\$@\"" >> $wrapper
chmod +x $wrapper
}