nixpkgs/pkgs/development/libraries/libdrm/default.nix
Shea Levy e309c50e7e Get libdrm to compile on darwin
The added patch uses mach_absolute_time() to get a nanosecond-resolution monotonic clock on darwin systems (See http://developer.apple.com/library/mac/#qa/qa1398/_index.html for an understanding of the added code). In addition, the patch changes one use of clock_gettime to gettimeofday since only resolution of a second is needed at that point. This code compiles on darwin, but the resulting library is not yet tested.

svn path=/nixpkgs/trunk/; revision=28879
2011-08-29 18:55:37 +00:00

28 lines
864 B
Nix

{stdenv, fetchurl, pkgconfig, libpthreadstubs}:
stdenv.mkDerivation (rec {
name = "libdrm-2.4.24";
src = fetchurl {
url = "http://dri.freedesktop.org/libdrm/${name}.tar.bz2";
sha256 = "19dnzy7g6jqfjz38dp187b97vb4a8h4k748x56gsyn24ys0j60f7";
};
buildInputs = [ pkgconfig libpthreadstubs ];
patches = [ ./libdrm-apple.patch ];
preConfigure = ''
# General case: non intel.
if test -n "$crossConfig"; then
configureFlags="$configureFlags --disable-intel";
fi
'' + stdenv.lib.optionalString stdenv.isDarwin
"echo : \\\${ac_cv_func_clock_gettime=\'yes\'} > config.cache";
meta = {
homepage = http://dri.freedesktop.org/libdrm/;
description = "Library for accessing the kernel's Direct Rendering Manager";
license = "bsd";
};
} // (stdenv.lib.optionalAttrs stdenv.isDarwin { configureFlags = [ "-C" ]; }))