3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/audio/adlplug/default.nix

106 lines
2.3 KiB
Nix
Raw Normal View History

{ 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
# 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 {
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";
rev = "v${version}";
2019-01-08 15:51:01 +00:00
fetchSubmodules = true;
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;
})
];
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 = [
fmt
liblo
] ++ lib.optionals stdenv.hostPlatform.isLinux [
alsa-lib
freetype
libX11
libXrandr
libXinerama
libXext
2019-01-08 15:51:01 +00:00
libXcursor
] ++ 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
meta = with lib; {
inherit mainProgram;
description = "${chip} FM Chip Synthesizer";
2019-01-08 15:51:01 +00:00
homepage = src.meta.homepage;
license = licenses.boost;
platforms = platforms.all;
maintainers = with maintainers; [ OPNA2608 ];
2019-01-08 15:51:01 +00:00
};
}