1{ stdenv, lib, fetchFromGitHub, cmake, CoreServices }:
2
3stdenv.mkDerivation rec {
4 pname = "libbtbb";
5 version = "2020-12-R1";
6
7 src = fetchFromGitHub {
8 owner = "greatscottgadgets";
9 repo = pname;
10 rev = version;
11 sha256 = "1byv8174xam7siakr1p0523x97wkh0fmwmq341sd3g70qr2g767d";
12 };
13
14 nativeBuildInputs = [ cmake ] ++ lib.optionals stdenv.isDarwin [ CoreServices ];
15
16 # https://github.com/greatscottgadgets/libbtbb/issues/63
17 postPatch = ''
18 substituteInPlace lib/libbtbb.pc.in \
19 --replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
20 --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
21 '';
22
23 meta = with lib; {
24 description = "Bluetooth baseband decoding library";
25 homepage = "https://github.com/greatscottgadgets/libbtbb";
26 license = licenses.gpl2;
27 maintainers = with maintainers; [ oxzi ];
28 };
29}