From debbugs-submit-bounces@debbugs.gnu.org Tue May 03 14:34:47 2022 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 To: 55248@debbugs.gnu.org Subject: [PATCH 5/7] gnu: chez-scheme: Refactor configure phase and fix '--threads'. 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 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.6 (/) X-Debbugs-Envelope-To: 55248 Cc: Philip McGrath X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.4 (/) 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