Merge pull request #240547 from wegank/libepoxy-x11-darwin

libepoxy: fix x11 support on darwin
This commit is contained in:
Weijia Wang 2023-06-30 09:39:38 +03:00 committed by GitHub
commit 4fe6f7cc75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,10 +13,6 @@
, x11Support ? !stdenv.isDarwin
}:
let
inherit (lib) getLib optional optionalString;
in
stdenv.mkDerivation rec {
pname = "libepoxy";
version = "1.5.10";
@ -33,7 +29,7 @@ stdenv.mkDerivation rec {
postPatch = ''
patchShebangs src/*.py
''
+ optionalString stdenv.isDarwin ''
+ lib.optionalString stdenv.isDarwin ''
substituteInPlace src/dispatch_common.h --replace "PLATFORM_HAS_GLX 0" "PLATFORM_HAS_GLX 1"
'';
@ -41,8 +37,9 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ meson ninja pkg-config utilmacros python3 ];
buildInputs = lib.optionals x11Support [
buildInputs = lib.optionals (x11Support && !stdenv.isDarwin) [
libGL
] ++ lib.optionals x11Support [
libX11
] ++ lib.optionals stdenv.isDarwin [
Carbon
@ -56,7 +53,7 @@ stdenv.mkDerivation rec {
"-Dx11=${lib.boolToString x11Support}"
];
env.NIX_CFLAGS_COMPILE = lib.optionalString x11Support ''-DLIBGL_PATH="${getLib libGL}/lib"'';
env.NIX_CFLAGS_COMPILE = lib.optionalString (x11Support && !stdenv.isDarwin) ''-DLIBGL_PATH="${lib.getLib libGL}/lib"'';
# cgl_core and cgl_epoxy_api fail in darwin sandbox and on Hydra (because it's headless?)
preCheck = lib.optionalString stdenv.isDarwin ''