2016-11-28 18:56:50 +00:00
|
|
|
{ stdenv, lib, fetchurl, kernel ? null, which
|
2016-01-20 19:51:52 +00:00
|
|
|
, xorg, makeWrapper, glibc, patchelf, unzip
|
2019-11-10 16:44:34 +00:00
|
|
|
, fontconfig, freetype, libGLU, libGL # for fgl_glxgears
|
2014-09-06 05:17:00 +01: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 20:36:55 +01:00
|
|
|
}:
|
|
|
|
|
2014-09-06 05:17:00 +01:00
|
|
|
assert (!libsOnly) -> kernel != null;
|
|
|
|
|
2016-01-20 19:51:52 +00:00
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
# 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 20:36:55 +01: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.
|
2018-11-30 01:19:05 +00:00
|
|
|
# See https://marc.info/?l=nix-dev&m=139641585515351 for a
|
2010-05-18 20:36:55 +01:00
|
|
|
# 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 20:36:55 +01:00
|
|
|
|
|
|
|
# http://wiki.cchtml.com/index.php/Main_Page
|
|
|
|
|
2012-10-07 17:03:06 +01: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
|
|
|
|
2016-05-03 09:54:49 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
|
|
|
version = "15.12";
|
|
|
|
pname = "ati-drivers";
|
|
|
|
build = "15.302";
|
2010-05-18 20:36:55 +01:00
|
|
|
|
2016-01-20 19:51:52 +00:00
|
|
|
linuxonly =
|
2018-08-20 20:11:29 +01:00
|
|
|
if stdenv.hostPlatform.system == "i686-linux" then
|
2016-01-20 19:51:52 +00:00
|
|
|
true
|
2018-08-20 20:11:29 +01:00
|
|
|
else if stdenv.hostPlatform.system == "x86_64-linux" then
|
2016-01-20 19:51:52 +00:00
|
|
|
true
|
|
|
|
else throw "ati-drivers are Linux only. Sorry. The build was stopped.";
|
2010-05-18 20:36:55 +01:00
|
|
|
|
2016-05-03 09:54:49 +01:00
|
|
|
name = pname + "-" + version + (optionalString (!libsOnly) "-${kernelDir.version}");
|
2016-01-20 19:51:52 +00:00
|
|
|
|
|
|
|
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;
|
2018-12-31 03:40:47 +00:00
|
|
|
xorgproto = xorg.xorgproto;
|
2016-01-20 19:51:52 +00:00
|
|
|
libSM = xorg.libSM;
|
|
|
|
libICE = xorg.libICE;
|
|
|
|
libfreetype = freetype;
|
|
|
|
libfontconfig = fontconfig;
|
2016-05-03 09:54:49 +01:00
|
|
|
libStdCxx = stdenv.cc.cc.lib;
|
2010-05-18 20:36:55 +01:00
|
|
|
|
2012-02-17 14:32:28 +00:00
|
|
|
src = fetchurl {
|
2016-05-03 09:54:49 +01:00
|
|
|
url =
|
|
|
|
"https://www2.ati.com/drivers/linux/radeon-crimson-15.12-15.302-151217a-297685e.zip";
|
2018-11-04 03:03:57 +00:00
|
|
|
sha256 = "704f2dfc14681f76dae3b4120c87b1ded33cf43d5a1d800b6de5ca292bb61e58";
|
|
|
|
curlOpts = "--referer https://www.amd.com/en/support";
|
2010-05-18 20:36:55 +01:00
|
|
|
};
|
|
|
|
|
2016-08-13 15:06:57 +01:00
|
|
|
hardeningDisable = [ "pic" "format" ];
|
|
|
|
|
2016-05-20 12:05:41 +01:00
|
|
|
patchPhaseSamples = "patch -p2 < ${./patches/patch-samples.patch}";
|
|
|
|
patches = [
|
|
|
|
./patches/15.12-xstate-fp.patch
|
|
|
|
./patches/15.9-kcl_str.patch
|
|
|
|
./patches/15.9-mtrr.patch
|
|
|
|
./patches/15.9-preempt.patch
|
2016-08-31 03:28:01 +01:00
|
|
|
./patches/15.9-sep_printf.patch ]
|
|
|
|
++ optionals ( kernel != null &&
|
2016-11-28 18:56:50 +00:00
|
|
|
(lib.versionAtLeast kernel.version "4.6") )
|
2016-08-31 03:28:01 +01:00
|
|
|
[ ./patches/kernel-4.6-get_user_pages.patch
|
2016-11-28 18:56:50 +00:00
|
|
|
./patches/kernel-4.6-page_cache_release-put_page.patch ]
|
|
|
|
++ optionals ( kernel != null &&
|
|
|
|
(lib.versionAtLeast kernel.version "4.7") )
|
2017-02-04 01:25:38 +00:00
|
|
|
[ ./patches/4.7-arch-cpu_has_pge-v2.patch ]
|
|
|
|
++ optionals ( kernel != null &&
|
|
|
|
(lib.versionAtLeast kernel.version "4.9") )
|
|
|
|
[ ./patches/4.9-get_user_pages.patch ];
|
2013-08-22 11:00:23 +01: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
|
2018-12-31 03:40:47 +00:00
|
|
|
xorg.libXrandr xorg.libXxf86vm xorg.xorgproto xorg.imake xorg.libICE
|
2012-02-17 14:32:28 +00:00
|
|
|
patchelf
|
2012-10-07 17:03:06 +01:00
|
|
|
unzip
|
2019-11-10 16:44:34 +00:00
|
|
|
libGLU libGL
|
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 05:17:00 +01:00
|
|
|
inherit libsOnly;
|
|
|
|
|
2016-05-03 09:54:49 +01:00
|
|
|
kernelDir = if libsOnly then null else kernel.dev;
|
2013-03-24 11:45:00 +00:00
|
|
|
|
2016-05-03 09:54:49 +01:00
|
|
|
# glibc only used for setting the binaries interpreter
|
|
|
|
glibcDir = glibc.out;
|
2013-01-17 21:05:59 +00:00
|
|
|
|
2016-02-03 15:54:03 +00:00
|
|
|
# outputs TODO: probably many fixes are needed;
|
2016-05-03 09:54:49 +01:00
|
|
|
LD_LIBRARY_PATH = makeLibraryPath
|
|
|
|
[ xorg.libXrender xorg.libXext xorg.libX11 xorg.libXinerama xorg.libSM
|
2018-12-31 03:40:47 +00:00
|
|
|
xorg.libXrandr xorg.libXxf86vm xorg.xorgproto xorg.imake xorg.libICE
|
2019-11-10 16:44:34 +00:00
|
|
|
libGLU libGL
|
2016-05-03 09:54:49 +01:00
|
|
|
fontconfig
|
|
|
|
freetype
|
|
|
|
stdenv.cc.cc
|
2010-05-18 20:36:55 +01:00
|
|
|
];
|
|
|
|
|
2013-08-22 11:00:23 +01: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-05-03 09:54:49 +01:00
|
|
|
extraDRIlibs = [ xorg.libXrandr.out xorg.libXrender.out xorg.libXext.out
|
2016-05-20 12:05:41 +01:00
|
|
|
xorg.libX11.out xorg.libXinerama.out xorg.libSM.out
|
2016-05-03 09:54:49 +01:00
|
|
|
xorg.libICE.out ];
|
2016-01-20 19:51:52 +00:00
|
|
|
|
2019-11-10 16:44:34 +00:00
|
|
|
inherit libGLU libGL; # only required to build the examples
|
2016-01-20 19:51:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2010-05-18 20:36:55 +01:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2016-01-20 19:51:52 +00:00
|
|
|
description = "ATI Catalyst display drivers";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://support.amd.com/us/gpudownload/Pages/index.aspx";
|
2014-01-22 09:57:43 +00:00
|
|
|
license = licenses.unfree;
|
2019-03-12 22:45:33 +00:00
|
|
|
maintainers = with maintainers; [ marcweber offline jerith666 ];
|
2014-09-06 05:17:00 +01: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 20:36:55 +01:00
|
|
|
};
|
2016-01-20 19:51:52 +00:00
|
|
|
|
2010-05-18 20:36:55 +01:00
|
|
|
}
|