nixpkgs/pkgs/misc/emulators/mame/default.nix

75 lines
2.1 KiB
Nix
Raw Normal View History

2019-12-06 20:43:40 +00:00
{ stdenv, mkDerivation, fetchFromGitHub, makeDesktopItem, makeWrapper
2019-10-30 19:29:51 +00:00
, python, pkgconfig, SDL2, SDL2_ttf, alsaLib, which, qtbase, libXinerama }:
let
majorVersion = "0";
2019-12-06 20:43:40 +00:00
minorVersion = "216";
2019-10-30 19:29:51 +00:00
desktopItem = makeDesktopItem {
name = "MAME";
exec = "mame${stdenv.lib.optionalString stdenv.is64bit "64"}";
desktopName = "MAME";
genericName = "MAME is a multi-purpose emulation framework";
categories = "System;Emulator;";
};
2019-12-06 20:43:40 +00:00
dest = "$out/opt/mame";
2019-10-30 19:29:51 +00:00
in mkDerivation {
pname = "mame";
version = "${majorVersion}.${minorVersion}";
src = fetchFromGitHub {
owner = "mamedev";
repo = "mame";
rev = "mame${majorVersion}${minorVersion}";
2019-12-06 20:43:40 +00:00
sha256 = "0dmmw08pxxznvadrc51zg27jc9fjh688355w8kxkmi7k8qa367r0";
2019-10-30 19:29:51 +00:00
};
hardeningDisable = [ "fortify" ];
NIX_CFLAGS_COMPILE = [ "-Wno-error=maybe-uninitialized" ];
makeFlags = [ "TOOLS=1" ];
2019-12-06 20:43:40 +00:00
dontWrapQtApps = true;
2019-10-30 19:29:51 +00:00
buildInputs = [ SDL2 SDL2_ttf alsaLib qtbase libXinerama ];
2019-12-06 20:43:40 +00:00
nativeBuildInputs = [ python pkgconfig which makeWrapper ];
2019-10-30 19:29:51 +00:00
2019-12-06 20:43:40 +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
patches = [ ./emuopts.patch ];
2019-10-30 19:29:51 +00:00
2019-12-06 20:43:40 +00:00
postPatch = ''
substituteInPlace src/emu/emuopts.cpp \
--subst-var-by mame ${dest}
'';
installPhase = ''
make -f dist.mak PTR64=${stdenv.lib.optionalString stdenv.is64bit "1"}
mkdir -p ${dest}
mv build/release/*/Release/mame/* ${dest}
2019-10-30 19:29:51 +00:00
mkdir -p $out/bin
2019-12-06 20:43:40 +00:00
find ${dest} -maxdepth 1 -executable -type f -exec mv -t $out/bin {} \;
install -Dm755 src/osd/sdl/taputil.sh $out/bin/taputil.sh
2019-10-30 19:29:51 +00:00
mkdir -p $out/share/man/man{1,6}
2019-12-06 20:43:40 +00:00
mv ${dest}/docs/man/*.1 $out/share/man/man1
mv ${dest}/docs/man/*.6 $out/share/man/man6
mv artwork plugins samples ${dest}
2019-10-30 19:29:51 +00:00
mkdir -p $out/share
ln -s ${desktopItem}/share/applications $out/share
'';
meta = with stdenv.lib; {
description = "Is a multi-purpose emulation framework";
homepage = https://www.mamedev.org/;
license = with licenses; [ bsd3 gpl2Plus ];
platforms = [ "x86_64-linux" "i686-linux" ];
maintainers = with maintainers; [ gnidorah ];
};
}