2016-01-20 19:51:52 +00:00
|
|
|
{ stdenv, fetchurl, kernel ? null, which
|
|
|
|
, xorg, makeWrapper, glibc, patchelf, unzip
|
|
|
|
, fontconfig, freetype, mesa # for fgl_glxgears
|
2014-09-06 04:17:00 +00:00
|
|
|
, # Whether to build the libraries only (i.e. not the kernel module or
|
|
|
|
# driver utils). Used to support 32-bit binaries on 64-bit
|
|
|
|
# Linux.
|
|
|
|
libsOnly ? false
|
2010-05-18 19:36:55 +00:00
|
|
|
}:
|
|
|
|
|
2014-09-06 04:17:00 +00:00
|
|
|
assert (!libsOnly) -> kernel != null;
|
|
|
|
|
2016-01-20 19:51:52 +00:00
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
version = "15.7";
|
|
|
|
in
|
|
|
|
|
|
|
|
# This derivation requires a maximum of gcc49, Linux kernel 4.1 and xorg.xserver 1.17
|
|
|
|
# and will not build or run using versions newer
|
|
|
|
|
2010-05-18 19:36:55 +00:00
|
|
|
# If you want to use a different Xorg version probably
|
|
|
|
# DIR_DEPENDING_ON_XORG_VERSION in builder.sh has to be adopted (?)
|
|
|
|
# make sure libglx.so of ati is used. xorg.xorgserver does provide it as well
|
|
|
|
# which is a problem because it doesn't contain the xorgserver patch supporting
|
|
|
|
# the XORG_DRI_DRIVER_PATH env var.
|
|
|
|
# See http://thread.gmane.org/gmane.linux.distributions.nixos/4145 for a
|
|
|
|
# workaround (TODO)
|
|
|
|
|
2016-01-20 19:51:52 +00:00
|
|
|
# The gentoo ebuild contains much more "magic" and is usually a great resource to
|
|
|
|
# find patches XD
|
2010-05-18 19:36:55 +00:00
|
|
|
|
|
|
|
# http://wiki.cchtml.com/index.php/Main_Page
|
|
|
|
|
2016-01-20 19:51:52 +00:00
|
|
|
#
|
2012-10-07 16:03:06 +00:00
|
|
|
# /usr/lib/dri/fglrx_dri.so must point to /run/opengl-driver/lib/fglrx_dri.so
|
2016-01-20 19:51:52 +00:00
|
|
|
# This is done in the builder script.
|
2014-01-05 01:57:21 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2010-05-18 19:36:55 +00:00
|
|
|
|
2016-01-20 19:51:52 +00:00
|
|
|
linuxonly =
|
|
|
|
if stdenv.system == "i686-linux" then
|
|
|
|
true
|
|
|
|
else if stdenv.system == "x86_64-linux" then
|
|
|
|
true
|
|
|
|
else throw "ati-drivers are Linux only. Sorry. The build was stopped.";
|
2010-05-18 19:36:55 +00:00
|
|
|
|
2016-01-20 19:51:52 +00:00
|
|
|
name = "ati-drivers-${version}" + (optionalString (!libsOnly) "-${kernel.version}");
|
|
|
|
|
|
|
|
builder = ./builder.sh;
|
2015-01-15 04:25:26 +00:00
|
|
|
gcc = stdenv.cc.cc;
|
2016-01-20 19:51:52 +00:00
|
|
|
libXinerama = xorg.libXinerama;
|
|
|
|
libXrandr = xorg.libXrandr;
|
|
|
|
libXrender = xorg.libXrender;
|
|
|
|
libXxf86vm = xorg.libXxf86vm;
|
|
|
|
xf86vidmodeproto = xorg.xf86vidmodeproto;
|
|
|
|
libSM = xorg.libSM;
|
|
|
|
libICE = xorg.libICE;
|
|
|
|
libfreetype = freetype;
|
|
|
|
libfontconfig = fontconfig;
|
2010-05-18 19:36:55 +00:00
|
|
|
|
2012-02-17 14:32:28 +00:00
|
|
|
src = fetchurl {
|
2015-08-03 04:14:36 +00:00
|
|
|
url = "http://www2.ati.com/drivers/linux/amd-driver-installer-15.20.1046-x86.x86_64.zip";
|
|
|
|
sha256 = "ffde64203f49d9288eaa25f4d744187b6f4f14a87a444bab6a001d822b327a9d";
|
2013-12-13 23:59:17 +00:00
|
|
|
curlOpts = "--referer http://support.amd.com/en-us/download/desktop?os=Linux%20x86_64";
|
2010-05-18 19:36:55 +00:00
|
|
|
};
|
|
|
|
|
2014-01-22 09:57:43 +00:00
|
|
|
patchPhaseSamples = "patch -p2 < ${./patch-samples.patch}";
|
2016-01-20 19:51:52 +00:00
|
|
|
patchPhase1 = "patch -p1 < ${./kernel-api-fixes.patch}";
|
2013-08-22 10:00:23 +00:00
|
|
|
|
2012-02-17 14:32:28 +00:00
|
|
|
buildInputs =
|
2016-01-20 19:51:52 +00:00
|
|
|
[ xorg.libXrender xorg.libXext xorg.libX11 xorg.libXinerama xorg.libSM
|
|
|
|
xorg.libXrandr xorg.libXxf86vm xorg.xf86vidmodeproto xorg.imake xorg.libICE
|
2012-02-17 14:32:28 +00:00
|
|
|
patchelf
|
2012-10-07 16:03:06 +00:00
|
|
|
unzip
|
2013-08-22 10:00:23 +00:00
|
|
|
mesa
|
2016-01-20 19:51:52 +00:00
|
|
|
fontconfig
|
|
|
|
freetype
|
|
|
|
makeWrapper
|
|
|
|
which
|
2012-02-17 14:32:28 +00:00
|
|
|
];
|
2013-01-17 21:05:59 +00:00
|
|
|
|
2014-09-06 04:17:00 +00:00
|
|
|
inherit libsOnly;
|
|
|
|
|
|
|
|
kernel = if libsOnly then null else kernel.dev;
|
2013-03-24 11:45:00 +00:00
|
|
|
|
|
|
|
inherit glibc /* glibc only used for setting interpreter */;
|
2013-01-17 21:05:59 +00:00
|
|
|
|
2016-02-03 15:54:03 +00:00
|
|
|
# outputs TODO: probably many fixes are needed;
|
|
|
|
# this in particular would be much better by lib.makeLibraryPath
|
2012-02-17 14:32:28 +00:00
|
|
|
LD_LIBRARY_PATH = stdenv.lib.concatStringsSep ":"
|
2016-02-03 15:54:03 +00:00
|
|
|
[ "${xorg.libXrandr.out}/lib/"
|
|
|
|
"${xorg.libXrender.out}/lib/"
|
|
|
|
"${xorg.libXext.out}/lib/"
|
|
|
|
"${xorg.libX11.out}/lib/"
|
|
|
|
"${xorg.libXinerama.out}/lib/"
|
|
|
|
"${xorg.libSM.out}/lib/"
|
|
|
|
"${xorg.libICE.out}/lib/"
|
|
|
|
"${stdenv.cc.cc.out}/lib/"
|
2010-05-18 19:36:55 +00:00
|
|
|
];
|
|
|
|
|
2013-08-22 10:00:23 +00:00
|
|
|
# without this some applications like blender don't start, but they start
|
|
|
|
# with nvidia. This causes them to be symlinked to $out/lib so that they
|
|
|
|
# appear in /run/opengl-driver/lib which get's added to LD_LIBRARY_PATH
|
|
|
|
|
2016-01-20 19:51:52 +00:00
|
|
|
extraDRIlibs = [ xorg.libXrandr xorg.libXrender xorg.libXext xorg.libX11 xorg.libXinerama xorg.libSM xorg.libICE ];
|
|
|
|
|
|
|
|
inherit mesa; # only required to build the examples
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2010-05-18 19:36:55 +00:00
|
|
|
|
2014-01-22 09:57:43 +00:00
|
|
|
meta = with stdenv.lib; {
|
2016-01-20 19:51:52 +00:00
|
|
|
description = "ATI Catalyst display drivers";
|
2010-05-18 19:36:55 +00:00
|
|
|
homepage = http://support.amd.com/us/gpudownload/Pages/index.aspx;
|
2014-01-22 09:57:43 +00:00
|
|
|
license = licenses.unfree;
|
2014-10-14 22:37:39 +00:00
|
|
|
maintainers = with maintainers; [ marcweber offline jgeerds ];
|
2014-09-06 04:17:00 +00:00
|
|
|
platforms = platforms.linux;
|
2013-11-04 23:04:36 +00:00
|
|
|
hydraPlatforms = [];
|
2016-01-20 19:51:52 +00:00
|
|
|
# Copied from the nvidia default.nix to prevent a store collision.
|
|
|
|
priority = 4;
|
2010-05-18 19:36:55 +00:00
|
|
|
};
|
2016-01-20 19:51:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-18 19:36:55 +00:00
|
|
|
}
|