Merge pull request #19646 from phunehehe/opera

opera: 12.16-1860 -> 40.0.2308.81
This commit is contained in:
Jörg Thalheim 2016-10-23 11:38:38 +02:00 committed by GitHub
commit de7f231f6c
2 changed files with 101 additions and 69 deletions

View file

@ -1,91 +1,125 @@
{ stdenv, fetchurl, zlib, libX11, libXext, libSM, libICE, libXt
, freetype, fontconfig, libXft, libXrender, libxcb, expat, libXau, libXdmcp
, libuuid, cups, xz
, gstreamer, gst_plugins_base, libxml2
, gtkSupport ? true, glib, gtk2, pango, gdk_pixbuf, cairo, atk
, kdeSupport ? false, qt4, kdelibs
{ alsaLib
, atk
, cairo
, cups
, curl
, dbus
, dpkg
, expat
, fetchurl
, fontconfig
, freetype
, gdk_pixbuf
, glib
, gnome2
, gtk2
, libX11
, libXScrnSaver
, libXcomposite
, libXcursor
, libXdamage
, libXext
, libXfixes
, libXi
, libXrandr
, libXrender
, libXtst
, libnotify
, libpulseaudio
, nspr
, nss
, pango
, stdenv
, systemd
}:
assert stdenv.isLinux && stdenv.cc.isGNU && stdenv.cc.libc != null;
let
mirror = http://get.geo.opera.com/pub/opera;
in
stdenv.mkDerivation rec {
name = "opera-12.16-1860";
mirror = https://get.geo.opera.com/pub/opera/desktop;
version = "40.0.2308.90";
rpath = stdenv.lib.makeLibraryPath [
# These provide shared libraries loaded when starting. If one is missing,
# an error is shown in stderr.
alsaLib.out
atk.out
cairo.out
cups.out
curl.out
dbus.lib
expat.out
fontconfig.lib
freetype.out
gdk_pixbuf.out
glib.out
gnome2.GConf.out
gtk2.out
libX11.out
libXScrnSaver.out
libXcomposite.out
libXcursor.out
libXdamage.out
libXext.out
libXfixes.out
libXi.out
libXrandr.out
libXrender.out
libXtst.out
libnotify.out
nspr.out
nss.out
pango.out
stdenv.cc.cc.lib
# This is a little tricky. Without it the app starts then crashes. Then it
# brings up the crash report, which also crashes. `strace -f` hints at a
# missing libudev.so.0.
systemd.lib
# Works fine without this except there is no sound.
libpulseaudio.out
];
in stdenv.mkDerivation {
name = "opera-${version}";
src =
if stdenv.system == "i686-linux" then
fetchurl {
url = "${mirror}/linux/1216/${name}.i386.linux.tar.xz";
sha256 = "df640656a52b7c714faf25de92d84992116ce8f82b7a67afc1121eb3c428489d";
url = "${mirror}/${version}/linux/opera-stable_${version}_i386.deb";
sha256 = "1fqbxbn4531yv9figgg8xxr63swimrgpamqrphcg8jq5q3smrk4k";
}
else if stdenv.system == "x86_64-linux" then
fetchurl {
url = "${mirror}/linux/1216/${name}.x86_64.linux.tar.xz";
sha256 = "b3b5cada3829d2b3b0e2da25e9444ce9dff73dc6692586ce72cfd4f6431e639e";
url = "${mirror}/${version}/linux/opera-stable_${version}_amd64.deb";
sha256 = "12imzjxwip9r7bjyfnrpdsxyxb0cjn92s3b7ajdlbqccxxmc6k6g";
}
else throw "Opera is not supported on ${stdenv.system} (only i686-linux and x86_64 linux are supported)";
dontStrip = 1;
phases = "unpackPhase installPhase fixupPhase";
unpackCmd = "${dpkg}/bin/dpkg-deb -x $curSrc .";
installPhase = ''
./install --unattended --prefix $out
'';
buildInputs =
[ stdenv.cc.cc stdenv.cc.libc zlib libX11 libXt libXext libSM libICE
libXft freetype fontconfig libXrender libuuid expat
gstreamer libxml2 gst_plugins_base
]
++ stdenv.lib.optionals gtkSupport [ glib gtk2 pango gdk_pixbuf cairo atk ]
++ stdenv.lib.optionals kdeSupport [ kdelibs qt4 ];
libPath = stdenv.lib.makeLibraryPath buildInputs
+ stdenv.lib.optionalString (stdenv.system == "x86_64-linux")
(":" + stdenv.lib.makeSearchPathOutput "lib" "lib64" buildInputs);
preFixup =
''
rm $out/bin/uninstall-opera
find $out/lib/opera -type f | while read f; do
type=$(readelf -h "$f" 2>/dev/null | sed -n 's/ *Type: *\([A-Z]*\).*/\1/p' || true)
if [ -z "$type" ]; then
:
elif [ $type == "EXEC" ]; then
echo "patching $f executable <<"
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${libPath}" \
"$f"
elif [ $type == "DYN" ]; then
echo "patching $f library <<"
patchelf --set-rpath "${libPath}" "$f"
else
echo "Unknown type $type"
exit 1
fi
done
'';
mkdir --parent $out
mv * $out/
mv $out/lib/*/opera/*.so $out/lib/
'';
postFixup = ''
oldRPATH=`patchelf --print-rpath $out/lib/opera/opera`
patchelf --set-rpath $oldRPATH:${cups.out}/lib $out/lib/opera/opera
# This file should normally require a gtk-update-icon-cache -q /usr/share/icons/hicolor command
# It have no reasons to exist in a redistribuable package
rm $out/share/icons/hicolor/icon-theme.cache
'';
find $out -executable -type f \
| while read f
do
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "$out/lib:${rpath}" \
"$f"
done
'';
meta = {
homepage = http://www.opera.com;
description = "Web browser";
license = stdenv.lib.licenses.unfree;
# Marked as broken due to needing an update for security issues.
# See: https://github.com/NixOS/nixpkgs/issues/18856
broken = true;
};
}

View file

@ -13973,9 +13973,7 @@ in
openscad = callPackage ../applications/graphics/openscad {};
opera = callPackage ../applications/networking/browsers/opera {
inherit (pkgs.kde4) kdelibs;
};
opera = callPackage ../applications/networking/browsers/opera {};
osmctools = callPackage ../applications/misc/osmctools { };