From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id 2N/pDU9Jq2XnbAEAe85BDQ:P1 (envelope-from ) for ; Sat, 20 Jan 2024 05:17:19 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id 2N/pDU9Jq2XnbAEAe85BDQ (envelope-from ) for ; Sat, 20 Jan 2024 05:17:19 +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=INAoec5+; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1705724239; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: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=BmlFK80BqkHhhoX9GS9SR/Rq3cWXO0OQqp1T+e6FWJ4=; b=mXSAyUxkRgLd88kcA2x4BEWzwmQRBdBD5nfL4DQg6mn0Ole3YKdQO/LGTJcipgAwQ9tVyb QNbaRDxQJjZQGUcUoNkp6JvWpAaipaZ1rlGhi+Xy8v+ZeTokxXGc4cldFqgrpdrL4TMsc+ btvX/7JqN3HnuvB7zSuRWz3L7Lze0+SMXSQXGdEGZ0Wj/mGnNehgLNl6ghvtShK7JQLnss pcTlXfD4ltHMgKzCsyiCv+ZQBMZaN4/Cyvfq4BTBigXYl1Z7GzaHPA6mi/45ObLKmx2w2I Ssk7dhyvDwSmffLCUKDKz9DivUqExKnu75bSx/Mi73+XtoQ2EH66iY/XOykLBQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1705724239; a=rsa-sha256; cv=none; b=qDufijjnPcKornVHkf2yDYgGdVcWndEEQfndnvA78ZVn9rWmQnzZGo0doLeimyMSN1W8a5 iha4mCVH7QK9VnxMWsTPmzs0ozQRUSM1ItQAAFMkLZ5rJqWJmNtvOLXJZGsfkVmO8MCVEW WPmPviHZ1Py7boSOqbre8h8Sk6gA4CixCMPHUQViEynsyBPD02Pfl/qeoBIgQgez7S4DTR HoJC1/WvKUlYUj3NEWDQto7PITAHpUcKM3qngTXQf6wJniGlkMC16ARb/eCRLGxfxEn6KO GjgFyq1RW+61wKl1uKYnolqSIUIuM5XmwQF7yNMXakbdWHO4JXoTu2Z09RNIdA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=INAoec5+; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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" 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 C880F7D490 for ; Sat, 20 Jan 2024 05:17:18 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rR2mz-0003mE-R2; Fri, 19 Jan 2024 23:17:01 -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 1rR2mx-0003ll-VN for guix-patches@gnu.org; Fri, 19 Jan 2024 23:17:00 -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 1rR2mx-0007pU-ND for guix-patches@gnu.org; Fri, 19 Jan 2024 23:16:59 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rR2n0-0003me-9c for guix-patches@gnu.org; Fri, 19 Jan 2024 23:17:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68554] [PATCH v3 3/6] gnu: Add dmd. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 20 Jan 2024 04:17:02 +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: Efraim Flashner Cc: 68554@debbugs.gnu.org Received: via spool by 68554-submit@debbugs.gnu.org id=B68554.170572416411391 (code B ref 68554); Sat, 20 Jan 2024 04:17:02 +0000 Received: (at 68554) by debbugs.gnu.org; 20 Jan 2024 04:16:04 +0000 Received: from localhost ([127.0.0.1]:60628 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rR2m3-0002wz-JZ for submit@debbugs.gnu.org; Fri, 19 Jan 2024 23:16:04 -0500 Received: from mail-qt1-x834.google.com ([2607:f8b0:4864:20::834]:52587) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rR2m1-0002nh-3V for 68554@debbugs.gnu.org; Fri, 19 Jan 2024 23:16:01 -0500 Received: by mail-qt1-x834.google.com with SMTP id d75a77b69052e-42a029c8e62so8818301cf.1 for <68554@debbugs.gnu.org>; Fri, 19 Jan 2024 20:15:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705724152; x=1706328952; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=BmlFK80BqkHhhoX9GS9SR/Rq3cWXO0OQqp1T+e6FWJ4=; b=INAoec5+lsCimKBTYZlJ97L+f6moZzYqpMRDkGpXgXoaE+sBSIlDJCC6bbuE3o0hdY C4jh16f84Yy3JCDua+fjC4BjXgBiiIFr7dCRXpu4APJb37B7DfKxRewBoUASEdOf1XTr 7zgS+3y9Xt4ED/qIzRVMZ9zCQSmzFXkBz0/6RSFjCoLrqFeGR5+wyE+oyXLMloDOXgXf LOQqnmsaXVXi1FbuuW2VxRIx8cPXZtIKJZtoraTaHsmNle7BklbfNDrmvDy5CNQeahkE 4I4gIcnzhNNGDPCByxe5gpc8z96HBFlCmo3op/JiQxjBMW41xlBtTBeQSKfZsOsy6brD prJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705724152; x=1706328952; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=BmlFK80BqkHhhoX9GS9SR/Rq3cWXO0OQqp1T+e6FWJ4=; b=vLO59LvB5a+jXLdZkr+SKSLCvKbt5l/sgz4oolKBVvUemvXDM6jY+UkrrxcMR2YwEv oEoD0gzNLSyj0hgy4uK3iFw0dY61xfzq5cDwg/EJXJw2nHXvOAZfRi1Ok2520Vp2nKlf WOzzpV4dQ7JuoFk0q6Lv4VtLPRpz4TZdYlQJRJrBzwDNpXA19e/8k6Pp3P+lmf0tnPWL eiIol8UjmMxQbLoD4ng2wTG8k5nHzcm49fBcsYFHh/R2Iap9C9qxlefnDj6QfTGOFtEV HULettR+rq4no57TxXF8c1fRuEGjWtNHlReMj9wetSX/jUDcM2YMqCWwRATuilLaQmtC RAAA== X-Gm-Message-State: AOJu0YxWYR2f8Xqvqd383Gl3+Cuel6BmbfuoimThkf60lB9IG3DTqjXn G0MVWznegY3BsYT1y4XjDDJfFwuGFa7ziSSmUIpMJFkqNoXd+Klz+kL1tbmkZ1U= X-Google-Smtp-Source: AGHT+IH1orGr3tgtRCGx9SOAP3mFypzUScpvfxsnNUWPJFAud1nfhGEMwgXwYQY/63/vxqZG+ilpAA== X-Received: by 2002:ac8:58d1:0:b0:429:fea0:efc6 with SMTP id u17-20020ac858d1000000b00429fea0efc6mr1090267qta.71.1705724152384; Fri, 19 Jan 2024 20:15:52 -0800 (PST) Received: from hurd (dsl-10-132-160.b2b2c.ca. [72.10.132.160]) by smtp.gmail.com with ESMTPSA id jr42-20020a05622a802a00b0042545c7beccsm338461qtb.59.2024.01.19.20.15.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 20:15:51 -0800 (PST) From: Maxim Cournoyer In-Reply-To: (Efraim Flashner's message of "Fri, 19 Jan 2024 11:38:09 +0200") References: <33263f493ea13d0a468a73c9b704e1a0496c0a91.1705639243.git.maxim.cournoyer@gmail.com> Date: Fri, 19 Jan 2024 23:15:50 -0500 Message-ID: <87mst0hc7d.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain 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-Scanner: mx10.migadu.com X-Migadu-Spam-Score: 2.32 X-Spam-Score: 2.32 X-Migadu-Queue-Id: C880F7D490 X-TUID: 2q4yWUVYmWTD Hello! Efraim Flashner writes: > On Thu, Jan 18, 2024 at 11:40:41PM -0500, Maxim Cournoyer wrote: >> * gnu/packages/dlang.scm (dmd-bootstrap, dmd): New variables. >> >> Change-Id: I53e00a429e2084a392341ef1bc7ea63f0fcaaab4 [...] >> +;;; 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 name version)) > > you should probably switch name to "phobos", otherwise I assume it'll be > added as dmd. Good catch, done. > Also, is this the right way to add phobos as an input? It's the gexp way to add extra source files to a package workspace. We used to do this via labeled origins, but this is not possible in the label-less new world. I think it'd be cool to have a procedure that would take multiple source and merge them into one, possible using a copy-build-system like "plan" for the layout. Note: I tried building phobos separately at first, but that was a world of hurt, and the end result was a seg faulting dmd :-(. >> + (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 ".."))) > > Can this one be: > (with-directory-excursion "../druntime" > (apply (assoc-ref %standard-phases 'install) args)) Confusingly, no, as what I'm doing here is moving from ./phobos to ./druntime and finally to "."; i.e. the starting directory for the 'install-druntime phase is './phobos', not '.' Does that make some sense (writing it I'm doubtful, eh) ? > >> + (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)) > > Is this different than the regular install phase? I the install phase of druntime doesn't install its import includes, for some reason, and the install phase of phobos puts them under src/phobos instead of include/dmd. >> + (add-after 'install-license-files 'refine-install-layout >> + (lambda _ >> + (let* ((docdir (string-append #$output "/share/doc/" >> + (strip-store-file-name #$output))) > > is strip-store-file-name better than #$name "-" #$version ? I got bit by gexps being expanded in-place and not being rewritten in the inherited package, so to reuse that phase I had to use dynamic alternatives. >> + ;; 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") > > I only see 1 output, so this should probably be > (string-append #$output "/etc/dmd.conf") The search-input-file on outputs is a defensive trick: it fails with a clear error message when the file isn't found (I can't say that much about substitute* ^^'). So it's used here to test the file got installed there as expected. Thanks for taking a look! -- Maxim