about summary refs log tree commit diff
path: root/pkgs/by-name/fm/fmtoy/package.nix
blob: fd466b777fd78fc14501046c0e55024adb3e93b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{ stdenv
, lib
, fetchFromGitHub
, unstableGitUpdater
, alsa-lib
, libfmvoice
, libjack2
, pkg-config
, zlib
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "fmtoy";
  version = "0-unstable-2024-04-18";

  src = fetchFromGitHub {
    owner = "vampirefrog";
    repo = "fmtoy";
    rev = "aca005c770724f21c8a91dc6a482738871e78c9f";
    hash = "sha256-vrd7Eg3Bh8ll2yCfD1rAJpotEe+Zq+JuF4VMhiYsbDw=";
  };

  postPatch = ''
    rmdir libfmvoice
    cp --no-preserve=all -r ${libfmvoice.src} libfmvoice

    substituteInPlace Makefile \
      --replace 'pkg-config' "$PKG_CONFIG"
  '';

  strictDeps = true;

  nativeBuildInputs = [
    pkg-config
  ];

  buildInputs = [
    alsa-lib
    libjack2
    zlib
  ];

  enableParallelBuilding = true;

  buildFlags = [
    "CC=${stdenv.cc.targetPrefix}cc"
    "CXX=${stdenv.cc.targetPrefix}c++"
  ];

  installPhase = ''
    runHook preInstall

    install -Dm755 fmtoy_jack $out/bin/fmtoy_jack

    runHook postInstall
  '';

  passthru = {
    updateScript = unstableGitUpdater { };
  };

  meta = with lib; {
    description = "FM synthesiser based on emulated Yamaha YM chips (OPL, OPM and OPN series)";
    homepage = "https://github.com/vampirefrog/fmtoy";
    license = licenses.gpl3Only;
    mainProgram = "fmtoy_jack";
    maintainers = with maintainers; [ OPNA2608 ];
    platforms = platforms.linux;
  };
})