2010-02-23 19:45:44 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Ghc <Formula
|
|
|
|
homepage 'http://haskell.org/ghc/'
|
2010-04-07 05:58:35 +00:00
|
|
|
url "http://darcs.haskell.org/download/dist/6.12.3/GHC-6.12.3-i386.pkg"
|
2010-06-14 17:16:07 +00:00
|
|
|
version '6.12.3'
|
|
|
|
md5 '58399e3af68f50a23a847bdfe3de5aca'
|
2010-02-23 19:45:44 +00:00
|
|
|
|
2010-06-29 04:42:12 +00:00
|
|
|
# Avoid stripping the Haskell binaries & libraries.
|
|
|
|
# See: http://hackage.haskell.org/trac/ghc/ticket/2458
|
2010-02-24 11:16:15 +00:00
|
|
|
skip_clean ['bin', 'lib']
|
2010-02-23 19:45:44 +00:00
|
|
|
|
|
|
|
def replace_all foo, bar
|
|
|
|
# Find all text files containing foo and replace it with bar
|
|
|
|
files = `/usr/bin/grep -lsIR #{foo} .`.split
|
|
|
|
inreplace files, foo, bar
|
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
2010-02-24 11:16:15 +00:00
|
|
|
short_version = version.split('.').first(2).join('')
|
|
|
|
|
2010-02-23 19:45:44 +00:00
|
|
|
# Extract files from .pax.gz
|
|
|
|
system '/bin/pax -f ghc.pkg/Payload -p p -rz'
|
2010-02-24 11:16:15 +00:00
|
|
|
cd "GHC.framework/Versions/#{short_version}/usr"
|
2010-02-23 19:45:44 +00:00
|
|
|
|
|
|
|
# Fix paths
|
2010-02-24 11:16:15 +00:00
|
|
|
replace_all "/Library/Frameworks/GHC.framework/Versions/#{short_version}/usr/lib/ghc-#{version}", "#{lib}/ghc"
|
|
|
|
replace_all "/Library/Frameworks/GHC.framework/Versions/#{short_version}/usr", prefix
|
2010-02-23 19:45:44 +00:00
|
|
|
|
2010-06-29 04:42:12 +00:00
|
|
|
prefix.install ['bin', 'share']
|
|
|
|
|
|
|
|
# Remove version from lib folder
|
|
|
|
lib.install "lib/ghc-#{version}" => 'ghc'
|
|
|
|
|
|
|
|
# Fix ghc-asm Perl reference
|
|
|
|
inreplace "#{lib}/ghc/ghc-asm", "#!/opt/local/bin/perl", "#!/usr/bin/env perl"
|
2010-02-23 19:45:44 +00:00
|
|
|
|
|
|
|
# Regenerate GHC package cache
|
|
|
|
rm "#{lib}/ghc/package.conf.d/package.cache"
|
|
|
|
system "#{bin}/ghc-pkg", 'recache', '--package-conf', "#{lib}/ghc/package.conf.d"
|
|
|
|
end
|
|
|
|
end
|