aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Vollmert <rob@vllmrt.net>2019-07-15 15:47:14 +0200
committerLudovic Courtès <ludo@gnu.org>2019-08-17 16:23:06 +0200
commitc902458863d1d341ffd74970b75e69c2bb848183 (patch)
tree3e1be743977b793ab705a1b38ab3cd3ed2fa5ad9
parent198f560fcdf4f05b83b565acfd632153fb09bbf0 (diff)
downloadpatches-c902458863d1d341ffd74970b75e69c2bb848183.tar
patches-c902458863d1d341ffd74970b75e69c2bb848183.tar.gz
gnu: Add elm-compiler 0.19.0
This adds the elm compiler, version 0.19.0. This provides the `elm` command, with the exception of the `elm reactor` subcommand. Named `elm-compiler`, to leave space for `elm` as the full elm including reactor. * gnu/packages/elm.scm: New module. (elm-compiler): New package. * gnu/packages/patches/elm-disable-reactor.patch: New patch. * gnu/packages/patches/elm-fix-map-key.patch: New patch. * gnu/packages/patches/elm-relax-glsl-bound.patch: New patch. * gnu/local.mk: Add new files. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--gnu/local.mk6
-rw-r--r--gnu/packages/elm.scm81
-rw-r--r--gnu/packages/patches/elm-compiler-disable-reactor.patch71
-rw-r--r--gnu/packages/patches/elm-compiler-fix-map-key.patch38
-rw-r--r--gnu/packages/patches/elm-compiler-relax-glsl-bound.patch19
5 files changed, 214 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 16b63bc951..aab29beb0a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -161,6 +161,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/electronics.scm \
%D%/packages/elf.scm \
%D%/packages/elixir.scm \
+ %D%/packages/elm.scm \
%D%/packages/embedded.scm \
%D%/packages/emacs.scm \
%D%/packages/emacs-xyz.scm \
@@ -770,9 +771,12 @@ dist_patch_DATA = \
%D%/packages/patches/dstat-fix-crash-when-specifying-delay.patch \
%D%/packages/patches/dstat-skip-devices-without-io.patch \
%D%/packages/patches/dvd+rw-tools-add-include.patch \
+ %D%/packages/patches/einstein-build.patch \
%D%/packages/patches/elfutils-tests-ptrace.patch \
%D%/packages/patches/elixir-path-length.patch \
- %D%/packages/patches/einstein-build.patch \
+ %D%/packages/patches/elm-compiler-disable-reactor.patch \
+ %D%/packages/patches/elm-compiler-fix-map-key.patch \
+ %D%/packages/patches/elm-compiler-relax-glsl-bound.patch \
%D%/packages/patches/emacs-dired-toggle-sudo-emacs-26.patch \
%D%/packages/patches/emacs-exec-path.patch \
%D%/packages/patches/emacs-fix-scheme-indent-function.patch \
diff --git a/gnu/packages/elm.scm b/gnu/packages/elm.scm
new file mode 100644
index 0000000000..8b5ec36621
--- /dev/null
+++ b/gnu/packages/elm.scm
@@ -0,0 +1,81 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Robert Vollmert <rob@vllmrt.net>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages elm)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages haskell)
+ #:use-module (gnu packages haskell-check)
+ #:use-module (gnu packages haskell-crypto)
+ #:use-module (gnu packages haskell-xyz)
+ #:use-module (gnu packages haskell-web)
+ #:use-module (guix build-system haskell)
+ #:use-module (guix git-download)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix packages))
+
+;; The full elm build calls out to itself via Template Haskell to
+;; compile the elm reactor web app. elm reactor isn't required to
+;; compile elm applications, so we take this part out of this
+;; bootstrap package.
+(define-public elm-compiler
+ (package
+ (name "elm-compiler")
+ (version "0.19.0")
+ (source
+ (origin
+ (method git-fetch)
+ (file-name (git-file-name name version))
+ (uri (git-reference
+ (url "https://github.com/elm/compiler/")
+ (commit version)))
+ (sha256
+ (base32 "0s93z9vr0vp5w894ghc5s34nsq09sg1msf59zfiba87sid5vgjqy"))
+ (patches
+ (search-patches "elm-compiler-disable-reactor.patch"
+ "elm-compiler-relax-glsl-bound.patch"
+ "elm-compiler-fix-map-key.patch"))))
+ (build-system haskell-build-system)
+ (inputs
+ `(("ghc-ansi-terminal" ,ghc-ansi-terminal)
+ ("ghc-ansi-wl-pprint" ,ghc-ansi-wl-pprint)
+ ("ghc-edit-distance" ,ghc-edit-distance)
+ ("ghc-file-embed" ,ghc-file-embed)
+ ("ghc-http" ,ghc-http)
+ ("ghc-http-client" ,ghc-http-client)
+ ("ghc-http-client-tls" ,ghc-http-client-tls)
+ ("ghc-http-types" ,ghc-http-types)
+ ("ghc-language-glsl" ,ghc-language-glsl)
+ ("ghc-logict" ,ghc-logict)
+ ("ghc-network" ,ghc-network)
+ ("ghc-raw-strings-qq" ,ghc-raw-strings-qq)
+ ("ghc-scientific" ,ghc-scientific)
+ ("ghc-sha" ,ghc-sha)
+ ("ghc-snap-core" ,ghc-snap-core)
+ ("ghc-snap-server" ,ghc-snap-server)
+ ("ghc-unordered-containers"
+ ,ghc-unordered-containers)
+ ("ghc-utf8-string" ,ghc-utf8-string)
+ ("ghc-vector" ,ghc-vector)
+ ("ghc-zip-archive" ,ghc-zip-archive)))
+ (home-page "https://elm-lang.org")
+ (synopsis "Programming language for Web applications")
+ (description
+ "This package provides Elm, a statically-typed functional programming
+language for the browser. It includes commands for developers such as
+@command{elm make} and @command{elm repl}.")
+ (license license:bsd-3)))
diff --git a/gnu/packages/patches/elm-compiler-disable-reactor.patch b/gnu/packages/patches/elm-compiler-disable-reactor.patch
new file mode 100644
index 0000000000..9871b55e8d
--- /dev/null
+++ b/gnu/packages/patches/elm-compiler-disable-reactor.patch
@@ -0,0 +1,71 @@
+commit 20d80e2323b565a36751c9455e535d8f73fa32f7
+Author: Robert Vollmert <rob@vllmrt.net>
+Date: Fri Jun 14 16:05:47 2019 +0200
+
+ disable reactor
+
+diff --git a/elm.cabal b/elm.cabal
+index c75f9689..ece63c46 100644
+--- a/elm.cabal
++++ b/elm.cabal
+@@ -45,9 +45,6 @@ Executable elm
+ builder/src
+ ui/terminal/src
+
+- other-extensions:
+- TemplateHaskell
+-
+ Main-Is:
+ Main.hs
+
+@@ -56,8 +53,6 @@ Executable elm
+ Develop
+ Develop.Generate.Help
+ Develop.Generate.Index
+- Develop.StaticFiles
+- Develop.StaticFiles.Build
+ Diff
+ Init
+ Install
+diff --git a/ui/terminal/src/Develop.hs b/ui/terminal/src/Develop.hs
+index 4b2252e1..7ed7716e 100644
+--- a/ui/terminal/src/Develop.hs
++++ b/ui/terminal/src/Develop.hs
+@@ -23,7 +23,6 @@ import Snap.Util.FileServe
+ import qualified Elm.Project as Project
+ import qualified Develop.Generate.Help as Generate
+ import qualified Develop.Generate.Index as Index
+-import qualified Develop.StaticFiles as StaticFiles
+ import qualified Generate.Output as Output
+ import qualified Json.Encode as Encode
+ import qualified Reporting.Exit as Exit
+@@ -219,16 +218,7 @@ compileToHtmlBuilder mode file =
+
+
+ serveAssets :: Snap ()
+-serveAssets =
+- do file <- getSafePath
+- case StaticFiles.lookup file of
+- Nothing ->
+- pass
+-
+- Just (content, mimeType) ->
+- do modifyResponse (setContentType (mimeType <> ";charset=utf-8"))
+- writeBS content
+-
++serveAssets = pass
+
+
+ -- MIME TYPES
+diff --git a/ui/terminal/src/Main.hs b/terminal/src/Main.hs
+index 7000f3ca..2c76965a 100644
+--- a/ui/terminal/src/Main.hs
++++ b/ui/terminal/src/Main.hs
+@@ -39,7 +39,6 @@ main =
+ complex intro outro
+ [ repl
+ , init
+- , reactor
+ , make
+ , install
+ , bump
diff --git a/gnu/packages/patches/elm-compiler-fix-map-key.patch b/gnu/packages/patches/elm-compiler-fix-map-key.patch
new file mode 100644
index 0000000000..4f05ded530
--- /dev/null
+++ b/gnu/packages/patches/elm-compiler-fix-map-key.patch
@@ -0,0 +1,38 @@
+commit e3512d887df41a8162c3e361171c04beca08415b
+Author: Tom Stejskal <tom.stejskal@gmail.com>
+Date: Mon Nov 19 20:09:43 2018 +0100
+
+ Fix Map.!: given key is not an element in the map
+
+diff --git a/compiler/src/Elm/Compiler/Type/Extract.hs b/compiler/src/Elm/Compiler/Type/Extract.hs
+index 1aafe1d4..99763392 100644
+--- a/compiler/src/Elm/Compiler/Type/Extract.hs
++++ b/compiler/src/Elm/Compiler/Type/Extract.hs
+@@ -10,6 +10,7 @@ module Elm.Compiler.Type.Extract
+
+
+ import Data.Map ((!))
++import qualified Data.Map as Map
+ import qualified Data.Maybe as Maybe
+ import qualified Data.Set as Set
+
+@@ -134,11 +135,15 @@ extractUnion interfaces (Opt.Global home name) =
+ else
+ let
+ pname = toPublicName home name
+- unions = I._unions (interfaces ! home)
++ maybeUnions = I._unions <$> Map.lookup home interfaces
+ in
+- case I.toUnionInternals (unions ! name) of
+- Can.Union vars ctors _ _ ->
+- T.Union pname vars <$> traverse extractCtor ctors
++ case Map.lookup name =<< maybeUnions of
++ Just union ->
++ case I.toUnionInternals union of
++ Can.Union vars ctors _ _ ->
++ T.Union pname vars <$> traverse extractCtor ctors
++ Nothing ->
++ return $ T.Union pname [] []
+
+
+ extractCtor :: Can.Ctor -> Extractor (N.Name, [T.Type])
diff --git a/gnu/packages/patches/elm-compiler-relax-glsl-bound.patch b/gnu/packages/patches/elm-compiler-relax-glsl-bound.patch
new file mode 100644
index 0000000000..3f8be810c2
--- /dev/null
+++ b/gnu/packages/patches/elm-compiler-relax-glsl-bound.patch
@@ -0,0 +1,19 @@
+commit 4c649a5a270aba15cc6a3913c3ad51a293047f40
+Author: Rémi Lefèvre <rlefevre@gmail.com>
+Date: Mon Sep 3 19:18:54 2018 +0200
+
+ update language-glsl maximum version
+
+diff --git a/elm.cabal b/elm.cabal
+index 48aa84f0..464fe9d5 100644
+--- a/elm.cabal
++++ b/elm.cabal
+@@ -246,7 +246,7 @@ Executable elm
+ http-client >= 0.5 && < 0.6,
+ http-client-tls >= 0.3 && < 0.4,
+ http-types >= 0.9 && < 1.0,
+- language-glsl >= 0.0.2 && < 0.3,
++ language-glsl >= 0.0.2 && < 0.4,
+ logict,
+ mtl >= 2.2.1 && < 3,
+ network >= 2.4 && < 2.7,