1{
2 pname,
3 chip,
4 version,
5 sha256,
6 extraPatches ? [ ],
7}:
8
9{
10 mkDerivation,
11 stdenv,
12 lib,
13 fetchFromGitHub,
14 dos2unix,
15 cmake,
16 pkg-config,
17 qttools,
18 qtbase,
19 qwt6_1,
20 rtaudio,
21 rtmidi,
22}:
23
24let
25 binname = "${chip} Bank Editor";
26 mainProgram = "${lib.strings.toLower chip}_bank_editor";
27in
28mkDerivation rec {
29 inherit pname version;
30
31 src = fetchFromGitHub {
32 owner = "Wohlstand";
33 repo = pname;
34 rev = "v${version}";
35 inherit sha256;
36 };
37
38 prePatch = ''
39 dos2unix CMakeLists.txt
40 '';
41
42 patches = extraPatches;
43
44 nativeBuildInputs = [
45 dos2unix
46 cmake
47 pkg-config
48 qttools
49 ];
50
51 buildInputs = [
52 qtbase
53 qwt6_1
54 rtaudio
55 rtmidi
56 ];
57
58 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
59 mkdir $out/{bin,Applications}
60 mv "${binname}.app" $out/Applications/
61
62 install_name_tool -change {,${qwt6_1}/lib/}libqwt.6.dylib "$out/Applications/${binname}.app/Contents/MacOS/${binname}"
63
64 ln -s "$out/Applications/${binname}.app/Contents/MacOS/${binname}" $out/bin/${mainProgram}
65 '';
66
67 meta = with lib; {
68 inherit mainProgram;
69 description = "Small cross-platform editor of the ${chip} FM banks of different formats";
70 homepage = src.meta.homepage;
71 license = licenses.gpl3Plus;
72 platforms = platforms.all;
73 maintainers = with maintainers; [ OPNA2608 ];
74 };
75}