From patchwork Sun May 8 20:07:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 39164 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0B21727BBEA; Sun, 8 May 2022 21:35:49 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7F9A227BBE9 for ; Sun, 8 May 2022 21:35:48 +0100 (BST) Received: from localhost ([::1]:45758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnnd5-00039M-M0 for patchwork@mira.cbaines.net; Sun, 08 May 2022 16:35:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnnED-0003o0-Bn for guix-patches@gnu.org; Sun, 08 May 2022 16:10:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33156) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnnED-0000FQ-1d for guix-patches@gnu.org; Sun, 08 May 2022 16:10:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nnnEC-0002Nd-Tm for guix-patches@gnu.org; Sun, 08 May 2022 16:10:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55248] [PATCH v2 5/9] gnu: chez-scheme: Refactor configure phase and fix '--threads'. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 08 May 2022 20:10:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55248 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55248@debbugs.gnu.org Cc: Liliana Marie Prikler , Maxime Devos , Philip McGrath , Liliana Marie Prikler Received: via spool by 55248-submit@debbugs.gnu.org id=B55248.16520405829034 (code B ref 55248); Sun, 08 May 2022 20:10:04 +0000 Received: (at 55248) by debbugs.gnu.org; 8 May 2022 20:09:42 +0000 Received: from localhost ([127.0.0.1]:55271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnnDq-0002Le-8w for submit@debbugs.gnu.org; Sun, 08 May 2022 16:09:42 -0400 Received: from mail-vk1-f179.google.com ([209.85.221.179]:37496) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnnDo-0002L0-Hn for 55248@debbugs.gnu.org; Sun, 08 May 2022 16:09:40 -0400 Received: by mail-vk1-f179.google.com with SMTP id j14so3302336vkp.4 for <55248@debbugs.gnu.org>; Sun, 08 May 2022 13:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6MUQea/akqiJw65v5UB+PXZnpK7I+lS4QjauOZJ1fUE=; b=AgnbKSnocBGjpwiWWvFgtfBy5OxAlMCQZHXNu7IVzIWjxVVT3uUSH/LD7IzhiqpTrY CDlaETUmbpggSJlK4t3D9fibxDRpcDv0tgQYd1qTo74Alik5ZhnrmQtkFlLhjKGE2D8q 4d6E+4LrEedIeTPxiH3HYIlaarErdZ7fBBOzVPILJZC9oJ0zRQAgXB8fr2ZNwN/nq/JM 5/56ZSm9yGns6MDHU87O2zw+P4QNLUbw6vqw1/2iuvoywK8h6bx00Md4TI7Fb19m8k44 3ThsRhWlFHE3qVf+z9VwiLfSPJtAJ9NORsTA8GSB12ofjJe0pRsdjNLtFmSnVpB+KKMt X7qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6MUQea/akqiJw65v5UB+PXZnpK7I+lS4QjauOZJ1fUE=; b=5W7E6HI0OGs+QFONLT0yJE9/8hBukk4W11YyZaO7VT5Y04HsgJCDof2cpUduG39918 Dgndx3GSBQfloGyotagjLYJ85NsERk1k3rcnpKliAQbebs+ujbEWbagMH7wMimJWwduS KT2MEXJEpQ+++0hVvJiJE1zAoQ8cBRcbd7YlhqH0HZGj4tkhuNAtWrs7oEw23zHvlgFc xiK7MW5zUUDPW2DEzriGD5vTLyzKvWKRwBWpPJtyzvlsqy480krHFIgYbhMU9bBwQfaF YI+x6omNlVpPLrdfG3C2VK//UbA7FLdrBdIqkkAX8ZKow2X6g/klMzor6kaYVtkukojC cxRw== X-Gm-Message-State: AOAM531LZGo8sUfNHgxXEWSmaLgxtcySySKobmS0NkotQ9ogmPwErP92 nusqeYe2+Txr42RNlUEbGVgcZlzyHZxbjBUj X-Google-Smtp-Source: ABdhPJyB2kxXyOjie5db4UbNs9LUij4L5uhQlLWRzXyTnFln0MalfLhd1o/tvYNSHeH3LN8tDv4DoA== X-Received: by 2002:a05:6122:98a:b0:34e:9a92:35fd with SMTP id g10-20020a056122098a00b0034e9a9235fdmr6890829vkd.29.1652040574031; Sun, 08 May 2022 13:09:34 -0700 (PDT) Received: from localhost (c-73-125-98-51.hsd1.fl.comcast.net. [73.125.98.51]) by smtp.gmail.com with UTF8SMTPSA id o46-20020ab05971000000b00365e024dc7bsm915209uad.8.2022.05.08.13.09.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 08 May 2022 13:09:33 -0700 (PDT) From: Philip McGrath Date: Sun, 8 May 2022 16:07:48 -0400 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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)))