nixpkgs/pkgs/applications/networking/browsers/opera/default.nix
Eelco Dolstra d4d7931a62 * Cleanup: remove obsolete references to ‘xz’, which is in stdenv now.
svn path=/nixpkgs/branches/stdenv-updates/; revision=31678
2012-01-18 20:53:01 +00:00

83 lines
2.5 KiB
Nix

{ stdenv, fetchurl, zlib, libX11, libXext, libSM, libICE, libXt
, freetype, fontconfig, libXft, libXrender, libxcb, expat, libXau, libXdmcp
, libuuid, cups, xz
, gstreamer, gstPluginsBase, libxml2
, gtkSupport ? true, glib, gtk, pango, gdk_pixbuf, cairo, atk
, kdeSupport ? false, qt4, kdelibs
}:
assert stdenv.isLinux && stdenv.gcc.gcc != null && stdenv.gcc.libc != null;
let
mirror = ftp://ftp.ussg.iu.edu/pub/opera;
in
stdenv.mkDerivation rec {
name = "opera-11.51-1087";
src =
if stdenv.system == "i686-linux" then
fetchurl {
url = "${mirror}/linux/1151/${name}.i386.linux.tar.bz2";
sha256 = "1baaim404g8nwd7knbl1p1ardpx36ib5159nkvqfnnavfyhkinp2";
}
else if stdenv.system == "x86_64-linux" then
fetchurl {
url = "${mirror}/linux/1151/${name}.x86_64.linux.tar.xz";
sha256 = "1bciqyfhhdywaasj717by1a975ywf672r3pv9cw9bn0b90pgp933";
}
else throw "Opera is not supported on ${stdenv.system} (only i686-linux and x86_64 linux are supported)";
dontStrip = 1;
phases = "unpackPhase installPhase fixupPhase";
installPhase = ''
./install --unattended --prefix $out
'';
buildInputs =
[ stdenv.gcc.gcc stdenv.gcc.libc zlib libX11 libXt libXext libSM libICE
libXft freetype fontconfig libXrender libuuid expat
gstreamer libxml2 gstPluginsBase
]
++ stdenv.lib.optionals gtkSupport [ glib gtk 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.makeSearchPath "lib64" buildInputs);
preFixup =
''
find $out/lib/opera -type f | while read f; do
type=$(readelf -h "$f" 2>/dev/null | grep 'Type:' | sed -e 's/ *Type: *\([A-Z]*\) (.*/\1/')
if [ -z "$type" ]; then
:
elif [ $type == "EXEC" ]; then
echo "patching $f executable <<"
patchelf \
--set-interpreter "$(cat $NIX_GCC/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
'';
postFixup = ''
oldRPATH=`patchelf --print-rpath $out/lib/opera/opera`
patchelf --set-rpath $oldRPATH:${cups}/lib $out/lib/opera/opera
'';
meta = {
homepage = http://www.opera.com;
description = "The Opera web browser";
};
}