From c5668943cd26e7d9406fbd634d99d253963f9221 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Thu, 10 Nov 2022 12:30:43 +0000 Subject: [PATCH] mame: some improvements - Do not depend on `dist.mak` during installPhase anymore, instead packaging everything manually. This removes the necessity of a patching it, and also we have more control - Use system's sqlite instead of the bundled one - General clean-up --- ...-Added-PDF-documentation-to-dist.mak.patch | 37 ------------------- pkgs/applications/emulators/mame/default.nix | 24 +++++------- 2 files changed, 10 insertions(+), 51 deletions(-) delete mode 100644 pkgs/applications/emulators/mame/0001-Revert-Added-PDF-documentation-to-dist.mak.patch diff --git a/pkgs/applications/emulators/mame/0001-Revert-Added-PDF-documentation-to-dist.mak.patch b/pkgs/applications/emulators/mame/0001-Revert-Added-PDF-documentation-to-dist.mak.patch deleted file mode 100644 index cee425eaa93d..000000000000 --- a/pkgs/applications/emulators/mame/0001-Revert-Added-PDF-documentation-to-dist.mak.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 54aebffc4584ee68149d4b5b64ceaa79a82b8427 Mon Sep 17 00:00:00 2001 -From: Thiago Kenji Okada -Date: Sat, 9 Apr 2022 13:16:08 +0100 -Subject: [PATCH] Revert "Added PDF documentation to dist.mak" - -This reverts commit c0e93076232e794c919231e4386445d78b2d80b1. ---- - dist.mak | 8 +------- - 1 file changed, 1 insertion(+), 7 deletions(-) - -diff --git a/dist.mak b/dist.mak -index edbb4cd67cb..c378dfdf708 100644 ---- a/dist.mak -+++ b/dist.mak -@@ -109,7 +109,7 @@ GEN_FOLDERS := $(addprefix $(STAGEDIR)/,$(CREATED_DIRS)) - COPY_BINARIES := $(addprefix $(STAGEDIR)/,$(addsuffix $(EXE),$(BINARIES))) - COPY_FILES := $(addprefix $(STAGEDIR)/,$(COPIED_FILES)) - --all: $(COPY_BINARIES) $(COPY_FILES) $(STAGEDIR)/docs/MAME.pdf -+all: $(COPY_BINARIES) $(COPY_FILES) - - clean: - $(SILENT) rm -rf $(STAGEDIR) -@@ -124,10 +124,4 @@ $(STAGEDIR)/%: $(BINDIR)/% | $(GEN_FOLDERS) - $(STAGEDIR)/%: % | $(GEN_FOLDERS) - $(call COPY,$<,$@) - --$(STAGEDIR)/docs/MAME.pdf: docs/build/latex/MAME.pdf | $(GEN_FOLDERS) -- $(call COPY,$<,$@) -- --docs/build/latex/MAME.pdf: -- $(MAKE) -C docs latexpdf -- - .PHONY: all clean --- -2.33.1 - diff --git a/pkgs/applications/emulators/mame/default.nix b/pkgs/applications/emulators/mame/default.nix index cd5d718c8a4e..48d77ce5e6fe 100644 --- a/pkgs/applications/emulators/mame/default.nix +++ b/pkgs/applications/emulators/mame/default.nix @@ -28,6 +28,7 @@ , rapidjson , SDL2 , SDL2_ttf +, sqlite , utf8proc , which , writeScript @@ -71,6 +72,7 @@ stdenv.mkDerivation rec { "USE_SYSTEM_LIB_PUGIXML=1" "USE_SYSTEM_LIB_RAPIDJSON=1" "USE_SYSTEM_LIB_UTF8PROC=1" + "USE_SYSTEM_LIB_SQLITE3=1" "USE_SYSTEM_LIB_ZLIB=1" ]; @@ -91,6 +93,7 @@ stdenv.mkDerivation rec { glm SDL2 SDL2_ttf + sqlite qtbase ] ++ lib.optionals stdenv.isLinux [ alsa-lib libpulseaudio libXinerama libXi fontconfig ] @@ -106,11 +109,6 @@ stdenv.mkDerivation rec { ]; patches = [ - # MAME is now generating the PDF documentation on its release script since commit: - # https://github.com/mamedev/mame/commit/c0e93076232e794c919231e4386445d78b2d80b1 - # however this needs sphinx+latex to build, and it is available in the website - # anyway for those who need it - ./0001-Revert-Added-PDF-documentation-to-dist.mak.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 @@ -139,18 +137,15 @@ stdenv.mkDerivation rec { installPhase = '' runHook preInstall - make -f dist.mak PTR64=${lib.optionalString stdenv.is64bit "1"} - # mame mkdir -p ${dest} - mv build/release/*/Release/mame/* ${dest} - find ${dest} -maxdepth 1 -executable -type f -delete; install -Dm755 mame -t $out/bin install -Dm644 ${icon} $out/share/icons/hicolor/scalable/apps/mame.svg - installManPage ${dest}/docs/man/*.1 ${dest}/docs/man/*.6 - - mv artwork plugins samples ${dest} + 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 # mame-tools for _i in castool chdman floptool imgtool jedutil ldresample ldverify nltool nlwav pngcmp regrep romcmp \ @@ -162,9 +157,10 @@ stdenv.mkDerivation rec { runHook postInstall ''; + # man1 is the tools documentation, man6 is the emulator documentation + # Need to be done in postFixup otherwise multi-output hook will move it back to $out postFixup = '' - mkdir -p $tools/share/man - mv {$out,$tools}/share/man/man1 + moveToOutput share/man/man1 $tools ''; enableParallelBuilding = true;