guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#58235] [PATCH] rakdo-build-system (2 of 3)


From: Daniel Sockwell
Subject: [bug#58235] [PATCH] rakdo-build-system (2 of 3)
Date: Sun, 02 Oct 2022 04:27:33 +0000

As previously indicated, this is the second of three patches to update
the Raku ecosystem.  This patch contains updates to the core Raku packages
that are used to build/test the rest of the ecosystem; these updates align
the core packages with the changes to rakudo-build-system in the previous
patch.

For clarity, I split changes to different packages into separate commits.
The final patch in this series will complete the update process for the
Raku ecosystem.

Best,
Daniel

From 8a76462dfb478f0d7290e1facecf51153257be8f Mon Sep 17 00:00:00 2001
Message-Id: 
<8a76462dfb478f0d7290e1facecf51153257be8f.1664684430.git.daniel@codesections.com>
From: Daniel Sockwell <daniel@codesections.com>
Date: Sat, 1 Oct 2022 19:10:04 -0400
Subject: [PATCH 1/5] gnu: moarvm: Update 2019.03 -> 2022.07

* gnu/packages/perl6.scm Update MoarVM to 2022.07
Change build system from perl-build-system to gnu-build-system
Update synopsis and description
---
 gnu/packages/perl6.scm | 97 ++++++++++++++++++++++--------------------
 1 file changed, 51 insertions(+), 46 deletions(-)

diff --git a/gnu/packages/perl6.scm b/gnu/packages/perl6.scm
index dab9dd477b..b4e1ac8c27 100644
--- a/gnu/packages/perl6.scm
+++ b/gnu/packages/perl6.scm
@@ -22,11 +22,14 @@ (define-module (gnu packages perl6)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix packages)
+  #:use-module (guix build-system gnu)
   #: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)
+  #:use-module (gnu packages perl)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages tls))
@@ -34,65 +37,67 @@ (define-module (gnu packages perl6)
 (define-public moarvm
   (package
     (name "moarvm")
-    (version "2019.03")
+    (version "2022.07")
     (source
-      (origin
-        (method url-fetch)
-        (uri (string-append "https://moarvm.org/releases/MoarVM-";
-                            version ".tar.gz"))
-        (sha256
-         (base32
-          "017w1zvr6yl0cgjfc1b3ddlc6vjw9q8p7alw1vvsckw95190xc14"))
-        (modules '((guix build utils)))
-        (snippet
-         '(begin
-            ;(delete-file-recursively "3rdparty/dynasm") ; JIT
-            (delete-file-recursively "3rdparty/dyncall")
-            (delete-file-recursively "3rdparty/freebsd")
-            (delete-file-recursively "3rdparty/libatomicops")
-            (delete-file-recursively "3rdparty/libuv")
-            (delete-file-recursively "3rdparty/libtommath")
-            (delete-file-recursively "3rdparty/msinttypes")
-            #t))))
-    (build-system perl-build-system)
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://moarvm.org/releases/MoarVM-"; version 
".tar.gz"))
+       (sha256 (base32 "0ijvdd7jyq990zyxrlv8pqhf53q20qhbjly6cnagj9pq2r6z0zik"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin (for-each
+                 delete-file-recursively
+                 '(;"3rdparty/dyncall" ; upstream prefers dyncall to libffi
+                   ;"3rdparty/dynasm"  ; needed for JIT
+                   ;"3rdparty/freebsd" ; freebsd/memmem.o is used on linux
+                   "3rdparty/libatomicops"
+                   "3rdparty/libtommath"
+                   "3rdparty/libuv"
+                   "3rdparty/msinttypes"))))))
+    (build-system gnu-build-system)
     (arguments
-     '(#:phases
+     `(#:test-target "test"
+       #:phases
        (modify-phases %standard-phases
          (replace 'configure
            (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((out        (assoc-ref outputs "out"))
-                   (pkg-config (assoc-ref inputs "pkg-config")))
+             (let* ((out        (assoc-ref outputs "out"))
+                    (perl (string-append (assoc-ref inputs "perl") 
"/bin/perl"))
+                    (dest       (string-append out "/moar"))
+                    (pkg-config (assoc-ref inputs "pkg-config")))
                (setenv "CFLAGS" "-fcommon")
                (setenv "LDFLAGS" (string-append "-Wl,-rpath=" out "/lib"))
-               (invoke "perl" "Configure.pl"
-                       "--prefix" out
-                       "--pkgconfig" (string-append pkg-config 
"/bin/pkg-config")
-                       "--has-libtommath"
+               (invoke perl "Configure.pl"
+                       "--mimalloc"
                        "--has-libatomic_ops"
-                       "--has-libffi"
-                       "--has-libuv")))))))
+                       "--has-libtommath"
+                       "--has-libuv"
+                       ;"--has-dyncall" ; TODO: package dyncall for guix
+                       "--toolchain" "gnu"
+                       "--os" "linux"
+                       "--pkgconfig" (string-append pkg-config 
"/bin/pkg-config")
+                       "--prefix" out)))))))
     (home-page "https://moarvm.org/";)
     ;; These should be inputs but moar.h can't find them when building rakudo
-    (propagated-inputs
-     (list libatomic-ops libffi libtommath-1.0 libuv))
-    (native-inputs
-     (list pkg-config))
-    (synopsis "VM for NQP And Rakudo Perl 6")
+    (propagated-inputs (list libatomic-ops libtommath libuv))
+    (native-inputs (list pkg-config perl))
+    (synopsis "Virtual machine for the Raku programming language")
     (description
-     "Short for \"Metamodel On A Runtime\", MoarVM is a modern virtual machine
-built for the Rakudo Perl 6 compiler and the NQP Compiler Toolchain.  
Highlights
-include:
+     "MoarVM (\"Metamodel On A Runtime\") is a modern virtual machine built for
+the Raku programming language, NQP, and the Rakudo Raku compiler.  MoarVM's
+features include:
 
 @itemize
-@item Great Unicode support, with strings represented at grapheme level
-@item Dynamic analysis of running code to identify hot functions and loops, and
-perform a range of optimizations, including type specialization and inlining
-@item Support for threads, a range of concurrency control constructs, and
-asynchronous sockets, timers, processes, and more
-@item Generational, parallel, garbage collection
-@item Support for numerous language features, including first class functions,
-exceptions, continuations, runtime loading of code, big integers and 
interfacing
-with native libraries.
+@item Just-in-time compilation and optimization of running code hot 
functions/loops.
+Optimizations include type specialization, code inlining/elimination, and 
on-stack
+replacement.
+@item Unusually strong Unicode support due to representing strings as
+graphemes and the compiled-in data from the Unicode Character Database
+@item Support various Raku language features, such as delimited continuations,
+first-class functions, resumable exceptions, runtime code loading, bounded
+serialization, and native calling/pointer manipulation.
+@item The low-level concurrency primitives required for Raku's concurrency
+system.
 @end itemize")
     (license license:artistic2.0)))
 
-- 
2.37.3

From e5416f42bd130a1306bf44c1628188a32f0222da Mon Sep 17 00:00:00 2001
Message-Id: 
<e5416f42bd130a1306bf44c1628188a32f0222da.1664684430.git.daniel@codesections.com>
In-Reply-To: 
<8a76462dfb478f0d7290e1facecf51153257be8f.1664684430.git.daniel@codesections.com>
References: 
<8a76462dfb478f0d7290e1facecf51153257be8f.1664684430.git.daniel@codesections.com>
From: Daniel Sockwell <daniel@codesections.com>
Date: Sat, 1 Oct 2022 19:21:20 -0400
Subject: [PATCH 2/5] gnu: nqp-configure: add package

* gnu/packages/perl6.scm: add nqp-configure
Add package needed as input to NQP and Rakudo
---
 gnu/packages/perl6.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gnu/packages/perl6.scm b/gnu/packages/perl6.scm
index b4e1ac8c27..1c125c02ae 100644
--- a/gnu/packages/perl6.scm
+++ b/gnu/packages/perl6.scm
@@ -23,6 +23,7 @@ (define-module (gnu packages perl6)
   #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system perl)
   #:use-module (guix build-system rakudo)
   #:use-module (gnu packages)
@@ -101,6 +102,30 @@ (define-public moarvm
 @end itemize")
     (license license:artistic2.0)))
 
+(define-public nqp-configure
+  (let ((commit "9b98931e0bfb8c4aac61590edf5074e63aa8ea4b" )
+        (revision "0"))
+    (package
+      (name "nqp-configure")
+      (version (git-version "0.1" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference (url "https://github.com/Raku/nqp-configure";)
+                             (commit commit)))
+         (sha256 (base32 
"1vc1q11kjb964jal9dhgf5vwp371a3rfw7gj987n33kzli7a10n0"))
+         (file-name (git-file-name name version))))
+      (build-system copy-build-system)
+      (arguments
+       '(#:install-plan
+         '(("lib" "lib")
+           ("bin" "bin"))))
+      (synopsis "Configuration utility for NQP and Rakudo installations")
+      (description "A utility that simplifies the process of compiling and
+installing NQP (Not Quite Perl) and the Rakudo Raku compiler.")
+      (license license:artistic2.0)
+      (home-page "https://github.com/Raku/nqp-configure"; ))))
+
 (define-public nqp
   (package
     (name "nqp")
-- 
2.37.3

From 1652e35754b06a54ff1d90fc3372f10bfb149898 Mon Sep 17 00:00:00 2001
Message-Id: 
<1652e35754b06a54ff1d90fc3372f10bfb149898.1664684430.git.daniel@codesections.com>
In-Reply-To: 
<8a76462dfb478f0d7290e1facecf51153257be8f.1664684430.git.daniel@codesections.com>
References: 
<8a76462dfb478f0d7290e1facecf51153257be8f.1664684430.git.daniel@codesections.com>
From: Daniel Sockwell <daniel@codesections.com>
Date: Sat, 1 Oct 2022 19:26:30 -0400
Subject: [PATCH 3/5] gnu: nqp: Update 2019.03 -> 2022.07

* gnu/packages/perl6.scm: Update nqp to 2022.07
Add patch to use nqp-configure as input (in place of fetching from GitHub)
Update synopsis and description
---
 .../nqp.do-not-pull-files-via-git.patch       | 26 +++++++
 gnu/packages/perl6.scm                        | 69 +++++++++----------
 2 files changed, 57 insertions(+), 38 deletions(-)
 create mode 100644 gnu/packages/patches/nqp.do-not-pull-files-via-git.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 1c125c02ae..af85df0aca 100644
--- a/gnu/packages/perl6.scm
+++ b/gnu/packages/perl6.scm
@@ -129,19 +129,19 @@ (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
@@ -152,43 +152,36 @@ (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"))
+               (mkdir-p (string-append out  "/share/nqp/lib/short"))
                (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.
+    (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 designed for compilers and VM creation.  NQP is used to
+implement the Rakudo compiler for Raku and to integrate it with VMs such as
+MoarVM and the Java Virtual Machine.
 
-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
-regular expression engine for the virtual machine.")
+NQP attempts to minimize its runtime footprint while providing Raku's object
+model and regular expression engine.")
     (license license:artistic2.0)))
 
 (define-public rakudo
-- 
2.37.3

From 9f9cd47ce2293f7dfdab07f024a246af000ed03a Mon Sep 17 00:00:00 2001
Message-Id: 
<9f9cd47ce2293f7dfdab07f024a246af000ed03a.1664684430.git.daniel@codesections.com>
In-Reply-To: 
<8a76462dfb478f0d7290e1facecf51153257be8f.1664684430.git.daniel@codesections.com>
References: 
<8a76462dfb478f0d7290e1facecf51153257be8f.1664684430.git.daniel@codesections.com>
From: Daniel Sockwell <daniel@codesections.com>
Date: Sun, 2 Oct 2022 00:01:18 -0400
Subject: [PATCH 5/5] gnu: perl6-zef: Update 0.6.7 -> 0.14.2

* gnu/packages/perl6.scm: Update perl6-zef to 0.14.2
Update synopsis and description
Set install directory to integrate with Guix-installed Raku packages
---
 .../perl6-zef.config-interpolation.patch      | 42 ++++++++++++++++++
 gnu/packages/perl6.scm                        | 44 +++++++++++--------
 2 files changed, 67 insertions(+), 19 deletions(-)
 create mode 100644 gnu/packages/patches/perl6-zef.config-interpolation.patch

diff --git a/gnu/packages/patches/perl6-zef.config-interpolation.patch 
b/gnu/packages/patches/perl6-zef.config-interpolation.patch
new file mode 100644
index 0000000000..357dfd18e6
--- /dev/null
+++ b/gnu/packages/patches/perl6-zef.config-interpolation.patch
@@ -0,0 +1,42 @@
+From f9e4306cba875999a44286bd8c585ef9e84a7a88 Mon Sep 17 00:00:00 2001
+From: Daniel Sockwell <daniel@codesections.com>
+Date: Fri, 30 Sep 2022 17:43:04 -0400
+Subject: [PATCH 4/4] Improve support for env vars in config.json
+
+The "StoreDir" and "TempDir" previously allowed for limited
+interpolation (limited to $*HOME and $*TMPDIR).  This commit adds
+interpolation of $*XDG_DATA_HOME, $*XDG_CONFIG_HOME, and
+$*XDG_STATE_HOME with default values from the XDG spec, see
+https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
+
+It also extends the interpolation for the same values to "DefaultCUR",
+which also specifies a path.
+---
+ lib/Zef/Config.rakumod | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/lib/Zef/Config.rakumod b/lib/Zef/Config.rakumod
+index f77c6be..4362b17 100644
+--- a/lib/Zef/Config.rakumod
++++ b/lib/Zef/Config.rakumod
+@@ -4,8 +4,15 @@ module Zef::Config {
+     our sub parse-file($path) {
+         my %config = %(Zef::from-json( $path.IO.slurp ));
+ 
+-        for %config.grep(*.key.ends-with('Dir')) {
+-            %config{$_.key} = $_.value.subst(/'{$*HOME}' || '$*HOME'/, $*HOME 
// $*TMPDIR, :g);
++        for %config.grep({.key.ends-with('Dir') || .key eq 'DefaultCUR'}) {
++            my $home = $*HOME // $*TMPDIR;
++            %config{$_.key} = $_.value.subst(/'{$*XDG_DATA_HOME}' || 
'$*XDG_DATA_HOME'/,
++                                          %*ENV<XDG_DATA_HOME> // 
"$home/.local/share", :g);
++            %config{$_.key} = $_.value.subst(/'{$*XDG_CONFIG_HOME}' || 
'$*XDG_CONFIG_HOME'/,
++                                          %*ENV<XDG_CONFIG_HOME> // 
"$home/.config", :g);
++            %config{$_.key} = $_.value.subst(/'{$*XDG_STATE_HOME}' || 
'$*XDG_STATE_HOME'/,
++                                          %*ENV<XDG_STATE_HOME> // 
"$home/.local/bin", :g);
++            %config{$_.key} = $_.value.subst(/'{$*HOME}' || '$*HOME'/, $home, 
:g);
+             %config{$_.key} = $_.value.subst(/'{$*TMPDIR}' || '$*TMPDIR'/, 
$*TMPDIR, :g);
+         }
+ 
+-- 
+2.37.3
+
diff --git a/gnu/packages/perl6.scm b/gnu/packages/perl6.scm
index e571920e53..a47d55a901 100644
--- a/gnu/packages/perl6.scm
+++ b/gnu/packages/perl6.scm
@@ -803,30 +803,36 @@ (define-public perl6-xml-writer
 (define-public perl6-zef
   (package
     (name "perl6-zef")
-    (version "0.6.7")
+    (version "0.14.2")
     (source
-      (origin
-        (method git-fetch)
-        (uri (git-reference
-               (url "https://github.com/ugexe/zef";)
-               (commit (string-append "v" version))))
-        (file-name (git-file-name name version))
-        (sha256
-         (base32
-          "07n7g1xw2c4g860rs890gx85vyhdq0ysgwbrnzw6q905jph2bkv7"))))
+     (origin
+       (method git-fetch)
+       (uri (git-reference (url "https://github.com/ugexe/zef";)
+                           (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256 (base32 "09lgpkz93w5g9bsw44rag763fa8857bvjj9r4wwvnnawykl4lkzr"))
+       ;; patch submitted upstream, https://github.com/ugexe/zef/pull/470
+       (patches (search-patches "perl6-zef.config-interpolation.patch"))))
     (build-system rakudo-build-system)
     (arguments
-     '(#:with-zef? #f
+     '(#:test-runner "rakudo" ; to avoid bootstrapping issues
        #:phases
        (modify-phases %standard-phases
-         (replace 'check
+         (add-after 'unpack 'set-config-values
            (lambda _
-             (setenv "HOME" "/tmp")
-             (invoke "perl6" "-I." "bin/zef" "--debug"
-                     "--tap-harness" "test" "."))))))
+             ;; Upstream recommends editing config.json to set system defaults
+             (substitute* "resources/config.json"
+               (("DefaultCUR.+$")
+                "DefaultCUR\" : [\"$*XDG_DATA_HOME/raku/repo\"],\n")))))))
     (home-page "https://github.com/ugexe/zef";)
-    (synopsis "Perl6 Module Management")
-    (description "Zef is a Perl 6 package (module) manager.  It can be used to
-download and install Perl 6 modules in your home directory or as a system-wide
-module.")
+    (synopsis "Raku Language Package Management")
+    (description "Zef is a language package manager for the Raku programming
+language.  It can be used to search for, download, install, and manage Raku
+modules to your home directory.
+
+As an end user, you should typically prefer to install executable Raku
+packages via Guix when possible.  However, Zef provides particular support for
+using Raku packages while developing other Raku programs, so developers may
+prefer Zef in that situation.  Zef and Guix packages are installed such that
+they should work smoothly together.")
     (license license:artistic2.0)))
-- 
2.37.3





reply via email to

[Prev in Thread] Current Thread [Next in Thread]