1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 kissfft,
7}:
8
9stdenv.mkDerivation rec {
10 pname = "qm-dsp";
11 version = "1.7.1";
12
13 src = fetchFromGitHub {
14 owner = "c4dm";
15 repo = "qm-dsp";
16 rev = "v${version}";
17 sha256 = "1vkb1xr2hjcaw88gig7rknlwsx01lm0w94d2z0rk5vz9ih4fslvv";
18 };
19
20 patches = [
21 # Make installable
22 (fetchpatch {
23 url = "https://src.fedoraproject.org/rpms/qm-dsp/raw/6eb385e2f970c4150f9c8eba73b558318475ed15/f/qm-dsp-install.patch";
24 sha256 = "071g30p17ya0pknzqa950pb93vrgp2024ray8axn22c44gvy147c";
25 })
26 (fetchpatch {
27 url = "https://src.fedoraproject.org/rpms/qm-dsp/raw/6eb385e2f970c4150f9c8eba73b558318475ed15/f/qm-dsp-flags.patch";
28 sha256 = "127n6j5bsp94kf2m1zqfvkf4iqk1h5f7w778bk7w02vi45nm4x6q";
29 postFetch = ''
30 sed -i 's~/Makefile~/build/linux/Makefile.linux32~g' "$out"
31 '';
32 })
33 ];
34
35 buildInputs = [
36 kissfft
37 ];
38
39 makefile = "build/linux/Makefile.linux32";
40
41 makeFlags = [
42 "PREFIX=${placeholder "out"}"
43 "LIBDIR=${placeholder "out"}/lib"
44 ];
45
46 postInstall = ''
47 mv $out/include/qm-dsp/* $out/include
48 rmdir $out/include/qm-dsp
49 '';
50
51 env.NIX_CFLAGS_COMPILE = "-I${lib.getInclude kissfft}/include/kissfft";
52
53 meta = with lib; {
54 description = "C++ library of functions for DSP and Music Informatics purposes";
55 homepage = "https://code.soundsoftware.ac.uk/projects/qm-dsp";
56 license = licenses.gpl2Plus;
57 maintainers = [ ];
58 platforms = platforms.unix;
59 };
60}