1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-24 22:50:49 +00:00

chromium/plugins: Use @var@ for passing variables

There is already a pull request from @colemickens, who has just reversed
the variable references $flash and $flashVersion but the fix is kinda
fragile as he points out himself in #12713.

The reason the wrong substition was made is that both variables begin
with the same name and we do a simple replace instead of a more
complicated one using builtins.match.

So staying simple but to still not raising issues with other variables
that begin with the same name I'm now using @var@ instead, like we use
in substituteAll and other substituters (like the ones in CMake or
autotools) deal with it.

Note that I'm not using $var$ here to make sure it doesn't get confused
with real shell variables.

So with this fix in place, the wrapper now has the following flags:

  --ppapi-flash-path=/nix/store/.../lib/libpepflashplayer.so
  --ppapi-flash-version=20.0.0.294

Previously we had (#12710):

  --ppapi-flash-path=/nix/store/.../lib/libpepflashplayer.so
  --ppapi-flash-version=/nix/store/...-binary-plugins-flashVersion

Thanks to @colemickens for reporting and putting up a pull request.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Fixes: #12710
Fixes: #12713
This commit is contained in:
aszlig 2016-02-02 05:19:51 +01:00
parent ff90f52375
commit 61042a5b6a
No known key found for this signature in database
GPG key ID: D0EBD0EC8C2DC961

View file

@ -16,7 +16,7 @@ let
mkPluginInfo = { output ? "out", allowedVars ? [ output ] mkPluginInfo = { output ? "out", allowedVars ? [ output ]
, flags ? [], envVars ? {} , flags ? [], envVars ? {}
}: let }: let
shSearch = ["'"] ++ map (var: "\$${var}") allowedVars; shSearch = ["'"] ++ map (var: "@${var}@") allowedVars;
shReplace = ["'\\''"] ++ map (var: "'\"\${${var}}\"'") allowedVars; shReplace = ["'\\''"] ++ map (var: "'\"\${${var}}\"'") allowedVars;
# We need to triple-escape "val": # We need to triple-escape "val":
# * First because makeWrapper doesn't do any quoting of its arguments by # * First because makeWrapper doesn't do any quoting of its arguments by
@ -94,8 +94,8 @@ let
output = "flash"; output = "flash";
allowedVars = [ "flash" "flashVersion" ]; allowedVars = [ "flash" "flashVersion" ];
flags = [ flags = [
"--ppapi-flash-path=$flash/lib/libpepflashplayer.so" "--ppapi-flash-path=@flash@/lib/libpepflashplayer.so"
"--ppapi-flash-version=$flashVersion" "--ppapi-flash-version=@flashVersion@"
]; ];
}} }}
@ -107,7 +107,7 @@ let
${mkPluginInfo { ${mkPluginInfo {
output = "widevine"; output = "widevine";
flags = [ "--register-pepper-plugins=${wvModule}${wvInfo}" ]; flags = [ "--register-pepper-plugins=${wvModule}${wvInfo}" ];
envVars.NIX_CHROMIUM_PLUGIN_PATH_WIDEVINE = "$widevine/lib"; envVars.NIX_CHROMIUM_PLUGIN_PATH_WIDEVINE = "@widevine@/lib";
}} }}
''; '';