1{ lib
2, stdenv
3, fetchurl
4, fetchpatch
5, cmake
6, ffmpeg_6
7, darwin
8, zlib
9}:
10
11stdenv.mkDerivation rec {
12 pname = "chromaprint";
13 version = "1.5.1";
14
15 src = fetchurl {
16 url = "https://github.com/acoustid/chromaprint/releases/download/v${version}/${pname}-${version}.tar.gz";
17 sha256 = "sha256-oarY+juLGLeNN1Wzdn+v+au2ckLgG0eOyaZOGQ8zXhw=";
18 };
19
20 patches = [
21 # Use FFmpeg 5.x
22 # https://github.com/acoustid/chromaprint/pull/120
23 (fetchpatch {
24 url = "https://github.com/acoustid/chromaprint/commit/8ccad6937177b1b92e40ab8f4447ea27bac009a7.patch";
25 hash = "sha256-yO2iWmU9s2p0uJfwIdmk3jZ5HXBIQZ/NyOqG+Y5EHdg=";
26 excludes = [ "package/build.sh" ];
27 })
28 # ffmpeg5 fix for issue #122
29 # https://github.com/acoustid/chromaprint/pull/125
30 (fetchpatch {
31 url = "https://github.com/acoustid/chromaprint/commit/aa67c95b9e486884a6d3ee8b0c91207d8c2b0551.patch";
32 hash = "sha256-dLY8FBzBqJehAofE924ayZK0HA/aKiuFhEFxL7dg6rY=";
33 })
34 ];
35
36 nativeBuildInputs = [ cmake ];
37
38 buildInputs = [ ffmpeg_6 ] ++ lib.optionals stdenv.isDarwin
39 (with darwin.apple_sdk.frameworks; [ Accelerate CoreGraphics CoreVideo zlib ]);
40
41 cmakeFlags = [ "-DBUILD_EXAMPLES=ON" "-DBUILD_TOOLS=ON" ];
42
43 meta = with lib; {
44 homepage = "https://acoustid.org/chromaprint";
45 description = "AcoustID audio fingerprinting library";
46 mainProgram = "fpcalc";
47 license = licenses.lgpl21Plus;
48 platforms = platforms.unix;
49 };
50}