From patchwork Fri Jun 24 17:56:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\\(" X-Patchwork-Id: 3370 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 B5F2027BBEA; Fri, 24 Jun 2022 18:58:44 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED 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 2B7F127BBE9 for ; Fri, 24 Jun 2022 18:58:44 +0100 (BST) Received: from localhost ([::1]:59432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4nZp-00062f-N6 for patchwork@mira.cbaines.net; Fri, 24 Jun 2022 13:58:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4nYE-0005F2-QT for guix-patches@gnu.org; Fri, 24 Jun 2022 13:57:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49566) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4nYE-0005fY-HO for guix-patches@gnu.org; Fri, 24 Jun 2022 13:57:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o4nYE-0005MT-H6 for guix-patches@gnu.org; Fri, 24 Jun 2022 13:57:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55999] [PATCH v3 3/3] guix: Modernize dub-build-system somewhat. Resent-From: "(" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 24 Jun 2022 17:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55999 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55999@debbugs.gnu.org Cc: "\(" Received: via spool by 55999-submit@debbugs.gnu.org id=B55999.165609340820572 (code B ref 55999); Fri, 24 Jun 2022 17:57:02 +0000 Received: (at 55999) by debbugs.gnu.org; 24 Jun 2022 17:56:48 +0000 Received: from localhost ([127.0.0.1]:43461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4nY0-0005Lk-6R for submit@debbugs.gnu.org; Fri, 24 Jun 2022 13:56:48 -0400 Received: from knopi.disroot.org ([178.21.23.139]:54728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4nXw-0005LN-4s for 55999@debbugs.gnu.org; Fri, 24 Jun 2022 13:56:44 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 67EB145941; Fri, 24 Jun 2022 19:56:43 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZZJL5_bEnfrI; Fri, 24 Jun 2022 19:56:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1656093402; bh=DGTSUPSRruKnNTVsnd59TIVzP7NZmgWnhy3zbTSWMIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Jw0vLWhygNwAqNZrherRLu2W1mIMpYWNa0NO//iZuNgcsGtuxxib7U+qVoOmfnqQ6 LSQWeQCzEAuCG5P0ODQUneadHoTHSqs/2kHEyL0VH+rsHUKoKFeqZ770G/vDmb8ZH5 rNn1q4PdzLugk/kKFLizzlUciaIHX8/NDQ7A95iYzHFinbyLja1u52Sa0aaj/m0+jG zTxrZzaVyXEobRZb2lXjkONIm/O3RdN2by5iQfxbipDAOFlKBpet00Emw5gK8XLMip xLCGE32/HuKmpiDhesTu195372I3aWZY/V0G9XkT7LPJeGU46J3x6xYJGplGgwFE0m dF0Zr/O9HE54Q== Date: Fri, 24 Jun 2022 18:56:28 +0100 Message-Id: <20220624175628.7877-3-paren@disroot.org> In-Reply-To: <20220624175628.7877-1-paren@disroot.org> References: <20220624175628.7877-1-paren@disroot.org> 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" Reply-to: "\(" X-ACL-Warn: , "\( via Guix-patches" X-Patchwork-Original-From: "\( via Guix-patches" via From: "\\(" X-getmail-retrieved-from-mailbox: Patches * guix/build-system/dub.scm (default-ld-gold-wrapper): New variable. (lower): Add keyed argument ld-gold-wrapper. [bag]: Add ld-gold-wrapper. * guix/build/dub-build-system.scm (configure): Remove trailing #t, and fix docstring formatting. (build): Remove trailing #t, and avoid substituting ".dub/dub.json" as Dub no longer produces it. (check): Same as (build). (install): Remove trailing #t. --- guix/build-system/dub.scm | 8 ++++++++ guix/build/dub-build-system.scm | 26 ++++++++------------------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/guix/build-system/dub.scm b/guix/build-system/dub.scm index 55ad7decb8..1577f4a0c7 100644 --- a/guix/build-system/dub.scm +++ b/guix/build-system/dub.scm @@ -51,6 +51,12 @@ (define (default-pkg-config) (let ((pkg-config (resolve-interface '(gnu packages pkg-config)))) (module-ref pkg-config 'pkg-config))) +;; LDC doesn't work with the bfd linker. +(define (default-ld-gold-wrapper) + "Return the default ld-gold-wrapper package." + (let ((commencement (resolve-interface '(gnu packages commencement)))) + (module-ref commencement 'ld-gold-wrapper))) + (define %dub-build-system-modules ;; Build-side modules imported by default. `((guix build dub-build-system) @@ -100,6 +106,7 @@ (define* (lower name (ldc (default-ldc)) (dub (default-dub)) (pkg-config (default-pkg-config)) + (ld-gold-wrapper (default (default-ld-gold-wrapper))) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -121,6 +128,7 @@ (define private-keywords ,@(standard-packages))) (build-inputs `(("ldc" ,ldc) ("dub" ,dub) + ("ld-gold-wrapper" ,ld-gold-wrapper) ,@native-inputs)) (outputs outputs) (build dub-build) diff --git a/guix/build/dub-build-system.scm b/guix/build/dub-build-system.scm index 3ab50733de..9ee0433ffd 100644 --- a/guix/build/dub-build-system.scm +++ b/guix/build/dub-build-system.scm @@ -48,10 +48,10 @@ (define (package-name->d-package-name name) (_ #f))) (define* (configure #:key inputs #:allow-other-keys) - "Prepare one new directory with all the required dependencies. - It's necessary to do this (instead of just using /gnu/store as the - directory) because we want to hide the libraries in subdirectories - lib/dub/... instead of polluting the user's profile root." + "Prepare one new directory with all the required dependencies. It's necessary +to do this (instead of just using /gnu/store as the directory) because we want +to hide the libraries in subdirectories lib/dub/... instead of polluting the +user's profile root." (let* ((dir (mkdtemp! "/tmp/dub.XXXXXX")) (vendor-dir (string-append dir "/vendor"))) (setenv "HOME" dir) @@ -67,8 +67,7 @@ (define* (configure #:key inputs #:allow-other-keys) (symlink (string-append path "/lib/dub/" d-basename) (string-append vendor-dir "/" d-basename)))))))) inputs) - (invoke "dub" "add-path" vendor-dir) - #t)) + (invoke "dub" "add-path" vendor-dir))) (define (grep string file-name) "Find the first occurrence of STRING in the file named FILE-NAME. @@ -92,19 +91,11 @@ (define* (build #:key (dub-build-flags '()) (unless (or (grep* "sourceLibrary" "package.json") (grep* "sourceLibrary" "dub.sdl") ; note: format is different! (grep* "sourceLibrary" "dub.json")) - (apply invoke `("dub" "build" ,@dub-build-flags)) - (substitute* ".dub/dub.json" - (("\"lastUpgrade\": \"[^\"]*\"") - "\"lastUpgrade\": \"1970-01-01T00:00:00.0000000\""))) - #t) + (apply invoke `("dub" "build" ,@dub-build-flags)))) (define* (check #:key tests? #:allow-other-keys) (when tests? - (invoke "dub" "test") - (substitute* ".dub/dub.json" - (("\"lastUpgrade\": \"[^\"]*\"") - "\"lastUpgrade\": \"1970-01-01T00:00:00.0000000\""))) - #t) + (invoke "dub" "test"))) (define* (install #:key inputs outputs #:allow-other-keys) "Install a given DUB package." @@ -115,8 +106,7 @@ (define* (install #:key inputs outputs #:allow-other-keys) ;; TODO remove "-test-application" (copy-recursively "bin" outbin) (mkdir-p outlib) - (copy-recursively "." (string-append outlib)) - #t)) + (copy-recursively "." (string-append outlib)))) (define %standard-phases (modify-phases gnu:%standard-phases