adlplug,opnplug: Add maintainer, refactor

This commit is contained in:
OPNA2608 2021-05-29 02:18:08 +02:00
parent 5a409e8d4a
commit b6cebef234
2 changed files with 84 additions and 20 deletions

View file

@ -1,19 +1,48 @@
{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, libjack2, alsa-lib { lib
, freetype, libX11, libXrandr, libXinerama, libXext, libXcursor , stdenv
, fetchpatch, fmt , fetchFromGitHub
, adlplugChip ? "-DADLplug_CHIP=OPL3" , fetchpatch
, pname ? "ADLplug" }: , cmake
, pkg-config
, fmt
, liblo
, alsa-lib
, freetype
, libX11
, libXrandr
, libXinerama
, libXext
, libXcursor
, libobjc
, Cocoa
, CoreServices
, WebKit
, DiscRecording
# 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
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
inherit pname; pname = "${lib.strings.toLower type}plug";
version = "1.0.2"; version = "1.0.2";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "jpcima"; owner = "jpcima";
repo = "ADLplug"; repo = "ADLplug";
rev = "v${version}"; rev = "v${version}";
sha256 = "0mqx4bzri8s880v7jwd24nb93m5i3aklqld0b3h0hjnz0lh2qz0f";
fetchSubmodules = true; fetchSubmodules = true;
sha256 = "0mqx4bzri8s880v7jwd24nb93m5i3aklqld0b3h0hjnz0lh2qz0f";
}; };
patches = [ patches = [
@ -25,19 +54,52 @@ stdenv.mkDerivation rec {
}) })
]; ];
cmakeFlags = [ adlplugChip "-DADLplug_USE_SYSTEM_FMT=ON" ]; 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
];
buildInputs = [ buildInputs = [
libjack2 alsa-lib freetype libX11 libXrandr libXinerama libXext fmt
liblo
] ++ lib.optionals stdenv.hostPlatform.isLinux [
alsa-lib
freetype
libX11
libXrandr
libXinerama
libXext
libXcursor libXcursor
]; ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
nativeBuildInputs = [ cmake pkg-config fmt ]; 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}
'';
meta = with lib; { meta = with lib; {
description = "OPL3 and OPN2 FM Chip Synthesizer"; inherit mainProgram;
description = "${chip} FM Chip Synthesizer";
homepage = src.meta.homepage; homepage = src.meta.homepage;
license = licenses.boost; license = licenses.boost;
platforms = platforms.linux; platforms = platforms.all;
maintainers = with maintainers; [ ]; maintainers = with maintainers; [ OPNA2608 ];
}; };
} }

View file

@ -765,15 +765,17 @@ in
adafruit-ampy = callPackage ../tools/misc/adafruit-ampy { }; adafruit-ampy = callPackage ../tools/misc/adafruit-ampy { };
adlplug = callPackage ../applications/audio/adlplug { }; adlplug = callPackage ../applications/audio/adlplug {
inherit (darwin) libobjc;
inherit (darwin.apple_sdk.frameworks) Cocoa CoreServices WebKit DiscRecording;
jack = libjack2;
};
opnplug = adlplug.override {
type = "OPN";
};
arc_unpacker = callPackage ../tools/archivers/arc_unpacker { }; arc_unpacker = callPackage ../tools/archivers/arc_unpacker { };
opnplug = callPackage ../applications/audio/adlplug {
adlplugChip = "-DADLplug_CHIP=OPN2";
pname = "OPNplug";
};
adminer = callPackage ../servers/adminer { }; adminer = callPackage ../servers/adminer { };
advancecomp = callPackage ../tools/compression/advancecomp {}; advancecomp = callPackage ../tools/compression/advancecomp {};