From b8d69b120d8ef5e8f0d44c67b3d594de435456eb Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Sat, 20 Nov 2021 22:33:28 -0300 Subject: [PATCH] mame: 0.226 -> 0.237 - change CC/CXX flags - add missing dependencies - mkDerivation -> stdenv.mkDerivation - use Clang 6.0 when building with Clang - remove badPlatforms - increase meta.timeout (for Darwin) --- pkgs/misc/emulators/mame/default.nix | 62 ++++++++++++++++++---------- pkgs/top-level/all-packages.nix | 6 +++ 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/pkgs/misc/emulators/mame/default.nix b/pkgs/misc/emulators/mame/default.nix index 26abda81b309..ea29a81a8346 100644 --- a/pkgs/misc/emulators/mame/default.nix +++ b/pkgs/misc/emulators/mame/default.nix @@ -1,12 +1,26 @@ -{ lib, stdenv, mkDerivation, fetchFromGitHub, makeDesktopItem, makeWrapper -, python, pkg-config, SDL2, SDL2_ttf, alsa-lib, which, qtbase, libXinerama -, libpcap, CoreAudioKit, ForceFeedback -, installShellFiles }: +{ lib +, stdenv +, alsa-lib +, CoreAudioKit +, fetchFromGitHub +, fontconfig +, ForceFeedback +, installShellFiles +, libpcap +, libpulseaudio +, libXi +, libXinerama +, makeDesktopItem +, makeWrapper +, pkg-config +, python3 +, qtbase +, SDL2 +, SDL2_ttf +, which +}: let - majorVersion = "0"; - minorVersion = "226"; - desktopItem = makeDesktopItem { name = "MAME"; exec = "mame${lib.optionalString stdenv.is64bit "64"}"; @@ -16,15 +30,16 @@ let }; dest = "$out/opt/mame"; -in mkDerivation { +in +stdenv.mkDerivation rec { pname = "mame"; - version = "${majorVersion}.${minorVersion}"; + version = "0.237"; src = fetchFromGitHub { owner = "mamedev"; repo = "mame"; - rev = "mame${majorVersion}${minorVersion}"; - sha256 = "0pnsvz4vkjkqb1ac5wzwz31vx0iknyg5ffly90nhl13kcr656jrj"; + rev = "mame${builtins.replaceStrings [ "." ] [ "" ] version}"; + sha256 = "sha256-0GOzpE8YP32ixz+c4dtDur9K0Szf7cl/dkWzPcJRFAM="; }; hardeningDisable = [ "fortify" ]; @@ -33,18 +48,19 @@ in mkDerivation { makeFlags = [ "TOOLS=1" "USE_LIBSDL=1" - ] - ++ lib.optionals stdenv.cc.isClang [ "CC=clang" "CXX=clang++" ] - ; + "CC=${stdenv.cc.targetPrefix}cc" + "CXX=${stdenv.cc.targetPrefix}c++" + ]; dontWrapQtApps = true; + # https://docs.mamedev.org/initialsetup/compilingmame.html buildInputs = - [ SDL2 SDL2_ttf qtbase libXinerama ] - ++ lib.optional stdenv.isLinux alsa-lib - ++ lib.optionals stdenv.isDarwin [ libpcap CoreAudioKit ForceFeedback ] - ; - nativeBuildInputs = [ python pkg-config which makeWrapper installShellFiles ]; + [ SDL2 SDL2_ttf qtbase ] + ++ lib.optionals stdenv.isLinux [ alsa-lib libpulseaudio libXinerama libXi fontconfig ] + ++ lib.optionals stdenv.isDarwin [ libpcap CoreAudioKit ForceFeedback ]; + + nativeBuildInputs = [ python3 pkg-config which makeWrapper installShellFiles ]; # by default MAME assumes that paths with stock resources # are relative and that you run MAME changing to @@ -75,13 +91,15 @@ in mkDerivation { ln -s ${desktopItem}/share/applications $out/share ''; + enableParallelBuilding = true; + meta = with lib; { description = "Is a multi-purpose emulation framework"; homepage = "https://www.mamedev.org/"; license = with licenses; [ bsd3 gpl2Plus ]; platforms = platforms.unix; - # makefile needs fixes for install target - badPlatforms = [ "aarch64-linux" ]; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ thiagokokada ]; + # macOS needs more time to build + timeout = 24 * 3600; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e459bd49f3fa..d94b39b3b481 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -32356,6 +32356,12 @@ with pkgs; mame = libsForQt514.callPackage ../misc/emulators/mame { inherit (darwin.apple_sdk.frameworks) CoreAudioKit ForceFeedback; + # TODO: remove it on mame 0.238 + stdenv = + if stdenv.cc.isClang then + overrideCC stdenv clang_6 + else + stdenv; }; martyr = callPackage ../development/libraries/martyr { };