mame: refactor

- Use mame icon from papirus instead of downloading one from Archlinux packages;
- Rename the diff file to something more self-documenting;
- Add longDescription to mame;
- Add description to mame-tools;
- Get rid of top-level inheritance.
This commit is contained in:
AndersonTorres
2022-12-06 19:24:50 -03:00
parent 6b5cf5342e
commit 83d89a2fad
3 changed files with 61 additions and 49 deletions
@@ -10,18 +10,18 @@
- { OPTION_CTRLRPATH, "ctrlr", core_options::option_type::STRING, "path to controller definitions" },
- { OPTION_INIPATH, ".;ini;ini/presets", core_options::option_type::STRING, "path to ini files" },
- { OPTION_FONTPATH, ".", core_options::option_type::STRING, "path to font files" },
+ { OPTION_HASHPATH ";hash_directory;hash", "hash;@mame@/hash", core_options::option_type::STRING, "path to software definition files" },
+ { OPTION_SAMPLEPATH ";sp", "samples;@mame@/samples", core_options::option_type::STRING, "path to audio sample sets" },
+ { OPTION_ARTPATH, "artwork;@mame@/artwork", core_options::option_type::STRING, "path to artwork files" },
+ { OPTION_CTRLRPATH, "ctrlr;@mame@/ctrlr", core_options::option_type::STRING, "path to controller definitions" },
+ { OPTION_INIPATH, ".;ini;ini/presets;@mame@/ini/presets", core_options::option_type::STRING, "path to ini files" },
+ { OPTION_FONTPATH, ".;@mame@", core_options::option_type::STRING, "path to font files" },
+ { OPTION_HASHPATH ";hash_directory;hash", "hash;@mamePath@/hash", core_options::option_type::STRING, "path to software definition files" },
+ { OPTION_SAMPLEPATH ";sp", "samples;@mamePath@/samples", core_options::option_type::STRING, "path to audio sample sets" },
+ { OPTION_ARTPATH, "artwork;@mamePath@/artwork", core_options::option_type::STRING, "path to artwork files" },
+ { OPTION_CTRLRPATH, "ctrlr;@mamePath@/ctrlr", core_options::option_type::STRING, "path to controller definitions" },
+ { OPTION_INIPATH, ".;ini;ini/presets;@mamePath@/ini/presets", core_options::option_type::STRING, "path to ini files" },
+ { OPTION_FONTPATH, ".;@mamePath@", core_options::option_type::STRING, "path to font files" },
{ OPTION_CHEATPATH, "cheat", core_options::option_type::STRING, "path to cheat files" },
{ OPTION_CROSSHAIRPATH, "crosshair", core_options::option_type::STRING, "path to crosshair files" },
- { OPTION_PLUGINSPATH, "plugins", core_options::option_type::STRING, "path to plugin files" },
- { OPTION_LANGUAGEPATH, "language", core_options::option_type::STRING, "path to UI translation files" },
+ { OPTION_PLUGINSPATH, "plugins;@mame@/plugins", core_options::option_type::STRING, "path to plugin files" },
+ { OPTION_LANGUAGEPATH, "language;@mame@/language", core_options::option_type::STRING, "path to UI translation files" },
+ { OPTION_PLUGINSPATH, "plugins;@mamePath@/plugins", core_options::option_type::STRING, "path to plugin files" },
+ { OPTION_LANGUAGEPATH, "language;@mamePath@/language", core_options::option_type::STRING, "path to UI translation files" },
{ OPTION_SWPATH, "software", core_options::option_type::STRING, "path to loose software" },
// output directory options
+49 -37
View File
@@ -1,24 +1,24 @@
{ lib
, stdenv
, alsa-lib
, copyDesktopItems
, CoreAudioKit
, expat
, fetchFromGitHub
, fetchurl
, alsa-lib
, SDL2
, SDL2_ttf
, copyDesktopItems
, expat
, flac
, fontconfig
, ForceFeedback
, glm
, installShellFiles
, libXi
, libXinerama
, libjpeg
, libpcap
, libpulseaudio
, libXi
, libXinerama
, lua5_3
, makeDesktopItem
, makeWrapper
, papirus-icon-theme
, pkg-config
, portaudio
, portmidi
@@ -26,31 +26,27 @@
, python3
, qtbase
, rapidjson
, SDL2
, SDL2_ttf
, sqlite
, substituteAll
, utf8proc
, which
, writeScript
, zlib
, darwin
}:
let
# Get icon from Arch Linux package
icon = fetchurl {
url = "https://raw.githubusercontent.com/archlinux/svntogit-community/614b24ef3856cb52b5cafc386b0f77923cbc9156/trunk/mame.svg";
sha256 = "sha256-F8RCyTPXZBdeTOHeUKgMDC3dXXM8rwnDzV5rppesQ/Q=";
};
dest = "$out/opt/mame";
inherit (darwin.apple_sdk.frameworks) CoreAudioKit ForceFeedback;
in
stdenv.mkDerivation rec {
pname = "mame";
version = "0.250";
srcVersion = builtins.replaceStrings [ "." ] [ "" ] version;
src = fetchFromGitHub {
owner = "mamedev";
repo = "mame";
rev = "mame${builtins.replaceStrings [ "." ] [ "" ] version}";
rev = "mame${srcVersion}";
sha256 = "sha256-jexs/1ovRk9Is5orD7hT9fN+dYm+WA+57aZ6JH7zjL4=";
};
@@ -109,17 +105,15 @@ stdenv.mkDerivation rec {
];
patches = [
# 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
./emuopts.patch
# 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
(substituteAll {
mamePath = "$out/opt/mame";
src = ./001-use-absolute-paths.diff;
})
];
postPatch = ''
substituteInPlace src/emu/emuopts.cpp \
--subst-var-by mame ${dest}
'';
desktopItems = [
(makeDesktopItem {
name = "MAME";
@@ -134,23 +128,26 @@ stdenv.mkDerivation rec {
})
];
installPhase = ''
# TODO: copy shaders from src/osd/modules/opengl/shader/glsl*.*h
# to the final package after we figure out how they work
installPhase = let
icon = "${papirus-icon-theme}/share/icons/Papirus/32x32/apps/mame.svg";
in ''
runHook preInstall
# mame
mkdir -p ${dest}
mkdir -p $out/opt/mame
install -Dm755 mame -t $out/bin
install -Dm644 ${icon} $out/share/icons/hicolor/scalable/apps/mame.svg
installManPage docs/man/*.1 docs/man/*.6
cp -ar {artwork,bgfx,plugins,language,ctrlr,keymaps,hash} ${dest}
# TODO: copy shaders from src/osd/modules/opengl/shader/glsl*.*h
# to the final package after we figure out how they work
cp -ar {artwork,bgfx,plugins,language,ctrlr,keymaps,hash} $out/opt/mame
# mame-tools
for _i in castool chdman floptool imgtool jedutil ldresample ldverify nltool nlwav pngcmp regrep romcmp \
split srcclean testkeys unidasm; do
install -Dm755 $_i -t $tools/bin
for _tool in castool chdman floptool imgtool jedutil ldresample ldverify \
nltool nlwav pngcmp regrep romcmp split srcclean testkeys \
unidasm; do
install -Dm755 $_tool -t $tools/bin
done
mv $tools/bin/{,mame-}split
@@ -176,11 +173,26 @@ stdenv.mkDerivation rec {
'';
meta = with lib; {
broken = stdenv.isDarwin;
description = "Is a multi-purpose emulation framework";
homepage = "https://www.mamedev.org/";
description = "A multi-purpose emulation framework";
longDescription = ''
MAME's purpose is to preserve decades of software history. As electronic
technology continues to rush forward, MAME prevents this important
"vintage" software from being lost and forgotten. This is achieved by
documenting the hardware and how it functions. The source code to MAME
serves as this documentation. The fact that the software is usable serves
primarily to validate the accuracy of the documentation (how else can you
prove that you have recreated the hardware faithfully?). Over time, MAME
(originally stood for Multiple Arcade Machine Emulator) absorbed the
sister-project MESS (Multi Emulator Super System), so MAME now documents a
wide variety of (mostly vintage) computers, video game consoles and
calculators, in addition to the arcade video games that were its initial
focus.
'';
changelog = "https://github.com/mamedev/mame/releases/download/mame${srcVersion}/whatsnew_${srcVersion}.txt";
license = with licenses; [ bsd3 gpl2Plus ];
platforms = platforms.unix;
maintainers = with maintainers; [ thiagokokada ];
platforms = platforms.unix;
broken = stdenv.isDarwin;
};
}
+4 -4
View File
@@ -2024,11 +2024,11 @@ with pkgs;
maiko = callPackage ../applications/emulators/maiko { };
mame = libsForQt5.callPackage ../applications/emulators/mame {
inherit (darwin.apple_sdk.frameworks) CoreAudioKit ForceFeedback;
};
mame = libsForQt5.callPackage ../applications/emulators/mame { };
mame-tools = (lib.getOutput "tools" mame);
mame-tools = lib.addMetaAttrs {
description = mame.meta.description + " (tools only)";
} (lib.getOutput "tools" mame);
mednafen = callPackage ../applications/emulators/mednafen {
inherit (darwin) libiconv;