* A utility function for the automatic generation of wrapper scripts.
svn path=/nixpkgs/trunk/; revision=2241
This commit is contained in:
parent
1dcbda3398
commit
b930967805
@ -1,9 +1,8 @@
|
||||
. $stdenv/setup
|
||||
. $makeWrapper
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
mkdir -p $out/bin
|
||||
|
||||
pluginPath=
|
||||
extraLibPath=
|
||||
for i in $plugins; do
|
||||
@ -17,11 +16,20 @@ for i in $plugins; do
|
||||
done
|
||||
done
|
||||
|
||||
cat > $out/bin/firefox <<EOF
|
||||
#! $SHELL
|
||||
export LD_LIBRARY_PATH=$extraLibPath
|
||||
export MOZ_PLUGIN_PATH=$pluginPath
|
||||
exec $firefox/bin/firefox "\$@"
|
||||
EOF
|
||||
makeWrapper "$firefox/bin/firefox" "$out/bin/firefox" \
|
||||
--suffix MOZ_PLUGIN_PATH ':' $pluginPath \
|
||||
--suffix LD_LIBRARY_PATH ':' $extraLibPath
|
||||
|
||||
chmod +x $out/bin/firefox
|
||||
# --add-to-env MOZ_PLUGIN_PATH ':' --each lib/mozilla/plugins "$plugins" \
|
||||
# --add-to-env MOZ_PLUGIN_PATH ':' --each 'jre/plugin/*/mozilla' "$plugins" \
|
||||
# --add-to-env LD_LIBRARY_PATH --contents lib/mozilla/plugins/extra-library-path "$plugins" \
|
||||
# --add-to-env LD_LIBRARY_PATH --contents 'jre/plugin/*/mozilla/extra-library-path' "$plugins"
|
||||
|
||||
#cat > $out/bin/firefox <<EOF
|
||||
##! $SHELL
|
||||
#export LD_LIBRARY_PATH=$extraLibPath
|
||||
#export MOZ_PLUGIN_PATH=$pluginPath
|
||||
#exec $firefox/bin/firefox "\$@"
|
||||
#EOF
|
||||
|
||||
#chmod +x $out/bin/firefox
|
||||
|
@ -4,6 +4,7 @@ stdenv.mkDerivation {
|
||||
name = firefox.name;
|
||||
|
||||
builder = ./builder.sh;
|
||||
makeWrapper = ../../../../build-support/make-wrapper/make-wrapper.sh;
|
||||
|
||||
inherit firefox plugins;
|
||||
}
|
||||
|
26
pkgs/build-support/make-wrapper/make-wrapper.sh
Normal file
26
pkgs/build-support/make-wrapper/make-wrapper.sh
Normal file
@ -0,0 +1,26 @@
|
||||
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
|
||||
echo FOOBAR
|
||||
varName=${params[$((n + 1))]}
|
||||
separator=${params[$((n + 2))]}
|
||||
value=${params[$((n + 3))]}
|
||||
n=$((n + 3))
|
||||
echo "export $varName=\$$varName\${$varName:+$separator}$value" >> $wrapper
|
||||
fi
|
||||
done
|
||||
|
||||
echo "exec \"$original\" \"\$@\"" >> $wrapper
|
||||
|
||||
chmod +x $wrapper
|
||||
}
|
Loading…
Reference in New Issue
Block a user