nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchurl,
5 pkg-config,
6 meson,
7 ninja,
8 docutils,
9 libpthreadstubs,
10 withIntel ? lib.meta.availableOn stdenv.hostPlatform libpciaccess,
11 libpciaccess,
12 withValgrind ? lib.meta.availableOn stdenv.hostPlatform valgrind-light && !stdenv.cc.isClang,
13 valgrind-light,
14 gitUpdater,
15}:
16
17stdenv.mkDerivation rec {
18 pname = "libdrm";
19 version = "2.4.131";
20
21 src = fetchurl {
22 url = "https://dri.freedesktop.org/${pname}/${pname}-${version}.tar.xz";
23 hash = "sha256-RbqZg7UciWQGo9ZU3oHTE7lTt25jkeJ5cHPVQ8X2F9U=";
24 };
25
26 outputs = [
27 "out"
28 "dev"
29 "bin"
30 ];
31
32 nativeBuildInputs = [
33 pkg-config
34 meson
35 ninja
36 docutils
37 ];
38 buildInputs = [
39 libpthreadstubs
40 ]
41 ++ lib.optional withIntel libpciaccess
42 ++ lib.optional withValgrind valgrind-light;
43
44 mesonFlags = [
45 "-Dinstall-test-programs=true"
46 "-Dcairo-tests=disabled"
47 (lib.mesonEnable "intel" withIntel)
48 (lib.mesonEnable "omap" stdenv.hostPlatform.isLinux)
49 (lib.mesonEnable "valgrind" withValgrind)
50 ]
51 ++ lib.optionals stdenv.hostPlatform.isAarch [
52 "-Dtegra=enabled"
53 ]
54 ++ lib.optionals (!stdenv.hostPlatform.isLinux) [
55 "-Detnaviv=disabled"
56 ];
57
58 passthru = {
59 updateScript = gitUpdater {
60 url = "https://gitlab.freedesktop.org/mesa/drm.git";
61 rev-prefix = "libdrm-";
62 # Skip versions like libdrm-2_0_2 that happen to go last when
63 # sorted.
64 ignoredVersions = "_";
65 };
66 };
67
68 meta = {
69 homepage = "https://gitlab.freedesktop.org/mesa/drm";
70 downloadPage = "https://dri.freedesktop.org/libdrm/";
71 description = "Direct Rendering Manager library and headers";
72 longDescription = ''
73 A userspace library for accessing the DRM (Direct Rendering Manager) on
74 Linux, BSD and other operating systems that support the ioctl interface.
75 The library provides wrapper functions for the ioctls to avoid exposing
76 the kernel interface directly, and for chipsets with drm memory manager,
77 support for tracking relocations and buffers.
78 New functionality in the kernel DRM drivers typically requires a new
79 libdrm, but a new libdrm will always work with an older kernel.
80
81 libdrm is a low-level library, typically used by graphics drivers such as
82 the Mesa drivers, the X drivers, libva and similar projects.
83 '';
84 license = lib.licenses.mit;
85 platforms = lib.subtractLists lib.platforms.darwin lib.platforms.unix;
86 maintainers = [ ];
87 };
88}