nixpkgs/pkgs/build-support/make-wrapper/make-wrapper.sh
Eelco Dolstra 3bf404a3f2 * Let the Mozilla plugins announce where in their output the actual
plugins are, rather then requiring certain fixed directories.

svn path=/nixpkgs/trunk/; revision=2242
2005-02-16 11:24:40 +00:00

28 lines
649 B
Bash

makeWrapper() {
original=$1
wrapper=$2
ensureDir "$(dirname $wrapper)"
echo "#! $SHELL -e" > $wrapper
params=("$@")
for ((n = 2; n < ${#params[*]}; n += 1)); do
p=${params[$n]}
if test "$p" = "--suffix"; then
varName=${params[$((n + 1))]}
separator=${params[$((n + 2))]}
value=${params[$((n + 3))]}
n=$((n + 3))
if test -n "$value"; then
echo "export $varName=\$$varName\${$varName:+$separator}$value" >> $wrapper
fi
fi
done
echo "exec \"$original\" \"\$@\"" >> $wrapper
chmod +x $wrapper
}