2015-12-17 11:29:17 +00:00
|
|
|
require "language/haskell"
|
|
|
|
|
|
|
|
class Elm < Formula
|
|
|
|
include Language::Haskell::Cabal
|
|
|
|
|
|
|
|
desc "Functional programming language for building browser-based GUIs"
|
|
|
|
homepage "http://elm-lang.org"
|
|
|
|
|
|
|
|
stable do
|
2016-07-02 16:44:18 +00:00
|
|
|
url "https://github.com/elm-lang/elm-compiler/archive/0.17.1.tar.gz"
|
|
|
|
sha256 "3339b79696981b76a719c651bda18082f4ecc58e01d913b29b202f174665e387"
|
2015-12-17 11:29:17 +00:00
|
|
|
|
|
|
|
resource "elm-package" do
|
2016-07-02 16:44:18 +00:00
|
|
|
url "https://github.com/elm-lang/elm-package/archive/0.17.1.tar.gz"
|
|
|
|
sha256 "f7f9ede1066fe55e0f9e94906fdda0e4a0f56efeb12de8481bc5f5b96b78d33d"
|
2015-12-17 11:29:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "elm-make" do
|
2016-07-02 16:44:18 +00:00
|
|
|
url "https://github.com/elm-lang/elm-make/archive/0.17.1.tar.gz"
|
|
|
|
sha256 "918316f65fc8cac1f6fe8cffa9b86aeff3d9d9a446559db43ec7c87e1dc78d95"
|
2015-12-17 11:29:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "elm-repl" do
|
2016-07-02 16:44:18 +00:00
|
|
|
url "https://github.com/elm-lang/elm-repl/archive/0.17.1.tar.gz"
|
|
|
|
sha256 "01621479d798f906d90c2bff77fdefe4a76b1855241efc9a3530d4febcdee61b"
|
2015-12-17 11:29:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "elm-reactor" do
|
2016-07-02 16:44:18 +00:00
|
|
|
url "https://github.com/elm-lang/elm-reactor/archive/0.17.1.tar.gz"
|
|
|
|
sha256 "0778df7e7fad897c750c29024166234cf3b4fcebe664aa52d864e0b64691e5e0"
|
2015-12-17 11:29:17 +00:00
|
|
|
end
|
|
|
|
end
|
2015-12-20 16:23:32 +00:00
|
|
|
|
2015-12-20 13:12:16 +00:00
|
|
|
bottle do
|
2016-07-04 11:27:27 +00:00
|
|
|
sha256 "d7babb625ca0a614a434d2db6c4af692bb9a5d543461a4e5a39e61f2f86b3e53" => :el_capitan
|
|
|
|
sha256 "ed537a9a30af32282badb2d61b52f653a073eec07efd08405b37b025de8b01e1" => :yosemite
|
|
|
|
sha256 "63eb1dfad6bd3b17c07d9695082c7771f1ea2773ee3231ed6289ebf887f81013" => :mavericks
|
2015-12-20 13:12:16 +00:00
|
|
|
end
|
|
|
|
|
2015-12-17 11:29:17 +00:00
|
|
|
depends_on "ghc" => :build
|
|
|
|
depends_on "cabal-install" => :build
|
|
|
|
|
2016-07-02 16:44:18 +00:00
|
|
|
# GHC 8 compat
|
|
|
|
# Fixes "No instance for (Num Json.Indent) arising from the literal '2'"
|
|
|
|
# Reported 3 Jul 2016; PR subject "aeson-pretty: use Spaces with confIndent"
|
|
|
|
patch do
|
|
|
|
url "https://github.com/elm-lang/elm-compiler/pull/1431.patch"
|
|
|
|
sha256 "4f11e645b4190eb3b0cbea7c641d4b28b307b811889f3b8206f45f6e53a5575b"
|
|
|
|
end
|
|
|
|
|
2015-12-17 11:29:17 +00:00
|
|
|
def install
|
|
|
|
# elm-compiler needs to be staged in a subdirectory for the build process to succeed
|
|
|
|
(buildpath/"elm-compiler").install Dir["*"]
|
|
|
|
|
elm: GHC 8 compatibility
Without adding "allow-newer" for the packages aeson, base, HTTP, time,
and transformers, I get build failures like the following (depends which
subset you're trying):
```
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: elm-compiler-0.17 (user goal)
trying: base-4.9.0.0/installed-4.9... (dependency of elm-compiler-0.17)
trying: unix-2.7.2.0/installed-2.7... (dependency of
process-1.4.2.0/installed-1.4...)
next goal: aeson (dependency of elm-compiler-0.17)
rejecting: aeson-0.11.2.0, aeson-0.11.1.4, aeson-0.11.1.3, aeson-0.11.1.2,
aeson-0.11.1.1, aeson-0.11.1.0, aeson-0.11.0.0, aeson-0.9.0.1, aeson-0.9.0.0
(conflict: elm-compiler => aeson>=0.7 && <0.9)
rejecting: aeson-0.8.1.1, aeson-0.8.1.0, aeson-0.8.0.2 (conflict:
base==4.9.0.0/installed-4.9..., aeson => base>=4.5 && <4.9)
rejecting: aeson-0.7.0.6, aeson-0.7.0.4 (conflict: unix =>
etc. etc.
```
Can be removed as soon as the dependencies setting unecessary
restrictions on these versions catch up, or as soon as elm itself has a
similar built-in workaround.
Closes #1409.
Signed-off-by: ilovezfs <ilovezfs@icloud.com>
2016-05-25 18:04:19 +00:00
|
|
|
# GHC 8 compat
|
|
|
|
# Fixes "cabal: Could not resolve dependencies"
|
|
|
|
# Reported 25 May 2016: https://github.com/elm-lang/elm-compiler/issues/1397
|
2016-07-02 16:44:18 +00:00
|
|
|
(buildpath/"cabal.config").write("allow-newer: base,time,transformers,HTTP\n")
|
elm: GHC 8 compatibility
Without adding "allow-newer" for the packages aeson, base, HTTP, time,
and transformers, I get build failures like the following (depends which
subset you're trying):
```
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: elm-compiler-0.17 (user goal)
trying: base-4.9.0.0/installed-4.9... (dependency of elm-compiler-0.17)
trying: unix-2.7.2.0/installed-2.7... (dependency of
process-1.4.2.0/installed-1.4...)
next goal: aeson (dependency of elm-compiler-0.17)
rejecting: aeson-0.11.2.0, aeson-0.11.1.4, aeson-0.11.1.3, aeson-0.11.1.2,
aeson-0.11.1.1, aeson-0.11.1.0, aeson-0.11.0.0, aeson-0.9.0.1, aeson-0.9.0.0
(conflict: elm-compiler => aeson>=0.7 && <0.9)
rejecting: aeson-0.8.1.1, aeson-0.8.1.0, aeson-0.8.0.2 (conflict:
base==4.9.0.0/installed-4.9..., aeson => base>=4.5 && <4.9)
rejecting: aeson-0.7.0.6, aeson-0.7.0.4 (conflict: unix =>
etc. etc.
```
Can be removed as soon as the dependencies setting unecessary
restrictions on these versions catch up, or as soon as elm itself has a
similar built-in workaround.
Closes #1409.
Signed-off-by: ilovezfs <ilovezfs@icloud.com>
2016-05-25 18:04:19 +00:00
|
|
|
|
2015-12-17 11:29:17 +00:00
|
|
|
extras_no_reactor = ["elm-package", "elm-make", "elm-repl"]
|
|
|
|
extras = extras_no_reactor + ["elm-reactor"]
|
|
|
|
extras.each do |extra|
|
|
|
|
resource(extra).stage buildpath/extra
|
|
|
|
end
|
|
|
|
|
|
|
|
cabal_sandbox do
|
2015-12-23 13:21:20 +00:00
|
|
|
cabal_sandbox_add_source "elm-compiler", *extras
|
2015-12-17 11:29:17 +00:00
|
|
|
cabal_install "--only-dependencies", "elm-compiler", *extras
|
|
|
|
cabal_install "--prefix=#{prefix}", "elm-compiler", *extras_no_reactor
|
|
|
|
|
|
|
|
# elm-reactor needs to be installed last because of a post-build dependency on elm-make
|
|
|
|
ENV.prepend_path "PATH", bin
|
|
|
|
|
|
|
|
cabal_install "--prefix=#{prefix}", "elm-reactor"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
src_path = testpath/"Hello.elm"
|
|
|
|
src_path.write <<-EOS.undent
|
|
|
|
import Html exposing (text)
|
|
|
|
main = text "Hello, world!"
|
|
|
|
EOS
|
|
|
|
|
2016-05-10 17:54:59 +00:00
|
|
|
system bin/"elm", "package", "install", "elm-lang/html", "--yes"
|
2015-12-17 11:29:17 +00:00
|
|
|
|
|
|
|
out_path = testpath/"index.html"
|
|
|
|
system bin/"elm", "make", src_path, "--output=#{out_path}"
|
|
|
|
assert File.exist?(out_path)
|
|
|
|
end
|
|
|
|
end
|