diff mbox series

[bug#57491] patch series: Update Raku ecosystem

Message ID 209b7ee5a4550c6de4495ef66584f718@codesections.com
State New
Headers show
Series [bug#57491] patch series: Update Raku ecosystem | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Daniel Sockwell Aug. 30, 2022, 4:49 p.m. UTC
The third patch in this series updates NQP, the sub-language that
the Raku compiler depends on.

Best,
Daniel

From 924cc46a38b103906d534e9554fca9499315e12c Mon Sep 17 00:00:00 2001
Message-Id: <924cc46a38b103906d534e9554fca9499315e12c.1661878022.git.daniel@codesections.com>
From: Daniel Sockwell <daniel@codesections.com>
Date: Tue, 30 Aug 2022 12:46:51 -0400
Subject: [PATCH] nqp 2019.03->2022.07

---
 .../nqp.do-not-pull-files-via-git.patch       | 26 +++++++
 gnu/packages/perl6.scm                        | 73 +++++++++----------
 2 files changed, 61 insertions(+), 38 deletions(-)
 create mode 100644 gnu/packages/patches/nqp.do-not-pull-files-via-git.patch
diff mbox series

Patch

diff --git a/gnu/packages/patches/nqp.do-not-pull-files-via-git.patch b/gnu/packages/patches/nqp.do-not-pull-files-via-git.patch
new file mode 100644
index 0000000000..b99919286f
--- /dev/null
+++ b/gnu/packages/patches/nqp.do-not-pull-files-via-git.patch
@@ -0,0 +1,26 @@ 
+# Don't fetch nqp-configure from git (Guix supplies it as an input)
+diff --git a/Configure.pl b/Configure.patched.pl
+index ded227d..1fd59c8 100755
+--- a/Configure.pl
++++ b/Configure.patched.pl
+@@ -11,20 +11,6 @@ use File::Spec;
+ use File::Path;
+ use FindBin;
+ 
+-BEGIN {
+-    # Download / Update submodules
+-    my $set_config = !qx{git config nqp.initialized};
+-    if ( !-e '3rdparty/nqp-configure/LICENSE' ) {
+-        my $code = system($^X, 'tools/build/update-submodules.pl', Cwd::cwd(), @ARGV);
+-        exit 1 if $code >> 8 != 0;
+-        $set_config = 1;
+-    }
+-    if ($set_config) {
+-        system("git config submodule.recurse true");
+-        system("git config nqp.initialized 1");
+-    }
+-}
+-
+ use lib ( "$FindBin::Bin/tools/lib",
+     "$FindBin::Bin/3rdparty/nqp-configure/lib", );
+ use NQP::Config qw<system_or_die>;
diff --git a/gnu/packages/perl6.scm b/gnu/packages/perl6.scm
index 086fc9d2e2..5f43cd59aa 100644
--- a/gnu/packages/perl6.scm
+++ b/gnu/packages/perl6.scm
@@ -26,6 +26,7 @@  (define-module (gnu packages perl6)
   #:use-module (guix build-system copy)
   #:use-module (guix build-system perl)
   #:use-module (guix build-system rakudo)
+  #:use-module (gnu packages)
   #:use-module (gnu packages bdw-gc)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages libffi)
@@ -126,19 +127,20 @@  (define-public nqp-configure
 (define-public nqp
   (package
     (name "nqp")
-    (version "2019.03")
+    (version "2022.07")
     (source
-      (origin
-        (method url-fetch)
-        (uri (string-append "https://rakudo.perl6.org/downloads/nqp/nqp-"
-                            version ".tar.gz"))
-        (sha256
-         (base32
-          "183zhll13fx416s3hkg4bkvib77kyr857h0nydgrl643fpacxp83"))
-        (modules '((guix build utils)))
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://github.com/Raku/nqp/releases/download/2022.07/nqp-"
+             version ".tar.gz"))
+
+       (sha256 (base32 "0s124fl2kjahbhr52n92pw9gv1flr099kmlg04358ak7dl81q22q"))
+       (patches (search-patches "nqp.do-not-pull-files-via-git.patch"))
+       (modules '((guix build utils)))
         (snippet
          '(begin
-            (delete-file-recursively "3rdparty") #t))))
+            (delete-file-recursively "3rdparty")))))
     (build-system perl-build-system)
     (arguments
      '(#:phases
@@ -149,42 +151,37 @@  (define-public nqp
                             "tools/build/gen-js-cross-runner.pl"
                             "tools/build/gen-js-runner.pl"
                             "tools/build/install-js-runner.pl"
-                            "tools/build/install-moar-runner.pl"
-                            "tools/build/gen-moar-runner.pl"
                             "t/nqp/111-spawnprocasync.t"
                             "t/nqp/113-run-command.t")
-               (("/bin/sh") (which "sh")))
-             #t))
-         (add-after 'unpack 'patch-source-date
-           (lambda _
-             (substitute* "tools/build/gen-version.pl"
-               (("gmtime") "gmtime(0)"))
-             #t))
-         (add-after 'unpack 'remove-failing-test
-           ;; One subtest fails for unknown reasons
-           (lambda _
-             (delete-file "t/nqp/019-file-ops.t")
-             #t))
+               (("/bin/sh") (which "sh")))))
          (replace 'configure
            (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((out  (assoc-ref outputs "out"))
-                   (moar (assoc-ref inputs "moarvm")))
+             (let ((out        (assoc-ref outputs "out"))
+                   (moar       (assoc-ref inputs "moarvm"))
+                   (nqp-config (assoc-ref inputs "nqp-configure")))
+               (setenv "PERL5LIB" (string-append
+                                   nqp-config "/lib:" (or (getenv "PERL5LIB")
+                                                          "")))
+               ; MoarVM has some M_AST files that NQP expects to share
+               (copy-recursively (string-append moar "/share/nqp/lib")
+                                 (string-append out  "/share/nqp/lib"))
                (invoke "perl" "Configure.pl"
                        "--backends=moar"
                        "--with-moar" (string-append moar "/bin/moar")
                        "--prefix" out)))))))
-    (inputs
-     (list moarvm))
-    (home-page "https://github.com/perl6/nqp")
-    (synopsis "Not Quite Perl")
-    (description "This is \"Not Quite Perl\" -- a lightweight Perl 6-like
-environment for virtual machines.  The key feature of NQP is that it's designed
-to be a very small environment (as compared with, say, perl6 or Rakudo) and is
-focused on being a high-level way to create compilers and libraries for virtual
-machines like MoarVM, the JVM, and others.
-
-Unlike a full-fledged implementation of Perl 6, NQP strives to have as small a
-runtime footprint as it can, while still providing a Perl 6 object model and
+
+    (inputs (list moarvm))
+    (native-inputs (list nqp-configure))
+    (home-page "https://github.com/Raku/nqp")
+    (synopsis "Small programming language built for writing compilers and VMs")
+    (description "NQP is \"Not Quite Perl\", a lightweight Raku-like programming
+language that's designed to provide a high-level way to create compilers and
+libraries for virtual machines.  NQP is used to implement the Rakudo compiler
+and to integrate Rakudo with various virtual machines, including MoarVM and the
+Java Virtual Machine.
+
+Unlike a full-fledged implementation of Raku, NQP strives to have as small a
+runtime footprint as it can while still providing Raku's object model and
 regular expression engine for the virtual machine.")
     (license license:artistic2.0)))