aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/cabal-install.rb
blob: de808d2bfa009783b3f4f40984490aa949f34299 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require "formula"

class CabalInstall < Formula
  homepage "http://www.haskell.org/haskellwiki/Cabal-Install"
  url "http://hackage.haskell.org/package/cabal-install-1.20.0.2/cabal-install-1.20.0.2.tar.gz"
  sha1 "e9b3843270b8f5969a4e1205263e59439bc35692"
  revision 1

  bottle do
    cellar :any
    sha1 "98a2b33c24cf095f5647dd294319b2391d88636d" => :mavericks
    sha1 "6de72c12c3d0eaa7e2b0ee4f5227a834ba7c7a5b" => :mountain_lion
    sha1 "7c2d5603cf554037c397a1adfa844caf94cef444" => :lion
  end

  depends_on "ghc"

  conflicts_with "haskell-platform"

  def install
    # use a temporary package database instead of ~/.cabal or ~/.ghc
    pkg_db = "#{Dir.pwd}/package.conf.d"
    system "ghc-pkg", "init", pkg_db
    ENV["EXTRA_CONFIGURE_OPTS"] = "--package-db=#{pkg_db}"
    ENV["PREFIX"] = Dir.pwd
    inreplace "bootstrap.sh", "list --global",
      "list --global --no-user-package-db"

    system "sh", "bootstrap.sh"
    bin.install "bin/cabal"
    bash_completion.install "bash-completion/cabal"
  end

  test do
    system "#{bin}/cabal", "--config-file=#{testpath}/config", "info", "cabal"
  end
end