diff --git a/pkgs/applications/networking/browsers/firefox-wrapper/builder.sh b/pkgs/applications/networking/browsers/firefox-wrapper/builder.sh index 2b7e68e0b144..15ff68dd09ce 100644 --- a/pkgs/applications/networking/browsers/firefox-wrapper/builder.sh +++ b/pkgs/applications/networking/browsers/firefox-wrapper/builder.sh @@ -1,33 +1,6 @@ . $stdenv/setup . $makeWrapper -shopt -s nullglob - -pluginPath= -extraLibPath= -for p in $plugins; do - if test -e $p; then - pluginPath=$pluginPath${pluginPath:+:}$p - if test -e $p/extra-library-path; then - extraLibPath=$extraLibPath${extraLibPath:+:}$(cat $p/extra-library-path) - fi - fi -done - makeWrapper "$firefox/bin/firefox" "$out/bin/firefox" \ - --suffix MOZ_PLUGIN_PATH ':' "$pluginPath" \ - --suffix LD_LIBRARY_PATH ':' "$extraLibPath" - -# --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 <> $wrapper fi fi + + if test "$p" = "--suffix-each"; then + varName=${params[$((n + 1))]} + separator=${params[$((n + 2))]} + values=${params[$((n + 3))]} + n=$((n + 3)) + for value in $values; do + echo "export $varName=\$$varName\${$varName:+$separator}$value" >> $wrapper + done + fi + + if test "$p" = "--suffix-contents"; then + varName=${params[$((n + 1))]} + separator=${params[$((n + 2))]} + fileNames=${params[$((n + 3))]} + n=$((n + 3)) + for fileName in $fileNames; do + echo "export $varName=\$$varName\${$varName:+$separator}$(cat $fileName)" >> $wrapper + done + fi done echo "exec \"$original\" \"\$@\"" >> $wrapper chmod +x $wrapper } + +addSuffix() { + suffix=$1 + shift + for name in "$@"; do + echo "$name$suffix" + done +} + +filterExisting() { + for fn in "$@"; do + if test -e "$fn"; then + echo "$fn" + fi + done +}