summary refs log tree commit diff
diff options
context:
space:
mode:
authorBasile Henry <bjm.henry@gmail.com>2023-07-16 21:43:43 +0200
committerBasile Henry <bjm.henry@gmail.com>2023-07-20 21:07:23 +0200
commit6fc1dc08de8e63188888cb0dff0b28c53886181d (patch)
tree3effd95927716072273be813c6241168c0eebe91
parent2014e8cad073d7c82d9b7681fa7dc8f8204f9ada (diff)
downloadnixpkgs-6fc1dc08de8e63188888cb0dff0b28c53886181d.tar
nixpkgs-6fc1dc08de8e63188888cb0dff0b28c53886181d.tar.gz
nixpkgs-6fc1dc08de8e63188888cb0dff0b28c53886181d.tar.bz2
nixpkgs-6fc1dc08de8e63188888cb0dff0b28c53886181d.tar.lz
nixpkgs-6fc1dc08de8e63188888cb0dff0b28c53886181d.tar.xz
nixpkgs-6fc1dc08de8e63188888cb0dff0b28c53886181d.tar.zst
nixpkgs-6fc1dc08de8e63188888cb0dff0b28c53886181d.zip
raylib: Fix audio
When upgrading from `4.2.0` to `4.5.0` in #243155 the audio fix was
removed. This fix didn't apply properly any more, because the `cmake`
build in `4.5.0` is producing shared objects with the wrong version in
the name.

The commit https://github.com/raysan5/raylib/commit/0d4db7ad7f6fd442ed165ebf8ab8b3f4033b04e7
which fixes the versioning issue does not appear to have made it into
the `4.5.0` tag.

Removing the audio fix did actually makes the project compile, however
when running games built against `raylib`, no audio device was found.
-rw-r--r--pkgs/development/libraries/raylib/default.nix15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkgs/development/libraries/raylib/default.nix b/pkgs/development/libraries/raylib/default.nix
index 7dbd272e436..5af34139f93 100644
--- a/pkgs/development/libraries/raylib/default.nix
+++ b/pkgs/development/libraries/raylib/default.nix
@@ -37,6 +37,21 @@ stdenv.mkDerivation (finalAttrs: {
 
   passthru.tests = [ raylib-games ];
 
+  patches = [
+    # Patch version in CMakeList to 4.5.0
+    # Remove this when updating to a new revision
+    (fetchpatch {
+      url = "https://github.com/raysan5/raylib/commit/0d4db7ad7f6fd442ed165ebf8ab8b3f4033b04e7.patch";
+      hash = "sha256-RGokbQAwJAZm2FU2VNwraE3xko8E+RLLFjUfDRXeKhA=";
+    })
+  ];
+
+  # fix libasound.so/libpulse.so not being found
+  preFixup = ''
+    ${lib.optionalString alsaSupport "patchelf --add-needed ${alsa-lib}/lib/libasound.so $out/lib/libraylib.so.${finalAttrs.version}"}
+    ${lib.optionalString pulseSupport "patchelf --add-needed ${libpulseaudio}/lib/libpulse.so $out/lib/libraylib.so.${finalAttrs.version}"}
+  '';
+
   meta = with lib; {
     description = "A simple and easy-to-use library to enjoy videogames programming";
     homepage = "https://www.raylib.com/";