about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/openal-soft
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/openal-soft')
-rw-r--r--nixpkgs/pkgs/development/libraries/openal-soft/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/openal-soft/search-out.patch12
2 files changed, 58 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/openal-soft/default.nix b/nixpkgs/pkgs/development/libraries/openal-soft/default.nix
new file mode 100644
index 000000000000..d2cdebdf3553
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openal-soft/default.nix
@@ -0,0 +1,46 @@
+{ lib, stdenv, fetchFromGitHub, cmake
+, alsaSupport ? !stdenv.isDarwin, alsa-lib
+, pulseSupport ? !stdenv.isDarwin, libpulseaudio
+, CoreServices, AudioUnit, AudioToolbox
+}:
+
+stdenv.mkDerivation rec {
+  pname = "openal-soft";
+  version = "1.21.1";
+
+  src = fetchFromGitHub {
+    owner = "kcat";
+    repo = "openal-soft";
+    rev = version;
+    sha256 = "sha256-rgc6kjXaZb6sCR+e9Gu7BEEHIiCHMygpLIeSqgWkuAg=";
+  };
+
+  # this will make it find its own data files (e.g. HRTF profiles)
+  # without any other configuration
+  patches = [ ./search-out.patch ];
+  postPatch = ''
+    substituteInPlace alc/helpers.cpp \
+      --replace "@OUT@" $out
+  '';
+
+  strictDeps = true;
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) stdenv.cc.libc
+    ++ lib.optional alsaSupport alsa-lib
+    ++ lib.optional pulseSupport libpulseaudio
+    ++ lib.optionals stdenv.isDarwin [ CoreServices AudioUnit AudioToolbox ];
+
+  NIX_LDFLAGS = toString (
+    lib.optional alsaSupport "-lasound"
+    ++ lib.optional pulseSupport "-lpulse");
+
+  meta = with lib; {
+    description = "OpenAL alternative";
+    homepage = "https://kcat.strangesoft.net/openal.html";
+    license = licenses.lgpl2;
+    maintainers = with maintainers; [ftrvxmtrx];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openal-soft/search-out.patch b/nixpkgs/pkgs/development/libraries/openal-soft/search-out.patch
new file mode 100644
index 000000000000..796642aa3c89
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openal-soft/search-out.patch
@@ -0,0 +1,12 @@
+diff --git a/alc/helpers.cpp b/alc/helpers.cpp
+index 8c1c856..19bbc0f 100644
+--- a/alc/helpers.cpp
++++ b/alc/helpers.cpp
+@@ -402,6 +402,7 @@ al::vector<std::string> SearchDataFiles(const char *ext, const char *subdir)
+ 
+         DirectorySearch(path.c_str(), ext, &results);
+     }
++    DirectorySearch("@OUT@/share/", ext, &results);
+ 
+     return results;
+ }