at 23.11-beta 76 lines 3.0 kB view raw
1{ stdenv, lib, fetchFromGitLab 2, autoreconfHook, pkg-config, python3, addOpenGLRunpath 3, libX11, libXext, xorgproto 4}: 5 6stdenv.mkDerivation rec { 7 pname = "libglvnd"; 8 version = "1.7.0"; 9 10 src = fetchFromGitLab { 11 domain = "gitlab.freedesktop.org"; 12 owner = "glvnd"; 13 repo = "libglvnd"; 14 rev = "v${version}"; 15 sha256 = "sha256-2U9JtpGyP4lbxtVJeP5GUgh5XthloPvFIw28+nldYx8="; 16 }; 17 18 nativeBuildInputs = [ autoreconfHook pkg-config python3 addOpenGLRunpath ]; 19 buildInputs = [ libX11 libXext xorgproto ]; 20 21 postPatch = lib.optionalString stdenv.isDarwin '' 22 substituteInPlace src/GLX/Makefile.am \ 23 --replace "-Wl,-Bsymbolic " "" 24 substituteInPlace src/EGL/Makefile.am \ 25 --replace "-Wl,-Bsymbolic " "" 26 substituteInPlace src/GLdispatch/Makefile.am \ 27 --replace "-Xlinker --version-script=$(VERSION_SCRIPT)" "-Xlinker" 28 ''; 29 30 env.NIX_CFLAGS_COMPILE = toString ([ 31 "-UDEFAULT_EGL_VENDOR_CONFIG_DIRS" 32 # FHS paths are added so that non-NixOS applications can find vendor files. 33 "-DDEFAULT_EGL_VENDOR_CONFIG_DIRS=\"${addOpenGLRunpath.driverLink}/share/glvnd/egl_vendor.d:/etc/glvnd/egl_vendor.d:/usr/share/glvnd/egl_vendor.d\"" 34 35 "-Wno-error=array-bounds" 36 ] ++ lib.optionals stdenv.cc.isClang [ 37 "-Wno-error" 38 "-Wno-int-conversion" 39 ]); 40 41 configureFlags = [] 42 # Indirectly: https://bugs.freedesktop.org/show_bug.cgi?id=35268 43 ++ lib.optional stdenv.hostPlatform.isMusl "--disable-tls" 44 # Remove when aarch64-darwin asm support is upstream: https://gitlab.freedesktop.org/glvnd/libglvnd/-/issues/216 45 ++ lib.optional (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) "--disable-asm"; 46 47 outputs = [ "out" "dev" ]; 48 49 # Set RUNPATH so that libGLX can find driver libraries in /run/opengl-driver(-32)/lib. 50 # Note that libEGL does not need it because it uses driver config files which should 51 # contain absolute paths to libraries. 52 postFixup = '' 53 addOpenGLRunpath $out/lib/libGLX.so 54 ''; 55 56 passthru = { inherit (addOpenGLRunpath) driverLink; }; 57 58 meta = with lib; { 59 description = "The GL Vendor-Neutral Dispatch library"; 60 longDescription = '' 61 libglvnd is a vendor-neutral dispatch layer for arbitrating OpenGL API 62 calls between multiple vendors. It allows multiple drivers from different 63 vendors to coexist on the same filesystem, and determines which vendor to 64 dispatch each API call to at runtime. 65 Both GLX and EGL are supported, in any combination with OpenGL and OpenGL ES. 66 ''; 67 inherit (src.meta) homepage; 68 # https://gitlab.freedesktop.org/glvnd/libglvnd#libglvnd: 69 changelog = "https://gitlab.freedesktop.org/glvnd/libglvnd/-/tags/v${version}"; 70 license = with licenses; [ mit bsd1 bsd3 gpl3Only asl20 ]; 71 platforms = platforms.unix; 72 # https://gitlab.freedesktop.org/glvnd/libglvnd/-/issues/212 73 badPlatforms = [ lib.systems.inspect.platformPatterns.isStatic ]; 74 maintainers = with maintainers; [ primeos ]; 75 }; 76}