2018-09-11 04:01:45 +02:00
|
|
|
{ stdenv
|
|
|
|
, runCommand
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pulseaudio
|
2021-01-19 07:50:56 +01:00
|
|
|
, pkg-config
|
2020-06-13 04:31:01 +02:00
|
|
|
, ffmpeg
|
2018-10-17 15:55:05 +02:00
|
|
|
, patchelf
|
2018-11-04 15:14:16 +01:00
|
|
|
, fdk_aac
|
2018-09-11 04:01:45 +02:00
|
|
|
, libtool
|
2019-04-15 04:32:56 +02:00
|
|
|
, ldacbt
|
2018-09-11 04:01:45 +02:00
|
|
|
, cmake
|
|
|
|
, bluez
|
|
|
|
, dbus
|
|
|
|
, sbc
|
2018-10-17 15:55:05 +02:00
|
|
|
, lib
|
2018-09-11 04:01:45 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pulseSources = runCommand "pulseaudio-sources" {} ''
|
|
|
|
mkdir $out
|
2020-11-09 19:10:12 +01:00
|
|
|
if [ -d ${pulseaudio.src} ]; then
|
|
|
|
ln -s ${pulseaudio.src}/* $out/
|
|
|
|
else
|
|
|
|
tar -xf ${pulseaudio.src}
|
|
|
|
mv pulseaudio*/* $out/
|
|
|
|
fi
|
2018-09-11 04:01:45 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "pulseaudio-modules-bt";
|
2020-06-06 22:46:39 +02:00
|
|
|
version = "1.4";
|
2018-09-11 04:01:45 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "EHfive";
|
|
|
|
repo = "pulseaudio-modules-bt";
|
2019-04-15 04:32:56 +02:00
|
|
|
rev = "v${version}";
|
2020-06-06 22:46:39 +02:00
|
|
|
sha256 = "0bzg6x405j39axnkvc6n6vkl1hv1frk94y1i9sl170081bk23asd";
|
2018-09-11 04:01:45 +02:00
|
|
|
};
|
|
|
|
|
2018-10-17 15:55:05 +02:00
|
|
|
patches = [
|
|
|
|
./fix-install-path.patch
|
|
|
|
];
|
|
|
|
|
2018-09-11 04:01:45 +02:00
|
|
|
nativeBuildInputs = [
|
2021-01-19 07:50:56 +01:00
|
|
|
pkg-config
|
2018-10-17 15:55:05 +02:00
|
|
|
patchelf
|
2018-09-11 04:01:45 +02:00
|
|
|
cmake
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
pulseaudio
|
2020-06-13 04:31:01 +02:00
|
|
|
ffmpeg
|
2018-11-04 15:14:16 +01:00
|
|
|
fdk_aac
|
2018-09-11 04:01:45 +02:00
|
|
|
libtool
|
2019-04-15 04:32:56 +02:00
|
|
|
ldacbt
|
2018-09-11 04:01:45 +02:00
|
|
|
bluez
|
|
|
|
dbus
|
|
|
|
sbc
|
|
|
|
];
|
|
|
|
|
2018-10-17 15:55:05 +02:00
|
|
|
postPatch = ''
|
|
|
|
# Upstream bundles pulseaudio as a submodule
|
2018-09-11 04:01:45 +02:00
|
|
|
rm -r pa
|
|
|
|
ln -s ${pulseSources} pa
|
2018-10-17 15:55:05 +02:00
|
|
|
|
|
|
|
# Pulseaudio version is detected with a -rebootstrapped suffix which build system assumptions
|
|
|
|
substituteInPlace config.h.in --replace PulseAudio_VERSION ${pulseaudio.version}
|
2020-10-26 02:18:26 +01:00
|
|
|
substituteInPlace CMakeLists.txt --replace '${"\${PULSE_DIR}"}' ${pulseaudio.pulseDir}
|
2020-06-06 22:46:39 +02:00
|
|
|
|
|
|
|
# Fraunhofer recommends to enable afterburner but upstream has it set to false by default
|
|
|
|
substituteInPlace src/modules/bluetooth/a2dp/a2dp_aac.c \
|
|
|
|
--replace "info->aac_afterburner = false;" "info->aac_afterburner = true;"
|
2018-10-17 15:55:05 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
for so in $out/lib/pulse-${pulseaudio.version}/modules/*.so; do
|
|
|
|
orig_rpath=$(patchelf --print-rpath "$so")
|
|
|
|
patchelf \
|
2020-10-26 02:18:26 +01:00
|
|
|
--set-rpath "${ldacbt}/lib:${lib.getLib ffmpeg}/lib:$out/${pulseaudio.pulseDir}/modules:$orig_rpath" \
|
2018-10-17 15:55:05 +02:00
|
|
|
"$so"
|
|
|
|
done
|
2018-09-11 04:01:45 +02:00
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/EHfive/pulseaudio-modules-bt";
|
2018-11-04 15:14:16 +01:00
|
|
|
description = "LDAC, aptX, aptX HD, AAC codecs (A2DP Audio) support for Linux PulseAudio";
|
2018-09-11 04:01:45 +02:00
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ adisbladis ];
|
|
|
|
};
|
|
|
|
}
|