From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id syeWCkBPq2X/GwAA62LTzQ:P1 (envelope-from ) for ; Sat, 20 Jan 2024 05:42:40 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id syeWCkBPq2X/GwAA62LTzQ (envelope-from ) for ; Sat, 20 Jan 2024 05:42:40 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=gW3FCNrn; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1705725760; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=T2SVT8GWHVM/vTnWKRBtbPpO6QjWXJoXNql5sflZpTU=; b=FuUd/9TppxhDHSHI71Tcw6gc9IfbiHLSkqS5E7/2FF6Q/uh4EKuqCWrWY1REvqJT/jD5w7 B1bO8SzKr6HX9eEVmWJplkpYaJjmW3EaebDaMqTUsEi3/re8rMZUEaE9APM3r5xjOJE2S+ Qvoo30wt+8gF3OQehfZXJECYyMzcqA+YKhITcu0/CSDCJQng7U15UobRJuYXxWfgwd6SZg d/DioogeGHZn0Sxe+ewe7kroRzMz1cf0N1xAvLOC2V+Twsyuu4ov49sEIhOwVZwmkc1N/F MnKXbTgOUG7d+uhMeDJXX9scF6LZk5NuRSDxFzft4AFT0xeQyQAgKnR71IrLTw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=gW3FCNrn; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1705725760; a=rsa-sha256; cv=none; b=dt33vMISCQ81aI4cmMwVNfZ5ReRSOfJ/PgqfYTG9WhgXeRktzPHGrQvj7gKRe/c6039Y8+ BOoKPyK6wZywizp5bh8tL8BXYNr2Q3mDJNwmRZd5fDUd/wzA8zmDLdwVylu2V7ofYy6SkO uayBuqFvp+y36c9MLiSDXNwE8upmEBbASGxbM++/JgIL7Jz0sZlHb4vN/5+HzclAppvJlS RUTEgHXuqqhplsOcTZVWQnMaKt0wgBn0mGoVoPEr8iQwrjidRatRclGI3YXjTYRUc3s1ob rRsWAL3yVtBYQHKQxgMX/7DIO4VDToDtDQn8wHv1YYnG7TnvFCpiQs3F6f28LQ== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id DFA113E11B for ; Sat, 20 Jan 2024 05:42:39 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rR3BC-0001qt-Sp; Fri, 19 Jan 2024 23:42:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rR3BB-0001qL-Dc for guix-patches@gnu.org; Fri, 19 Jan 2024 23:42:01 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rR3BB-0000Pz-57 for guix-patches@gnu.org; Fri, 19 Jan 2024 23:42:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rR3BD-0007HG-Ho for guix-patches@gnu.org; Fri, 19 Jan 2024 23:42:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68554] [PATCH v4 3/5] gnu: Add dmd. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 20 Jan 2024 04:42:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68554 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68554@debbugs.gnu.org Cc: efraim@flashner.co.il, Maxim Cournoyer Received: via spool by 68554-submit@debbugs.gnu.org id=B68554.170572570527917 (code B ref 68554); Sat, 20 Jan 2024 04:42:03 +0000 Received: (at 68554) by debbugs.gnu.org; 20 Jan 2024 04:41:45 +0000 Received: from localhost ([127.0.0.1]:60656 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rR3Au-0007GC-Og for submit@debbugs.gnu.org; Fri, 19 Jan 2024 23:41:45 -0500 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]:48187) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rR3Ao-0007FB-6O for 68554@debbugs.gnu.org; Fri, 19 Jan 2024 23:41:39 -0500 Received: by mail-qt1-x835.google.com with SMTP id d75a77b69052e-4298b23abffso8559551cf.0 for <68554@debbugs.gnu.org>; Fri, 19 Jan 2024 20:41:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705725689; x=1706330489; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T2SVT8GWHVM/vTnWKRBtbPpO6QjWXJoXNql5sflZpTU=; b=gW3FCNrnwPQDb9+9Ss2VjBED9CwOS9ejzqUjqjXUscSoAmOAcwxsSJs1JjiaFvQF/H HyCuaRlW7Yzw/nc6qsxKqtSZ/wmA2UBGPdtFSPK//kLqpvIAifq/jJbyyX4+AVUrr4qU iQuXfrnFQYGj45ZGWqKOV2JFQRGQ3lcQqJqWZm2N53N2H6P0CPzYlI87Y4Cs3uQI/qWm 2/0N3w47gE5fIpP/RqEdNM1bCDAe0bctX9i/S1z45cHsXRpqnCWGpiKBCiZQRuQCfErh NYlvg2zh5PNotEhP5f0zhyncshngRm565JQF/VTzDGT0lPcy0vWhEN8kJx/Rl4Xtgv8J 7Twg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705725689; x=1706330489; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T2SVT8GWHVM/vTnWKRBtbPpO6QjWXJoXNql5sflZpTU=; b=Dvmd5yzVXcY1eOorA0IZbyQi4TMEwZKFf0bULgjlhmsKNBKJNu78qbh6susUgIwiDs jLsJ3ffxzRPjXLGezDAWNi5jkP6kzS+9T22e+a9jXGobkz6iOQLEGdO0vyzNGbOQcwc/ oIn2tTi6sJtMtZZTpimIWC63owYv4dHRKlgsBjJNKU2rVNrPgyt9Z/tWhmG7BLWlp1o0 mm3lUH54i1XtnLuvtD2Z7pkvIR7qWwvX8kUj1FK2IOaobYnmcYOX7IjWQNMi9l1CSfY6 1DyDlvI6goKeT1EWDxyDT9Xi2RmqdJ7rOEmLXwRlj5LJk+NFitm2ixba2WLtP/8FAalf Stzw== X-Gm-Message-State: AOJu0YyLOW7bJbds33uKUK3AMfsiJ3CmtZKyBdfgPBUmXGV5wrZTy6Ki gPVgN/ohtd7+3WRsGpxyga/Mn5HqnKPB0NjFlR+2UlaTcU3pAWoN4RmapGAo X-Google-Smtp-Source: AGHT+IE+/WoAYVz25/oZvJ625MMHbUYQjGlbKaY+A8RN7ye0collk+6KYYw/92lF9OZp1zU5oOuh5A== X-Received: by 2002:ac8:5911:0:b0:42a:1e34:5dc3 with SMTP id 17-20020ac85911000000b0042a1e345dc3mr1202126qty.17.1705725689630; Fri, 19 Jan 2024 20:41:29 -0800 (PST) Received: from localhost.localdomain (dsl-10-132-160.b2b2c.ca. [72.10.132.160]) by smtp.gmail.com with ESMTPSA id ci21-20020a05622a261500b0042998676bc3sm363348qtb.43.2024.01.19.20.41.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 20:41:29 -0800 (PST) From: Maxim Cournoyer Date: Fri, 19 Jan 2024 23:37:07 -0500 Message-ID: <5e228e1b02057ef071c8c4eb7efda8706be8cda0.1705725428.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: 2.83 X-Migadu-Scanner: mx13.migadu.com X-Spam-Score: 2.83 X-Migadu-Queue-Id: DFA113E11B X-TUID: 2heYTHzhbSKa * gnu/packages/dlang.scm (dmd-bootstrap, dmd): New variables. Change-Id: I53e00a429e2084a392341ef1bc7ea63f0fcaaab4 --- Changes in v4: - Name phobos source as "phobos" (thanks to Efraim) Changes in v3: - Add packages built from dmd and D demangling support to qt-creator Changes in v2: - Build make flags via inheritance... - Fixing the missing SYSCONFDIR make flag gnu/packages/dlang.scm | 165 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm index 5c9766110d..58411166b7 100644 --- a/gnu/packages/dlang.scm +++ b/gnu/packages/dlang.scm @@ -358,6 +358,171 @@ (define-public ldc `(("clang" ,clang-14) ;propagates llvm and clang-runtime ("python-lit" ,python-lit)))))) +;;; Bootstrap version of phobos that is built with GDC, using GDC's standard +;;; library. +(define dmd-bootstrap + (package + ;; This package is purposefully named just "dmd" and not "dmd-bootstrap", + ;; as the final dmd package rewrites references from this one to itself, + ;; and their names must have the same length to avoid corrupting the + ;; binary. + (name "dmd") + (version "2.106.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/dlang/dmd") + (commit (string-append "v" version)))) + (file-name (git-file-name "dmd" version)) + (sha256 + (base32 + "1bq4jws1vns2jjzfz7biyngrx9y5pvvgklymhrvb5kvbzky1ldmy")))) + (build-system gnu-build-system) + (arguments + (list + #:disallowed-references (list (gexp-input (canonical-package gcc) + "lib")) + ;; Disable tests, as gdmd cannot cope with some arguments used such as + ;; '-conf'. + #:tests? #f + #:test-target "test" + #:make-flags + #~(list (string-append "CC=" #$(cc-for-target)) + ;; XXX: Proceed despite conflicts from symbols provided by both + ;; the source built and GDC. + "DFLAGS=-L--allow-multiple-definition" + "ENABLE_RELEASE=1" + (string-append "HOST_CXX=" #$(cxx-for-target)) + "HOST_DMD=gdmd" + (string-append "INSTALL_DIR=" #$output) + ;; Do not build the shared libphobos2.so library, to avoid + ;; retaining a reference to gcc:lib. + "SHARED=0" + (string-append "SYSCONFDIR=" #$output "/etc") + "VERBOSE=1" + "-f" "posix.mak") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'copy-phobos-source-and-chdir + ;; Start with building phobos, which in turns will automatically + ;; build druntime and dmd. A minimal dmd command is still + ;; required to do so, which is why we need dmd-bootstrap-0. + (lambda _ + (symlink "." "dmd") ;to please the build system expected layout + (copy-recursively + #$(origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/dlang/phobos") + (commit (string-append "v" version)))) + (file-name (git-file-name "phobos" version)) + (sha256 + (base32 + "1yw7nb5d78cx9m7sfibv7rfc7wj3w0dw9mfk3d269qpfpnwzs4n9"))) + "phobos") + (chdir "phobos"))) + (add-after 'copy-phobos-source-and-chdir 'adjust-phobos-install-dirs + (lambda _ + (substitute* "posix.mak" + ;; Install to lib directory, not to e.g. 'linux/lib64'. + (("\\$\\(INSTALL_DIR)/\\$\\(OS)/\\$\\(lib_dir)") + (string-append #$output "/lib")) + ;; Do not install license file, already done by the gnu build + ;; system. + ((".*\\$\\(INSTALL_DIR)/phobos-LICENSE.txt.*") "")))) + (delete 'configure) + (add-after 'install 'install-druntime + (lambda args + (chdir "../druntime") + (apply (assoc-ref %standard-phases 'install) args) + (chdir ".."))) + (add-after 'install-druntime 'install-includes + (lambda _ + ;; Normalize the include files prefix to include/dmd. + (let ((include-dir (string-append #$output "/include/dmd"))) + (mkdir-p include-dir) + (rename-file (string-append #$output "/src/phobos") + (string-append include-dir)) + (copy-recursively "druntime/import" include-dir)) + (delete-file-recursively (string-append #$output "/src")))) + (add-after 'install-druntime 'install-dmd + (assoc-ref %standard-phases 'install)) + (add-after 'install-license-files 'refine-install-layout + (lambda _ + (let* ((docdir (string-append #$output "/share/doc/" + (strip-store-file-name #$output))) + ;; The dmd binary gets installed to + ;; e.g. /linux/bin64/dmd. + (dmd (car (find-files #$output "^dmd$"))) + (dmd.conf (car (find-files #$output "^dmd.conf$"))) + (os-dir (dirname (dirname dmd)))) + ;; Move samples from root to the doc directory. + (rename-file (string-append #$output "/samples") + (string-append docdir "/samples")) + ;; Remove duplicate license file. + (delete-file (string-append #$output + "/dmd-boostlicense.txt")) + ;; Move dmd binary and dmd.conf. + (install-file dmd (string-append #$output "/bin")) + (install-file dmd.conf (string-append #$output "/etc")) + (delete-file-recursively os-dir)))) + (add-after 'refine-install-layout 'patch-dmd.conf + (lambda* (#:key outputs #:allow-other-keys) + (substitute* (search-input-file outputs "etc/dmd.conf") + (("lib(32|64)") + "lib") + (("\\.\\./src/(phobos|druntime/import)") + "include/dmd"))))))) + (native-inputs (list gdmd which)) + (home-page "https://github.com/dlang/dmd") + (synopsis "Reference D Programming Language compiler") + (description "@acronym{DMD, Digital Mars D compiler} is the reference +compiler for the D programming language.") + (license license:boost1.0))) + +;;; Second bootstrap of DMD, built using dmd-bootstrap, with its shared +;;; libraries preserved. +(define-public dmd + (package + (inherit dmd-bootstrap) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments + '(#:tests?) ;reinstate tests + (package-arguments dmd-bootstrap)) + ((#:disallowed-references _ ''()) + (list dmd-bootstrap)) + ((#:modules _ ''()) + '((guix build gnu-build-system) + (guix build utils) + (srfi srfi-1))) ;for fold + ((#:make-flags flags ''()) + #~(fold delete #$flags '("DFLAGS=-L--allow-multiple-definition" + "HOST_DMD=gdmd" + "SHARED=0"))) + ((#:phases phases '%standard-phases) + #~(modify-phases #$phases + (add-after 'patch-dmd.conf 'rewrite-references-to-bootstrap + ;; DMD keeps references to include files used to build a + ;; binary. Rewrite those of dmd-bootstrap to itself, to reduce + ;; its closure size. + (lambda* (#:key native-inputs inputs outputs + #:allow-other-keys) + (let ((dmd (search-input-file outputs "bin/dmd")) + (dmd-bootstrap (dirname + (dirname + (search-input-file + (or native-inputs inputs) + "bin/dmd"))))) + ;; XXX: Use sed, as replace-store-references wouldn't + ;; replace the references, while substitute* throws an + ;; error. + (invoke "sed" "-i" + (format #f "s,~a,~a,g" dmd-bootstrap #$output) + dmd)))))))) + (native-inputs (modify-inputs (package-native-inputs dmd-bootstrap) + (replace "gdmd" dmd-bootstrap))))) + (define-public dub (package (name "dub") -- 2.41.0