guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 9b155db240680a1bbea602f2be73dcfe1f80ac7a
Author: Aiden Isik <[email protected]>
AuthorDate: Thu Jul 24 13:40:38 2025 +0100

    gnu: 0ad: Update to 0.27.1
    
    * gnu/packages/games.scm (0ad): Update to 0.27.1
    [arguments]<#:phases>: Add ‘patch-python-shebangs’, ‘prepare-builtin-libs’,
    ‘fix-gmake2-references’ and ‘build-builtin-libs’.
    {configure}: Add “--with-system-premake” and replace $CC by cc-for-target.
    {install}: Also install libraries/source/nvtt/lib.
    [inputs]: Replace mozjs-78 with mozjs-115.
    [native-inputs]: Add premake5.  Replace python-2 with python.
    
    Change-Id: I04d0b88e6bfe23c4e2d1248dd83017142f7beba1
---
 gnu/packages/games.scm | 88 +++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 73 insertions(+), 15 deletions(-)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 1526550006..fedf6591bd 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -94,6 +94,7 @@
 ;;; Copyright © 2025 Adrien 'neox' Bourmault <[email protected]>
 ;;; Copyright © 2025 Ada Stevenson <[email protected]>
 ;;; Copyright © 2025 Gabriel Santos <[email protected]>
