From patchwork Tue May 3 18:33:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 39110 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 EF1CF27BBEA; Tue, 3 May 2022 19:37:33 +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 6E39A27BBE9 for ; Tue, 3 May 2022 19:37:33 +0100 (BST) Received: from localhost ([::1]:37192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlxOu-0001DL-Kj for patchwork@mira.cbaines.net; Tue, 03 May 2022 14:37:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlxMW-0000CL-1T for guix-patches@gnu.org; Tue, 03 May 2022 14:35:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:47163) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlxMV-0007Bd-Nm for guix-patches@gnu.org; Tue, 03 May 2022 14:35:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nlxMV-0002nd-K4 for guix-patches@gnu.org; Tue, 03 May 2022 14:35:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55248] [PATCH 5/7] 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: Tue, 03 May 2022 18:35:03 +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: Philip McGrath Received: via spool by 55248-submit@debbugs.gnu.org id=B55248.165160288710676 (code B ref 55248); Tue, 03 May 2022 18:35:03 +0000 Received: (at 55248) by debbugs.gnu.org; 3 May 2022 18:34:47 +0000 Received: from localhost ([127.0.0.1]:41050 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlxMF-0002m8-2Y for submit@debbugs.gnu.org; Tue, 03 May 2022 14:34:47 -0400 Received: from mail-vk1-f169.google.com ([209.85.221.169]:35804) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlxMD-0002lO-Ed for 55248@debbugs.gnu.org; Tue, 03 May 2022 14:34:45 -0400 Received: by mail-vk1-f169.google.com with SMTP id e7so8365940vkh.2 for <55248@debbugs.gnu.org>; Tue, 03 May 2022 11:34:45 -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=ZUQEq/o+IhLYs03j6ZjJbrIs7ms2A2hhip0CD0cJ/Za0NlQoRar+pr1m4d6UOI0eqG lTSZEcQdROaoRzDMiglkAN8hn0N5tEiz0fwczH/8wQj9R+79MngqTM9eyVXcIPtOlFwY L0nqtAjIh1CWUL5huUgPFdR0j4mDZz8wqRlUnN561uKJKxr9hhnWW+cBN/H2rpdFDIqs B0EwpmCPSUJH5oHFA4bQolpmfPQIGRCfsw4kuylmHjWzyGqDkl4zym6I95foVD6oAoF6 K4Oo/h+uoRFbNkvjWk1dzedkSIh1a5j4HqYVu3tl1M63a8xJ2JH3cOGAY6IDt4YXaD5q IqxA== 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=FDkIW9Max/6wOC1XIWr2Z0iHaxE6h8f7xMpeLXLgbxbrt1CZG/j/TYGc5V3Wu7+1Nj LDvDkYE4LO9gOsHCxyROvuk51QhU9SU/jtthooYMT4fzDOIOCgl0JPBYho2w9K/cM6Zg scrJxL1OJUuLIIKFpeu/zXpyQipLbtrFDtzBsUpY854uFECpMkCvmkrb3bCz68QRcIP2 ARBeCD7XoRTo7KGLD6OtYhdablDXHIG7+QDfbbQo/uCwAmmHNzjUWAaQtopQ9LqhhLfm f2y4swgU8RrVoZWV/XTssd9613a1yIXH5J8Nq29I7TT5Nu7WjIz+2Dt7lV+Ub6CkmTtg Uqaw== X-Gm-Message-State: AOAM533vHeyZ4j8LAWisqL7ECvzQHqWpICjp0nshkLGDHnPiXOP7KEHt GbE6WGlTxV1q7dONI9eGnXNoeyn753NtvC2G X-Google-Smtp-Source: ABdhPJw842Xmefjg6Pr516BmHvil7QMQAJbbyTK+Hkj4vHeiVJkDZb6CCalKioObVlmx7pHptle2+Q== X-Received: by 2002:ac5:cdd1:0:b0:34d:2e78:2482 with SMTP id u17-20020ac5cdd1000000b0034d2e782482mr5079732vkn.15.1651602879812; Tue, 03 May 2022 11:34:39 -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 r28-20020a05612206bc00b0034e6f1fd064sm1362437vkq.46.2022.05.03.11.34.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 May 2022 11:34:39 -0700 (PDT) From: Philip McGrath Date: Tue, 3 May 2022 14:33:44 -0400 Message-Id: <9e681352e108ec1464b3f35beb04f6d338450009.1651594312.git.philip@philipmcgrath.com> 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)))