base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12 (#356361)
[NixPkgs.git] / pkgs / tools / audio / opl3bankeditor / common.nix
blobabbd24efd87e8e4f83c16ba1f18f49a1c2e521f8
1 { pname, chip, version, sha256, extraPatches ? [] }:
3 { mkDerivation
4 , stdenv
5 , lib
6 , fetchFromGitHub
7 , dos2unix
8 , cmake
9 , pkg-config
10 , qttools
11 , qtbase
12 , qwt6_1
13 , rtaudio
14 , rtmidi
17 let
18   binname = "${chip} Bank Editor";
19   mainProgram = "${lib.strings.toLower chip}_bank_editor";
21 mkDerivation rec {
22   inherit pname version;
24   src = fetchFromGitHub {
25     owner = "Wohlstand";
26     repo = pname;
27     rev = "v${version}";
28     inherit sha256;
29   };
31   prePatch = ''
32     dos2unix CMakeLists.txt
33   '';
35   patches = extraPatches;
37   nativeBuildInputs = [
38     dos2unix
39     cmake
40     pkg-config
41     qttools
42   ];
44   buildInputs = [
45     qtbase
46     qwt6_1
47     rtaudio
48     rtmidi
49   ];
51   postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
52     mkdir $out/{bin,Applications}
53     mv "${binname}.app" $out/Applications/
55     install_name_tool -change {,${qwt6_1}/lib/}libqwt.6.dylib "$out/Applications/${binname}.app/Contents/MacOS/${binname}"
57     ln -s "$out/Applications/${binname}.app/Contents/MacOS/${binname}" $out/bin/${mainProgram}
58   '';
60   meta = with lib; {
61     inherit mainProgram;
62     description = "Small cross-platform editor of the ${chip} FM banks of different formats";
63     homepage = src.meta.homepage;
64     license = licenses.gpl3Plus;
65     platforms = platforms.all;
66     maintainers = with maintainers; [ OPNA2608 ];
67   };