diff options
| author | Miƫtek Bak | 2010-02-23 19:45:44 +0000 |
|---|---|---|
| committer | Max Howell | 2010-02-24 15:13:16 +0000 |
| commit | 076d5428c40e832964b579e57833e5e92fea5af6 (patch) | |
| tree | 5687639bdbb23c8a72dd32ac1759b4b43089f1b7 /Library/Formula | |
| parent | aee85da0f2bb08136d854210e5a6d03264b158d2 (diff) | |
| download | homebrew-076d5428c40e832964b579e57833e5e92fea5af6.tar.bz2 | |
GHC 6.12.1
GHC is a state-of-the-art open source compiler and interactive environment for the
functional language Haskell.
This formula uses the official GHC binary package for Mac OS X.
Signed Off By: Max Howell <max@methylblue.com>
I adapted the system calls to use full paths to tools.
FileUtils is included into Formula, so I neatened that stuff up too.
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/ghc.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Library/Formula/ghc.rb b/Library/Formula/ghc.rb new file mode 100644 index 000000000..a6f9aadff --- /dev/null +++ b/Library/Formula/ghc.rb @@ -0,0 +1,46 @@ +require 'formula' + +class PkgCurlDownloadStrategy <CurlDownloadStrategy + def stage + safe_system '/usr/sbin/pkgutil', '--expand', @tarball_path, File.basename(@url) + chdir + end +end + +# Remember to update the formula for Cabal when updating this formula +class Ghc <Formula + homepage 'http://haskell.org/ghc/' + version '6.12.1' + url "http://haskell.org/ghc/dist/6.12.1/GHC-#{version}-i386.pkg" + md5 '7f50698a6f34b978027a43fd836443e7' + + skip_clean :bin #http://hackage.haskell.org/trac/ghc/ticket/2458 + + def download_strategy + # Extract files from .pkg while caching the .pkg + PkgCurlDownloadStrategy + end + + 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 + # Extract files from .pax.gz + system '/bin/pax -f ghc.pkg/Payload -p p -rz' + cd 'GHC.framework/Versions/612/usr' + + # Fix paths + replace_all '/Library/Frameworks/GHC.framework/Versions/612/usr/lib/ghc-6.12.1', "#{lib}/ghc" + replace_all '/Library/Frameworks/GHC.framework/Versions/612/usr', prefix + mv 'lib/ghc-6.12.1', 'lib/ghc' + + prefix.install ['bin', 'lib', 'share'] + + # 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 |
