116 lines
4 KiB
Ruby
116 lines
4 KiB
Ruby
# Track Chrome stable.
|
|
# https://omahaproxy.appspot.com/
|
|
class V8 < Formula
|
|
desc "Google's JavaScript engine"
|
|
homepage "https://github.com/v8/v8/wiki"
|
|
url "https://github.com/v8/v8-git-mirror/archive/4.9.385.35.tar.gz"
|
|
sha256 "d775d0de8f0fa481254f81ccceffcdd14816316e2514a2f52b262e8ecfc390b6"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "8fe4e607c1a068ecdef73f9b5da7a43e031d03d9d4b9894fe95c4a46c609e3fa" => :el_capitan
|
|
sha256 "465719b89b764cbc468c8c5f43244475db4b6e7ae95880ae3f2ebdd6bd8c7d40" => :yosemite
|
|
sha256 "9c2c8d7fd429d1b4b4ea1bd474d4c1a8c0dff24cf3d6cc874f291787ed9fb7e7" => :mavericks
|
|
end
|
|
|
|
option "with-readline", "Use readline instead of libedit"
|
|
|
|
# not building on Snow Leopard:
|
|
# https://github.com/Homebrew/homebrew/issues/21426
|
|
depends_on :macos => :lion
|
|
|
|
depends_on :python => :build # gyp doesn't run under 2.6 or lower
|
|
depends_on "readline" => :optional
|
|
depends_on "icu4c" => :optional
|
|
|
|
needs :cxx11
|
|
|
|
# Update from "DEPS" file in tarball.
|
|
# Note that we don't require the "test" DEPS because we don't run the tests.
|
|
resource "gyp" do
|
|
url "https://chromium.googlesource.com/external/gyp.git",
|
|
:revision => "b85ad3e578da830377dbc1843aa4fbc5af17a192"
|
|
end
|
|
|
|
resource "icu" do
|
|
url "https://chromium.googlesource.com/chromium/deps/icu.git",
|
|
:revision => "8d342a405be5ae8aacb1e16f0bc31c3a4fbf26a2"
|
|
end
|
|
|
|
resource "buildtools" do
|
|
url "https://chromium.googlesource.com/chromium/buildtools.git",
|
|
:revision => "0f8e6e4b126ee88137930a0ae4776c4741808740"
|
|
end
|
|
|
|
resource "common" do
|
|
url "https://chromium.googlesource.com/chromium/src/base/trace_event/common.git",
|
|
:revision => "d83d44b13d07c2fd0a40101a7deef9b93b841732"
|
|
end
|
|
|
|
resource "swarming_client" do
|
|
url "https://chromium.googlesource.com/external/swarming.client.git",
|
|
:revision => "9cdd76171e517a430a72dcd7d66ade67e109aa00"
|
|
end
|
|
|
|
resource "gtest" do
|
|
url "https://chromium.googlesource.com/external/github.com/google/googletest.git",
|
|
:revision => "6f8a66431cb592dad629028a50b3dd418a408c87"
|
|
end
|
|
|
|
resource "gmock" do
|
|
url "https://chromium.googlesource.com/external/googlemock.git",
|
|
:revision => "0421b6f358139f02e102c9c332ce19a33faf75be"
|
|
end
|
|
|
|
resource "clang" do
|
|
url "https://chromium.googlesource.com/chromium/src/tools/clang.git",
|
|
:revision => "24e8c1c92fe54ef8ed7651b5850c056983354a4a"
|
|
end
|
|
|
|
def install
|
|
# Bully GYP into correctly linking with c++11
|
|
ENV.cxx11
|
|
ENV["GYP_DEFINES"] = "clang=1 mac_deployment_target=#{MacOS.version}"
|
|
# https://code.google.com/p/v8/issues/detail?id=4511#c3
|
|
ENV.append "GYP_DEFINES", "v8_use_external_startup_data=0"
|
|
|
|
if build.with? "icu4c"
|
|
ENV.append "GYP_DEFINES", "use_system_icu=1"
|
|
i18nsupport = "i18nsupport=on"
|
|
else
|
|
i18nsupport = "i18nsupport=off"
|
|
end
|
|
|
|
# fix up libv8.dylib install_name
|
|
# https://github.com/Homebrew/homebrew/issues/36571
|
|
# https://code.google.com/p/v8/issues/detail?id=3871
|
|
inreplace "tools/gyp/v8.gyp",
|
|
"'OTHER_LDFLAGS': ['-dynamiclib', '-all_load']",
|
|
"\\0, 'DYLIB_INSTALL_NAME_BASE': '#{opt_lib}'"
|
|
|
|
(buildpath/"build/gyp").install resource("gyp")
|
|
(buildpath/"third_party/icu").install resource("icu")
|
|
(buildpath/"buildtools").install resource("buildtools")
|
|
(buildpath/"base/trace_event/common").install resource("common")
|
|
(buildpath/"tools/swarming_client").install resource("swarming_client")
|
|
(buildpath/"testing/gtest").install resource("gtest")
|
|
(buildpath/"testing/gmock").install resource("gmock")
|
|
(buildpath/"tools/clang").install resource("clang")
|
|
|
|
system "make", "native", "library=shared", "snapshot=on",
|
|
"console=readline", i18nsupport,
|
|
"strictaliasing=off"
|
|
|
|
include.install Dir["include/*"]
|
|
|
|
cd "out/native" do
|
|
rm ["libgmock.a", "libgtest.a"]
|
|
lib.install Dir["lib*"]
|
|
bin.install "d8", "mksnapshot", "process", "shell" => "v8"
|
|
end
|
|
end
|
|
|
|
test do
|
|
assert_equal "Hello World!", pipe_output("#{bin}/v8 -e 'print(\"Hello World!\")'").chomp
|
|
end
|
|
end
|