2022-10-21 18:38:19 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, removeReferencesTo
|
2021-09-18 10:52:07 +00:00
|
|
|
, alsaSupport ? !stdenv.isDarwin, alsa-lib
|
2022-04-27 09:35:20 +00:00
|
|
|
, dbusSupport ? !stdenv.isDarwin, dbus
|
|
|
|
, pipewireSupport ? !stdenv.isDarwin, pipewire
|
2021-09-18 10:52:07 +00:00
|
|
|
, pulseSupport ? !stdenv.isDarwin, libpulseaudio
|
2020-04-24 23:36:52 +00:00
|
|
|
, CoreServices, AudioUnit, AudioToolbox
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "openal-soft";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "1.22.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "kcat";
|
|
|
|
repo = "openal-soft";
|
2021-09-18 10:52:07 +00:00
|
|
|
rev = version;
|
2022-08-12 12:06:08 +00:00
|
|
|
sha256 = "sha256-MVM0qCZDWcO7/Hnco+0dBqzBLcWD279xjx0slxxlc4w=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
patches = [
|
|
|
|
# this will make it find its own data files (e.g. HRTF profiles)
|
|
|
|
# without any other configuration
|
|
|
|
./search-out.patch
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
2022-04-27 09:35:20 +00:00
|
|
|
substituteInPlace core/helpers.cpp \
|
2020-04-24 23:36:52 +00:00
|
|
|
--replace "@OUT@" $out
|
|
|
|
'';
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config removeReferencesTo ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
buildInputs = lib.optional alsaSupport alsa-lib
|
2022-04-27 09:35:20 +00:00
|
|
|
++ lib.optional dbusSupport dbus
|
|
|
|
++ lib.optional pipewireSupport pipewire
|
2021-09-18 10:52:07 +00:00
|
|
|
++ lib.optional pulseSupport libpulseaudio
|
|
|
|
++ lib.optionals stdenv.isDarwin [ CoreServices AudioUnit AudioToolbox ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
# Automatically links dependencies without having to rely on dlopen, thus
|
|
|
|
# removes the need for NIX_LDFLAGS.
|
|
|
|
"-DALSOFT_DLOPEN=OFF"
|
2022-08-21 13:32:41 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/183774
|
|
|
|
"-DOSS_INCLUDE_DIR=${stdenv.cc.libc}/include"
|
2022-04-27 09:35:20 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
postInstall = lib.optional pipewireSupport ''
|
|
|
|
remove-references-to -t ${pipewire.dev} $(readlink -f $out/lib/*.so)
|
|
|
|
'';
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "OpenAL alternative";
|
2022-09-30 11:47:45 +00:00
|
|
|
homepage = "https://openal-soft.org/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.lgpl2;
|
|
|
|
maintainers = with maintainers; [ftrvxmtrx];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|