chrome: fix fallout from #26512

Fixes broken save dialogue (causes chrome to crash) and missing icons.
This commit is contained in:
Charles Strahan 2017-06-16 01:49:50 -04:00
parent 8a8f0408cd
commit 39fd944402
2 changed files with 40 additions and 6 deletions

View File

@ -1,4 +1,5 @@
{ newScope, stdenv, makeWrapper, makeDesktopItem, ed { newScope, stdenv, makeWrapper, makeDesktopItem, ed
, glib, gtk2, gtk3, gnome2, gnome3, gsettings_desktop_schemas
# package customization # package customization
, channel ? "stable" , channel ? "stable"
@ -62,10 +63,26 @@ let
sandboxExecutableName = chromium.browser.passthru.sandboxExecutableName; sandboxExecutableName = chromium.browser.passthru.sandboxExecutableName;
in stdenv.mkDerivation { version = chromium.browser.version;
name = "chromium${suffix}-${chromium.browser.version}";
buildInputs = [ makeWrapper ed ]; inherit (stdenv.lib) versionAtLeast;
gtk = if (versionAtLeast version "59.0.0.0") then gtk3 else gtk2;
gnome = if (versionAtLeast version "59.0.0.0") then gnome3 else gnome2;
in stdenv.mkDerivation {
name = "chromium${suffix}-${version}";
inherit version;
buildInputs = [
makeWrapper ed
# needed for GSETTINGS_SCHEMAS_PATH
gsettings_desktop_schemas glib gtk
# needed for XDG_ICON_DIRS
gnome.defaultIconTheme
];
outputs = ["out" "sandbox"]; outputs = ["out" "sandbox"];
@ -92,6 +109,8 @@ in stdenv.mkDerivation {
# libredirect causes chromium to deadlock on startup # libredirect causes chromium to deadlock on startup
export LD_PRELOAD="\$(echo -n "\$LD_PRELOAD" | tr ':' '\n' | grep -v /lib/libredirect\\\\.so$ | tr '\n' ':')" export LD_PRELOAD="\$(echo -n "\$LD_PRELOAD" | tr ':' '\n' | grep -v /lib/libredirect\\\\.so$ | tr '\n' ':')"
export XDG_DATA_DIRS=$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH\''${XDG_DATA_DIRS:+:}\$XDG_DATA_DIRS
. .
w w
EOF EOF
@ -107,7 +126,7 @@ in stdenv.mkDerivation {
cp -v "${desktopItem}/share/applications/"* "$out/share/applications" cp -v "${desktopItem}/share/applications/"* "$out/share/applications"
''; '';
inherit (chromium.browser) meta packageName version; inherit (chromium.browser) meta packageName;
passthru = { passthru = {
inherit (chromium) upstream-info browser; inherit (chromium) upstream-info browser;

View File

@ -31,6 +31,9 @@
# Only needed for getting information about upstream binaries # Only needed for getting information about upstream binaries
, chromium , chromium
, gsettings_desktop_schemas
, gnome2, gnome3
}: }:
with stdenv.lib; with stdenv.lib;
@ -42,6 +45,9 @@ let
withCustomModes = true; withCustomModes = true;
}; };
gtk = if (versionAtLeast version "59.0.0.0") then gtk3 else gtk2;
gnome = if (versionAtLeast version "59.0.0.0") then gnome3 else gnome2;
deps = [ deps = [
glib fontconfig freetype pango cairo libX11 libXi atk gconf nss nspr glib fontconfig freetype pango cairo libX11 libXi atk gconf nss nspr
libXcursor libXext libXfixes libXrender libXScrnSaver libXcomposite libxcb libXcursor libXext libXfixes libXrender libXScrnSaver libXcomposite libxcb
@ -53,7 +59,7 @@ let
flac harfbuzz icu libpng opusWithCustomModes snappy speechd flac harfbuzz icu libpng opusWithCustomModes snappy speechd
bzip2 libcap bzip2 libcap
] ++ optional pulseSupport libpulseaudio ] ++ optional pulseSupport libpulseaudio
++ (if (versionAtLeast version "59.0.0.0") then [gtk3] else [gtk2]); ++ [ gtk ];
suffix = if channel != "stable" then "-" + channel else ""; suffix = if channel != "stable" then "-" + channel else "";
@ -64,7 +70,15 @@ in stdenv.mkDerivation rec {
src = binary; src = binary;
buildInputs = [ patchelf ]; buildInputs = [
patchelf
# needed for GSETTINGS_SCHEMAS_PATH
gsettings_desktop_schemas glib gtk
# needed for XDG_ICON_DIRS
gnome.defaultIconTheme
];
unpackPhase = '' unpackPhase = ''
ar x $src ar x $src
@ -109,6 +123,7 @@ in stdenv.mkDerivation rec {
#!${bash}/bin/sh #!${bash}/bin/sh
export LD_LIBRARY_PATH=$rpath\''${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH} export LD_LIBRARY_PATH=$rpath\''${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH}
export PATH=$binpath\''${PATH:+:\$PATH} export PATH=$binpath\''${PATH:+:\$PATH}
export XDG_DATA_DIRS=$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH\''${XDG_DATA_DIRS:+:}\$XDG_DATA_DIRS
$out/share/google/$appname/google-$appname ${commandLineArgs} "\$@" $out/share/google/$appname/google-$appname ${commandLineArgs} "\$@"
EOF EOF
chmod +x $exe chmod +x $exe