70 lines
2.2 KiB
Ruby
70 lines
2.2 KiB
Ruby
require "language/haskell"
|
|
|
|
class HaskellStack < Formula
|
|
include Language::Haskell::Cabal
|
|
|
|
desc "The Haskell Tool Stack"
|
|
homepage "https://haskellstack.org/"
|
|
url "https://github.com/commercialhaskell/stack/releases/download/v1.3.0/stack-1.3.0-sdist-0.tar.gz"
|
|
version "1.3.0"
|
|
sha256 "487263501d09d4977040670eaf5e6798efac33a26b48dc57c031fc181405950e"
|
|
head "https://github.com/commercialhaskell/stack.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "8b91aa807605cd89e57363ba257c9793db15a903df6e02976e79bc0f4453fbdc" => :el_capitan_or_later
|
|
sha256 "9094b74b88d4bd33fb9a3a5fc311cedec9a594acb2dbc494e25abc452f86e756" => :yosemite
|
|
end
|
|
|
|
option "without-bootstrap", "Don't bootstrap a stage 2 stack"
|
|
|
|
# malformed mach-o: load commands size (40192) > 32768
|
|
depends_on MaximumMacOSRequirement => :el_capitan if build.bottle?
|
|
|
|
depends_on "ghc" => :build
|
|
depends_on "cabal-install" => :build
|
|
|
|
def install
|
|
if MacOS.version >= :sierra && build.with?("bootstrap")
|
|
raise <<-EOS.undent
|
|
stack cannot build with bootstrap on Sierra due to an upstream GHC
|
|
incompatiblity. Please use the pre-built bottle binary instead of attempting to
|
|
build from source or pass --without-bootstrap. For more details see
|
|
https://ghc.haskell.org/trac/ghc/ticket/12479
|
|
https://github.com/commercialhaskell/stack/issues/2577
|
|
EOS
|
|
end
|
|
|
|
if build.with? "bootstrap"
|
|
cabal_sandbox do
|
|
cabal_install
|
|
# Let `stack` handle its own parallelization
|
|
# Prevents "install: mkdir ... ghc-7.10.3/lib: File exists"
|
|
jobs = ENV.make_jobs
|
|
ENV.deparallelize do
|
|
system "stack", "-j#{jobs}", "setup"
|
|
system "stack", "-j#{jobs}", "--local-bin-path=#{bin}", "install"
|
|
end
|
|
end
|
|
else
|
|
install_cabal_package
|
|
end
|
|
|
|
# Remove the unneeded rpaths so that the binary works on Sierra
|
|
rpaths = Utils.popen_read("otool -l #{bin}/stack").split("\n")
|
|
rpaths = rpaths.inject([]) do |r, e|
|
|
if e =~ /^ +path (.*) \(offset.*/
|
|
r << $~[1]
|
|
else
|
|
r
|
|
end
|
|
end
|
|
rpaths.each do |r|
|
|
system "install_name_tool", "-delete_rpath", r, bin/"stack"
|
|
end
|
|
end
|
|
|
|
test do
|
|
system bin/"stack", "new", "test"
|
|
end
|
|
end
|