Merge pull request #112288 from primeos/chromium

chromium: Remove the Adobe Flash Player plugin support
This commit is contained in:
Michael Weiss 2021-02-07 19:13:26 +01:00 committed by GitHub
commit de88795283
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 100 deletions

View file

@ -12,7 +12,6 @@
, gnomeSupport ? false, gnome ? null
, gnomeKeyringSupport ? false
, proprietaryCodecs ? true
, enablePepperFlash ? false
, enableWideVine ? false
, enableVaapi ? false # Disabled by default due to unofficial support
, ungoogled ? false # Whether to build chromium or ungoogled-chromium
@ -45,10 +44,6 @@ let
browser = callPackage ./browser.nix { inherit channel enableWideVine ungoogled; };
plugins = callPackage ./plugins.nix {
inherit enablePepperFlash;
};
ungoogled-chromium = callPackage ./ungoogled.nix {};
};
@ -166,7 +161,6 @@ in stdenv.mkDerivation {
buildCommand = let
browserBinary = "${chromiumWV}/libexec/chromium/chromium";
getWrapperFlags = plugin: "$(< \"${plugin}/nix-support/wrapper-flags\")";
libPath = lib.makeLibraryPath [ libva pipewire_0_2 ];
in with lib; ''
@ -174,8 +168,7 @@ in stdenv.mkDerivation {
eval makeWrapper "${browserBinary}" "$out/bin/chromium" \
--add-flags ${escapeShellArg (escapeShellArg commandLineArgs)} \
${lib.optionalString enableVaapi "--add-flags --enable-accelerated-video-decode"} \
${concatMapStringsSep " " getWrapperFlags chromium.plugins.enabled}
${lib.optionalString enableVaapi "--add-flags --enable-accelerated-video-decode"}
ed -v -s "$out/bin/chromium" << EOF
2i

View file

@ -1,92 +0,0 @@
{ lib, stdenv, gcc
, jshon
, glib
, nspr
, nss
, fetchzip
, enablePepperFlash ? false
, upstream-info
}:
with lib;
let
mkrpath = p: "${makeSearchPathOutput "lib" "lib64" p}:${makeLibraryPath p}";
# Generate a shell fragment that emits flags appended to the
# final makeWrapper call for wrapping the browser's main binary.
#
# Note that this is shell-escaped so that only the variable specified
# by the "output" attribute is substituted.
mkPluginInfo = { output ? "out", allowedVars ? [ output ]
, flags ? [], envVars ? {}
}: let
shSearch = ["'"] ++ map (var: "@${var}@") allowedVars;
shReplace = ["'\\''"] ++ map (var: "'\"\${${var}}\"'") allowedVars;
# We need to triple-escape "val":
# * First because makeWrapper doesn't do any quoting of its arguments by
# itself.
# * Second because it's passed to the makeWrapper call separated by IFS but
# not by the _real_ arguments, for example the Widevine plugin flags
# contain spaces, so they would end up as separate arguments.
# * Third in order to be correctly quoted for the "echo" call below.
shEsc = val: "'${replaceStrings ["'"] ["'\\''"] val}'";
mkSh = val: "'${replaceStrings shSearch shReplace (shEsc val)}'";
mkFlag = flag: ["--add-flags" (shEsc flag)];
mkEnvVar = key: val: ["--set" (shEsc key) (shEsc val)];
envList = mapAttrsToList mkEnvVar envVars;
quoted = map mkSh (flatten ((map mkFlag flags) ++ envList));
in ''
mkdir -p "''$${output}/nix-support"
echo ${toString quoted} > "''$${output}/nix-support/wrapper-flags"
'';
flash = stdenv.mkDerivation rec {
pname = "flashplayer-ppapi";
version = "32.0.0.465";
src = fetchzip {
url = "https://fpdownload.adobe.com/pub/flashplayer/pdc/${version}/flash_player_ppapi_linux.x86_64.tar.gz";
sha256 = "16qbc2s8dg2rwggphf8f5665iccc6lrvgz45bdwskg9pwg87hlj1";
stripRoot = false;
};
patchPhase = ''
chmod +x libpepflashplayer.so
patchelf --set-rpath "${mkrpath [ gcc.cc ]}" libpepflashplayer.so
'';
doCheck = true;
checkPhase = ''
! find -iname '*.so' -exec ldd {} + | grep 'not found'
'';
installPhase = ''
flashVersion="$(
"${jshon}/bin/jshon" -F manifest.json -e version -u
)"
install -vD libpepflashplayer.so "$out/lib/libpepflashplayer.so"
${mkPluginInfo {
allowedVars = [ "out" "flashVersion" ];
flags = [
"--ppapi-flash-path=@out@/lib/libpepflashplayer.so"
"--ppapi-flash-version=@flashVersion@"
];
}}
'';
dontStrip = true;
meta = {
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [ taku0 ];
platforms = platforms.x86_64;
};
};
in {
enabled = optional enablePepperFlash flash;
}