gnu: monero-gui: Update to 0.16.0.2.
[jackhill/guix/guix.git] / gnu / packages / make-bootstrap.scm
index 5716ed3..b2d3e2a 100644 (file)
@@ -55,7 +55,8 @@
             %mes-bootstrap-tarball
             %bootstrap-tarballs
 
-            %guile-static-stripped))
+            %guile-static-stripped
+            %guile-3.0-static-stripped))
 
 ;;; Commentary:
 ;;;
@@ -676,95 +677,104 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
            #t))))
     (inputs `(("mes" ,%mes-minimal)))))
 
+(define* (make-guile-static guile patches)
+  (package-with-relocatable-glibc
+   (static-package
+    (package
+      (inherit guile)
+      (source
+       (origin (inherit (package-source guile))
+               (patches (append (map search-patch patches)
+                                (origin-patches (package-source guile))))))
+      (name (string-append (package-name guile) "-static"))
+      (synopsis "Statically-linked and relocatable Guile")
+
+      ;; Remove the 'debug' output (see above for the reason.)
+      (outputs (delete "debug" (package-outputs guile)))
+
+      (inputs
+       `(("libunistring:static" ,libunistring "static")
+         ,@(package-inputs guile)))
+
+      (propagated-inputs
+       `(("bdw-gc" ,libgc/static-libs)
+         ,@(alist-delete "bdw-gc"
+                         (package-propagated-inputs guile))))
+      (arguments
+       (substitute-keyword-arguments (package-arguments guile)
+         ((#:configure-flags flags '())
+          ;; When `configure' checks for ltdl availability, it
+          ;; doesn't try to link using libtool, and thus fails
+          ;; because of a missing -ldl.  Work around that.
+
+          ;; XXX: On ARMv7, disable JIT: it causes crashes with 3.0.2,
+          ;; possibly related to <https://bugs.gnu.org/40737>.
+          (if (target-arm32?)
+              ''("LDFLAGS=-ldl" "--disable-jit")
+              ''("LDFLAGS=-ldl")))
+         ((#:phases phases '%standard-phases)
+          `(modify-phases ,phases
+
+             ;; Do not record the absolute file name of 'sh' in
+             ;; (ice-9 popen).  This makes 'open-pipe' unusable in
+             ;; a build chroot ('open-pipe*' is fine) but avoids
+             ;; keeping a reference to Bash.
+             (delete 'pre-configure)
+
+             (add-before 'configure 'static-guile
+               (lambda _
+                 (substitute* "libguile/Makefile.in"
+                   ;; Create a statically-linked `guile'
+                   ;; executable.
+                   (("^guile_LDFLAGS =")
+                    "guile_LDFLAGS = -all-static")
+
+                   ;; Add `-ldl' *after* libguile-2.0.la.
+                   (("^guile_LDADD =(.*)$" _ ldadd)
+                    (string-append "guile_LDADD = "
+                                   (string-trim-right ldadd)
+                                   " -ldl\n")))))))
+         ((#:tests? _ #f)
+          ;; There are uses of `dynamic-link' in
+          ;; {foreign,coverage}.test that don't fly here.
+          #f)
+         ((#:parallel-build? _ #f)
+          ;; Work around the fact that the Guile build system is
+          ;; not deterministic when parallel-build is enabled.
+          #f)))))))
+
 (define %guile-static
   ;; A statically-linked Guile that is relocatable--i.e., it can search
   ;; .scm and .go files relative to its installation directory, rather
   ;; than in hard-coded configure-time paths.
-  (let* ((patches (cons* (search-patch "guile-relocatable.patch")
-                         (search-patch "guile-default-utf8.patch")
-                         (search-patch "guile-linux-syscalls.patch")
-                         (origin-patches (package-source guile-2.0))))
-         (source  (origin (inherit (package-source guile-2.0))
-                    (patches patches)))
-         (guile (package (inherit guile-2.0)
-                  (name (string-append (package-name guile-2.0) "-static"))
-                  (source source)
-                  (synopsis "Statically-linked and relocatable Guile")
-
-                  ;; Remove the 'debug' output (see above for the reason.)
-                  (outputs (delete "debug" (package-outputs guile-2.0)))
-
-                  (inputs
-                   `(("libunistring:static" ,libunistring "static")
-                     ,@(package-inputs guile-2.2)))
-
-                  (propagated-inputs
-                   `(("bdw-gc" ,libgc/static-libs)
-                     ,@(alist-delete "bdw-gc"
-                                     (package-propagated-inputs guile-2.0))))
-                  (arguments
-                   (substitute-keyword-arguments (package-arguments guile-2.0)
-                     ((#:configure-flags flags '())
-                      ;; When `configure' checks for ltdl availability, it
-                      ;; doesn't try to link using libtool, and thus fails
-                      ;; because of a missing -ldl.  Work around that.
-                      ''("LDFLAGS=-ldl"))
-                     ((#:phases phases '%standard-phases)
-                      `(modify-phases ,phases
-
-                         ;; Do not record the absolute file name of 'sh' in
-                         ;; (ice-9 popen).  This makes 'open-pipe' unusable in
-                         ;; a build chroot ('open-pipe*' is fine) but avoids
-                         ;; keeping a reference to Bash.
-                         (delete 'pre-configure)
-
-                         (add-before 'configure 'static-guile
-                           (lambda _
-                             (substitute* "libguile/Makefile.in"
-                               ;; Create a statically-linked `guile'
-                               ;; executable.
-                               (("^guile_LDFLAGS =")
-                                "guile_LDFLAGS = -all-static")
-
-                               ;; Add `-ldl' *after* libguile-2.0.la.
-                               (("^guile_LDADD =(.*)$" _ ldadd)
-                                (string-append "guile_LDADD = "
-                                               (string-trim-right ldadd)
-                                               " -ldl\n")))))))
-                     ((#:tests? _ #f)
-                      ;; There are uses of `dynamic-link' in
-                      ;; {foreign,coverage}.test that don't fly here.
-                      #f)
-                     ((#:parallel-build? _ #f)
-                      ;; Work around the fact that the Guile build system is
-                      ;; not deterministic when parallel-build is enabled.
-                      #f))))))
-    (package-with-relocatable-glibc (static-package guile))))
+  (make-guile-static guile-2.0 '("guile-relocatable.patch"
+                                 "guile-default-utf8.patch"
+                                 "guile-linux-syscalls.patch")))
 
-(define %guile-static-stripped
-  ;; A stripped static Guile binary, for use during bootstrap.
-  (package (inherit %guile-static)
-    (name "guile-static-stripped")
+(define* (make-guile-static-stripped static-guile)
+  (package
+    (inherit static-guile)
+    (name (string-append (package-name static-guile) "-stripped"))
     (build-system trivial-build-system)
     (arguments
      ;; The end result should depend on nothing but itself.
      `(#:allowed-references ("out")
        #:modules ((guix build utils))
        #:builder
-       (let ()
+       (let ((version ,(version-major+minor (package-version static-guile))))
          (use-modules (guix build utils))
 
          (let* ((in     (assoc-ref %build-inputs "guile"))
                 (out    (assoc-ref %outputs "out"))
                 (guile1 (string-append in "/bin/guile"))
                 (guile2 (string-append out "/bin/guile")))
-           (mkdir-p (string-append out "/share/guile/2.0"))
-           (copy-recursively (string-append in "/share/guile/2.0")
-                             (string-append out "/share/guile/2.0"))
+           (mkdir-p (string-append out "/share/guile/" version))
+           (copy-recursively (string-append in "/share/guile/" version)
+                             (string-append out "/share/guile/" version))
 
-           (mkdir-p (string-append out "/lib/guile/2.0/ccache"))
-           (copy-recursively (string-append in "/lib/guile/2.0/ccache")
-                             (string-append out "/lib/guile/2.0/ccache"))
+           (mkdir-p (string-append out "/lib/guile/" version "/ccache"))
+           (copy-recursively (string-append in "/lib/guile/" version "/ccache")
+                             (string-append out "/lib/guile/" version "/ccache"))
 
            (mkdir (string-append out "/bin"))
            (copy-file guile1 guile2)
@@ -785,10 +795,22 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                  '((invoke guile2 "--version")))
 
            #t))))
-    (inputs `(("guile" ,%guile-static)))
+    (inputs `(("guile" ,static-guile)))
     (outputs '("out"))
     (synopsis "Minimal statically-linked and relocatable Guile")))
 
+(define %guile-static-stripped
+  ;; A stripped static Guile binary, for use during bootstrap.
+  (make-guile-static-stripped %guile-static))
+
+(define %guile-3.0-static-stripped
+  ;; A stripped static Guile 3.0 binary, for use in initrds.
+  (make-guile-static-stripped
+   (make-guile-static guile-3.0
+                      '("guile-2.2-default-utf8.patch"
+                        "guile-3.0-linux-syscalls.patch"
+                        "guile-3.0-relocatable.patch"))))
+
 (define (tarball-package pkg)
   "Return a package containing a tarball of PKG."
   (package (inherit pkg)