summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorGuillaume Le Vaillant <glv@posteo.net>2022-01-02 13:44:19 +0100
committerGuillaume Le Vaillant <glv@posteo.net>2022-01-02 13:51:49 +0100
commitfea60a2fff443b9c172ed28bd37361e34e064f13 (patch)
tree175bf8e9a917a7935746542e62dbc67cce92eb33 /gnu
parentf107c20e50d704fdf117426acc87121abd0fa501 (diff)
downloadguix-fea60a2fff443b9c172ed28bd37361e34e064f13.tar.gz
gnu: 0ad: Fix building with mozjs version other than 78.6.
Fixes <https://issues.guix.gnu.org/52913>.

* gnu/packages/games.scm (0ad)[native-inputs]: Remove labels.
  [arguments]: Add 'fix-mozjs-compatibility' phase.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/games.scm26
1 files changed, 19 insertions, 7 deletions
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index c61dafc7a0..f086252dba 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -42,7 +42,7 @@
 ;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2019, 2020 Jesse Gibbons <jgibbons2357+guix@gmail.com>
 ;;; Copyright © 2019 Dan Frumin <dfrumin@cs.ru.nl>
-;;; Copyright © 2019, 2020, 2021 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2019, 2020, 2021, 2022 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2019, 2020 Timotej Lazar <timotej.lazar@araneo.si>
 ;;; Copyright © 2019 Josh Holland <josh@inv.alid.pw>
 ;;; Copyright © 2019 Pkill -9 <pkill9@runbox.com>
@@ -6617,12 +6617,12 @@ fight against their plot and save his fellow rabbits from slavery.")
            wxwidgets
            zlib))
     (native-inputs
-     `(("boost" ,boost)
-       ("cmake" ,cmake-minimal)
-       ("cxxtest" ,cxxtest)
-       ("mesa" ,mesa)
-       ("pkg-config" ,pkg-config)
-       ("python-2" ,python-2)))
+     (list boost
+           cmake-minimal
+           cxxtest
+           mesa
+           pkg-config
+           python-2))
     (build-system gnu-build-system)
     (arguments
      `(#:make-flags '("config=release" "verbose=1" "-C" "build/workspaces/gcc")
@@ -6638,6 +6638,18 @@ fight against their plot and save his fellow rabbits from slavery.")
                 (string-append "\"" (assoc-ref inputs "cxxtest")
                                "/bin/cxxtestgen"
                                "\"")))))
+         (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.
+           (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, "))))
          (replace 'configure
            (lambda* (#:key inputs outputs tests? #:allow-other-keys)
              (let* ((jobs (number->string (parallel-job-count)))