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