nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 20.09 54 lines 2.0 kB view raw
1{ stdenv, lib, fetchFromGitHub, fetchpatch, autoreconfHook, python3, pkgconfig, libX11, libXext, xorgproto, addOpenGLRunpath }: 2 3stdenv.mkDerivation rec { 4 pname = "libglvnd"; 5 version = "1.3.2"; 6 7 src = fetchFromGitHub { 8 owner = "NVIDIA"; 9 repo = "libglvnd"; 10 rev = "v${version}"; 11 sha256 = "10x7fgb114r4gikdg6flszl3kwzcb9y5qa7sj9936mk0zxhjaylz"; 12 }; 13 14 nativeBuildInputs = [ autoreconfHook pkgconfig python3 addOpenGLRunpath ]; 15 buildInputs = [ libX11 libXext xorgproto ]; 16 17 postPatch = lib.optionalString stdenv.isDarwin '' 18 substituteInPlace src/GLX/Makefile.am \ 19 --replace "-Wl,-Bsymbolic " "" 20 substituteInPlace src/EGL/Makefile.am \ 21 --replace "-Wl,-Bsymbolic " "" 22 substituteInPlace src/GLdispatch/Makefile.am \ 23 --replace "-Xlinker --version-script=$(VERSION_SCRIPT)" "-Xlinker" 24 ''; 25 26 NIX_CFLAGS_COMPILE = toString ([ 27 "-UDEFAULT_EGL_VENDOR_CONFIG_DIRS" 28 # FHS paths are added so that non-NixOS applications can find vendor files. 29 "-DDEFAULT_EGL_VENDOR_CONFIG_DIRS=\"${addOpenGLRunpath.driverLink}/share/glvnd/egl_vendor.d:/etc/glvnd/egl_vendor.d:/usr/share/glvnd/egl_vendor.d\"" 30 31 "-Wno-error=array-bounds" 32 ] ++ lib.optional stdenv.cc.isClang "-Wno-error"); 33 34 # Indirectly: https://bugs.freedesktop.org/show_bug.cgi?id=35268 35 configureFlags = stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-tls"; 36 37 outputs = [ "out" "dev" ]; 38 39 # Set RUNPATH so that libGLX can find driver libraries in /run/opengl-driver(-32)/lib. 40 # Note that libEGL does not need it because it uses driver config files which should 41 # contain absolute paths to libraries. 42 postFixup = '' 43 addOpenGLRunpath $out/lib/libGLX.so 44 ''; 45 46 passthru = { inherit (addOpenGLRunpath) driverLink; }; 47 48 meta = with stdenv.lib; { 49 description = "The GL Vendor-Neutral Dispatch library"; 50 homepage = "https://github.com/NVIDIA/libglvnd"; 51 license = licenses.bsd2; 52 platforms = platforms.linux ++ platforms.darwin; 53 }; 54}