adlplug,opnplug: Add maintainer, refactor

OPNA2608 b6cebef2 5a409e8d

+84 -20
+76 -14
pkgs/applications/audio/adlplug/default.nix
··· 1 - { lib, stdenv, fetchFromGitHub, cmake, pkg-config, libjack2, alsa-lib 2 - , freetype, libX11, libXrandr, libXinerama, libXext, libXcursor 3 - , fetchpatch, fmt 4 - , adlplugChip ? "-DADLplug_CHIP=OPL3" 5 - , pname ? "ADLplug" }: 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , fetchpatch 5 + , cmake 6 + , pkg-config 7 + , fmt 8 + , liblo 9 + , alsa-lib 10 + , freetype 11 + , libX11 12 + , libXrandr 13 + , libXinerama 14 + , libXext 15 + , libXcursor 16 + , libobjc 17 + , Cocoa 18 + , CoreServices 19 + , WebKit 20 + , DiscRecording 21 + 22 + # Enabling JACK requires a JACK server at runtime, no fallback mechanism 23 + , withJack ? false, jack 24 + 25 + , type ? "ADL" 26 + }: 6 27 28 + assert lib.assertOneOf "type" type [ "ADL" "OPN" ]; 29 + let 30 + chip = { 31 + ADL = "OPL3"; 32 + OPN = "OPN2"; 33 + }.${type}; 34 + mainProgram = "${type}plug"; 35 + in 7 36 stdenv.mkDerivation rec { 8 - inherit pname; 37 + pname = "${lib.strings.toLower type}plug"; 9 38 version = "1.0.2"; 10 39 11 40 src = fetchFromGitHub { 12 41 owner = "jpcima"; 13 42 repo = "ADLplug"; 14 43 rev = "v${version}"; 15 - sha256 = "0mqx4bzri8s880v7jwd24nb93m5i3aklqld0b3h0hjnz0lh2qz0f"; 16 44 fetchSubmodules = true; 45 + sha256 = "0mqx4bzri8s880v7jwd24nb93m5i3aklqld0b3h0hjnz0lh2qz0f"; 17 46 }; 18 47 19 48 patches = [ ··· 25 54 }) 26 55 ]; 27 56 28 - cmakeFlags = [ adlplugChip "-DADLplug_USE_SYSTEM_FMT=ON" ]; 57 + cmakeFlags = [ 58 + "-DADLplug_CHIP=${chip}" 59 + "-DADLplug_USE_SYSTEM_FMT=ON" 60 + "-DADLplug_Jack=${if withJack then "ON" else "OFF"}" 61 + ]; 62 + 63 + NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin (toString [ 64 + "-isystem ${CoreServices}/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers" 65 + ]); 66 + 67 + nativeBuildInputs = [ 68 + cmake 69 + pkg-config 70 + ]; 29 71 30 72 buildInputs = [ 31 - libjack2 alsa-lib freetype libX11 libXrandr libXinerama libXext 73 + fmt 74 + liblo 75 + ] ++ lib.optionals stdenv.hostPlatform.isLinux [ 76 + alsa-lib 77 + freetype 78 + libX11 79 + libXrandr 80 + libXinerama 81 + libXext 32 82 libXcursor 33 - ]; 34 - nativeBuildInputs = [ cmake pkg-config fmt ]; 83 + ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ 84 + libobjc 85 + Cocoa 86 + CoreServices 87 + WebKit 88 + DiscRecording 89 + ] ++ lib.optional withJack jack; 90 + 91 + postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' 92 + mkdir $out/Applications 93 + mv $out/bin/${mainProgram}.app $out/Applications/ 94 + ln -s $out/{Applications/${mainProgram}.app/Contents/MacOS,bin}/${mainProgram} 95 + ''; 35 96 36 97 meta = with lib; { 37 - description = "OPL3 and OPN2 FM Chip Synthesizer"; 98 + inherit mainProgram; 99 + description = "${chip} FM Chip Synthesizer"; 38 100 homepage = src.meta.homepage; 39 101 license = licenses.boost; 40 - platforms = platforms.linux; 41 - maintainers = with maintainers; [ ]; 102 + platforms = platforms.all; 103 + maintainers = with maintainers; [ OPNA2608 ]; 42 104 }; 43 105 }
+8 -6
pkgs/top-level/all-packages.nix
··· 765 765 766 766 adafruit-ampy = callPackage ../tools/misc/adafruit-ampy { }; 767 767 768 - adlplug = callPackage ../applications/audio/adlplug { }; 768 + adlplug = callPackage ../applications/audio/adlplug { 769 + inherit (darwin) libobjc; 770 + inherit (darwin.apple_sdk.frameworks) Cocoa CoreServices WebKit DiscRecording; 771 + jack = libjack2; 772 + }; 773 + opnplug = adlplug.override { 774 + type = "OPN"; 775 + }; 769 776 770 777 arc_unpacker = callPackage ../tools/archivers/arc_unpacker { }; 771 - 772 - opnplug = callPackage ../applications/audio/adlplug { 773 - adlplugChip = "-DADLplug_CHIP=OPN2"; 774 - pname = "OPNplug"; 775 - }; 776 778 777 779 adminer = callPackage ../servers/adminer { }; 778 780