+;;; Copyright © 2025 Aiden Isik <[email protected]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -8119,7 +8120,7 @@ fight against their plot and save his fellow rabbits from 
slavery.")
 (define-public 0ad-data
   (package
     (name "0ad-data")
-    (version "0.0.26-alpha")
+    (version "0.27.1")
     (source
      (origin
        (method url-fetch)
@@ -8127,7 +8128,7 @@ fight against their plot and save his fellow rabbits from 
slavery.")
                            version "-unix-data.tar.xz"))
        (file-name (string-append name "-" version ".tar.xz"))
        (sha256
-        (base32 "0z9dfw2hn2fyrx70866lv5464fbagdb8dip321wq10pqb22y805j"))))
+        (base32 "16592xq1ncjxc072rd4lzn2bp941fmfj85r0q1gh52qkvxnjszl3"))))
     (build-system trivial-build-system)
     (native-inputs (list tar unzip xz))
     (arguments
@@ -8167,7 +8168,7 @@ fight against their plot and save his fellow rabbits from 
slavery.")
 (define-public 0ad
   (package
     (name "0ad")
-    (version "0.0.26-alpha")
+    (version "0.27.1")
     (source
      (origin
        (method url-fetch)
@@ -8175,7 +8176,7 @@ fight against their plot and save his fellow rabbits from 
slavery.")
                            version "-unix-build.tar.xz"))
        (file-name (string-append name "-" version ".tar.xz"))
        (sha256
-        (base32 "0jzfq09ispi7740c01h6yqxqv9y3zx66d217z32pfbiiwgvns71f"))))
+        (base32 "1yvb04bxq1r7cva58xx0rgzdlx6ra1hp6w1p517x4s2rxdg3b9d0"))))
     ;; A snippet here would cause a build failure because of timestamps
     ;; reset.  See https://bugs.gnu.org/26734.
     (inputs
@@ -8185,7 +8186,7 @@ fight against their plot and save his fellow rabbits from 
slavery.")
            fmt
            freetype
            gloox
-           icu4c
+           icu4c-73
            libidn
            libpng
            libsodium
@@ -8193,7 +8194,7 @@ fight against their plot and save his fellow rabbits from 
slavery.")
            libxcursor
            libxml2
            miniupnpc
-           mozjs-78
+           mozjs-115
            openal
            sdl2
            wxwidgets
@@ -8204,7 +8205,8 @@ fight against their plot and save his fellow rabbits from 
slavery.")
            cxxtest
            mesa
            pkg-config
-           python-2))
+           python
+           premake5))
     (build-system gnu-build-system)
     (arguments
      `(#:make-flags '("config=release" "verbose=1" "-C" "build/workspaces/gcc")
@@ -8222,16 +8224,61 @@ fight against their plot and save his fellow rabbits 
from slavery.")
                                "\"")))))
          (add-after 'unpack 'fix-mozjs-compatibility
            ;; 0ad only builds fine with a specific version of mozjs
-           ;; (version 78.6 for 0ad-0.0.25).
-           ;; Here we change the error in case of version mismatch to a 
warning,
-           ;; and add some minor compatibility fixes.
+           ;; (version 115.16.1 for 0ad-0.27.1).
+           ;; Here we change the error in case of version mismatch to a 
warning.
            (lambda _
              (substitute* "source/scriptinterface/ScriptTypes.h"
                (("#error Your compiler is trying to use")
-                "#warning Your compiler is trying to use"))
-             (substitute* "source/scriptinterface/ScriptContext.cpp"
-               (("JS::PrepareZoneForGC\\(")
-                "JS::PrepareZoneForGC(m_cx, "))))
+                "#warning Your compiler is trying to use"))))
+         (add-after 'unpack 'patch-python-shebangs
+           ;; A couple Python scripts point to 'python' rather than 'python3'.
+           ;; They work fine under python3, so let's fix that.
+           (lambda _
+             (substitute* "source/tools/webservices/maint_graphics.py"
+               (("#!/usr/bin/env python")
+                "#!/usr/bin/env python3"))
+             (substitute* "source/tools/webservices/manage.py"
+               (("#!/usr/bin/env python")
+                "#!/usr/bin/env python3"))))
+         (add-after 'unpack 'prepare-builtin-libs
+           ;; Builtin libraries are included in the tarball as other tarballs.
+           ;; They're usually extracted during the build, but then shebangs
+           ;; within the libs don't get patched, so we do it here ourselves.
+           (lambda _
+             (let ((fcollada-version "28209")
+                   (nvtt-version "28209"))
+               (with-directory-excursion "libraries/source/fcollada"
+                 (invoke "tar" "-xvf"
+                         (string-append "fcollada-" fcollada-version 
".tar.xz"))
+                 (substitute* "build.sh"
+                   (("rm -Rf fcollada-[$][{]PV[}]")
+                    "")
+                   (("\"[$][{]TAR[}]\" xf fcollada-[$][{]PV[}].tar.xz")
+                    "")))
+               (with-directory-excursion "libraries/source/nvtt"
+                 (invoke "tar" "-xvf"
+                         (string-append "nvtt-" nvtt-version ".tar.xz"))
+                 (substitute* "build.sh"
+                   (("rm -Rf nvtt-[$][{]PV[}]")
+                    "")
+                   (("\"[$][{]TAR[}]\" xf nvtt-[$][{]PV[}].tar.xz")
+                    ""))))))
+         (add-after 'unpack 'fix-gmake2-references
+           ;; The current version of 0AD expects premake action 'gmake2',
+           ;; this was renamed to just 'gmake', so we patch to reflect that.
+           ;; Remove this when updating to the next release (fixed in main).
+           (lambda _
+             (substitute* "build/premake/cxxtest/cxxtest.lua"
+               (("gmake2")
+                "gmake"))
+             (substitute* "build/premake/premake5.lua"
+               (("if _ACTION == \"gmake\" then")
+                "if _ACTION == \"gmakelegacy\" then")
+               (("if _ACTION == \"gmake2\" then")
+                "if _ACTION == \"gmake\" then"))
+             (substitute* "build/workspaces/update-workspaces.sh"
+               (("gmake2")
+                "gmake"))))
          (replace 'configure
            (lambda* (#:key inputs outputs tests? #:allow-other-keys)
              (let* ((jobs (number->string (parallel-job-count)))
@@ -8239,15 +8286,25 @@ fight against their plot and save his fellow rabbits 
from slavery.")
                     (lib (string-append out "/lib"))
                     (data (string-append out "/share/0ad")))
                (setenv "JOBS" (string-append "-j" jobs))
-               (setenv "CC" "gcc")
+               (setenv "CC" ,(cc-for-target))
                (with-directory-excursion "build/workspaces"
                  (apply invoke
                         `("./update-workspaces.sh"
                           ,(string-append "--libdir=" lib)
                           ,(string-append "--datadir=" data)
                           ;; TODO: "--with-system-nvtt"
+                          "--with-system-premake5"
                           "--with-system-mozjs"
                           ,@(if tests? '() '("--without-tests"))))))))
+         (add-before 'build 'build-builtin-libs
+           (lambda _
+             (let ((jobs (number->string (parallel-job-count))))
+               (setenv "JOBS" (string-append "-j" jobs))
+               (setenv "CC" ,(cc-for-target))
+               (with-directory-excursion "libraries/source/fcollada"
+                                         (invoke "./build.sh"))
+               (with-directory-excursion "libraries/source/nvtt"
+                                         (invoke "./build.sh")))))
          (delete 'check)
          (replace 'install
            (lambda* (#:key inputs outputs #:allow-other-keys)
@@ -8271,6 +8328,7 @@ fight against their plot and save his fellow rabbits from 
slavery.")
                (for-each (lambda (file)
                            (install-file file lib))
                          (find-files "system" "\\.so$"))
+               (copy-recursively "../libraries/source/nvtt/lib" lib)
                ;; binaries
                (install-file "system/pyrogenesis" bin)
                (with-directory-excursion bin

Reply via email to