3
0
Fork 0
forked from mirrors/nixpkgs

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 <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2016-03-20 17:50:17 +01:00
parent 37dbd62a83
commit 4f981b4f84
No known key found for this signature in database
GPG key ID: D0EBD0EC8C2DC961
5 changed files with 33 additions and 99 deletions

View file

@ -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

View file

@ -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

View file

@ -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 \

View file

@ -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;
};
}

View file

@ -32,6 +32,7 @@ in rec {
getChannel = channel: let
chanAttrs = builtins.getAttr channel sources;
in {
inherit channel;
inherit (chanAttrs) version;
main = fetchurl {