diff options
author | Philip McGrath <philip@philipmcgrath.com> | 2022-05-18 14:11:09 -0400 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-05-22 01:07:54 +0200 |
commit | 9885c2fd07a26a48a40e0fda859a1c9ae0b3e973 (patch) | |
tree | 580b41df8203faff6e7e04b9360c16c7f1202fb3 | |
parent | gnu: Add elm-explorations-markdown. (diff) | |
download | guix-9885c2fd07a26a48a40e0fda859a1c9ae0b3e973.tar.gz guix-9885c2fd07a26a48a40e0fda859a1c9ae0b3e973.tar.bz2 guix-9885c2fd07a26a48a40e0fda859a1c9ae0b3e973.tar.xz |
gnu: elm: Support 'elm reactor'.
* 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.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r-- | doc/guix.texi | 7 | ||||
-rw-r--r-- | gnu/packages/elm.scm | 75 | ||||
-rw-r--r-- | guix/build-system/elm.scm | 2 |
3 files changed, 79 insertions, 5 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 5a07c995b9..27d0c69dad 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
@@ -8724,7 +8724,7 @@ build procedure for @url{https://elm-lang.org, Elm} packages similar to | |||
8724 | @samp{elm install}. | 8724 | @samp{elm install}. |
8725 | 8725 | ||
8726 | The build system adds an Elm compiler package to the set of inputs. The | 8726 | The build system adds an Elm compiler package to the set of inputs. The |
8727 | default compiler package (currently @code{elm}) can be overridden | 8727 | default compiler package (currently @code{elm-sans-reactor}) can be overridden |
8728 | using the @code{#:elm} argument. Additionally, Elm packages needed by the | 8728 | using the @code{#:elm} argument. Additionally, Elm packages needed by the |
8729 | build system itself are added as implicit inputs if they are not already | 8729 | build system itself are added as implicit inputs if they are not already |
8730 | present: to suppress this behavior, use the | 8730 | present: to suppress this behavior, use the |
@@ -8747,7 +8747,10 @@ The build system is focused on @dfn{packages} in the Elm sense of the word: | |||
8747 | Elm @dfn{projects} which declare @code{@{ "type": "package" @}} in their | 8747 | Elm @dfn{projects} which declare @code{@{ "type": "package" @}} in their |
8748 | @file{elm.json} files. Using @code{elm-build-system} to build Elm | 8748 | @file{elm.json} files. Using @code{elm-build-system} to build Elm |
8749 | @dfn{applications} (which declare @code{@{ "type": "application" @}}) is | 8749 | @dfn{applications} (which declare @code{@{ "type": "application" @}}) is |
8750 | possible, but requires ad-hoc modifications to the build phases. | 8750 | possible, but requires ad-hoc modifications to the build phases. For |
8751 | an example, see the definition of | ||
8752 | the @code{elm} package itself (because the front-end for the | ||
8753 | @samp{elm reactor} command is an Elm application). | ||
8751 | 8754 | ||
8752 | @item | 8755 | @item |
8753 | Elm supports multiple versions of a package coexisting simultaneously under | 8756 | 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 @@ | |||
40 | ;; `elm reactor` exit with a useful error message if they aren't there. | 40 | ;; `elm reactor` exit with a useful error message if they aren't there. |
41 | (define %reactor-root-base | 41 | (define %reactor-root-base |
42 | "share/elm/reactor-") | 42 | "share/elm/reactor-") |
43 | (define-public elm | 43 | (define-public elm-sans-reactor |
44 | (package | 44 | (package |
45 | (name "elm") | 45 | (name "elm-sans-reactor") |
46 | (version "0.19.1") | 46 | (version "0.19.1") |
47 | (source | 47 | (source |
48 | (origin | 48 | (origin |
@@ -93,6 +93,77 @@ | |||
93 | ghc-vector | 93 | ghc-vector |
94 | ghc-zip-archive)) | 94 | ghc-zip-archive)) |
95 | (home-page "https://elm-lang.org") | 95 | (home-page "https://elm-lang.org") |
96 | (synopsis "Minimal variant of @command{elm}") | ||
97 | (description | ||
98 | "This package provides a version of the Elm compiler without support for | ||
99 | the @command{elm reactor} development command.") | ||
100 | (license license:bsd-3))) | ||
101 | |||
102 | (define-public elm | ||
103 | (package | ||
104 | (name "elm") | ||
105 | (version (package-version elm-sans-reactor)) | ||
106 | (source (package-source elm-sans-reactor)) | ||
107 | (native-inputs (list elm-sans-reactor)) | ||
108 | (inputs (list elm-sans-reactor | ||
109 | elm-browser | ||
110 | elm-core | ||
111 | elm-html | ||
112 | elm-http | ||
113 | elm-json | ||
114 | elm-project-metadata-utils | ||
115 | elm-svg | ||
116 | elm-explorations-markdown)) | ||
117 | (build-system elm-build-system) | ||
118 | (arguments | ||
119 | (list | ||
120 | #:modules | ||
121 | `((srfi srfi-26) | ||
122 | ,@%elm-default-modules) | ||
123 | #:phases | ||
124 | #~(modify-phases %standard-phases | ||
125 | (delete 'stage) | ||
126 | (replace 'configure | ||
127 | (lambda* (#:key native-inputs inputs #:allow-other-keys) | ||
128 | (with-directory-excursion "reactor" | ||
129 | (patch-application-dependencies)))) | ||
130 | (replace 'build | ||
131 | (lambda* (#:key native-inputs inputs #:allow-other-keys) | ||
132 | (with-directory-excursion "reactor" | ||
133 | (invoke (search-input-file (or native-inputs inputs) | ||
134 | "/bin/elm") | ||
135 | "make" | ||
136 | "--optimize" | ||
137 | "src/NotFound.elm" | ||
138 | "src/Errors.elm" | ||
139 | "src/Index.elm")))) | ||
140 | (replace 'install | ||
141 | (lambda* (#:key inputs #:allow-other-keys) | ||
142 | (let* ((out-dir #$output) | ||
143 | (bin-dir (string-append out-dir "/bin")) | ||
144 | (reactor-dir (string-append out-dir | ||
145 | "/" | ||
146 | #$%reactor-root-base | ||
147 | (getenv "GUIX_ELM_VERSION"))) | ||
148 | (reactor-subdir (string-append reactor-dir "/_elm"))) | ||
149 | ;; We can't use a symlink here because Haskell's | ||
150 | ;; `getExecutablePath` follows all symlinks. | ||
151 | ;; Guix can make it a hard link later. | ||
152 | (install-file (search-input-file inputs ;; NOT native-inputs | ||
153 | "/bin/elm") | ||
154 | bin-dir) | ||
155 | (install-file "reactor/assets/favicon.ico" reactor-dir) | ||
156 | (for-each (cut install-file <> reactor-subdir) | ||
157 | '("reactor/elm.js" | ||
158 | "reactor/assets/styles.css" | ||
159 | ;; TODO: these are source-code-pro v1.017 and | ||
160 | ;; source-sans-pro v1.050: there may be breaking | ||
161 | ;; changes in Guix's existing | ||
162 | ;; font-adobe-source-{code,sans}-pro packages | ||
163 | "reactor/assets/source-code-pro.ttf" | ||
164 | "reactor/assets/source-sans-pro.ttf"))))) | ||
165 | (delete 'validate-compiled)))) | ||
166 | (home-page "https://elm-lang.org") | ||
96 | (synopsis "Programming language for Web applications") | 167 | (synopsis "Programming language for Web applications") |
97 | (description | 168 | (description |
98 | "Elm is a statically-typed, purely-functional programming language for | 169 | "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 @@ given VERSION with sha256 checksum HASH." | |||
101 | "Return the default Elm package for builds." | 101 | "Return the default Elm package for builds." |
102 | ;; Lazily resolve the binding to avoid a circular dependency. | 102 | ;; Lazily resolve the binding to avoid a circular dependency. |
103 | (let ((elm (resolve-interface '(gnu packages elm)))) | 103 | (let ((elm (resolve-interface '(gnu packages elm)))) |
104 | (module-ref elm 'elm))) | 104 | (module-ref elm 'elm-sans-reactor))) |
105 | 105 | ||
106 | (define (default-elm-core) | 106 | (define (default-elm-core) |
107 | "Return the default elm-core package." | 107 | "Return the default elm-core package." |