2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
2024-07-27 06:49:29 +00:00
|
|
|
setuptools,
|
2024-06-05 15:53:02 +00:00
|
|
|
miniaudio,
|
|
|
|
cffi,
|
|
|
|
pytestCheckHook,
|
|
|
|
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";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "1.61";
|
2024-07-27 06:49:29 +00:00
|
|
|
pyproject = true;
|
2023-04-12 12:48:02 +00:00
|
|
|
|
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}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-H3o2IWGuMqLrJTzQ7w636Ito6f57WBtMXpXXzrZ7UD8=";
|
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 \
|
2024-07-27 06:49:29 +00:00
|
|
|
--replace-fail "miniaudio/stb_vorbis.c" "miniaudio/extras/stb_vorbis.c";
|
2023-04-12 12:48:02 +00:00
|
|
|
substituteInPlace miniaudio.c \
|
2024-07-27 06:49:29 +00:00
|
|
|
--replace-fail "miniaudio/stb_vorbis.c" "miniaudio/extras/stb_vorbis.c";
|
2023-04-12 12:48:02 +00:00
|
|
|
'';
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
build-system = [ setuptools ];
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
|
2022-06-16 17:23:12 +00:00
|
|
|
AudioToolbox
|
|
|
|
CoreAudio
|
|
|
|
];
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
propagatedNativeBuildInputs = [ cffi ];
|
2024-07-27 06:49:29 +00:00
|
|
|
dependencies = [ cffi ];
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
pythonImportsCheck = [ "miniaudio" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-07-27 06:49:29 +00:00
|
|
|
changelog = "https://github.com/irmen/pyminiaudio/releases/tag/v${version}";
|
2021-06-28 23:13:55 +00:00
|
|
|
description = "Python bindings for the miniaudio library and its decoders";
|
|
|
|
homepage = "https://github.com/irmen/pyminiaudio";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ dotlambda ];
|
|
|
|
};
|
|
|
|
}
|