From 39921bd43ba6ccd273f4337098b71eb851e9c77d Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Fri, 27 Mar 2020 02:17:27 -0400 Subject: [PATCH] mame: add darwin support --- pkgs/misc/emulators/mame/default.nix | 28 +++++++++++++++++++++------- pkgs/top-level/all-packages.nix | 4 +++- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/pkgs/misc/emulators/mame/default.nix b/pkgs/misc/emulators/mame/default.nix index 995fd72a6e22..2b05a921590f 100644 --- a/pkgs/misc/emulators/mame/default.nix +++ b/pkgs/misc/emulators/mame/default.nix @@ -1,14 +1,17 @@ { stdenv, mkDerivation, fetchFromGitHub, makeDesktopItem, makeWrapper , python, pkgconfig, SDL2, SDL2_ttf, alsaLib, which, qtbase, libXinerama +, libpcap, CoreAudioKit, ForceFeedback , installShellFiles }: +with stdenv; + let majorVersion = "0"; minorVersion = "219"; desktopItem = makeDesktopItem { name = "MAME"; - exec = "mame${stdenv.lib.optionalString stdenv.is64bit "64"}"; + exec = "mame${lib.optionalString stdenv.is64bit "64"}"; desktopName = "MAME"; genericName = "MAME is a multi-purpose emulation framework"; categories = "System;Emulator;"; @@ -27,13 +30,22 @@ in mkDerivation { }; hardeningDisable = [ "fortify" ]; - NIX_CFLAGS_COMPILE = [ "-Wno-error=maybe-uninitialized" ]; + NIX_CFLAGS_COMPILE = [ "-Wno-error=maybe-uninitialized" "-Wno-error=missing-braces" ]; - makeFlags = [ "TOOLS=1" ]; + makeFlags = [ + "TOOLS=1" + "USE_LIBSDL=1" + ] + ++ lib.optionals stdenv.cc.isClang [ "CC=clang" "CXX=clang++" ] + ; dontWrapQtApps = true; - buildInputs = [ SDL2 SDL2_ttf alsaLib qtbase libXinerama ]; + buildInputs = + [ SDL2 SDL2_ttf qtbase libXinerama ] + ++ lib.optional stdenv.isLinux alsaLib + ++ lib.optionals stdenv.isDarwin [ libpcap CoreAudioKit ForceFeedback ] + ; nativeBuildInputs = [ python pkgconfig which makeWrapper installShellFiles ]; # by default MAME assumes that paths with stock resources @@ -58,16 +70,18 @@ in mkDerivation { installManPage ${dest}/docs/man/*.1 ${dest}/docs/man/*.6 mv artwork plugins samples ${dest} - + '' + lib.optionalString stdenv.isLinux '' mkdir -p $out/share ln -s ${desktopItem}/share/applications $out/share ''; - meta = with stdenv.lib; { + meta = with lib; { description = "Is a multi-purpose emulation framework"; homepage = https://www.mamedev.org/; license = with licenses; [ bsd3 gpl2Plus ]; - platforms = [ "x86_64-linux" "i686-linux" ]; + platforms = platforms.unix; + # makefile needs fixes for install target + badPlatforms = [ "aarch64-linux" ]; maintainers = with maintainers; [ gnidorah ]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7e469380abbd..6c3a8a4d430d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -25517,7 +25517,9 @@ in icu = icu58; }; - mame = libsForQt5.callPackage ../misc/emulators/mame { }; + mame = libsForQt5.callPackage ../misc/emulators/mame { + inherit (darwin.apple_sdk.frameworks) CoreAudioKit ForceFeedback; + }; martyr = callPackage ../development/libraries/martyr { };