2021-05-29 01:18:08 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, cmake
|
|
|
|
, pkg-config
|
|
|
|
, fmt
|
|
|
|
, liblo
|
|
|
|
, alsa-lib
|
|
|
|
, freetype
|
|
|
|
, libX11
|
|
|
|
, libXrandr
|
|
|
|
, libXinerama
|
|
|
|
, libXext
|
|
|
|
, libXcursor
|
|
|
|
, libobjc
|
|
|
|
, Cocoa
|
|
|
|
, CoreServices
|
|
|
|
, WebKit
|
|
|
|
, DiscRecording
|
2019-01-08 15:51:01 +00:00
|
|
|
|
2021-05-29 01:18:08 +01:00
|
|
|
# Enabling JACK requires a JACK server at runtime, no fallback mechanism
|
|
|
|
, withJack ? false, jack
|
|
|
|
|
|
|
|
, type ? "ADL"
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert lib.assertOneOf "type" type [ "ADL" "OPN" ];
|
|
|
|
let
|
|
|
|
chip = {
|
|
|
|
ADL = "OPL3";
|
|
|
|
OPN = "OPN2";
|
|
|
|
}.${type};
|
|
|
|
mainProgram = "${type}plug";
|
|
|
|
in
|
2019-01-08 15:51:01 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2021-05-29 01:18:08 +01:00
|
|
|
pname = "${lib.strings.toLower type}plug";
|
2020-08-06 07:21:31 +01:00
|
|
|
version = "1.0.2";
|
2019-01-08 15:51:01 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jpcima";
|
|
|
|
repo = "ADLplug";
|
2019-03-17 17:21:31 +00:00
|
|
|
rev = "v${version}";
|
2019-01-08 15:51:01 +00:00
|
|
|
fetchSubmodules = true;
|
2021-05-29 01:18:08 +01:00
|
|
|
sha256 = "0mqx4bzri8s880v7jwd24nb93m5i3aklqld0b3h0hjnz0lh2qz0f";
|
2019-01-08 15:51:01 +00:00
|
|
|
};
|
|
|
|
|
2019-11-06 23:50:01 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://raw.githubusercontent.com/jpcima/ADLplug/83636c55bec1b86cabf634b9a6d56d07f00ecc61/resources/patch/juce-gcc9.patch";
|
|
|
|
sha256 = "15hkdb76n9lgjsrpczj27ld9b4804bzrgw89g95cj4sc8wwkplyy";
|
|
|
|
extraPrefix = "thirdparty/JUCE/";
|
|
|
|
stripLen = 1;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-05-29 01:18:08 +01:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DADLplug_CHIP=${chip}"
|
|
|
|
"-DADLplug_USE_SYSTEM_FMT=ON"
|
|
|
|
"-DADLplug_Jack=${if withJack then "ON" else "OFF"}"
|
|
|
|
];
|
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin (toString [
|
|
|
|
"-isystem ${CoreServices}/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers"
|
|
|
|
]);
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pkg-config
|
|
|
|
];
|
2019-01-08 15:51:01 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2021-05-29 01:18:08 +01:00
|
|
|
fmt
|
|
|
|
liblo
|
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
|
|
alsa-lib
|
|
|
|
freetype
|
|
|
|
libX11
|
|
|
|
libXrandr
|
|
|
|
libXinerama
|
|
|
|
libXext
|
2019-01-08 15:51:01 +00:00
|
|
|
libXcursor
|
2021-05-29 01:18:08 +01:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
|
|
libobjc
|
|
|
|
Cocoa
|
|
|
|
CoreServices
|
|
|
|
WebKit
|
|
|
|
DiscRecording
|
|
|
|
] ++ lib.optional withJack jack;
|
|
|
|
|
|
|
|
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
|
|
mkdir $out/Applications
|
|
|
|
mv $out/bin/${mainProgram}.app $out/Applications/
|
|
|
|
ln -s $out/{Applications/${mainProgram}.app/Contents/MacOS,bin}/${mainProgram}
|
|
|
|
'';
|
2019-01-08 15:51:01 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2021-05-29 01:18:08 +01:00
|
|
|
inherit mainProgram;
|
|
|
|
description = "${chip} FM Chip Synthesizer";
|
2019-01-08 15:51:01 +00:00
|
|
|
homepage = src.meta.homepage;
|
|
|
|
license = licenses.boost;
|
2021-05-29 01:18:08 +01:00
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ OPNA2608 ];
|
2019-01-08 15:51:01 +00:00
|
|
|
};
|
|
|
|
}
|