Skip to content

Commit

Permalink
chromium: Move source/default.nix into common.nix
Browse files Browse the repository at this point in the history
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 <aszlig@redmoonstudios.org>
  • Loading branch information
aszlig committed Mar 20, 2016
1 parent 37dbd62 commit 4f981b4
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 99 deletions.
35 changes: 24 additions & 11 deletions pkgs/applications/networking/browsers/chromium/common.nix
Expand Up @@ -29,7 +29,7 @@
, pulseSupport ? false, libpulseaudio ? null
, hiDPISupport ? false

, source
, upstream-info
}:

buildFun:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 3 additions & 4 deletions pkgs/applications/networking/browsers/chromium/default.nix
Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions pkgs/applications/networking/browsers/chromium/plugins.nix
Expand Up @@ -3,7 +3,7 @@
, enablePepperFlash ? false
, enableWideVine ? false

, source
, upstream-info
}:

with stdenv.lib;
Expand Down Expand Up @@ -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 \
Expand Down
78 changes: 0 additions & 78 deletions pkgs/applications/networking/browsers/chromium/source/default.nix

This file was deleted.

1 change: 1 addition & 0 deletions pkgs/applications/networking/browsers/chromium/update.nix
Expand Up @@ -32,6 +32,7 @@ in rec {
getChannel = channel: let
chanAttrs = builtins.getAttr channel sources;
in {
inherit channel;
inherit (chanAttrs) version;

main = fetchurl {
Expand Down

0 comments on commit 4f981b4

Please sign in to comment.