2014-03-19 11:57:49 +00:00
|
|
|
{ stdenv
|
|
|
|
, enablePepperFlash ? false
|
|
|
|
, enablePepperPDF ? false
|
2014-09-30 05:00:47 +01:00
|
|
|
, enableWideVine ? false
|
2014-03-27 08:49:46 +00:00
|
|
|
|
|
|
|
, source
|
2014-03-19 11:57:49 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
plugins = stdenv.mkDerivation {
|
|
|
|
name = "chromium-binary-plugins";
|
|
|
|
|
|
|
|
# XXX: Only temporary and has to be version-specific
|
2014-03-27 08:49:46 +00:00
|
|
|
src = source.plugins;
|
2014-03-19 11:57:49 +00:00
|
|
|
|
2014-09-30 05:00:47 +01:00
|
|
|
phases = [ "unpackPhase" "patchPhase" "installPhase" "checkPhase" ];
|
|
|
|
outputs = [ "pdf" "flash" "widevine" ];
|
2014-03-19 11:57:49 +00:00
|
|
|
|
2014-03-27 08:49:46 +00:00
|
|
|
unpackCmd = let
|
|
|
|
chan = if source.channel == "dev" then "chrome-unstable"
|
|
|
|
else if source.channel == "stable" then "chrome"
|
|
|
|
else "chrome-${source.channel}";
|
|
|
|
in ''
|
2014-06-30 13:56:10 +01:00
|
|
|
mkdir -p plugins
|
2014-03-19 11:57:49 +00:00
|
|
|
ar p "$src" data.tar.lzma | tar xJ -C plugins --strip-components=4 \
|
2014-03-27 08:49:46 +00:00
|
|
|
./opt/google/${chan}/PepperFlash \
|
2014-09-30 05:00:47 +01:00
|
|
|
./opt/google/${chan}/libpdf.so \
|
|
|
|
./opt/google/${chan}/libwidevinecdm.so \
|
|
|
|
./opt/google/${chan}/libwidevinecdmadapter.so
|
2014-03-19 11:57:49 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
! find -iname '*.so' -exec ldd {} + | grep 'not found'
|
|
|
|
'';
|
|
|
|
|
|
|
|
patchPhase = let
|
|
|
|
rpaths = [ stdenv.gcc.gcc ];
|
|
|
|
mkrpath = p: "${makeSearchPath "lib64" p}:${makeSearchPath "lib" p}";
|
|
|
|
in ''
|
2014-09-30 05:00:47 +01:00
|
|
|
for sofile in PepperFlash/libpepflashplayer.so libpdf.so \
|
|
|
|
libwidevinecdm.so libwidevinecdmadapter.so; do
|
2014-03-19 11:57:49 +00:00
|
|
|
chmod +x "$sofile"
|
|
|
|
patchelf --set-rpath "${mkrpath rpaths}" "$sofile"
|
|
|
|
done
|
2014-09-30 05:00:47 +01:00
|
|
|
|
|
|
|
patchelf --set-rpath "$widevine/lib:${mkrpath rpaths}" \
|
|
|
|
libwidevinecdmadapter.so
|
2014-03-19 11:57:49 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = let
|
|
|
|
pdfName = "Chrome PDF Viewer";
|
|
|
|
pdfDescription = "Portable Document Format";
|
|
|
|
pdfMimeTypes = concatStringsSep ";" [
|
|
|
|
"application/pdf"
|
|
|
|
"application/x-google-chrome-print-preview-pdf"
|
|
|
|
];
|
|
|
|
pdfInfo = "#${pdfName}#${pdfDescription};${pdfMimeTypes}";
|
2014-09-30 05:00:47 +01:00
|
|
|
|
|
|
|
wvName = "Widevine Content Decryption Module";
|
|
|
|
wvDescription = "Playback of encrypted HTML audio/video content";
|
|
|
|
wvMimeTypes = "application/x-ppapi-widevine-cdm";
|
|
|
|
wvModule = "$widevine/lib/libwidevinecdmadapter.so";
|
|
|
|
wvInfo = "#${wvName}#${wvDescription}:${wvMimeTypes}";
|
2014-03-19 11:57:49 +00:00
|
|
|
in ''
|
|
|
|
install -vD libpdf.so "$pdf/lib/libpdf.so"
|
2014-06-30 13:56:10 +01:00
|
|
|
mkdir -p "$pdf/nix-support"
|
2014-03-19 11:57:49 +00:00
|
|
|
echo "--register-pepper-plugins='$pdf/lib/libpdf.so${pdfInfo}'" \
|
|
|
|
> "$pdf/nix-support/chromium-flags"
|
|
|
|
|
|
|
|
flashVersion="$(
|
|
|
|
sed -n -r 's/.*"version": "([^"]+)",.*/\1/p' PepperFlash/manifest.json
|
|
|
|
)"
|
|
|
|
|
|
|
|
install -vD PepperFlash/libpepflashplayer.so \
|
|
|
|
"$flash/lib/libpepflashplayer.so"
|
2014-06-30 13:56:10 +01:00
|
|
|
mkdir -p "$flash/nix-support"
|
2014-03-19 11:57:49 +00:00
|
|
|
echo "--ppapi-flash-path='$flash/lib/libpepflashplayer.so'" \
|
|
|
|
"--ppapi-flash-version=$flashVersion" \
|
|
|
|
> "$flash/nix-support/chromium-flags"
|
2014-09-30 05:00:47 +01:00
|
|
|
|
|
|
|
install -vD libwidevinecdm.so \
|
|
|
|
"$widevine/lib/libwidevinecdm.so"
|
|
|
|
install -vD libwidevinecdmadapter.so \
|
|
|
|
"$widevine/lib/libwidevinecdmadapter.so"
|
|
|
|
mkdir -p "$widevine/nix-support"
|
|
|
|
echo "--register-pepper-plugins='${wvModule}${wvInfo}'" \
|
|
|
|
> "$widevine/nix-support/chromium-flags"
|
2014-11-20 15:46:09 +00:00
|
|
|
echo "NIX_CHROMIUM_PLUGIN_PATH_WIDEVINE=$widevine/lib" \
|
|
|
|
> "$widevine/nix-support/chromium-env-vars"
|
2014-03-19 11:57:49 +00:00
|
|
|
'';
|
|
|
|
|
2014-11-20 15:46:09 +00:00
|
|
|
passthru = let
|
2014-03-19 11:57:49 +00:00
|
|
|
enabledPlugins = optional enablePepperFlash plugins.flash
|
2014-09-30 05:00:47 +01:00
|
|
|
++ optional enablePepperPDF plugins.pdf
|
|
|
|
++ optional enableWideVine plugins.widevine;
|
2014-03-19 11:57:49 +00:00
|
|
|
getFlags = plugin: "$(< ${plugin}/nix-support/chromium-flags)";
|
2014-11-20 15:46:09 +00:00
|
|
|
getEnvVars = plugin: "$(< ${plugin}/nix-support/chromium-env-vars)";
|
|
|
|
in {
|
|
|
|
flagsEnabled = concatStringsSep " " (map getFlags enabledPlugins);
|
|
|
|
envVarsEnabled = concatStringsSep " " (map getEnvVars enabledPlugins);
|
|
|
|
};
|
2014-03-19 11:57:49 +00:00
|
|
|
};
|
|
|
|
in plugins
|