diff --git a/pkgs/os-specific/linux/ati-drivers/builder.sh b/pkgs/os-specific/linux/ati-drivers/builder.sh index 844f30e0c60d..4394e785960a 100644 --- a/pkgs/os-specific/linux/ati-drivers/builder.sh +++ b/pkgs/os-specific/linux/ati-drivers/builder.sh @@ -1,4 +1,3 @@ -# What is LIBGL_DRIVERS_PATH used for? # TODO gentoo removes some tools because there are xorg sources (?) source $stdenv/setup @@ -6,15 +5,10 @@ set -x die(){ echo $@; exit 1; } -mkdir fglrx # custom unpack: -cd fglrx unzip $src -cd .. -run_file=$(echo fglrx/amd-driver-installer-*) +run_file=fglrx-$build/amd-driver-installer-$build-x86.x86_64.run sh $run_file --extract . -eval "$patchPhase1" - case "$system" in x86_64-linux) arch=x86_64 @@ -33,9 +27,9 @@ esac if test -z "$libsOnly"; then - kernelVersion=$(cd ${kernel}/lib/modules && ls) - kernelBuild=$(echo ${kernel}/lib/modules/$kernelVersion/build) - linuxsources=$(echo ${kernel}/lib/modules/$kernelVersion/source) + kernelVersion=$(cd ${kernelDir}/lib/modules && ls) + kernelBuild=$(echo ${kernelDir}/lib/modules/$kernelVersion/build) + linuxsources=$(echo ${kernelDir}/lib/modules/$kernelVersion/source) # note: maybe the .config file should be used to determine this ? # current kbuild infrastructure allows using CONFIG_* defines @@ -231,7 +225,7 @@ fi fglrx_dri.so \ libaticaldd.so do - patchelf --set-rpath $gcc/$lib_arch/ $out/lib/$pelib2 + patchelf --set-rpath $glibcDir/lib/:$libStdCxx/lib/ $out/lib/$pelib2 done } @@ -245,12 +239,12 @@ if test -z "$libsOnly"; then eval "$patchPhaseSamples" ( # build and install fgl_glxgears - cd fgl_glxgears; + cd fgl_glxgears; gcc -DGL_ARB_texture_multisample=1 -g \ -I$mesa/include \ -I$out/include \ -L$mesa/lib -lGL -lGLU -lX11 -lm \ - -o $out/bin/fgl_glxgears -Wall fgl_glxgears.c + -o $out/bin/fgl_glxgears -Wall fgl_glxgears.c ) true || ( # build and install @@ -267,12 +261,12 @@ if test -z "$libsOnly"; then -I${xf86vidmodeproto}/include \ -I$out/X11R6/include \ -L$out/lib \ - -Wall -lm -lfglrx_gamma -lX11 -lXext -o $out/bin/fglrx_xgamma fglrx_xgamma.c + -Wall -lm -lfglrx_gamma -lX11 -lXext -o $out/bin/fglrx_xgamma fglrx_xgamma.c ) { # patch and copy statically linked qt libs used by amdcccle - patchelf --set-interpreter $(echo $glibc/lib/ld-linux*.so.2) $TMP/arch/$arch/usr/share/ati/$lib_arch/libQtCore.so.4 && + patchelf --set-interpreter $(echo $glibcDir/lib/ld-linux*.so.2) $TMP/arch/$arch/usr/share/ati/$lib_arch/libQtCore.so.4 && patchelf --set-rpath $gcc/$lib_arch/ $TMP/arch/$arch/usr/share/ati/$lib_arch/libQtCore.so.4 && patchelf --set-rpath $gcc/$lib_arch/:$out/share/ati/:$libXrender/lib/:$libSM/lib/:$libICE/lib/:$libfontconfig/lib/:$libfreetype/lib/ $TMP/arch/$arch/usr/share/ati/$lib_arch/libQtGui.so.4 && mkdir -p $out/share/ati @@ -285,7 +279,7 @@ if test -z "$libsOnly"; then patchelf --shrink-rpath $BIN/amdcccle for prog in $BIN/*; do cp -f $prog $out/bin && - patchelf --set-interpreter $(echo $glibc/lib/ld-linux*.so.2) $out/bin/$(basename $prog) && + patchelf --set-interpreter $(echo $glibcDir/lib/ld-linux*.so.2) $out/bin/$(basename $prog) && wrapProgram $out/bin/$(basename $prog) --prefix LD_LIBRARY_PATH : $out/lib/:$gcc/lib/:$out/share/ati/:$libXinerama/lib/:$libXrandr/lib/:$libfontconfig/lib/:$libfreetype/lib/:$LD_LIBRARY_PATH done } diff --git a/pkgs/os-specific/linux/ati-drivers/default.nix b/pkgs/os-specific/linux/ati-drivers/default.nix index 78903da1f1a1..a4f8b707c084 100644 --- a/pkgs/os-specific/linux/ati-drivers/default.nix +++ b/pkgs/os-specific/linux/ati-drivers/default.nix @@ -11,10 +11,6 @@ assert (!libsOnly) -> kernel != null; 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 @@ -31,11 +27,14 @@ in # http://wiki.cchtml.com/index.php/Main_Page -# # /usr/lib/dri/fglrx_dri.so must point to /run/opengl-driver/lib/fglrx_dri.so # This is done in the builder script. -stdenv.mkDerivation { +stdenv.mkDerivation rec { + + version = "15.12"; + pname = "ati-drivers"; + build = "15.302"; linuxonly = if stdenv.system == "i686-linux" then @@ -44,7 +43,7 @@ stdenv.mkDerivation { true else throw "ati-drivers are Linux only. Sorry. The build was stopped."; - name = "ati-drivers-${version}" + (optionalString (!libsOnly) "-${kernel.version}"); + name = pname + "-" + version + (optionalString (!libsOnly) "-${kernelDir.version}"); builder = ./builder.sh; gcc = stdenv.cc.cc; @@ -57,15 +56,16 @@ stdenv.mkDerivation { libICE = xorg.libICE; libfreetype = freetype; libfontconfig = fontconfig; + libStdCxx = stdenv.cc.cc.lib; src = fetchurl { - url = "http://www2.ati.com/drivers/linux/amd-driver-installer-15.20.1046-x86.x86_64.zip"; - sha256 = "ffde64203f49d9288eaa25f4d744187b6f4f14a87a444bab6a001d822b327a9d"; - curlOpts = "--referer http://support.amd.com/en-us/download/desktop?os=Linux%20x86_64"; + url = + "https://www2.ati.com/drivers/linux/radeon-crimson-15.12-15.302-151217a-297685e.zip"; + sha256 = "0n0ynqmjkjp5dl5q07as7ps3rlyyn63hq4mlwgd7c7v82ky2skvh"; + curlOpts = "--referer http://support.amd.com/en-us/download/desktop?os=Linux+x86_64"; }; patchPhaseSamples = "patch -p2 < ${./patch-samples.patch}"; - patchPhase1 = "patch -p1 < ${./kernel-api-fixes.patch}"; buildInputs = [ xorg.libXrender xorg.libXext xorg.libX11 xorg.libXinerama xorg.libSM @@ -81,28 +81,28 @@ stdenv.mkDerivation { inherit libsOnly; - kernel = if libsOnly then null else kernel.dev; + kernelDir = if libsOnly then null else kernel.dev; - inherit glibc /* glibc only used for setting interpreter */; + # glibc only used for setting the binaries interpreter + glibcDir = glibc.out; # outputs TODO: probably many fixes are needed; - # this in particular would be much better by lib.makeLibraryPath - LD_LIBRARY_PATH = stdenv.lib.concatStringsSep ":" - [ "${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/" + LD_LIBRARY_PATH = makeLibraryPath + [ xorg.libXrender xorg.libXext xorg.libX11 xorg.libXinerama xorg.libSM + xorg.libXrandr xorg.libXxf86vm xorg.xf86vidmodeproto xorg.imake xorg.libICE + mesa + fontconfig + freetype + stdenv.cc.cc ]; # 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 - extraDRIlibs = [ xorg.libXrandr xorg.libXrender xorg.libXext xorg.libX11 xorg.libXinerama xorg.libSM xorg.libICE ]; + extraDRIlibs = [ xorg.libXrandr.out xorg.libXrender.out xorg.libXext.out + xorg.libX11.out xorg.libXinerama.out xorg.libSM.out + xorg.libICE.out ]; inherit mesa; # only required to build the examples @@ -119,6 +119,4 @@ stdenv.mkDerivation { priority = 4; }; - - }