unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip McGrath <philip@philipmcgrath.com>
To: 55248@debbugs.gnu.org
Cc: Liliana Marie Prikler <liliana.prikler@ist.tugraz.at>,
	Maxime Devos <maximedevos@telenet.be>,
	Philip McGrath <philip@philipmcgrath.com>,
	Liliana Marie Prikler <liliana.prikler@gmail.com>
Subject: [bug#55248] [PATCH v2 5/9] gnu: chez-scheme: Refactor configure phase and fix '--threads'.
Date: Sun,  8 May 2022 16:07:48 -0400	[thread overview]
Message-ID: <a1c54704d4b4ffddd5af5868af8aae453455c82a.1652039837.git.philip@philipmcgrath.com> (raw)
In-Reply-To: <cover.1652039837.git.philip@philipmcgrath.com>

Move Chez-specific logic into '#:configure-flags' and a new
'configure-environment-variables' phase, leaving the 'configure' phase
as just a variant of the one from 'gnu-build-system' (including support
for '#:out-of-source?') that doesn't add implicit Autoconf-style flags.

In the process, do the right thing for "--threads", rather than assuming
the only nonthreaded platform is broken.

* gnu/packages/chez.scm (chez-scheme)[arguments]: Set configure flags in
'#:configure-flags' and separate 'configure-environment-variables' from
the residual 'configure' phase. More closely follow 'gnu-build-system'.
Use 'chez-upstream-features-for-system' for "--threads".
(chez-scheme-for-racket)[arguments]<#:configure-flags>: Add "--threads"
unconditionally.
---
 gnu/packages/chez.scm | 63 ++++++++++++++++++++++++++++---------------
 1 file changed, 42 insertions(+), 21 deletions(-)

diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 49051abd17..785b6837c1 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -258,8 +258,18 @@ (define-public chez-scheme
         (ice-9 ftw)
         (ice-9 match))
       #:test-target "test"
-      ;; TODO when we fix armhf, it may not support --threads
-      #:configure-flags #~'("--threads")
+      #:configure-flags
+      #~`(,(string-append "--installprefix=" #$output)
+          #$@(if (and=> (chez-upstream-features-for-system)
+                        (cut memq 'threads <>))
+                 #~("--threads")
+                 #~())
+          "ZLIB=-lz"
+          "LZ4=-llz4"
+          "--libkernel"
+          ;; Guix will do 'compress-man-pages',
+          ;; and letting Chez try causes an error
+          "--nogzip-man-pages")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'unpack-nanopass+stex
@@ -273,26 +283,35 @@ (define-public chez-scheme
                (search-input-directory (or native-inputs inputs)
                                        "lib/chez-scheme-bootfiles")
                "boot")))
-          ;; NOTE: the custom Chez 'configure' script doesn't allow
+          ;; NOTE: The custom Chez 'configure' script doesn't allow
           ;; unrecognized flags, such as those automatically added
