From patchwork Wed May 18 18:11:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 39502 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 0B97627BBEA; Wed, 18 May 2022 19:16:20 +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 6E6F527BBE9 for ; Wed, 18 May 2022 19:16:19 +0100 (BST) Received: from localhost ([::1]:43730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nrODa-0004fy-HB for patchwork@mira.cbaines.net; Wed, 18 May 2022 14:16:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nrOBR-000081-DR for guix-patches@gnu.org; Wed, 18 May 2022 14:14:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39692) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nrOBQ-0005P7-VJ for guix-patches@gnu.org; Wed, 18 May 2022 14:14:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nrOBQ-0006TE-Qt for guix-patches@gnu.org; Wed, 18 May 2022 14:14:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55030] [PATCH v2 22/34] gnu: elm: Support 'elm reactor'. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 18 May 2022 18:14:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55030 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55030@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Philip McGrath Received: via spool by 55030-submit@debbugs.gnu.org id=B55030.165289761924721 (code B ref 55030); Wed, 18 May 2022 18:14:04 +0000 Received: (at 55030) by debbugs.gnu.org; 18 May 2022 18:13:39 +0000 Received: from localhost ([127.0.0.1]:33565 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nrOB0-0006QZ-Q7 for submit@debbugs.gnu.org; Wed, 18 May 2022 14:13:39 -0400 Received: from mail-vs1-f42.google.com ([209.85.217.42]:37437) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nrOAy-0006Oq-0k for 55030@debbugs.gnu.org; Wed, 18 May 2022 14:13:36 -0400 Received: by mail-vs1-f42.google.com with SMTP id w10so460384vsa.4 for <55030@debbugs.gnu.org>; Wed, 18 May 2022 11:13:36 -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=UHfL3C/ibqhoWyMSseXInHhRAjPSYuVXliqi06fgUCQ=; b=E1dixoAik3ep+cOGleYWgwC/gw64M2O0nWBmG9Gn4n0r/DFcu6oS+KDx7LUZu/orIL hKVoBmFvWjjPRFQ03J/o/aJOhjn1KD3okvi6jgM5QcEmupJXO31ZiVtZjkbNBUAMRq7m ORV3CMNsW+8lfDnDcmrrH0ls/Tct0p8tYTzfZvDq4+08OBNh11tyPW66kHP+2O3Z1iR3 dVFbjBTQKdvY88amPOt+eN1HaIw42yQ9EKBJS8N19VGyXSUOIvK6VMpmS8EWXa4FpIf6 JLl2q3Y0v16SbVXeqgGvYEE6rPSNi5K+so6qmtFqr44QT4ymqnHuKLbMn7utMvMzvjpw pzYg== 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=UHfL3C/ibqhoWyMSseXInHhRAjPSYuVXliqi06fgUCQ=; b=a6mRFfFy1Y9/RxusjBAQz7Gu1HVQZkmy6FepIYyHTY+TUmETigCYZkJ1YR99MlJnIe N5G8CqKuvYq2/R0i3Z3e/LGl2t4Ikx5MeNLlOiFCppVFA9WlNo4ZMuMm9hSMK5fbszAh KD7CltJ8/B6IFi3W142fPMCeF0MSXvnoomteN9BMlUamcUtVL5gzypuVrdLg2ILNpmrG O9psTgdujqou85HdEW7cwN9tQ3RwlkSC/UtX2e6G78cY5hh2liyhcFvSoM7ZHTMdr9GM Pl4dSInQU2I+5P6OFRONf1/2v4CpiWMpyOx/MuTrRVk6S0GAIcGqwYpO8euVW/U5Anpk cizQ== X-Gm-Message-State: AOAM5315U0X5qa1PZgOOwZSBV4szqvX9IFQ7wdJHS6rZlByaGunjgXl3 Vi/OL8i51MGPdLstBx+hirzTuurtVHUmHFaJ X-Google-Smtp-Source: ABdhPJysnL8i7NRJ9IHrOBY1BeXhkWEFrPmCtAnZ11ULl2GUDgMnpmq8hOnLqQsOKMb+tcZ12nG24Q== X-Received: by 2002:a05:6102:3002:b0:335:c397:db4f with SMTP id s2-20020a056102300200b00335c397db4fmr648346vsa.37.1652897615527; Wed, 18 May 2022 11:13:35 -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 b19-20020a67cb13000000b0032d275e6909sm261975vsl.9.2022.05.18.11.13.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 May 2022 11:13:35 -0700 (PDT) From: Philip McGrath Date: Wed, 18 May 2022 14:11:09 -0400 Message-Id: <1a6669a4b3f0364cb0686e4ff70a0cdc44b53de6.1652890702.git.philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: <20220419232736.272970-1-philip@philipmcgrath.com> 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 * gnu/packages/elm.scm (elm): Rename to ... (elm-sans-reactor): ... this new variable. [synopsis, description]: Tweak. (elm): New variable. * guix/build-system/elm.scm (default-elm): Use elm-sans-reactor. * doc/guix.texi (Build Systems)[elm-build-system]: Update accordingly. --- doc/guix.texi | 7 ++-- gnu/packages/elm.scm | 75 +++++++++++++++++++++++++++++++++++++-- guix/build-system/elm.scm | 2 +- 3 files changed, 79 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index d7bc7523cd..282cddf798 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -8724,7 +8724,7 @@ Build Systems @samp{elm install}. The build system adds an Elm compiler package to the set of inputs. The -default compiler package (currently @code{elm}) can be overridden +default compiler package (currently @code{elm-sans-reactor}) can be overridden using the @code{#:elm} argument. Additionally, Elm packages needed by the build system itself are added as implicit inputs if they are not already present: to suppress this behavior, use the @@ -8747,7 +8747,10 @@ Build Systems Elm @dfn{projects} which declare @code{@{ "type": "package" @}} in their @file{elm.json} files. Using @code{elm-build-system} to build Elm @dfn{applications} (which declare @code{@{ "type": "application" @}}) is -possible, but requires ad-hoc modifications to the build phases. +possible, but requires ad-hoc modifications to the build phases. For +an example, see the definition of +the @code{elm} package itself (because the front-end for the +@samp{elm reactor} command is an Elm application). @item Elm supports multiple versions of a package coexisting simultaneously under diff --git a/gnu/packages/elm.scm b/gnu/packages/elm.scm index 8f92eea041..d515d68e8f 100644 --- a/gnu/packages/elm.scm +++ b/gnu/packages/elm.scm @@ -40,9 +40,9 @@ (define-module (gnu packages elm) ;; `elm reactor` exit with a useful error message if they aren't there. (define %reactor-root-base "share/elm/reactor-") -(define-public elm +(define-public elm-sans-reactor (package - (name "elm") + (name "elm-sans-reactor") (version "0.19.1") (source (origin @@ -93,6 +93,77 @@ (define-public elm ghc-vector ghc-zip-archive)) (home-page "https://elm-lang.org") + (synopsis "Minimal variant of @command{elm}") + (description + "This package provides a version of the Elm compiler without support for +the @command{elm reactor} development command.") + (license license:bsd-3))) + +(define-public elm + (package + (name "elm") + (version (package-version elm-sans-reactor)) + (source (package-source elm-sans-reactor)) + (native-inputs (list elm-sans-reactor)) + (inputs (list elm-sans-reactor + elm-browser + elm-core + elm-html + elm-http + elm-json + elm-project-metadata-utils + elm-svg + elm-explorations-markdown)) + (build-system elm-build-system) + (arguments + (list + #:modules + `((srfi srfi-26) + ,@%elm-default-modules) + #:phases + #~(modify-phases %standard-phases + (delete 'stage) + (replace 'configure + (lambda* (#:key native-inputs inputs #:allow-other-keys) + (with-directory-excursion "reactor" + (patch-application-dependencies)))) + (replace 'build + (lambda* (#:key native-inputs inputs #:allow-other-keys) + (with-directory-excursion "reactor" + (invoke (search-input-file (or native-inputs inputs) + "/bin/elm") + "make" + "--optimize" + "src/NotFound.elm" + "src/Errors.elm" + "src/Index.elm")))) + (replace 'install + (lambda* (#:key inputs #:allow-other-keys) + (let* ((out-dir #$output) + (bin-dir (string-append out-dir "/bin")) + (reactor-dir (string-append out-dir + "/" + #$%reactor-root-base + (getenv "GUIX_ELM_VERSION"))) + (reactor-subdir (string-append reactor-dir "/_elm"))) + ;; We can't use a symlink here because Haskell's + ;; `getExecutablePath` follows all symlinks. + ;; Guix can make it a hard link later. + (install-file (search-input-file inputs ;; NOT native-inputs + "/bin/elm") + bin-dir) + (install-file "reactor/assets/favicon.ico" reactor-dir) + (for-each (cut install-file <> reactor-subdir) + '("reactor/elm.js" + "reactor/assets/styles.css" + ;; TODO: these are source-code-pro v1.017 and + ;; source-sans-pro v1.050: there may be breaking + ;; changes in Guix's existing + ;; font-adobe-source-{code,sans}-pro packages + "reactor/assets/source-code-pro.ttf" + "reactor/assets/source-sans-pro.ttf"))))) + (delete 'validate-compiled)))) + (home-page "https://elm-lang.org") (synopsis "Programming language for Web applications") (description "Elm is a statically-typed, purely-functional programming language for diff --git a/guix/build-system/elm.scm b/guix/build-system/elm.scm index 293bcbfb64..f5321f811b 100644 --- a/guix/build-system/elm.scm +++ b/guix/build-system/elm.scm @@ -101,7 +101,7 @@ (define (default-elm) "Return the default Elm package for builds." ;; Lazily resolve the binding to avoid a circular dependency. (let ((elm (resolve-interface '(gnu packages elm)))) - (module-ref elm 'elm))) + (module-ref elm 'elm-sans-reactor))) (define (default-elm-core) "Return the default elm-core package."