From 254ff60f2799913411afc8436c5bf104608fa363 Mon Sep 17 00:00:00 2001 From: Daniel Perry Date: Fri, 10 Mar 2023 15:10:10 -0500 Subject: [PATCH] recastnavigation: fix for darwin build break Building on Darwin resulted in an error with not being able to find SDL header files. Looking through the remote repository code, it looks like it expects the SDL2.framework layout and not the Linux-style include directory layout. The main difference between these two layouts is whether or not the SDL header files are contained within a `SDL2` subdirectory. In the .framework file, the header files are located at `Headers/SDL_*.h`. On Linux, the headers are located under `include/SDL2/SDL_*.h`. When Nix builds SDL on Darwin, the output is in the Linux-style layout, while the recastnavigation CMakeLists.txt is expecting things to be in the .framework layout. The fix I made was to change the Darwin-specific `include_directories` directive which points to the Headers directory to instead point to the headers from the Nix store. --- pkgs/development/libraries/recastnavigation/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/recastnavigation/default.nix b/pkgs/development/libraries/recastnavigation/default.nix index 9920838aaba..8e0fe7947f4 100644 --- a/pkgs/development/libraries/recastnavigation/default.nix +++ b/pkgs/development/libraries/recastnavigation/default.nix @@ -20,6 +20,11 @@ stdenv.mkDerivation rec { substituteInPlace CMakeLists.txt \ --replace '\$'{exec_prefix}/'$'{CMAKE_INSTALL_LIBDIR} '$'{CMAKE_INSTALL_FULL_LIBDIR} \ --replace '\$'{prefix}/'$'{CMAKE_INSTALL_INCLUDEDIR} '$'{CMAKE_INSTALL_FULL_INCLUDEDIR} + '' + lib.optionalString stdenv.hostPlatform.isDarwin '' + # Expects SDL2.framework in specific location, which we don't have + # Change where SDL2 headers are searched for to match what we do have + substituteInPlace RecastDemo/CMakeLists.txt \ + --replace 'include_directories(''${SDL2_LIBRARY}/Headers)' 'include_directories(${SDL2.dev}/include/SDL2)' ''; doCheck = true; @@ -29,7 +34,6 @@ stdenv.mkDerivation rec { buildInputs = [ libGL SDL2 libGLU ]; meta = with lib; { - broken = stdenv.isDarwin; homepage = "https://github.com/recastnavigation/recastnavigation"; description = "Navigation-mesh Toolset for Games"; license = licenses.zlib;