-          ;; by `gnu-build-system`.
+          ;; by `gnu-build-system`. This replacement phase uses only
+          ;; the explicitly provided `#:configure-flags`.
           (replace 'configure
-            (lambda* (#:key inputs (configure-flags '()) #:allow-other-keys)
-              ;; add flags which are always required:
-              (let ((flags (cons* (string-append "--installprefix=" #$output)
-                                  "ZLIB=-lz"
-                                  "LZ4=-llz4"
-                                  "--libkernel"
-                                  ;; Guix will do compress-man-pages,
-                                  ;; and letting Chez try causes an error
-                                  "--nogzip-man-pages"
-                                  configure-flags)))
-                (format #t "configure flags: ~s~%" flags)
-                ;; Some makefiles (for tests) don't seem to propagate CC
-                ;; properly, so we take it out of their hands:
-                (setenv "CC" #$(cc-for-target))
-                (setenv "HOME" "/tmp")
-                (apply invoke "./configure" flags))))
+            (lambda* (#:key inputs (configure-flags '()) out-of-source?
+                            #:allow-other-keys)
+              (let* ((abs-srcdir (getcwd))
+                     (srcdir (if out-of-source?
+                                 (string-append "../" (basename abs-srcdir))
+                                 ".")))
+                (format #t "source directory: ~s (relative from build: ~s)~%"
+                        abs-srcdir srcdir)
+                (if out-of-source?
+                    (begin
+                      (mkdir "../build")
+                      (chdir "../build")))
+                (format #t "build directory: ~s~%" (getcwd))
+                (format #t "configure flags: ~s~%" configure-flags)
+                (apply invoke
+                       (string-append srcdir "/configure")
+                       configure-flags))))
+          (add-after 'configure 'configure-environment-variables
+            (lambda args
+              ;; Some makefiles (for tests) don't seem to propagate CC
+              ;; properly, so we take it out of their hands:
+              (setenv "CC" #$(cc-for-target))
+              ;; Likewise, some tests have needed HOME to be set:
+              (setenv "HOME" "/tmp")))
           ;; The binary file name is called "scheme" as is the one from
           ;; MIT/GNU Scheme.  We add a symlink to use in case both are
           ;; installed.
@@ -385,7 +404,9 @@ (define-public chez-scheme-for-racket
     (arguments
      (substitute-keyword-arguments (package-arguments chez-scheme)
        ((#:configure-flags cfg-flags #~'())
-        #~(cons "--disable-x11" #$cfg-flags))
+        #~(cons* "--disable-x11"
+                 "--threads" ;; ok to potentially duplicate
+                 #$cfg-flags))
        ((#:phases those-phases #~%standard-phases)
         #~(let* ((those-phases #$those-phases)
                  (unpack (assoc-ref those-phases 'unpack)))
-- 
2.32.0





  parent reply	other threads:[~2022-05-08 20:35 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03 18:31 [bug#55248] [PATCH 0/7] gnu: Update Racket to 8.5 and Chez Scheme to 9.5.8 Philip McGrath
2022-05-03 18:33 ` [bug#55248] [PATCH 1/7] gnu: racket: Update to 8.5 Philip McGrath
2022-05-04  6:53   ` Liliana Marie Prikler
2022-05-05 21:49     ` Philip McGrath
2022-05-06  6:37       ` Liliana Marie Prikler
2022-05-07 18:39         ` Philip McGrath
2022-05-07 20:01           ` Maxime Devos
2022-05-03 18:33 ` [bug#55248] [PATCH 2/7] gnu: racket: Fix out-of-source build Philip McGrath
2022-05-04  9:29   ` Maxime Devos
2022-05-05 18:53     ` Philip McGrath
2022-05-05 19:52       ` Liliana Marie Prikler
2022-05-05 20:36         ` Maxime Devos
2022-05-05 20:33       ` Maxime Devos
2022-05-05 21:55         ` Philip McGrath
2022-05-03 18:33 ` [bug#55248] [PATCH 3/7] gnu: chez-scheme: Update to 9.5.8 Philip McGrath
2022-05-03 18:33 ` [bug#55248] [PATCH 4/7] gnu: chez-scheme: Refactor documentation phases Philip McGrath
2022-05-03 18:33 ` [bug#55248] [PATCH 5/7] gnu: chez-scheme: Refactor configure phase and fix '--threads' Philip McGrath
2022-05-03 18:33 ` [bug#55248] [PATCH 6/7] gnu: stex: Get machine type dynamically Philip McGrath
2022-05-04  6:58   ` Liliana Marie Prikler
2022-05-05 19:39     ` Philip McGrath
2022-05-03 18:33 ` [bug#55248] [PATCH 7/7] gnu: chez-scheme-for-system: Adjust support logic Philip McGrath
2022-05-04  7:21   ` Liliana Marie Prikler
2022-05-05 20:42     ` Philip McGrath
2022-05-06  7:08       ` Liliana Marie Prikler
2022-05-07 19:18         ` Philip McGrath
2022-05-08 20:07 ` [bug#55248] [PATCH v2 0/9] gnu: Update Racket to 8.5 and Chez Scheme to 9.5.8 Philip McGrath
2022-05-08 20:07   ` [bug#55248] [PATCH v2 1/9] gnu: racket: Update to 8.5 Philip McGrath
2022-05-08 20:07   ` [bug#55248] [PATCH v2 2/9] gnu: racket: Fix out-of-source build Philip McGrath
2022-05-09  3:54     ` Liliana Marie Prikler
2022-05-09  6:02       ` [bug#55248] [PATCH v3 0/9] gnu: Update Racket to 8.5 and Chez Scheme to 9.5.8 Philip McGrath
2022-05-09  6:02         ` [bug#55248] [PATCH v3 1/9] gnu: racket: Update to 8.5 Philip McGrath
2022-05-09  6:02         ` [bug#55248] [PATCH v3 2/9] gnu: racket: Fix out-of-source build Philip McGrath
2022-05-09  6:02         ` [bug#55248] [PATCH v3 3/9] gnu: chez-scheme: Update to 9.5.8 Philip McGrath
2022-05-09  6:02         ` [bug#55248] [PATCH v3 4/9] gnu: chez-scheme: Refactor documentation phases Philip McGrath
2022-05-09  6:02         ` [bug#55248] [PATCH v3 5/9] gnu: chez-scheme: Refactor configure phase and fix '--threads' Philip McGrath
2022-05-09  6:02         ` [bug#55248] [PATCH v3 6/9] gnu: stex: Get machine type dynamically Philip McGrath
2022-05-09  6:02         ` [bug#55248] [PATCH v3 7/9] gnu: chez-upstream-features-for-system: Improve implementation Philip McGrath
2022-05-09  6:21           ` Liliana Marie Prikler
2022-05-09  7:20             ` Philip McGrath
2022-05-09  7:41               ` Liliana Marie Prikler
2022-05-09  6:02         ` [bug#55248] [PATCH v3 8/9] gnu: chez-scheme-for-racket: Fix supported systems Philip McGrath
2022-05-09  6:34           ` Liliana Marie Prikler
2022-05-09  7:55             ` Philip McGrath
2022-05-09  9:36               ` Liliana Marie Prikler
2022-05-12  5:26                 ` Philip McGrath
2022-05-12  8:04                   ` Liliana Marie Prikler
2022-05-09  6:02         ` [bug#55248] [PATCH v3 9/9] gnu: chez-scheme-for-system: Adjust for bytecode backend Philip McGrath
2022-05-09  9:44         ` [bug#55248] [PATCH 0/7] gnu: Update Racket to 8.5 and Chez Scheme to 9.5.8 Ludovic Courtès
2022-05-12  3:50           ` Philip McGrath
2022-05-12  3:59           ` [bug#55248] [PATCH v4 1/9] gnu: racket: Update to 8.5 Philip McGrath
2022-05-12 10:32         ` bug#55248: [PATCH 0/7] gnu: Update Racket to 8.5 and Chez Scheme to 9.5.8 Ludovic Courtès
2022-05-08 20:07   ` [bug#55248] [PATCH v2 3/9] gnu: chez-scheme: Update " Philip McGrath
2022-05-08 20:07   ` [bug#55248] [PATCH v2 4/9] gnu: chez-scheme: Refactor documentation phases Philip McGrath
2022-05-08 20:07   ` Philip McGrath [this message]
2022-05-08 20:07   ` [bug#55248] [PATCH v2 6/9] gnu: stex: Get machine type dynamically Philip McGrath
2022-05-08 20:07   ` [bug#55248] [PATCH v2 7/9] gnu: chez-upstream-features-for-system: Improve implementation Philip McGrath
2022-05-08 20:07   ` [bug#55248] [PATCH v2 8/9] gnu: chez-scheme-for-racket: Fix supported systems Philip McGrath
2022-05-08 20:07   ` [bug#55248] [PATCH v2 9/9] gnu: chez-scheme-for-system: Adjust for bytecode backend Philip McGrath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a1c54704d4b4ffddd5af5868af8aae453455c82a.1652039837.git.philip@philipmcgrath.com \
    --to=philip@philipmcgrath.com \
    --cc=55248@debbugs.gnu.org \
    --cc=liliana.prikler@gmail.com \
    --cc=liliana.prikler@ist.tugraz.at \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).