2021-12-06 16:07:01 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, alsa-lib
|
|
|
|
, CoreAudioKit
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fontconfig
|
|
|
|
, ForceFeedback
|
|
|
|
, installShellFiles
|
|
|
|
, libpcap
|
|
|
|
, libpulseaudio
|
|
|
|
, libXi
|
|
|
|
, libXinerama
|
|
|
|
, makeDesktopItem
|
|
|
|
, makeWrapper
|
|
|
|
, pkg-config
|
|
|
|
, python3
|
|
|
|
, qtbase
|
|
|
|
, SDL2
|
|
|
|
, SDL2_ttf
|
|
|
|
, which
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "MAME";
|
|
|
|
exec = "mame${lib.optionalString stdenv.is64bit "64"}";
|
|
|
|
desktopName = "MAME";
|
|
|
|
genericName = "MAME is a multi-purpose emulation framework";
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "System" "Emulator" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
dest = "$out/opt/mame";
|
2021-12-06 16:07:01 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "mame";
|
2022-01-03 16:56:52 +00:00
|
|
|
version = "0.239";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mamedev";
|
|
|
|
repo = "mame";
|
2021-12-06 16:07:01 +00:00
|
|
|
rev = "mame${builtins.replaceStrings [ "." ] [ "" ] version}";
|
2022-01-03 16:56:52 +00:00
|
|
|
sha256 = "sha256-svclBaFkp4d6db+zWZNvZP8vWIFz/7M5N1M6WseOFEk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
hardeningDisable = [ "fortify" ];
|
|
|
|
NIX_CFLAGS_COMPILE = [ "-Wno-error=maybe-uninitialized" "-Wno-error=missing-braces" ];
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"TOOLS=1"
|
|
|
|
"USE_LIBSDL=1"
|
2021-12-06 16:07:01 +00:00
|
|
|
"CC=${stdenv.cc.targetPrefix}cc"
|
|
|
|
"CXX=${stdenv.cc.targetPrefix}c++"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
dontWrapQtApps = true;
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# https://docs.mamedev.org/initialsetup/compilingmame.html
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs =
|
2021-12-06 16:07:01 +00:00
|
|
|
[ 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 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# by default MAME assumes that paths with stock resources
|
|
|
|
# are relative and that you run MAME changing to
|
|
|
|
# install directory, so we add absolute paths here
|
2020-09-25 04:45:31 +00:00
|
|
|
patches = [
|
|
|
|
./emuopts.patch
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/emu/emuopts.cpp \
|
|
|
|
--subst-var-by mame ${dest}
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2021-01-17 00:15:33 +00:00
|
|
|
make -f dist.mak PTR64=${lib.optionalString stdenv.is64bit "1"}
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p ${dest}
|
|
|
|
mv build/release/*/Release/mame/* ${dest}
|
|
|
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
find ${dest} -maxdepth 1 -executable -type f -exec mv -t $out/bin {} \;
|
|
|
|
install -Dm755 src/osd/sdl/taputil.sh $out/bin/taputil.sh
|
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Is a multi-purpose emulation framework";
|
|
|
|
homepage = "https://www.mamedev.org/";
|
|
|
|
license = with licenses; [ bsd3 gpl2Plus ];
|
|
|
|
platforms = platforms.unix;
|
2021-12-06 16:07:01 +00:00
|
|
|
maintainers = with maintainers; [ thiagokokada ];
|
|
|
|
# macOS needs more time to build
|
|
|
|
timeout = 24 * 3600;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|