···13131414eval "$patchPhase"
15151616+case "$system" in
1717+ x86_64-linux)
1818+ arch=x86_64
1919+ lib_arch=lib64
2020+ DIR_DEPENDING_ON_XORG_VERSION=xpic_64a
2121+ ;;
2222+ i686-linux)
2323+ arch=x86
2424+ lib_arch=lib
2525+ DIR_DEPENDING_ON_XORG_VERSION=xpic
2626+ ;;
2727+ *) exit 1;;
2828+esac
2929+3030+if test -z "$libsOnly"; then
1631kernelVersion=$(cd ${kernel}/lib/modules && ls)
1732kernelBuild=$(echo ${kernel}/lib/modules/$kernelVersion/build)
1833linuxsources=$(echo ${kernel}/lib/modules/$kernelVersion/source)
···105120setModVersions
106121CC=gcc
107122MODULE=fglrx
108108-case "$system" in
109109- x86_64-linux)
110110- arch=x86_64
111111- lib_arch=lib64
112112- ;;
113113- i686-linux)
114114- arch=x86
115115- lib_arch=lib
116116- ;;
117117- *) exit 1;;
118118-esac
119123LIBIP_PREFIX=$TMP/arch/$arch/lib/modules/fglrx/build_mod
120124[ -d $LIBIP_PREFIX ]
121125GCC_MAJOR="`gcc --version | grep -o -e ") ." | head -1 | cut -d " " -f 2`"
···138142 cd $TMP
139143}
140144145145+fi
146146+141147{ # install
142148143149 mkdir -p $out/lib/xorg
···152158 # what are those files used for?
153159 cp -r common/etc $out
154160155155- DIR_DEPENDING_ON_XORG_VERSION=xpic_64a
156161 cp -r $DIR_DEPENDING_ON_XORG_VERSION/usr/X11R6/$lib_arch/* $out/lib/xorg
157162163163+ # install kernel module
164164+ if test -z "$libsOnly"; then
158165 t=$out/lib/modules/${kernelVersion}/kernel/drivers/misc
159166 mkdir -p $t
160167161168 cp ./common/lib/modules/fglrx/build_mod/2.6.x/fglrx.ko $t
169169+ fi
162170163171 # should this be installed at all?
164172 # its used by the example fglrx_gamma only
···185193 patchelf --set-rpath $gcc/$lib_arch $out/lib/libatiadlxx.so
186194}
187195196196+if test -z "$libsOnly"; then
197197+188198{ # build samples
189199 mkdir -p $out/bin
190200···228238 rm -fr $out/lib/modules/fglrx # don't think those .a files are needed. They cause failure of the mod
229239230240}
241241+242242+fi
231243232244for p in $extraDRIlibs; do
233245 for lib in $p/lib/*.so*; do
+13-13
pkgs/os-specific/linux/ati-drivers/default.nix
···11-{ stdenv, fetchurl, kernel, xlibs, which, imake
11+{ stdenv, fetchurl, kernel ? null, xlibs, which, imake
22, mesa # for fgl_glxgears
33, libXxf86vm, xf86vidmodeproto # for fglrx_gamma
44, xorg, makeWrapper, glibc, patchelf
55, unzip
66+, # Whether to build the libraries only (i.e. not the kernel module or
77+ # driver utils). Used to support 32-bit binaries on 64-bit
88+ # Linux.
99+ libsOnly ? false
610}:
7111212+assert (!libsOnly) -> kernel != null;
1313+814# If you want to use a different Xorg version probably
915# DIR_DEPENDING_ON_XORG_VERSION in builder.sh has to be adopted (?)
1016# make sure libglx.so of ati is used. xorg.xorgserver does provide it as well
···2127# There is one issue left:
2228# /usr/lib/dri/fglrx_dri.so must point to /run/opengl-driver/lib/fglrx_dri.so
23292424-assert stdenv.system == "x86_64-linux";
3030+with stdenv.lib;
25312632stdenv.mkDerivation {
2727- name = "ati-drivers-14.4-${kernel.version}";
3333+ name = "ati-drivers-14.4" + (optionalString (!libsOnly) "-${kernel.version}");
28342935 builder = ./builder.sh;
3036···4955 mesa
5056 ];
51575252- kernel = kernel.dev;
5858+ inherit libsOnly;
5959+6060+ kernel = if libsOnly then null else kernel.dev;
53615462 inherit glibc /* glibc only used for setting interpreter */;
5563···7381 homepage = http://support.amd.com/us/gpudownload/Pages/index.aspx;
7482 license = licenses.unfree;
7583 maintainers = with maintainers; [marcweber offline];
7676- platforms = [ "x86_64-linux" ];
8484+ platforms = platforms.linux;
7785 hydraPlatforms = [];
7886 };
7979-8080- # moved assertions here because the name is evaluated when the NixOS manual is generated
8181- # Don't make that fail - fail lazily when a users tries to build this derivation only
8282- dummy =
8383- # assert xorg.xorgserver.name == "xorg-server-1.7.5";
8484- assert stdenv.system == "x86_64-linux"; # i686-linux should work as well - however I didn't test it.
8585- null;
8686-8787}