2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-09-01 14:17:44 +00:00
|
|
|
|
2011-07-07 18:19:58 +00:00
|
|
|
# Private older version of autoconf required to compile Spidermonkey
|
|
|
|
class Autoconf213 < Formula
|
2011-09-12 16:31:30 +00:00
|
|
|
url 'http://ftpmirror.gnu.org/autoconf/autoconf-2.13.tar.gz'
|
2011-07-07 18:19:58 +00:00
|
|
|
md5 '9de56d4a161a723228220b0f425dc711'
|
|
|
|
homepage 'http://www.gnu.org/software/autoconf/'
|
|
|
|
end
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Spidermonkey < Formula
|
2009-10-04 14:43:04 +00:00
|
|
|
homepage 'https://developer.mozilla.org/en/SpiderMonkey'
|
2011-07-08 16:43:06 +00:00
|
|
|
# Pick a version that's known to work with CouchDB), revision r35345.
|
|
|
|
url 'http://hg.mozilla.org/tracemonkey/archive/57a6ad20eae9.tar.gz'
|
|
|
|
md5 '0f2490f78d880ec184d9233df97ab83d'
|
|
|
|
version '1.8.0'
|
2009-09-01 14:17:44 +00:00
|
|
|
|
2009-12-01 01:02:36 +00:00
|
|
|
depends_on 'readline'
|
2010-01-23 21:38:59 +00:00
|
|
|
depends_on 'nspr'
|
2009-09-01 14:17:44 +00:00
|
|
|
|
|
|
|
def install
|
2011-04-08 18:16:37 +00:00
|
|
|
# aparently this flag causes the build to fail for ivanvc on 10.5 with a
|
|
|
|
# penryn (core 2 duo) CPU. So lets be cautious here and remove it.
|
|
|
|
ENV['CFLAGS'] = ENV['CFLAGS'].gsub(/-msse[^\s]+/, '') if MacOS.leopard?
|
2009-09-01 14:17:44 +00:00
|
|
|
|
2010-06-25 21:32:24 +00:00
|
|
|
# For some reason SpiderMonkey requires Autoconf-2.13
|
|
|
|
ac213_prefix = Pathname.pwd.join('ac213')
|
|
|
|
Autoconf213.new.brew do |f|
|
2011-07-07 18:19:58 +00:00
|
|
|
# Force use of plain "awk"
|
2010-06-25 21:32:24 +00:00
|
|
|
inreplace 'configure', 'for ac_prog in mawk gawk nawk awk', 'for ac_prog in awk'
|
|
|
|
|
|
|
|
system "./configure", "--disable-debug",
|
|
|
|
"--program-suffix=213",
|
|
|
|
"--prefix=#{ac213_prefix}"
|
|
|
|
system "make install"
|
|
|
|
end
|
|
|
|
|
|
|
|
Dir.chdir "js/src" do
|
|
|
|
# Fixes a bug with linking against CoreFoundation. Tests all pass after
|
|
|
|
# building like this. See: http://openradar.appspot.com/7209349
|
|
|
|
inreplace "configure.in", "LDFLAGS=\"$LDFLAGS -framework Cocoa\"", ""
|
|
|
|
system "#{ac213_prefix}/bin/autoconf213"
|
2009-12-17 19:55:27 +00:00
|
|
|
|
2010-06-25 21:32:24 +00:00
|
|
|
# Remove the broken *(for anyone but FF) install_name
|
2009-12-17 19:55:27 +00:00
|
|
|
inreplace "config/rules.mk",
|
2010-11-09 15:45:09 +00:00
|
|
|
"-install_name @executable_path/$(SHARED_LIBRARY) ",
|
2009-12-17 19:55:27 +00:00
|
|
|
"-install_name #{lib}/$(SHARED_LIBRARY) "
|
2010-06-25 21:32:24 +00:00
|
|
|
end
|
|
|
|
|
2010-04-07 05:58:35 +00:00
|
|
|
mkdir "brew-build"
|
2009-12-01 01:02:36 +00:00
|
|
|
|
|
|
|
Dir.chdir "brew-build" do
|
2010-06-25 21:32:24 +00:00
|
|
|
system "../js/src/configure", "--prefix=#{prefix}",
|
|
|
|
"--enable-readline",
|
|
|
|
"--enable-threadsafe",
|
|
|
|
"--with-system-nspr"
|
2009-12-01 01:02:36 +00:00
|
|
|
|
2010-06-25 21:32:24 +00:00
|
|
|
inreplace "js-config", /JS_CONFIG_LIBS=.*?$/, "JS_CONFIG_LIBS=''"
|
2011-07-07 18:19:58 +00:00
|
|
|
# These need to be in separate steps.
|
2009-12-01 01:02:36 +00:00
|
|
|
system "make"
|
|
|
|
system "make install"
|
|
|
|
|
2011-07-07 18:19:58 +00:00
|
|
|
# Also install js REPL.
|
2009-12-01 01:02:36 +00:00
|
|
|
bin.install "shell/js"
|
|
|
|
end
|
|
|
|
end
|
2010-06-25 21:32:24 +00:00
|
|
|
|
2011-07-07 18:19:58 +00:00
|
|
|
def caveats; <<-EOS.undent
|
2011-07-08 16:43:06 +00:00
|
|
|
This formula installs Spidermonkey 1.8.x.
|
2010-06-25 21:32:24 +00:00
|
|
|
|
2011-07-07 18:19:58 +00:00
|
|
|
If you are trying to compile MongoDB from scratch, you will need 1.7.x instead.
|
|
|
|
EOS
|
|
|
|
end
|
2010-06-25 21:32:24 +00:00
|
|
|
end
|