From 09f87eeb7f48ea15d800d73e2a4229a1d47f26a2 Mon Sep 17 00:00:00 2001 From: aszlig Date: Sun, 9 Oct 2016 19:52:07 +0200 Subject: [PATCH 01/13] gn: Init at 0.0.0.20161008 This is the standalone version of GN used currently solely for building Chromium. An upstream bug report is available at https://crbug.com/504074 to support a standalone build without needing various components from the Chromium source tree. Because there isn't a standalone vrsion available, I'm choosing 0.0.0.${date} as the version scheme here so that we don't conflict with versioned releases from upstream someday[TM]. Signed-off-by: aszlig --- .../tools/build-managers/gn/default.nix | 80 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 82 insertions(+) create mode 100644 pkgs/development/tools/build-managers/gn/default.nix diff --git a/pkgs/development/tools/build-managers/gn/default.nix b/pkgs/development/tools/build-managers/gn/default.nix new file mode 100644 index 00000000000..a579b45cf62 --- /dev/null +++ b/pkgs/development/tools/build-managers/gn/default.nix @@ -0,0 +1,80 @@ +{ stdenv, fetchgit, fetchurl, python, ninja, libevent, xdg-user-dirs }: + +let + date = "20161008"; + + sourceTree = { + "src/base" = { + rev = "e71a514e60b085cc92bf6ef951ec329f52c79f9f"; + sha256 = "0zycbssmd2za0zij8czcs1fr66fi12f1g5ysc8fzkf8khbs5h6a9"; + }; + "src/build" = { + rev = "17093d45bf738e9ae4b6294492860ee65218a657"; + sha256 = "0i9py78c3f46sc789qvdhmgjgyrghysbqjgr67iypwphw52jv2dz"; + }; + "src/tools/gn" = { + rev = "9ff32cf3f1f4ad0212ac674b6303e7aa68f44f3f"; + sha256 = "14jr45k5fgcqk9d18fd77sijlqavvnv0knndh74zyb0b60464hz1"; + }; + "testing/gtest" = { + rev = "585ec31ea716f08233a815e680fc0d4699843938"; + sha256 = "0csn1cza66851nmxxiw42smsm3422mx67vcyykwn0a71lcjng6rc"; + }; + }; + + mkDepend = path: attrs: fetchgit { + url = "https://chromium.googlesource.com/chromium/${path}"; + inherit (attrs) rev sha256; + }; + +in stdenv.mkDerivation rec { + name = "gn-${version}"; + version = "0.0.0.${date}"; + + unpackPhase = '' + ${with stdenv.lib; concatStrings (mapAttrsToList (path: sha256: '' + dest=source/${escapeShellArg (removePrefix "src/" path)} + mkdir -p "$(dirname "$dest")" + cp --no-preserve=all -rT ${escapeShellArg (mkDepend path sha256)} "$dest" + '') sourceTree)} + ( mkdir -p source/third_party + cd source/third_party + unpackFile ${xdg-user-dirs.src} + mv * xdg_user + ) + ''; + + sourceRoot = "source"; + + postPatch = '' + # GN's bootstrap script relies on shebangs (which are relying on FHS paths), + # except when on Windows. So instead of patchShebang-ing it, let's just + # force the same behaviour as on Windows. + sed -i -e '/^def *check_call/,/^[^ ]/ { + s/is_win/True/ + }' tools/gn/bootstrap/bootstrap.py + + # Patch out Chromium-bundled libevent and xdg_user_dirs + sed -i -e '/static_libraries.*libevent/,/^ *\]\?[})]$/d' \ + tools/gn/bootstrap/bootstrap.py + ''; + + NIX_LDFLAGS = "-levent"; + + nativeBuildInputs = [ python ninja ]; + buildInputs = [ libevent ]; + + buildPhase = '' + python tools/gn/bootstrap/bootstrap.py -v -s --no-clean + ''; + + installPhase = '' + install -vD out_bootstrap/gn "$out/bin/gn" + ''; + + meta = { + description = "A meta-build system that generates NinjaBuild files"; + homepage = "https://chromium.googlesource.com/chromium/src/tools/gn/"; + license = stdenv.lib.licenses.bsd3; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b89d1f3a582..d2ee0c9c7e5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6079,6 +6079,8 @@ in global = callPackage ../development/tools/misc/global { }; + gn = callPackage ../development/tools/build-managers/gn { }; + gnome_doc_utils = callPackage ../development/tools/documentation/gnome-doc-utils {}; gnum4 = callPackage ../development/tools/misc/gnum4 { }; From d0e8f3c5034ef90933987ab0ba094c5364b7c8de Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Oct 2016 10:50:36 +0200 Subject: [PATCH 02/13] chromium: Add preliminary support for GN This only uses the most basic GN flags which should represent the GYP flags we had before. In order to get rid most of the GYP cruft, we now have common.nix and common-gn.nix which are mostly the same, just that the latter is only for GN builds. The GN implementation is far from complete and currently not even builds, so we need more work to get the beta and dev channels building. Signed-off-by: aszlig --- .../browsers/chromium/common-gn.nix | 202 ++++++++++++++++++ .../networking/browsers/chromium/default.nix | 7 +- 2 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 pkgs/applications/networking/browsers/chromium/common-gn.nix diff --git a/pkgs/applications/networking/browsers/chromium/common-gn.nix b/pkgs/applications/networking/browsers/chromium/common-gn.nix new file mode 100644 index 00000000000..e795c2735b0 --- /dev/null +++ b/pkgs/applications/networking/browsers/chromium/common-gn.nix @@ -0,0 +1,202 @@ +{ stdenv, gn, ninja, which + +# default dependencies +, bzip2, flac, speex, libopus +, libevent, expat, libjpeg, snappy +, libpng, libxml2, libxslt, libcap +, xdg_utils, yasm, minizip, libwebp +, libusb1, pciutils, nss, re2, zlib, libvpx + +, python, pythonPackages, perl, pkgconfig +, nspr, systemd, kerberos +, utillinux, alsaLib +, bison, gperf +, glib, gtk2, dbus_glib +, libXScrnSaver, libXcursor, libXtst, mesa +, protobuf, speechd, libXdamage, cups + +# optional dependencies +, libgcrypt ? null # gnomeSupport || cupsSupport +, libexif ? null # only needed for Chromium before version 51 + +# package customization +, enableSELinux ? false, libselinux ? null +, enableNaCl ? false +, enableHotwording ? false +, gnomeSupport ? false, gnome ? null +, gnomeKeyringSupport ? false, libgnome_keyring3 ? null +, proprietaryCodecs ? true +, cupsSupport ? true +, pulseSupport ? false, libpulseaudio ? null +, hiDPISupport ? false + +, upstream-info +}: + +buildFun: + +with stdenv.lib; + +let + # The additional attributes for creating derivations based on the chromium + # source tree. + extraAttrs = buildFun base; + + mkGnFlags = + let + # Serialize Nix types into GN types according to this document: + # https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/language.md + mkGnString = value: "\"${escape ["\"" "$" "\\"] value}\""; + sanitize = value: + if value == true then "true" + else if value == false then "false" + else if isList value then "[${concatMapStringsSep ", " sanitize value}]" + else if isInt value then toString value + else if isString value then mkGnString value + else throw "Unsupported type for GN value `${value}'."; + toFlag = key: value: "${key}=${sanitize value}"; + in attrs: concatStringsSep " " (attrValues (mapAttrs toFlag attrs)); + + gnSystemLibraries = [ + "flac" "libjpeg" "libpng" "libvpx" "libwebp" "libxml" "libxslt" "re2" + "snappy" "yasm" "zlib" + ]; + + opusWithCustomModes = libopus.override { + withCustomModes = true; + }; + + defaultDependencies = [ + bzip2 flac speex opusWithCustomModes + libevent expat libjpeg snappy + libpng libxml2 libxslt libcap + xdg_utils yasm minizip libwebp + libusb1 re2 zlib libvpx + ]; + + # build paths and release info + packageName = extraAttrs.packageName or extraAttrs.name; + buildType = "Release"; + buildPath = "out/${buildType}"; + libExecPath = "$out/libexec/${packageName}"; + + base = rec { + name = "${packageName}-${version}"; + inherit (upstream-info) version; + inherit packageName buildType buildPath; + + src = upstream-info.main; + + nativeBuildInputs = [ gn which python perl pkgconfig ]; + + buildInputs = defaultDependencies ++ [ + nspr nss systemd + utillinux alsaLib + bison gperf kerberos + glib gtk2 dbus_glib + libXScrnSaver libXcursor libXtst mesa + pciutils protobuf speechd libXdamage + pythonPackages.ply pythonPackages.jinja2 + ] ++ optional gnomeKeyringSupport libgnome_keyring3 + ++ optionals gnomeSupport [ gnome.GConf libgcrypt ] + ++ optional enableSELinux libselinux + ++ optionals cupsSupport [ libgcrypt cups ] + ++ optional pulseSupport libpulseaudio; + + patches = [ + ./patches/widevine.patch + ./patches/glibc-2.24.patch + (if versionOlder version "52.0.0.0" + then ./patches/nix_plugin_paths_50.patch + else ./patches/nix_plugin_paths_52.patch) + ]; + + postPatch = '' + # We want to be able to specify where the sandbox is via CHROME_DEVEL_SANDBOX + substituteInPlace sandbox/linux/suid/client/setuid_sandbox_host.cc \ + --replace \ + 'return sandbox_binary;' \ + 'return base::FilePath(GetDevelSandboxPath());' + + sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${systemd.lib}/lib/\1!' \ + device/udev_linux/udev?_loader.cc + + sed -i -e '/libpci_loader.*Load/s!"\(libpci\.so\)!"${pciutils}/lib/\1!' \ + gpu/config/gpu_info_collector_linux.cc + + sed -i -re 's/([^:])\<(isnan *\()/\1std::\2/g' \ + chrome/browser/ui/webui/engagement/site_engagement_ui.cc + + sed -i -e '/#include/ { + i #include + :l; n; bl + }' gpu/config/gpu_control_list.cc + + patchShebangs . + '' + optionalString (versionAtLeast version "52.0.0.0") '' + sed -i -re 's/([^:])\<(isnan *\()/\1std::\2/g' \ + third_party/pdfium/xfa/fxbarcode/utils.h + ''; + + gnFlags = mkGnFlags ({ + linux_use_bundled_binutils = false; + linux_use_bundled_gold = false; + linux_use_gold_flags = true; + is_debug = false; + + proprietary_codecs = false; + use_sysroot = false; + use_gnome_keyring = gnomeKeyringSupport; + use_gconf = gnomeSupport; + use_gio = gnomeSupport; + enable_nacl = enableNaCl; + enable_hotwording = enableHotwording; + selinux = enableSELinux; + use_cups = cupsSupport; + } // { + treat_warnings_as_errors = false; + is_clang = false; + enable_hidpi = hiDPISupport; + + # Google API keys, see: + # http://www.chromium.org/developers/how-tos/api-keys + # Note: These are for NixOS/nixpkgs use ONLY. For your own distribution, + # please get your own set of keys. + google_api_key = "AIzaSyDGi15Zwl11UNe6Y-5XW_upsfyw31qwZPI"; + google_default_client_id = "404761575300.apps.googleusercontent.com"; + google_default_client_secret = "9rIFQjfnkykEmqb6FfjJQD1D"; + } // optionalAttrs proprietaryCodecs { + # enable support for the H.264 codec + proprietary_codecs = true; + enable_hangout_services_extension = true; + ffmpeg_branding = "Chrome"; + } // optionalAttrs pulseSupport { + use_pulseaudio = true; + link_pulseaudio = true; + } // (extraAttrs.gnFlags or {})); + + configurePhase = '' + # This is to ensure expansion of $out. + libExecPath="${libExecPath}" + python build/linux/unbundle/replace_gn_files.py \ + --system-libraries ${toString gnSystemLibraries} + gn gen --args=${escapeShellArg gnFlags} out/Release + ''; + + buildPhase = let + buildCommand = target: '' + "${ninja}/bin/ninja" -C "${buildPath}" \ + -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES \ + "${target}" + '' + optionalString (target == "mksnapshot" || target == "chrome") '' + paxmark m "${buildPath}/${target}" + ''; + targets = extraAttrs.buildTargets or []; + commands = map buildCommand targets; + in concatStringsSep "\n" commands; + }; + +# Remove some extraAttrs we supplied to the base attributes already. +in stdenv.mkDerivation (base // removeAttrs extraAttrs [ + "name" "gnFlags" "buildTargets" +]) diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix index 7402a8bae29..c03011c07c1 100644 --- a/pkgs/applications/networking/browsers/chromium/default.nix +++ b/pkgs/applications/networking/browsers/chromium/default.nix @@ -18,10 +18,15 @@ let callPackage = newScope chromium; + # XXX: This is an ugly hack for the transition to GN: + inherit (stdenv.lib) versionAtLeast; + gnRequired = versionAtLeast chromium.upstream-info.version "54.0.0.0"; + common = if gnRequired then ./common-gn.nix else ./common.nix; + chromium = { upstream-info = (callPackage ./update.nix {}).getChannel channel; - mkChromiumDerivation = callPackage ./common.nix { + mkChromiumDerivation = callPackage common { inherit enableSELinux enableNaCl enableHotwording gnomeSupport gnome gnomeKeyringSupport proprietaryCodecs cupsSupport pulseSupport hiDPISupport; From 7a3a16dd8040e7ba675b50ca47d023ee61f087d3 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Oct 2016 10:56:22 +0200 Subject: [PATCH 03/13] chromium: Remove plugin paths patch for version 50 The oldest version we build is version 53, so we no longer need this patch. Signed-off-by: aszlig --- .../browsers/chromium/common-gn.nix | 4 +- .../networking/browsers/chromium/common.nix | 4 +- .../patches/nix_plugin_paths_50.patch | 75 ------------------- 3 files changed, 2 insertions(+), 81 deletions(-) delete mode 100644 pkgs/applications/networking/browsers/chromium/patches/nix_plugin_paths_50.patch diff --git a/pkgs/applications/networking/browsers/chromium/common-gn.nix b/pkgs/applications/networking/browsers/chromium/common-gn.nix index e795c2735b0..68798071ea1 100644 --- a/pkgs/applications/networking/browsers/chromium/common-gn.nix +++ b/pkgs/applications/networking/browsers/chromium/common-gn.nix @@ -106,9 +106,7 @@ let patches = [ ./patches/widevine.patch ./patches/glibc-2.24.patch - (if versionOlder version "52.0.0.0" - then ./patches/nix_plugin_paths_50.patch - else ./patches/nix_plugin_paths_52.patch) + ./patches/nix_plugin_paths_52.patch ]; postPatch = '' diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index 8a561e75f79..8f6e324765f 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -131,9 +131,7 @@ let patches = [ ./patches/widevine.patch ./patches/glibc-2.24.patch - (if versionOlder version "52.0.0.0" - then ./patches/nix_plugin_paths_50.patch - else ./patches/nix_plugin_paths_52.patch) + ./patches/nix_plugin_paths_52.patch ]; postPatch = '' diff --git a/pkgs/applications/networking/browsers/chromium/patches/nix_plugin_paths_50.patch b/pkgs/applications/networking/browsers/chromium/patches/nix_plugin_paths_50.patch deleted file mode 100644 index 062098a8522..00000000000 --- a/pkgs/applications/networking/browsers/chromium/patches/nix_plugin_paths_50.patch +++ /dev/null @@ -1,75 +0,0 @@ -diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc -index 74bf041..5f34198 100644 ---- a/chrome/common/chrome_paths.cc -+++ b/chrome/common/chrome_paths.cc -@@ -66,21 +66,14 @@ static base::LazyInstance - g_invalid_specified_user_data_dir = LAZY_INSTANCE_INITIALIZER; - - // Gets the path for internal plugins. --bool GetInternalPluginsDirectory(base::FilePath* result) { --#if defined(OS_MACOSX) -- // If called from Chrome, get internal plugins from a subdirectory of the -- // framework. -- if (base::mac::AmIBundled()) { -- *result = chrome::GetFrameworkBundlePath(); -- DCHECK(!result->empty()); -- *result = result->Append("Internet Plug-Ins"); -- return true; -- } -- // In tests, just look in the module directory (below). --#endif -- -- // The rest of the world expects plugins in the module directory. -- return PathService::Get(base::DIR_MODULE, result); -+bool GetInternalPluginsDirectory(base::FilePath* result, -+ const std::string& ident) { -+ std::string full_env = std::string("NIX_CHROMIUM_PLUGIN_PATH_") + ident; -+ const char* value = getenv(full_env.c_str()); -+ if (value == NULL) -+ return PathService::Get(base::DIR_MODULE, result); -+ else -+ *result = base::FilePath(value); - } - - #if defined(OS_WIN) -@@ -253,11 +246,11 @@ bool PathProvider(int key, base::FilePath* result) { - create_dir = true; - break; - case chrome::DIR_INTERNAL_PLUGINS: -- if (!GetInternalPluginsDirectory(&cur)) -+ if (!GetInternalPluginsDirectory(&cur, "ALL")) - return false; - break; - case chrome::DIR_PEPPER_FLASH_PLUGIN: -- if (!GetInternalPluginsDirectory(&cur)) -+ if (!GetInternalPluginsDirectory(&cur, "PEPPERFLASH")) - return false; - cur = cur.Append(kPepperFlashBaseDirectory); - break; -@@ -314,7 +307,7 @@ bool PathProvider(int key, base::FilePath* result) { - // We currently need a path here to look up whether the plugin is disabled - // and what its permissions are. - case chrome::FILE_NACL_PLUGIN: -- if (!GetInternalPluginsDirectory(&cur)) -+ if (!GetInternalPluginsDirectory(&cur, "NACL")) - return false; - cur = cur.Append(kInternalNaClPluginFileName); - break; -@@ -349,7 +342,7 @@ bool PathProvider(int key, base::FilePath* result) { - cur = cur.DirName(); - } - #else -- if (!GetInternalPluginsDirectory(&cur)) -+ if (!GetInternalPluginsDirectory(&cur, "PNACL")) - return false; - #endif - cur = cur.Append(FILE_PATH_LITERAL("pnacl")); -@@ -366,7 +359,7 @@ bool PathProvider(int key, base::FilePath* result) { - // In the component case, this is the source adapter. Otherwise, it is the - // actual Pepper module that gets loaded. - case chrome::FILE_WIDEVINE_CDM_ADAPTER: -- if (!GetInternalPluginsDirectory(&cur)) -+ if (!GetInternalPluginsDirectory(&cur, "WIDEVINE")) - return false; - cur = cur.AppendASCII(kWidevineCdmAdapterFileName); - break; From 872b4782e929c2eda9076bda9b0b53c4a91c9c8a Mon Sep 17 00:00:00 2001 From: Herwig Hochleitner Date: Fri, 14 Oct 2016 14:12:49 +0200 Subject: [PATCH 04/13] chromium: 53 -> 54 --- .../browsers/chromium/upstream-info.nix | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/upstream-info.nix b/pkgs/applications/networking/browsers/chromium/upstream-info.nix index dfac55a18b6..295651e7c24 100644 --- a/pkgs/applications/networking/browsers/chromium/upstream-info.nix +++ b/pkgs/applications/networking/browsers/chromium/upstream-info.nix @@ -1,18 +1,18 @@ # This file is autogenerated from update.sh in the same directory. { beta = { - sha256 = "0f6cqvhlg06lrf4bzaiwzm9yi3fi1dk5jrzvjcg7alw3mzrmh2wv"; - sha256bin64 = "02cv9vc1l2nlwa4a0lc7cj9c9czrwp1jd8d024bq16a5fvmhl01l"; - version = "54.0.2840.50"; + sha256 = "1bdjnyc88lpvd0gf5xdmngniijv57phmnih4h896dn2y89dvzv9j"; + sha256bin64 = "0kc16xzh1g0nsxq8gjnh6a2p0a69q2irplwkbgi9wx9ldxl4rg88"; + version = "55.0.2883.21"; }; dev = { - sha256 = "06kcymwi0wfir7w10g8viayk2h0b5a66dav76mlia4lm30p502kz"; - sha256bin64 = "0mgamiffnnkaw8c68b5kyna84x7hlhrzmqfc36kzf434fmm8v5d6"; - version = "55.0.2873.0"; + sha256 = "02zlz4b9rpd57hfzw5jpnzdx746cckdmkfqj8wmij8kxfjrl67m9"; + sha256bin64 = "00bg43k00shcabwv9wv1ipy9y0gwrr769rb18gpkj39xrmv3qzh7"; + version = "56.0.2897.0"; }; stable = { - sha256 = "1hyw0z7dsfaxyy8b4mvnfjy5yj0160hzz9m0wj3vn9zvkfvmhan5"; - sha256bin64 = "0n0px7yi94gdxq7p6pjqfdz04bnh3mcvbaccjaglj6h5p0jc8abq"; - version = "53.0.2785.143"; + sha256 = "0zfxwygqjhq37agqpn34nvjwa8ijm7xc9l6hwv89m5rs1gmx60nj"; + sha256bin64 = "1mlqxglbqdqnhsmy1p6jn1z9md0lsia6lrhw11q7d523masvbb1m"; + version = "54.0.2840.71"; }; } From b43142c958577163ee193401589053141ea2c649 Mon Sep 17 00:00:00 2001 From: Herwig Hochleitner Date: Sat, 29 Oct 2016 03:29:42 +0200 Subject: [PATCH 05/13] chromium: remove pepperflash fixes NixOS#19565 --- .../networking/browsers/chromium/default.nix | 2 +- .../networking/browsers/chromium/plugins.nix | 45 +++++-------------- 2 files changed, 12 insertions(+), 35 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix index c03011c07c1..a16326fc98c 100644 --- a/pkgs/applications/networking/browsers/chromium/default.nix +++ b/pkgs/applications/networking/browsers/chromium/default.nix @@ -35,7 +35,7 @@ let browser = callPackage ./browser.nix { inherit channel; }; plugins = callPackage ./plugins.nix { - inherit enablePepperFlash enableWideVine; + inherit enableWideVine; }; }; diff --git a/pkgs/applications/networking/browsers/chromium/plugins.nix b/pkgs/applications/networking/browsers/chromium/plugins.nix index ac7f8111212..f611bfd0275 100644 --- a/pkgs/applications/networking/browsers/chromium/plugins.nix +++ b/pkgs/applications/networking/browsers/chromium/plugins.nix @@ -1,6 +1,5 @@ { stdenv , jshon -, enablePepperFlash ? false , enableWideVine ? false , upstream-info @@ -37,14 +36,12 @@ let echo ${toString quoted} > "''$${output}/nix-support/wrapper-flags" ''; - plugins = stdenv.mkDerivation { - name = "chromium-binary-plugins"; + widevine = stdenv.mkDerivation { + name = "chromium-binary-plugin-widevine"; src = upstream-info.binary; phases = [ "unpackPhase" "patchPhase" "installPhase" "checkPhase" ]; - outputs = [ "flash" "widevine" ]; - out = "flash"; # outputs TODO: is this a hack? unpackCmd = let chan = if upstream-info.channel == "dev" then "chrome-unstable" @@ -53,7 +50,6 @@ let in '' mkdir -p plugins ar p "$src" data.tar.xz | tar xJ -C plugins --strip-components=4 \ - ./opt/google/${chan}/PepperFlash \ ./opt/google/${chan}/libwidevinecdm.so \ ./opt/google/${chan}/libwidevinecdmadapter.so ''; @@ -67,13 +63,12 @@ let rpaths = [ stdenv.cc.cc ]; mkrpath = p: "${makeSearchPathOutput "lib" "lib64" p}:${makeLibraryPath p}"; in '' - for sofile in PepperFlash/libpepflashplayer.so \ - libwidevinecdm.so libwidevinecdmadapter.so; do + for sofile in libwidevinecdm.so libwidevinecdmadapter.so; do chmod +x "$sofile" patchelf --set-rpath "${mkrpath rpaths}" "$sofile" done - patchelf --set-rpath "$widevine/lib:${mkrpath rpaths}" \ + patchelf --set-rpath "$out/lib:${mkrpath rpaths}" \ libwidevinecdmadapter.so ''; @@ -81,38 +76,20 @@ let wvName = "Widevine Content Decryption Module"; wvDescription = "Playback of encrypted HTML audio/video content"; wvMimeTypes = "application/x-ppapi-widevine-cdm"; - wvModule = "@widevine@/lib/libwidevinecdmadapter.so"; + wvModule = "@out@/lib/libwidevinecdmadapter.so"; wvInfo = "#${wvName}#${wvDescription};${wvMimeTypes}"; in '' - flashVersion="$( - "${jshon}/bin/jshon" -F PepperFlash/manifest.json -e version -u - )" - - install -vD PepperFlash/libpepflashplayer.so \ - "$flash/lib/libpepflashplayer.so" - - ${mkPluginInfo { - output = "flash"; - allowedVars = [ "flash" "flashVersion" ]; - flags = [ - "--ppapi-flash-path=@flash@/lib/libpepflashplayer.so" - "--ppapi-flash-version=@flashVersion@" - ]; - }} - install -vD libwidevinecdm.so \ - "$widevine/lib/libwidevinecdm.so" + "$out/lib/libwidevinecdm.so" install -vD libwidevinecdmadapter.so \ - "$widevine/lib/libwidevinecdmadapter.so" + "$out/lib/libwidevinecdmadapter.so" ${mkPluginInfo { - output = "widevine"; flags = [ "--register-pepper-plugins=${wvModule}${wvInfo}" ]; - envVars.NIX_CHROMIUM_PLUGIN_PATH_WIDEVINE = "@widevine@/lib"; + envVars.NIX_CHROMIUM_PLUGIN_PATH_WIDEVINE = "@out@/lib"; }} ''; - - passthru.enabled = optional enablePepperFlash plugins.flash - ++ optional enableWideVine plugins.widevine; }; -in plugins +in { + enabled = optional enableWideVine widevine; +} From 5f18ccb001caf62e9c4908354a1fea44bb11300b Mon Sep 17 00:00:00 2001 From: aszlig Date: Sat, 29 Oct 2016 04:01:04 +0200 Subject: [PATCH 06/13] chromium: Remove flag for hiDPISupport This should now be the upstream default and there also is no more flag for GN to set it, so we'll no longer need it on our side as well. Signed-off-by: aszlig --- pkgs/applications/networking/browsers/chromium/common-gn.nix | 2 -- pkgs/applications/networking/browsers/chromium/common.nix | 2 -- pkgs/applications/networking/browsers/chromium/default.nix | 4 +--- pkgs/top-level/all-packages.nix | 1 - 4 files changed, 1 insertion(+), 8 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/common-gn.nix b/pkgs/applications/networking/browsers/chromium/common-gn.nix index 68798071ea1..b574edef205 100644 --- a/pkgs/applications/networking/browsers/chromium/common-gn.nix +++ b/pkgs/applications/networking/browsers/chromium/common-gn.nix @@ -28,7 +28,6 @@ , proprietaryCodecs ? true , cupsSupport ? true , pulseSupport ? false, libpulseaudio ? null -, hiDPISupport ? false , upstream-info }: @@ -154,7 +153,6 @@ let } // { treat_warnings_as_errors = false; is_clang = false; - enable_hidpi = hiDPISupport; # Google API keys, see: # http://www.chromium.org/developers/how-tos/api-keys diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index 8f6e324765f..3ff90d28b9f 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -28,7 +28,6 @@ , proprietaryCodecs ? true , cupsSupport ? true , pulseSupport ? false, libpulseaudio ? null -, hiDPISupport ? false , upstream-info }: @@ -179,7 +178,6 @@ let } // { werror = ""; clang = false; - enable_hidpi = hiDPISupport; # Google API keys, see: # http://www.chromium.org/developers/how-tos/api-keys diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix index a16326fc98c..fd42c1b927b 100644 --- a/pkgs/applications/networking/browsers/chromium/default.nix +++ b/pkgs/applications/networking/browsers/chromium/default.nix @@ -12,7 +12,6 @@ , enableWideVine ? false , cupsSupport ? true , pulseSupport ? false -, hiDPISupport ? false }: let @@ -28,8 +27,7 @@ let mkChromiumDerivation = callPackage common { inherit enableSELinux enableNaCl enableHotwording gnomeSupport gnome - gnomeKeyringSupport proprietaryCodecs cupsSupport pulseSupport - hiDPISupport; + gnomeKeyringSupport proprietaryCodecs cupsSupport pulseSupport; }; browser = callPackage ./browser.nix { inherit channel; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d2ee0c9c7e5..764c4822cb4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12277,7 +12277,6 @@ in pulseSupport = config.pulseaudio or true; enablePepperFlash = config.chromium.enablePepperFlash or false; enableWideVine = config.chromium.enableWideVine or false; - hiDPISupport = config.chromium.hiDPISupport or false; gnome = gnome2; }; From 8391241e0c90c8e5ee90d86d6cc1c9146e575768 Mon Sep 17 00:00:00 2001 From: aszlig Date: Sat, 29 Oct 2016 04:05:53 +0200 Subject: [PATCH 07/13] chromium: Build with GN unconditionally Previously I've added the extra file common-gn.nix in addition to common.nix, so we can possibly have a smooth transition from current stable to the new version 54. Unfortunately, version 53 is already EOL and we have to move to version 54 as soon as possible so we can only use GN and thus it doesn't make sense to provide expressions for GYP anymore. Signed-off-by: aszlig --- .../browsers/chromium/common-gn.nix | 198 ------------------ .../networking/browsers/chromium/common.nix | 112 ++++------ .../networking/browsers/chromium/default.nix | 7 +- 3 files changed, 42 insertions(+), 275 deletions(-) delete mode 100644 pkgs/applications/networking/browsers/chromium/common-gn.nix diff --git a/pkgs/applications/networking/browsers/chromium/common-gn.nix b/pkgs/applications/networking/browsers/chromium/common-gn.nix deleted file mode 100644 index b574edef205..00000000000 --- a/pkgs/applications/networking/browsers/chromium/common-gn.nix +++ /dev/null @@ -1,198 +0,0 @@ -{ stdenv, gn, ninja, which - -# default dependencies -, bzip2, flac, speex, libopus -, libevent, expat, libjpeg, snappy -, libpng, libxml2, libxslt, libcap -, xdg_utils, yasm, minizip, libwebp -, libusb1, pciutils, nss, re2, zlib, libvpx - -, python, pythonPackages, perl, pkgconfig -, nspr, systemd, kerberos -, utillinux, alsaLib -, bison, gperf -, glib, gtk2, dbus_glib -, libXScrnSaver, libXcursor, libXtst, mesa -, protobuf, speechd, libXdamage, cups - -# optional dependencies -, libgcrypt ? null # gnomeSupport || cupsSupport -, libexif ? null # only needed for Chromium before version 51 - -# package customization -, enableSELinux ? false, libselinux ? null -, enableNaCl ? false -, enableHotwording ? false -, gnomeSupport ? false, gnome ? null -, gnomeKeyringSupport ? false, libgnome_keyring3 ? null -, proprietaryCodecs ? true -, cupsSupport ? true -, pulseSupport ? false, libpulseaudio ? null - -, upstream-info -}: - -buildFun: - -with stdenv.lib; - -let - # The additional attributes for creating derivations based on the chromium - # source tree. - extraAttrs = buildFun base; - - mkGnFlags = - let - # Serialize Nix types into GN types according to this document: - # https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/language.md - mkGnString = value: "\"${escape ["\"" "$" "\\"] value}\""; - sanitize = value: - if value == true then "true" - else if value == false then "false" - else if isList value then "[${concatMapStringsSep ", " sanitize value}]" - else if isInt value then toString value - else if isString value then mkGnString value - else throw "Unsupported type for GN value `${value}'."; - toFlag = key: value: "${key}=${sanitize value}"; - in attrs: concatStringsSep " " (attrValues (mapAttrs toFlag attrs)); - - gnSystemLibraries = [ - "flac" "libjpeg" "libpng" "libvpx" "libwebp" "libxml" "libxslt" "re2" - "snappy" "yasm" "zlib" - ]; - - opusWithCustomModes = libopus.override { - withCustomModes = true; - }; - - defaultDependencies = [ - bzip2 flac speex opusWithCustomModes - libevent expat libjpeg snappy - libpng libxml2 libxslt libcap - xdg_utils yasm minizip libwebp - libusb1 re2 zlib libvpx - ]; - - # build paths and release info - packageName = extraAttrs.packageName or extraAttrs.name; - buildType = "Release"; - buildPath = "out/${buildType}"; - libExecPath = "$out/libexec/${packageName}"; - - base = rec { - name = "${packageName}-${version}"; - inherit (upstream-info) version; - inherit packageName buildType buildPath; - - src = upstream-info.main; - - nativeBuildInputs = [ gn which python perl pkgconfig ]; - - buildInputs = defaultDependencies ++ [ - nspr nss systemd - utillinux alsaLib - bison gperf kerberos - glib gtk2 dbus_glib - libXScrnSaver libXcursor libXtst mesa - pciutils protobuf speechd libXdamage - pythonPackages.ply pythonPackages.jinja2 - ] ++ optional gnomeKeyringSupport libgnome_keyring3 - ++ optionals gnomeSupport [ gnome.GConf libgcrypt ] - ++ optional enableSELinux libselinux - ++ optionals cupsSupport [ libgcrypt cups ] - ++ optional pulseSupport libpulseaudio; - - patches = [ - ./patches/widevine.patch - ./patches/glibc-2.24.patch - ./patches/nix_plugin_paths_52.patch - ]; - - postPatch = '' - # We want to be able to specify where the sandbox is via CHROME_DEVEL_SANDBOX - substituteInPlace sandbox/linux/suid/client/setuid_sandbox_host.cc \ - --replace \ - 'return sandbox_binary;' \ - 'return base::FilePath(GetDevelSandboxPath());' - - sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${systemd.lib}/lib/\1!' \ - device/udev_linux/udev?_loader.cc - - sed -i -e '/libpci_loader.*Load/s!"\(libpci\.so\)!"${pciutils}/lib/\1!' \ - gpu/config/gpu_info_collector_linux.cc - - sed -i -re 's/([^:])\<(isnan *\()/\1std::\2/g' \ - chrome/browser/ui/webui/engagement/site_engagement_ui.cc - - sed -i -e '/#include/ { - i #include - :l; n; bl - }' gpu/config/gpu_control_list.cc - - patchShebangs . - '' + optionalString (versionAtLeast version "52.0.0.0") '' - sed -i -re 's/([^:])\<(isnan *\()/\1std::\2/g' \ - third_party/pdfium/xfa/fxbarcode/utils.h - ''; - - gnFlags = mkGnFlags ({ - linux_use_bundled_binutils = false; - linux_use_bundled_gold = false; - linux_use_gold_flags = true; - is_debug = false; - - proprietary_codecs = false; - use_sysroot = false; - use_gnome_keyring = gnomeKeyringSupport; - use_gconf = gnomeSupport; - use_gio = gnomeSupport; - enable_nacl = enableNaCl; - enable_hotwording = enableHotwording; - selinux = enableSELinux; - use_cups = cupsSupport; - } // { - treat_warnings_as_errors = false; - is_clang = false; - - # Google API keys, see: - # http://www.chromium.org/developers/how-tos/api-keys - # Note: These are for NixOS/nixpkgs use ONLY. For your own distribution, - # please get your own set of keys. - google_api_key = "AIzaSyDGi15Zwl11UNe6Y-5XW_upsfyw31qwZPI"; - google_default_client_id = "404761575300.apps.googleusercontent.com"; - google_default_client_secret = "9rIFQjfnkykEmqb6FfjJQD1D"; - } // optionalAttrs proprietaryCodecs { - # enable support for the H.264 codec - proprietary_codecs = true; - enable_hangout_services_extension = true; - ffmpeg_branding = "Chrome"; - } // optionalAttrs pulseSupport { - use_pulseaudio = true; - link_pulseaudio = true; - } // (extraAttrs.gnFlags or {})); - - configurePhase = '' - # This is to ensure expansion of $out. - libExecPath="${libExecPath}" - python build/linux/unbundle/replace_gn_files.py \ - --system-libraries ${toString gnSystemLibraries} - gn gen --args=${escapeShellArg gnFlags} out/Release - ''; - - buildPhase = let - buildCommand = target: '' - "${ninja}/bin/ninja" -C "${buildPath}" \ - -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES \ - "${target}" - '' + optionalString (target == "mksnapshot" || target == "chrome") '' - paxmark m "${buildPath}/${target}" - ''; - targets = extraAttrs.buildTargets or []; - commands = map buildCommand targets; - in concatStringsSep "\n" commands; - }; - -# Remove some extraAttrs we supplied to the base attributes already. -in stdenv.mkDerivation (base // removeAttrs extraAttrs [ - "name" "gnFlags" "buildTargets" -]) diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index 3ff90d28b9f..b574edef205 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -1,13 +1,13 @@ -{ stdenv, ninja, which +{ stdenv, gn, ninja, which # default dependencies , bzip2, flac, speex, libopus , libevent, expat, libjpeg, snappy , libpng, libxml2, libxslt, libcap , xdg_utils, yasm, minizip, libwebp -, libusb1, pciutils, nss +, libusb1, pciutils, nss, re2, zlib, libvpx -, python2Packages, perl, pkgconfig +, python, pythonPackages, perl, pkgconfig , nspr, systemd, kerberos , utillinux, alsaLib , bison, gperf @@ -37,47 +37,29 @@ buildFun: with stdenv.lib; let - inherit (python2Packages) python gyp ply jinja2; - # The additional attributes for creating derivations based on the chromium # source tree. extraAttrs = buildFun base; - mkGypFlags = + mkGnFlags = let + # Serialize Nix types into GN types according to this document: + # https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/language.md + mkGnString = value: "\"${escape ["\"" "$" "\\"] value}\""; sanitize = value: - if value == true then "1" - else if value == false then "0" - else "${value}"; - toFlag = key: value: "-D${key}=${sanitize value}"; + if value == true then "true" + else if value == false then "false" + else if isList value then "[${concatMapStringsSep ", " sanitize value}]" + else if isInt value then toString value + else if isString value then mkGnString value + else throw "Unsupported type for GN value `${value}'."; + toFlag = key: value: "${key}=${sanitize value}"; in attrs: concatStringsSep " " (attrValues (mapAttrs toFlag attrs)); - gypFlagsUseSystemLibs = { - use_system_bzip2 = true; - use_system_flac = true; - use_system_libevent = true; - use_system_libexpat = true; - # XXX: System libjpeg fails to link for version 52.0.2743.10 - use_system_libjpeg = versionOlder upstream-info.version "52.0.2743.10"; - use_system_libpng = false; - use_system_libwebp = true; - use_system_libxml = true; - use_system_opus = true; - use_system_snappy = true; - use_system_speex = true; - use_system_stlport = true; - use_system_xdg_utils = true; - use_system_yasm = true; - use_system_zlib = false; - use_system_protobuf = false; # needs newer protobuf - - use_system_harfbuzz = false; - use_system_icu = false; # Doesn't support ICU 52 yet. - use_system_libusb = false; # http://crbug.com/266149 - use_system_skia = false; - use_system_sqlite = false; # http://crbug.com/22208 - use_system_v8 = false; - }; + gnSystemLibraries = [ + "flac" "libjpeg" "libpng" "libvpx" "libwebp" "libxml" "libxslt" "re2" + "snappy" "yasm" "zlib" + ]; opusWithCustomModes = libopus.override { withCustomModes = true; @@ -88,7 +70,7 @@ let libevent expat libjpeg snappy libpng libxml2 libxslt libcap xdg_utils yasm minizip libwebp - libusb1 + libusb1 re2 zlib libvpx ]; # build paths and release info @@ -104,23 +86,16 @@ let src = upstream-info.main; - unpackCmd = '' - tar xf "$src" \ - --anchored \ - --no-wildcards-match-slash \ - --exclude='*/tools/gyp' - ''; + nativeBuildInputs = [ gn which python perl pkgconfig ]; buildInputs = defaultDependencies ++ [ - which - python perl pkgconfig nspr nss systemd utillinux alsaLib bison gperf kerberos glib gtk2 dbus_glib libXScrnSaver libXcursor libXtst mesa pciutils protobuf speechd libXdamage - gyp ply jinja2 + pythonPackages.ply pythonPackages.jinja2 ] ++ optional gnomeKeyringSupport libgnome_keyring3 ++ optionals gnomeSupport [ gnome.GConf libgcrypt ] ++ optional enableSELinux libselinux @@ -140,12 +115,6 @@ let 'return sandbox_binary;' \ 'return base::FilePath(GetDevelSandboxPath());' - sed -i -r \ - -e 's/-f(stack-protector)(-all)?/-fno-\1/' \ - -e 's|/bin/echo|echo|' \ - -e "/python_arch/s/: *'[^']*'/: '""'/" \ - build/common.gypi chrome/chrome_tests.gypi - sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${systemd.lib}/lib/\1!' \ device/udev_linux/udev?_loader.cc @@ -154,30 +123,36 @@ let sed -i -re 's/([^:])\<(isnan *\()/\1std::\2/g' \ chrome/browser/ui/webui/engagement/site_engagement_ui.cc + + sed -i -e '/#include/ { + i #include + :l; n; bl + }' gpu/config/gpu_control_list.cc + + patchShebangs . '' + optionalString (versionAtLeast version "52.0.0.0") '' sed -i -re 's/([^:])\<(isnan *\()/\1std::\2/g' \ third_party/pdfium/xfa/fxbarcode/utils.h ''; - gypFlags = mkGypFlags (gypFlagsUseSystemLibs // { + gnFlags = mkGnFlags ({ linux_use_bundled_binutils = false; linux_use_bundled_gold = false; linux_use_gold_flags = true; + is_debug = false; proprietary_codecs = false; use_sysroot = false; use_gnome_keyring = gnomeKeyringSupport; use_gconf = gnomeSupport; use_gio = gnomeSupport; - use_pulseaudio = pulseSupport; - linux_link_pulseaudio = pulseSupport; - disable_nacl = !enableNaCl; + enable_nacl = enableNaCl; enable_hotwording = enableHotwording; selinux = enableSELinux; use_cups = cupsSupport; } // { - werror = ""; - clang = false; + treat_warnings_as_errors = false; + is_clang = false; # Google API keys, see: # http://www.chromium.org/developers/how-tos/api-keys @@ -191,22 +166,17 @@ let proprietary_codecs = true; enable_hangout_services_extension = true; ffmpeg_branding = "Chrome"; - } // optionalAttrs (stdenv.system == "x86_64-linux") { - target_arch = "x64"; - python_arch = "x86-64"; - } // optionalAttrs (stdenv.system == "i686-linux") { - target_arch = "ia32"; - python_arch = "ia32"; - } // (extraAttrs.gypFlags or {})); + } // optionalAttrs pulseSupport { + use_pulseaudio = true; + link_pulseaudio = true; + } // (extraAttrs.gnFlags or {})); configurePhase = '' - echo "Precompiling .py files to prevent race conditions..." >&2 - python -m compileall -q -f . > /dev/null 2>&1 || : # ignore errors - # This is to ensure expansion of $out. libExecPath="${libExecPath}" - python build/linux/unbundle/replace_gyp_files.py ${gypFlags} - python build/gyp_chromium -f ninja --depth . ${gypFlags} + python build/linux/unbundle/replace_gn_files.py \ + --system-libraries ${toString gnSystemLibraries} + gn gen --args=${escapeShellArg gnFlags} out/Release ''; buildPhase = let @@ -224,5 +194,5 @@ let # Remove some extraAttrs we supplied to the base attributes already. in stdenv.mkDerivation (base // removeAttrs extraAttrs [ - "name" "gypFlags" "buildTargets" + "name" "gnFlags" "buildTargets" ]) diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix index fd42c1b927b..bf4e4cf8ae3 100644 --- a/pkgs/applications/networking/browsers/chromium/default.nix +++ b/pkgs/applications/networking/browsers/chromium/default.nix @@ -17,15 +17,10 @@ let callPackage = newScope chromium; - # XXX: This is an ugly hack for the transition to GN: - inherit (stdenv.lib) versionAtLeast; - gnRequired = versionAtLeast chromium.upstream-info.version "54.0.0.0"; - common = if gnRequired then ./common-gn.nix else ./common.nix; - chromium = { upstream-info = (callPackage ./update.nix {}).getChannel channel; - mkChromiumDerivation = callPackage common { + mkChromiumDerivation = callPackage ./common.nix { inherit enableSELinux enableNaCl enableHotwording gnomeSupport gnome gnomeKeyringSupport proprietaryCodecs cupsSupport pulseSupport; }; From 5f53fddf1ef784e2279bd4236c9f7566a038e89c Mon Sep 17 00:00:00 2001 From: aszlig Date: Sat, 29 Oct 2016 14:28:06 +0200 Subject: [PATCH 08/13] chromium: Remove some libs from system depenencies Seems that these libraries aren't the ones Chromium is expecting to be, so let's switch to use the bundled version of these libraries instead. Signed-off-by: aszlig --- pkgs/applications/networking/browsers/chromium/common.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index b574edef205..ce3b0f84cbb 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -57,8 +57,7 @@ let in attrs: concatStringsSep " " (attrValues (mapAttrs toFlag attrs)); gnSystemLibraries = [ - "flac" "libjpeg" "libpng" "libvpx" "libwebp" "libxml" "libxslt" "re2" - "snappy" "yasm" "zlib" + "flac" "libwebp" "libxml" "libxslt" "snappy" "yasm" ]; opusWithCustomModes = libopus.override { @@ -70,7 +69,7 @@ let libevent expat libjpeg snappy libpng libxml2 libxslt libcap xdg_utils yasm minizip libwebp - libusb1 re2 zlib libvpx + libusb1 re2 zlib ]; # build paths and release info From b84e3379fed770557a983b4c1f7642b0fc7b11de Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 1 Nov 2016 11:39:34 +0100 Subject: [PATCH 09/13] chromium: Bring back pepper flash from Adobe So far we had the bundled Flash player plugin that came with Chrome, but since version 54 the Chrome package doesn't include PPAPI Flash anymore. Instead we're going to download the PPAPI Flash plugin directly from Adobe and try to use them for all release channels of Chromium. Of course it would be nice if we'd have an updater for it but for now it's important that we don't break things for people who are currently forced to use Flash. Signed-off-by: aszlig --- .../networking/browsers/chromium/default.nix | 2 +- .../networking/browsers/chromium/plugins.nix | 57 ++++++++++++++++--- 2 files changed, 51 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix index bf4e4cf8ae3..b59cda875b6 100644 --- a/pkgs/applications/networking/browsers/chromium/default.nix +++ b/pkgs/applications/networking/browsers/chromium/default.nix @@ -28,7 +28,7 @@ let browser = callPackage ./browser.nix { inherit channel; }; plugins = callPackage ./plugins.nix { - inherit enableWideVine; + inherit enablePepperFlash enableWideVine; }; }; diff --git a/pkgs/applications/networking/browsers/chromium/plugins.nix b/pkgs/applications/networking/browsers/chromium/plugins.nix index f611bfd0275..9b779ab9892 100644 --- a/pkgs/applications/networking/browsers/chromium/plugins.nix +++ b/pkgs/applications/networking/browsers/chromium/plugins.nix @@ -1,5 +1,7 @@ { stdenv , jshon +, fetchzip +, enablePepperFlash ? false , enableWideVine ? false , upstream-info @@ -8,6 +10,8 @@ with stdenv.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. # @@ -59,16 +63,13 @@ let ! find -iname '*.so' -exec ldd {} + | grep 'not found' ''; - patchPhase = let - rpaths = [ stdenv.cc.cc ]; - mkrpath = p: "${makeSearchPathOutput "lib" "lib64" p}:${makeLibraryPath p}"; - in '' + patchPhase = '' for sofile in libwidevinecdm.so libwidevinecdmadapter.so; do chmod +x "$sofile" - patchelf --set-rpath "${mkrpath rpaths}" "$sofile" + patchelf --set-rpath "${mkrpath [ stdenv.cc.cc ]}" "$sofile" done - patchelf --set-rpath "$out/lib:${mkrpath rpaths}" \ + patchelf --set-rpath "$out/lib:${mkrpath [ stdenv.cc.cc ]}" \ libwidevinecdmadapter.so ''; @@ -90,6 +91,48 @@ let }} ''; }; + + flash = stdenv.mkDerivation rec { + name = "flashplayer-ppapi-${version}"; + version = "23.0.0.205"; + + src = fetchzip { + url = "https://fpdownload.adobe.com/pub/flashplayer/pdc/" + + "${version}/flash_player_ppapi_linux.x86_64.tar.gz"; + sha256 = "0gj5d8475qcplm3iqs3hkq0i6qkmbhci1zp3ljnhafc6xz0avyhj"; + stripRoot = false; + }; + + patchPhase = '' + chmod +x libpepflashplayer.so + patchelf --set-rpath "${mkrpath [ stdenv.cc.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; + }; + in { - enabled = optional enableWideVine widevine; + enabled = optional enableWideVine widevine + ++ optional enablePepperFlash flash; } From 66ce15a3b163753c7d0c2e237bdaa4e515d77500 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 1 Nov 2016 07:59:30 +0100 Subject: [PATCH 10/13] chromium: Update all channels to latest versions Overview of updated versions: stable: 54.0.2840.71 -> 54.0.2840.90 beta: 55.0.2883.21 -> 55.0.2883.35 dev: 56.0.2897.0 -> 56.0.2906.0 This is to get our Chromium versions in par with the latest upstream ones before merging in the GN migration changes. Signed-off-by: aszlig --- .../browsers/chromium/upstream-info.nix | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/upstream-info.nix b/pkgs/applications/networking/browsers/chromium/upstream-info.nix index 295651e7c24..5fa9bb86c51 100644 --- a/pkgs/applications/networking/browsers/chromium/upstream-info.nix +++ b/pkgs/applications/networking/browsers/chromium/upstream-info.nix @@ -1,18 +1,18 @@ # This file is autogenerated from update.sh in the same directory. { beta = { - sha256 = "1bdjnyc88lpvd0gf5xdmngniijv57phmnih4h896dn2y89dvzv9j"; - sha256bin64 = "0kc16xzh1g0nsxq8gjnh6a2p0a69q2irplwkbgi9wx9ldxl4rg88"; - version = "55.0.2883.21"; + sha256 = "11a98nknz7lh5jmjslznccg11nr0wla4c9l40fvxqxjm2gs6qags"; + sha256bin64 = "0qdydj0i9ll72f5m9r48gc3dyc22q6qas5nq8h0mbnrxrwd9dnyj"; + version = "55.0.2883.35"; }; dev = { - sha256 = "02zlz4b9rpd57hfzw5jpnzdx746cckdmkfqj8wmij8kxfjrl67m9"; - sha256bin64 = "00bg43k00shcabwv9wv1ipy9y0gwrr769rb18gpkj39xrmv3qzh7"; - version = "56.0.2897.0"; + sha256 = "1pfgb5dnygyxiwfq6ini5s159c178zz7235npaag7k8gcc10ybnz"; + sha256bin64 = "14s185361inkqh8ykl94xhgv01z68gxqh7j6gyb4jbr0rhcsd9pl"; + version = "56.0.2906.0"; }; stable = { - sha256 = "0zfxwygqjhq37agqpn34nvjwa8ijm7xc9l6hwv89m5rs1gmx60nj"; - sha256bin64 = "1mlqxglbqdqnhsmy1p6jn1z9md0lsia6lrhw11q7d523masvbb1m"; - version = "54.0.2840.71"; + sha256 = "01h1qkdw5dpwz61dybpf4bhag198j082lzwpkdx2nj55k2j3lawl"; + sha256bin64 = "18mxgzi79qhi07wgyyx6bb0lqm9pzkw85ypg6vmqv8gh0abn7dn1"; + version = "54.0.2840.90"; }; } From d2e60d1f93c037dd337f32e5d80f1b70915eca57 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 8 Nov 2016 20:18:15 +0100 Subject: [PATCH 11/13] chromium: Fix building with WineVine components Before version 54, the WideVine CDM plugin was built unconditionally and it seems since version 54 this now is dependent upon a GYP/GN flag on whether to include the CDM shared library or not. Also, we now use a patch from Gentoo which should hopefully get the CDM plugin to work properly, at least according to their bugtracker: https://bugs.gentoo.org/show_bug.cgi?id=547630 Signed-off-by: aszlig --- .../networking/browsers/chromium/browser.nix | 5 ++++ .../networking/browsers/chromium/common.nix | 5 ++-- .../networking/browsers/chromium/default.nix | 3 ++- .../browsers/chromium/patches/widevine.patch | 24 +++++++++++-------- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/browser.nix b/pkgs/applications/networking/browsers/chromium/browser.nix index 9eb25c316f9..58e5ab98c16 100644 --- a/pkgs/applications/networking/browsers/chromium/browser.nix +++ b/pkgs/applications/networking/browsers/chromium/browser.nix @@ -18,6 +18,11 @@ mkChromiumDerivation (base: rec { cp -vLR "$buildPath/locales" "$buildPath/resources" "$libExecPath/" cp -v "$buildPath/chrome" "$libExecPath/$packageName" + if [ -e "$buildPath/libwidevinecdmadapter.so" ]; then + cp -v "$buildPath/libwidevinecdmadapter.so" \ + "$libExecPath/libwidevinecdmadapter.so" + fi + mkdir -p "$sandbox/bin" cp -v "$buildPath/chrome_sandbox" "$sandbox/bin/${sandboxExecutableName}" diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index ce3b0f84cbb..e70f180f489 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -23,6 +23,7 @@ , enableSELinux ? false, libselinux ? null , enableNaCl ? false , enableHotwording ? false +, enableWideVine ? false , gnomeSupport ? false, gnome ? null , gnomeKeyringSupport ? false, libgnome_keyring3 ? null , proprietaryCodecs ? true @@ -102,10 +103,9 @@ let ++ optional pulseSupport libpulseaudio; patches = [ - ./patches/widevine.patch ./patches/glibc-2.24.patch ./patches/nix_plugin_paths_52.patch - ]; + ] ++ optional enableWideVine ./patches/widevine.patch; postPatch = '' # We want to be able to specify where the sandbox is via CHROME_DEVEL_SANDBOX @@ -147,6 +147,7 @@ let use_gio = gnomeSupport; enable_nacl = enableNaCl; enable_hotwording = enableHotwording; + enable_widevine = enableWideVine; selinux = enableSELinux; use_cups = cupsSupport; } // { diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix index b59cda875b6..1556603db2c 100644 --- a/pkgs/applications/networking/browsers/chromium/default.nix +++ b/pkgs/applications/networking/browsers/chromium/default.nix @@ -22,7 +22,8 @@ let mkChromiumDerivation = callPackage ./common.nix { inherit enableSELinux enableNaCl enableHotwording gnomeSupport gnome - gnomeKeyringSupport proprietaryCodecs cupsSupport pulseSupport; + gnomeKeyringSupport proprietaryCodecs cupsSupport pulseSupport + enableWideVine; }; browser = callPackage ./browser.nix { inherit channel; }; diff --git a/pkgs/applications/networking/browsers/chromium/patches/widevine.patch b/pkgs/applications/networking/browsers/chromium/patches/widevine.patch index 45048cada87..90a13928e3b 100644 --- a/pkgs/applications/networking/browsers/chromium/patches/widevine.patch +++ b/pkgs/applications/networking/browsers/chromium/patches/widevine.patch @@ -1,12 +1,16 @@ -diff -upr chromium-42.0.2311.90.orig/third_party/widevine/cdm/widevine_cdm_version.h chromium-42.0.2311.90/third_party/widevine/cdm/widevine_cdm_version.h ---- chromium-42.0.2311.90.orig/third_party/widevine/cdm/widevine_cdm_version.h 2015-04-15 01:18:59.000000000 +0300 -+++ chromium-42.0.2311.90/third_party/widevine/cdm/widevine_cdm_version.h 2015-04-15 09:09:49.157260050 +0300 -@@ -14,4 +14,8 @@ - // - WIDEVINE_CDM_VERSION_STRING (with the version of the CDM that's available - // as a string, e.g., "1.0.123.456"). +Minimal WideVine patch from Gentoo: + +https://gitweb.gentoo.org/repo/gentoo.git/tree/www-client/chromium/files/chromium-widevine-r1.patch + +BTS: https://bugs.gentoo.org/show_bug.cgi?id=547630 + +--- a/third_party/widevine/cdm/stub/widevine_cdm_version.h ++++ b/third_party/widevine/cdm/stub/widevine_cdm_version.h +@@ -10,6 +10,7 @@ + + #include "third_party/widevine/cdm/widevine_cdm_common.h" + ++#define WIDEVINE_CDM_VERSION_STRING "unknown" + #define WIDEVINE_CDM_AVAILABLE -+#include "third_party/widevine/cdm/widevine_cdm_common.h" -+#define WIDEVINE_CDM_AVAILABLE -+#define WIDEVINE_CDM_VERSION_STRING "@WIDEVINE_VERSION@" -+ #endif // WIDEVINE_CDM_VERSION_H_ From 6f8a72bbff0dcdf78df96ad366f52956bcc5c7e7 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 8 Nov 2016 21:19:49 +0100 Subject: [PATCH 12/13] chromium: Add Gtk 3 for versions >= 56 Versions before 56 already had experimental support for Gtk 3 and since version 56, Gtk 3 _seemed_ to become the default. Although it's now requiring *both* Gtk 2 and Gtk3, so let's supply the dependency for now to get it to build. In the future however we might want to add use_gtk3 to the GN flags and get rid of Gtk 2 completely. Signed-off-by: aszlig --- pkgs/applications/networking/browsers/chromium/common.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index e70f180f489..07ad1bef25f 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -11,7 +11,7 @@ , nspr, systemd, kerberos , utillinux, alsaLib , bison, gperf -, glib, gtk2, dbus_glib +, glib, gtk2, gtk3, dbus_glib , libXScrnSaver, libXcursor, libXtst, mesa , protobuf, speechd, libXdamage, cups @@ -100,7 +100,8 @@ let ++ optionals gnomeSupport [ gnome.GConf libgcrypt ] ++ optional enableSELinux libselinux ++ optionals cupsSupport [ libgcrypt cups ] - ++ optional pulseSupport libpulseaudio; + ++ optional pulseSupport libpulseaudio + ++ optional (versionAtLeast version "56.0.0.0") gtk3; patches = [ ./patches/glibc-2.24.patch From 4e7eb75a79a48b0d7068f1949f8c7c42553181d7 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 9 Nov 2016 09:41:10 +0100 Subject: [PATCH 13/13] nixos/tests/chromium: Fix popup detection Sometimes it happens that the "Type to search or enter a URL to navigate" popup doesn't show, but all we need to know at this time is whether Chromium has finished starting up. So checking for the "startup done" page is a better option here. Signed-off-by: aszlig --- nixos/tests/chromium.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/tests/chromium.nix b/nixos/tests/chromium.nix index 9a6414f81c3..55b1fb5a722 100644 --- a/nixos/tests/chromium.nix +++ b/nixos/tests/chromium.nix @@ -118,7 +118,7 @@ mapAttrs (channel: chromiumPkg: makeTest rec { "ulimit -c unlimited; ". "chromium $args \"$url\" & disown" ); - $machine->waitForText(qr/Type to search or enter a URL to navigate/); + $machine->waitForText(qr/startup done/); $machine->waitUntilSucceeds("${xdo "check-startup" '' search --sync --onlyvisible --name "startup done" # close first start help popup