aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/mlton.rb22
1 files changed, 15 insertions, 7 deletions
diff --git a/Library/Formula/mlton.rb b/Library/Formula/mlton.rb
index a478920c3..3d4e070fa 100644
--- a/Library/Formula/mlton.rb
+++ b/Library/Formula/mlton.rb
@@ -4,6 +4,20 @@ require 'formula'
# Since MLton is written in ML, building from source
# would require an existing ML compiler/interpreter for bootstrapping.
+class StandardHomebrewLocation < Requirement
+ def message; <<-EOS.undent
+ mlton won't work outside of /usr/local
+
+ Because this uses pre-compiled binaries, it will not work if
+ Homebrew is installed somewhere other than /usr/local; mlton
+ will be unable to find GMP.
+ EOS
+ end
+ def satisfied?
+ HOMEBREW_PREFIX.to_s == "/usr/local"
+ end
+end
+
class Mlton < Formula
homepage 'http://mlton.org'
url 'http://mlton.org/pages/Download/attachments/mlton-20100608-1.amd64-darwin.gmp-static.tgz'
@@ -11,18 +25,12 @@ class Mlton < Formula
# We download and install the version of MLton which is statically linked to libgmp, but all
# generated executables will require gmp anyway, hence the dependency
+ depends_on StandardHomebrewLocation.new
depends_on 'gmp'
skip_clean :all
def install
- unless HOMEBREW_PREFIX.to_s == "/usr/local"
- opoo "mlton won't work outside of /usr/local."
- puts "Because this uses pre-compiled binaries, it will not work if"
- puts "Homebrew is installed somewhere other than /usr/local; mlton"
- puts "will be unable to find GMP."
- end
-
cd "local" do
# Remove OS X droppings
rm Dir["man/man1/._*"]