summary refs log tree commit diff
path: root/pkgs/applications/networking/browsers/opera/default.nix
diff options
context:
space:
mode:
authorHoang Xuan Phu <phuhimself@phunehehe.net>2016-10-18 20:52:43 +0800
committerHoang Xuan Phu <phuhimself@phunehehe.net>2016-10-23 16:38:29 +0800
commitc2281d649419b8f15a39679734ddac03e4854e11 (patch)
treecabd252cf42467a19d654704f5676829c3903710 /pkgs/applications/networking/browsers/opera/default.nix
parentcbec6a304a96908b35502c9e126b08968fc77ab2 (diff)
downloadnixpkgs-c2281d649419b8f15a39679734ddac03e4854e11.tar
nixpkgs-c2281d649419b8f15a39679734ddac03e4854e11.tar.gz
nixpkgs-c2281d649419b8f15a39679734ddac03e4854e11.tar.bz2
nixpkgs-c2281d649419b8f15a39679734ddac03e4854e11.tar.lz
nixpkgs-c2281d649419b8f15a39679734ddac03e4854e11.tar.xz
nixpkgs-c2281d649419b8f15a39679734ddac03e4854e11.tar.zst
nixpkgs-c2281d649419b8f15a39679734ddac03e4854e11.zip
opera: 12.16-1860 -> 40.0.2308.90
and unbreak
Diffstat (limited to 'pkgs/applications/networking/browsers/opera/default.nix')
-rw-r--r--pkgs/applications/networking/browsers/opera/default.nix166
1 files changed, 100 insertions, 66 deletions
diff --git a/pkgs/applications/networking/browsers/opera/default.nix b/pkgs/applications/networking/browsers/opera/default.nix
index fe7cb477371..0c6d36b3818 100644
--- a/pkgs/applications/networking/browsers/opera/default.nix
+++ b/pkgs/applications/networking/browsers/opera/default.nix
@@ -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;
   };
 }