at 23.05-pre 74 lines 1.7 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, meson 5, ninja 6, pkg-config 7, utilmacros 8, python3 9, libGL 10, libX11 11, Carbon 12, OpenGL 13, x11Support ? !stdenv.isDarwin 14}: 15 16let 17 inherit (lib) getLib optional optionalString; 18 19in 20stdenv.mkDerivation rec { 21 pname = "libepoxy"; 22 version = "1.5.10"; 23 24 src = fetchFromGitHub { 25 owner = "anholt"; 26 repo = pname; 27 rev = version; 28 sha256 = "sha256-gZiyPOW2PeTMILcPiUTqPUGRNlMM5mI1z9563v4SgEs="; 29 }; 30 31 patches = [ ./libgl-path.patch ]; 32 33 postPatch = '' 34 patchShebangs src/*.py 35 '' 36 + optionalString stdenv.isDarwin '' 37 substituteInPlace src/dispatch_common.h --replace "PLATFORM_HAS_GLX 0" "PLATFORM_HAS_GLX 1" 38 ''; 39 40 outputs = [ "out" "dev" ]; 41 42 nativeBuildInputs = [ meson ninja pkg-config utilmacros python3 ]; 43 44 buildInputs = lib.optionals x11Support [ 45 libGL 46 libX11 47 ] ++ lib.optionals stdenv.isDarwin [ 48 Carbon 49 OpenGL 50 ]; 51 52 mesonFlags = [ 53 "-Dtests=${if doCheck then "true" else "false"}" 54 "-Dglx=${if x11Support then "yes" else "no"}" 55 ]; 56 57 NIX_CFLAGS_COMPILE = lib.optionalString x11Support ''-DLIBGL_PATH="${getLib libGL}/lib"''; 58 59 # cgl_epoxy_api fails in darwin sandbox and on Hydra (because it's headless?) 60 preCheck = lib.optionalString stdenv.isDarwin '' 61 substituteInPlace ../test/meson.build \ 62 --replace "[ 'cgl_epoxy_api', [ 'cgl_epoxy_api.c' ] ]," "" 63 ''; 64 65 doCheck = true; 66 67 meta = with lib; { 68 description = "A library for handling OpenGL function pointer management"; 69 homepage = "https://github.com/anholt/libepoxy"; 70 license = licenses.mit; 71 maintainers = with maintainers; [ goibhniu erictapen ]; 72 platforms = platforms.unix; 73 }; 74}