2021-06-28 23:13:55 +00:00
|
|
|
{ lib
|
2022-06-16 17:23:12 +00:00
|
|
|
, stdenv
|
2021-06-28 23:13:55 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, pythonOlder
|
|
|
|
, fetchFromGitHub
|
2023-04-12 12:48:02 +00:00
|
|
|
, miniaudio
|
2021-06-28 23:13:55 +00:00
|
|
|
, cffi
|
|
|
|
, pytestCheckHook
|
2022-06-16 17:23:12 +00:00
|
|
|
, AudioToolbox
|
|
|
|
, CoreAudio
|
2021-06-28 23:13:55 +00:00
|
|
|
}:
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
let
|
|
|
|
# TODO: recheck after 1.59
|
|
|
|
miniaudio' = miniaudio.overrideAttrs (oldAttrs: rec {
|
|
|
|
version = "0.11.16"; # cffi breakage with 0.11.17
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
inherit (oldAttrs.src) owner repo;
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-POe/dYPJ25RKNGIhaLoqxm9JJ08MrTyHVN4NmaGOdwM=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
in
|
2021-06-28 23:13:55 +00:00
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "miniaudio";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "1.59";
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.6";
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "irmen";
|
|
|
|
repo = "pyminiaudio";
|
2022-06-26 10:26:21 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-07-15 17:15:38 +00:00
|
|
|
hash = "sha256-tMQOGqEThtownW3cnNpCzWye0Uo/Es7E8abVySo1QnQ=";
|
2021-06-28 23:13:55 +00:00
|
|
|
};
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
postPatch = ''
|
|
|
|
rm -r miniaudio
|
2023-07-15 17:15:38 +00:00
|
|
|
ln -s ${miniaudio'} miniaudio
|
2023-04-12 12:48:02 +00:00
|
|
|
substituteInPlace build_ffi_module.py \
|
|
|
|
--replace "miniaudio/stb_vorbis.c" "miniaudio/extras/stb_vorbis.c";
|
|
|
|
substituteInPlace miniaudio.c \
|
|
|
|
--replace "miniaudio/stb_vorbis.c" "miniaudio/extras/stb_vorbis.c";
|
|
|
|
'';
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [
|
|
|
|
AudioToolbox
|
|
|
|
CoreAudio
|
|
|
|
];
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
propagatedNativeBuildInputs = [ cffi ];
|
|
|
|
propagatedBuildInputs = [ cffi ];
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-06-28 23:13:55 +00:00
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "miniaudio" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python bindings for the miniaudio library and its decoders";
|
|
|
|
homepage = "https://github.com/irmen/pyminiaudio";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ dotlambda ];
|
|
|
|
};
|
|
|
|
}
|