From 4f981b4f84707a63904410bb3e2b88621db03e8e Mon Sep 17 00:00:00 2001 From: aszlig Date: Sun, 20 Mar 2016 17:50:17 +0100 Subject: [PATCH] chromium: Move source/default.nix into common.nix This addresses #12794 so that we now have only a single tarball where we base our build on instead of splitting the source into different outputs first and then reference the outputs. The reason I did this in the first place is that we previously built the sandbox as a different derivation and unpacking the whole source tree just for building the sandbox was a bit too much. As we now have namespaces sandbox built in by default we no longer have that derivation anymore. It still might come up however if we want to build NaCl as a separate derivation (see #8560), but splitting the source code into things only NaCl might require is already too much work and doesn't weight out the benefits. Another issue with the source splitup is that Hydra now has an output limit for non-fixed-output derivations which we're already hitting. Tested the build against the stable channel and it went well, but I haven't tested running the browser. Signed-off-by: aszlig --- .../networking/browsers/chromium/common.nix | 35 ++++++--- .../networking/browsers/chromium/default.nix | 7 +- .../networking/browsers/chromium/plugins.nix | 11 ++- .../browsers/chromium/source/default.nix | 78 ------------------- .../networking/browsers/chromium/update.nix | 1 + 5 files changed, 33 insertions(+), 99 deletions(-) delete mode 100644 pkgs/applications/networking/browsers/chromium/source/default.nix diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index 8c2703e76ce..d77fd104815 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -29,7 +29,7 @@ , pulseSupport ? false, libpulseaudio ? null , hiDPISupport ? false -, source +, upstream-info }: buildFun: @@ -97,9 +97,17 @@ let base = rec { name = "${packageName}-${version}"; - inherit (source) version; + inherit (upstream-info) version; inherit packageName buildType buildPath; - src = source; + + src = upstream-info.main; + + unpackCmd = '' + tar xf "$src" \ + --anchored \ + --no-wildcards-match-slash \ + --exclude='*/tools/gyp' + ''; buildInputs = defaultDependencies ++ [ which @@ -117,16 +125,21 @@ let ++ optionals cupsSupport [ libgcrypt cups ] ++ optional pulseSupport libpulseaudio; - # XXX: Wait for https://crbug.com/239107 and https://crbug.com/239181 to - # be fixed, then try again to unbundle everything into separate - # derivations. - prePatch = '' - cp -dr --no-preserve=mode "${source.main}"/* . - cp -dr "${source.bundled}" third_party - chmod -R u+w third_party - ''; + patches = [ + ./patches/build_fixes_46.patch + ./patches/widevine.patch + (if versionOlder version "50.0.0.0" + then ./patches/nix_plugin_paths_46.patch + else ./patches/nix_plugin_paths_50.patch) + ]; postPatch = '' + 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 '/module_path *=.*libexif.so/ { s|= [^;]*|= base::FilePath().AppendASCII("${libexif}/lib/libexif.so")| }' chrome/utility/media_galleries/image_metadata_extractor.cc diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix index f9ed1f31e54..79e5e2dfec3 100644 --- a/pkgs/applications/networking/browsers/chromium/default.nix +++ b/pkgs/applications/networking/browsers/chromium/default.nix @@ -19,10 +19,9 @@ let callPackage = newScope chromium; chromium = { - source = callPackage ./source { - inherit channel; - # XXX: common config - }; + upstream-info = (import ./update.nix { + inherit (stdenv) system; + }).getChannel channel; mkChromiumDerivation = callPackage ./common.nix { inherit enableSELinux enableNaCl enableHotwording gnomeSupport diff --git a/pkgs/applications/networking/browsers/chromium/plugins.nix b/pkgs/applications/networking/browsers/chromium/plugins.nix index b2e777c6faf..a0b354f0327 100644 --- a/pkgs/applications/networking/browsers/chromium/plugins.nix +++ b/pkgs/applications/networking/browsers/chromium/plugins.nix @@ -3,7 +3,7 @@ , enablePepperFlash ? false , enableWideVine ? false -, source +, upstream-info }: with stdenv.lib; @@ -40,16 +40,15 @@ let plugins = stdenv.mkDerivation { name = "chromium-binary-plugins"; - # XXX: Only temporary and has to be version-specific - src = source.plugins; + src = upstream-info.binary; phases = [ "unpackPhase" "patchPhase" "installPhase" "checkPhase" ]; outputs = [ "flash" "widevine" ]; unpackCmd = let - chan = if source.channel == "dev" then "chrome-unstable" - else if source.channel == "stable" then "chrome" - else "chrome-${source.channel}"; + chan = if upstream-info.channel == "dev" then "chrome-unstable" + else if upstream-info.channel == "stable" then "chrome" + else "chrome-${upstream-info.channel}"; in '' mkdir -p plugins ar p "$src" data.tar.xz | tar xJ -C plugins --strip-components=4 \ diff --git a/pkgs/applications/networking/browsers/chromium/source/default.nix b/pkgs/applications/networking/browsers/chromium/source/default.nix deleted file mode 100644 index 6e0decbca25..00000000000 --- a/pkgs/applications/networking/browsers/chromium/source/default.nix +++ /dev/null @@ -1,78 +0,0 @@ -{ stdenv, fetchpatch, patchutils, python -, channel ? "stable" -}: - -with stdenv.lib; - -with (import ../update.nix { - inherit (stdenv) system; -}).getChannel channel; - -let - transform = flags: concatStringsSep ";" (map (subst: subst + flags) [ - "s,^[^/]+(.*)$,$main\\1," - "s,$main/(build|tools)(/.*)?$,$out/\\1\\2," - "s,$main/third_party(/.*)?$,$bundled\\1," - "s,^/,," - ]); - -in stdenv.mkDerivation { - name = "chromium-source-${version}"; - - src = main; - - buildInputs = [ python ]; # cannot patch shebangs otherwise - - phases = [ "unpackPhase" "patchPhase" ]; - outputs = [ "out" "bundled" "main" ]; - - unpackPhase = '' - tar xf "$src" -C / \ - --transform="${transform "xS"}" \ - --anchored \ - --no-wildcards-match-slash \ - --exclude='*/tools/gyp' \ - --exclude='*/.*' - ''; - - prePatch = '' - for i in $outputs; do - eval patchShebangs "\$$i" - done - ''; - - patches = [ - ../patches/build_fixes_46.patch - ../patches/widevine.patch - (if versionOlder version "50.0.0.0" - then ../patches/nix_plugin_paths_46.patch - else ../patches/nix_plugin_paths_50.patch) - ]; - - patchPhase = let - diffmod = sym: "/^${sym} /{s/^${sym} //;${transform ""};s/^/${sym} /}"; - allmods = "${diffmod "---"};${diffmod "\\+\\+\\+"}"; - sedexpr = "/^(---|\\+\\+\\+) *\\/dev\\/null/b;${allmods}"; - in '' - runHook prePatch - for i in $patches; do - header "applying patch $i" 3 - sed -r -e "${sedexpr}" "$i" | patch -d / -p0 - stopNest - done - runHook postPatch - ''; - - postPatch = '' - sed -i -r \ - -e 's/-f(stack-protector)(-all)?/-fno-\1/' \ - -e 's|/bin/echo|echo|' \ - -e "/python_arch/s/: *'[^']*'/: '""'/" \ - "$out/build/common.gypi" "$main/chrome/chrome_tests.gypi" - ''; - - passthru = { - inherit version channel; - plugins = binary; - }; -} diff --git a/pkgs/applications/networking/browsers/chromium/update.nix b/pkgs/applications/networking/browsers/chromium/update.nix index 150031ab788..cff84199562 100644 --- a/pkgs/applications/networking/browsers/chromium/update.nix +++ b/pkgs/applications/networking/browsers/chromium/update.nix @@ -32,6 +32,7 @@ in rec { getChannel = channel: let chanAttrs = builtins.getAttr channel sources; in { + inherit channel; inherit (chanAttrs) version; main = fetchurl {