2021-11-08 07:28:18 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, meson
|
|
|
|
, ninja
|
|
|
|
, pkg-config
|
|
|
|
, utilmacros
|
|
|
|
, python3
|
|
|
|
, libGL
|
|
|
|
, libX11
|
2021-12-08 08:54:15 +00:00
|
|
|
, Carbon
|
|
|
|
, OpenGL
|
2021-12-31 20:39:01 +00:00
|
|
|
, x11Support ? !stdenv.isDarwin
|
2014-07-27 10:14:38 +00:00
|
|
|
}:
|
|
|
|
|
2021-12-12 04:49:24 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2021-11-11 04:35:34 +00:00
|
|
|
pname = "libepoxy";
|
2022-03-19 16:00:46 +00:00
|
|
|
version = "1.5.10";
|
2014-07-27 10:14:38 +00:00
|
|
|
|
2015-08-13 22:00:18 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "anholt";
|
2021-11-11 04:35:34 +00:00
|
|
|
repo = pname;
|
2019-09-08 23:38:31 +00:00
|
|
|
rev = version;
|
2022-03-19 16:00:46 +00:00
|
|
|
sha256 = "sha256-gZiyPOW2PeTMILcPiUTqPUGRNlMM5mI1z9563v4SgEs=";
|
2014-07-27 10:14:38 +00:00
|
|
|
};
|
|
|
|
|
2021-11-08 07:28:18 +00:00
|
|
|
patches = [ ./libgl-path.patch ];
|
2014-07-27 10:14:38 +00:00
|
|
|
|
2021-11-08 07:28:18 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs src/*.py
|
|
|
|
''
|
2023-06-29 14:32:02 +00:00
|
|
|
+ lib.optionalString stdenv.isDarwin ''
|
2015-10-27 07:38:00 +00:00
|
|
|
substituteInPlace src/dispatch_common.h --replace "PLATFORM_HAS_GLX 0" "PLATFORM_HAS_GLX 1"
|
|
|
|
'';
|
|
|
|
|
2021-11-08 07:28:18 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ meson ninja pkg-config utilmacros python3 ];
|
|
|
|
|
2023-06-29 14:32:02 +00:00
|
|
|
buildInputs = lib.optionals (x11Support && !stdenv.isDarwin) [
|
2021-12-08 08:54:15 +00:00
|
|
|
libGL
|
2023-06-29 14:32:02 +00:00
|
|
|
] ++ lib.optionals x11Support [
|
2021-12-08 08:54:15 +00:00
|
|
|
libX11
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
Carbon
|
|
|
|
OpenGL
|
|
|
|
];
|
2021-11-08 07:28:18 +00:00
|
|
|
|
|
|
|
mesonFlags = [
|
2023-03-26 11:19:56 +00:00
|
|
|
"-Degl=${if (x11Support && !stdenv.isDarwin) then "yes" else "no"}"
|
2021-12-31 20:39:01 +00:00
|
|
|
"-Dglx=${if x11Support then "yes" else "no"}"
|
2023-01-24 17:43:30 +00:00
|
|
|
"-Dtests=${lib.boolToString doCheck}"
|
|
|
|
"-Dx11=${lib.boolToString x11Support}"
|
2021-12-31 20:39:01 +00:00
|
|
|
];
|
2018-03-29 12:47:07 +00:00
|
|
|
|
2023-06-29 14:32:02 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = lib.optionalString (x11Support && !stdenv.isDarwin) ''-DLIBGL_PATH="${lib.getLib libGL}/lib"'';
|
2018-02-22 08:52:28 +00:00
|
|
|
|
2023-01-15 19:14:14 +00:00
|
|
|
# cgl_core and cgl_epoxy_api fail in darwin sandbox and on Hydra (because it's headless?)
|
2021-12-12 04:49:24 +00:00
|
|
|
preCheck = lib.optionalString stdenv.isDarwin ''
|
|
|
|
substituteInPlace ../test/meson.build \
|
|
|
|
--replace "[ 'cgl_epoxy_api', [ 'cgl_epoxy_api.c' ] ]," ""
|
2023-01-15 19:14:14 +00:00
|
|
|
'' + lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
|
|
|
|
substituteInPlace ../test/meson.build \
|
|
|
|
--replace "[ 'cgl_core', [ 'cgl_core.c' ] ]," ""
|
2021-12-12 04:49:24 +00:00
|
|
|
'';
|
|
|
|
|
2021-11-08 07:28:18 +00:00
|
|
|
doCheck = true;
|
2018-04-25 03:20:18 +00:00
|
|
|
|
2021-11-08 07:28:18 +00:00
|
|
|
meta = with lib; {
|
2014-07-27 10:14:38 +00:00
|
|
|
description = "A library for handling OpenGL function pointer management";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/anholt/libepoxy";
|
2014-07-27 10:14:38 +00:00
|
|
|
license = licenses.mit;
|
2023-04-03 15:07:16 +00:00
|
|
|
maintainers = with maintainers; [ goibhniu ];
|
2015-05-23 00:04:06 +00:00
|
|
|
platforms = platforms.unix;
|
2014-07-27 10:14:38 +00:00
|
|
|
};
|
2021-12-12 04:49:24 +00:00
|
|
|
}
|