[bug#76545,v2] gnu: mame: Update to 0.275.

Message ID 5179ae334bbc5b51d217a8cd310758add6a1e5d5.1741823527.git.mail@nicolasgoaziou.fr
State New
Headers
Series [bug#76545,v2] gnu: mame: Update to 0.275. |

Commit Message

Nicolas Goaziou March 13, 2025, 3:53 p.m. UTC
  * gnu/packages/emulators.scm (mame): Update to 0.275.
[source]: Add modules for cut and scandir.  Preserve the minimum set of
third-party libraries.
[arguments]<#:make-flags>: Remove unnecessary flags.
<#:phases>: Add a phase to use all possible system libraries instead of
listing them piece wise.
[native-inputs]: Add nasm.
[inputs]: Replace lua with lua-5.4. Add zstd:lib.

Change-Id: I650a008461d69e5a39ba6a12e7140aa785dc0298
---

- v2: Update to 0.275. Add zstd:lib as an input.

 gnu/packages/emulators.scm | 74 +++++++++++++++++++++++++++-----------
 1 file changed, 54 insertions(+), 20 deletions(-)


base-commit: d83d4653e42da26bfb4548f9fcf1bd6e323b40fe
  

Comments

宋文武 March 14, 2025, 5:58 a.m. UTC | #1
Hello,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> * gnu/packages/emulators.scm (mame): Update to 0.275.
> [source]: Add modules for cut and scandir.  Preserve the minimum set of
> third-party libraries.
> [arguments]<#:make-flags>: Remove unnecessary flags.
> <#:phases>: Add a phase to use all possible system libraries instead of
> listing them piece wise.
> [native-inputs]: Add nasm.
> [inputs]: Replace lua with lua-5.4. Add zstd:lib.
> [...]
>        #~(modify-phases %standard-phases
> +          ;; (add-after 'unpack 'fix-sol2-build-error
> +          ;;   ;; Fix "error: operator '!=' has no left operand" because
> +          ;;   ;; LUA_COMPAT_BITLIB is empty.
> +          ;;   (lambda _
> +          ;;     (substitute* "3rdparty/sol2/sol/sol.hpp"
> +          ;;       (("&& \\(LUA_COMPAT_BITLIB != 0\\)") ""))))

Does this commented phase useful?  Maybe just remove it.

Otherwise looks good to me, thanks.
  
Nicolas Goaziou March 14, 2025, 6:36 a.m. UTC | #2
Hello,

宋文武 via Guix-patches via <guix-patches@gnu.org> writes:

> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>> * gnu/packages/emulators.scm (mame): Update to 0.275.
>> [source]: Add modules for cut and scandir.  Preserve the minimum set of
>> third-party libraries.
>> [arguments]<#:make-flags>: Remove unnecessary flags.
>> <#:phases>: Add a phase to use all possible system libraries instead of
>> listing them piece wise.
>> [native-inputs]: Add nasm.
>> [inputs]: Replace lua with lua-5.4. Add zstd:lib.
>> [...]
>>        #~(modify-phases %standard-phases
>> +          ;; (add-after 'unpack 'fix-sol2-build-error
>> +          ;;   ;; Fix "error: operator '!=' has no left operand" because
>> +          ;;   ;; LUA_COMPAT_BITLIB is empty.
>> +          ;;   (lambda _
>> +          ;;     (substitute* "3rdparty/sol2/sol/sol.hpp"
>> +          ;;       (("&& \\(LUA_COMPAT_BITLIB != 0\\)") ""))))
>
> Does this commented phase useful?  Maybe just remove it.

You’re right. I had forgotten about this comment. I’ll remove it when
the package is ready or at the next iteration. However, at the moment,
this package doesn’t want to build…

Regards,
  

Patch

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index 2bed105653..b7dd141120 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -6,7 +6,7 @@ 
 ;;; Copyright © 2015, 2018, 2023 David Thompson <dthompson2@worcester.edu>
 ;;; Copyright © 2016 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
 ;;; Copyright © 2016, 2017, 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2017-2024 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2017-2025 Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;;; Copyright © 2017, 2020, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
 ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
@@ -3025,7 +3025,7 @@  (define-public libticalcs2
 (define-public mame
   (package
     (name "mame")
-    (version "0.252")
+    (version "0.275")
     (source
      (origin
        (method git-fetch)
@@ -3034,33 +3034,65 @@  (define-public mame
              (commit (apply string-append "mame" (string-split version #\.)))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "07qhcm1v47sy2wj30nx3cbhvcbgki0cl83gabr0miiw60fhgyn6j"))
-       (modules '((guix build utils)))
+        (base32 "178wvdr126klz4xmhiv737xys6d3wvgrs216h9544y4s1pvxskpk"))
+       (modules '((ice-9 ftw)
+                  (srfi srfi-26)
+                  (guix build utils)))
        (snippet
-        ;; Remove bundled libraries.
-        '(begin
-           (with-directory-excursion "3rdparty"
-             (for-each delete-file-recursively
-                       '("asio" "expat" "glm" "libflac" "libjpeg" "lua"
-                         "portaudio" "portmidi" "pugixml" "rapidjson" "SDL2"
-                         "SDL2-override" "sqlite3" "utf8proc" "zlib")))))))
+        ;; Remove most bundled libraries.
+        ;;
+        ;; XXX: Some of the preserved the libraries below ship with Guix, but
+        ;; may prove difficult to un-bundle.
+        #~(with-directory-excursion "3rdparty"
+            (let ((keep (list "." ".."
+                              "asmjit"
+                              "bgfx"
+                              "bimg"
+                              "bx"
+                              "genie"
+                              "linenoise"
+                              "lsqlite3"
+                              "lua-linenoise"
+                              "lua-zlib"
+                              "luafilesystem"
+                              "lzma"
+                              "minimp3"
+                              "nanosvg"
+                              "softfloat"
+                              "softfloat3"
+                              "sol2"
+                              "wdlfft"
+                              "ymfm")))
+              (for-each delete-file-recursively
+                        (scandir "." (negate (cut member <> keep)))))))))
     (build-system gnu-build-system)
     (arguments
      (list
       #:make-flags
-      #~(cons*
+      #~(list
          ;; A 'strict-overflow' error pops up on i686 so disable '-Werror'.
          "NOWERROR=1"
          (string-append "QT_HOME=" #$(this-package-input "qtbase"))
-         (string-append "SDL_INI_PATH=" #$output "/share/mame/ini")
-         (map (lambda (lib)
-                (string-append "USE_SYSTEM_LIB_" (string-upcase lib) "=1"))
-              '("asio" "expat" "flac" "glm" "jpeg" "lua" "portaudio" "portmidi"
-                "pugixml" "rapidjson" "sqlite3" "utf8proc" "zlib")))
+         (string-append "SDL_INI_PATH=" #$output "/share/mame/ini"))
       #:tests? #f                       ;no test in regular release
       #:phases
       #~(modify-phases %standard-phases
+          ;; (add-after 'unpack 'fix-sol2-build-error
+          ;;   ;; Fix "error: operator '!=' has no left operand" because
+          ;;   ;; LUA_COMPAT_BITLIB is empty.
+          ;;   (lambda _
+          ;;     (substitute* "3rdparty/sol2/sol/sol.hpp"
+          ;;       (("&& \\(LUA_COMPAT_BITLIB != 0\\)") ""))))
           (delete 'configure)
+          (add-before 'build 'use-system-libraries
+            (lambda _
+              (substitute* "makefile"
+                (("# +(USE_SYSTEM_LIB)" _ option) option))))
+          (add-before 'build 'use-c++-lua
+            (lambda _
+              (substitute* (list "scripts/src/main.lua"
+                                 "scripts/src/3rdparty.lua")
+                (("ext_lib\\(\"lua\"\\)") "ext_lib(\"lua++\")"))))
           (add-after 'build 'build-documentation
             (lambda _ (invoke "make" "-C" "docs" "man" "info")))
           (replace 'install
@@ -3163,7 +3195,8 @@  (define-public mame
                            Keywords=Game;Emulator;Arcade;~%"
                             executable)))))))))
     (native-inputs
-     (list pkg-config
+     (list nasm
+           pkg-config
            python-sphinx
            python-sphinxcontrib-svg2pdfconverter
            texinfo))
@@ -3177,7 +3210,7 @@  (define-public mame
            libjpeg-turbo
            libxi
            libxinerama
-           lua
+           lua-5.4
            portaudio
            portmidi
            pugixml
@@ -3188,7 +3221,8 @@  (define-public mame
            (sdl-union (list sdl2 sdl2-ttf))
            sqlite
            utf8proc
-           zlib))
+           zlib
+           `(,zstd "lib")))
     (home-page "https://www.mamedev.org")
     (synopsis "Multi-purpose emulation framework")
     (description "MAME's purpose is to preserve decades of software