From 89096c92104ab89b1fd8ba273cbbf441dcfe5a84 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 27 Nov 2018 17:21:42 -0500 Subject: [PATCH] Use prebuilt V8 library by default. This still retains the ability to build V8 from scratch, with an number of configurations. The prebuilt binaries were created using DENO_BUILD_MODE=release ./tools/build.py v8 --- prebuilt/.gitignore | 2 ++ prebuilt/linux64/libv8.a.sha1 | 1 + prebuilt/mac/libv8.a.sha1 | 1 + prebuilt/win/v8.lib.sha1 | 1 + tools/gcloud_upload.py | 54 +++++++++++++++++++++++++++++++++++ tools/prebuilt.py | 31 ++++++++++++++++++++ 6 files changed, 90 insertions(+) create mode 100644 prebuilt/.gitignore create mode 100644 prebuilt/linux64/libv8.a.sha1 create mode 100644 prebuilt/mac/libv8.a.sha1 create mode 100644 prebuilt/win/v8.lib.sha1 create mode 100755 tools/gcloud_upload.py create mode 100644 tools/prebuilt.py diff --git a/prebuilt/.gitignore b/prebuilt/.gitignore new file mode 100644 index 0000000000..09cabcb079 --- /dev/null +++ b/prebuilt/.gitignore @@ -0,0 +1,2 @@ +*.a +*.lib diff --git a/prebuilt/linux64/libv8.a.sha1 b/prebuilt/linux64/libv8.a.sha1 new file mode 100644 index 0000000000..4438635822 --- /dev/null +++ b/prebuilt/linux64/libv8.a.sha1 @@ -0,0 +1 @@ +3728bfff7eb91e4e2c96999d974573e4d697e663 \ No newline at end of file diff --git a/prebuilt/mac/libv8.a.sha1 b/prebuilt/mac/libv8.a.sha1 new file mode 100644 index 0000000000..2f2fcce0c1 --- /dev/null +++ b/prebuilt/mac/libv8.a.sha1 @@ -0,0 +1 @@ +597ca3bbcdc6edbaf23905988f9ca9911bb23250 \ No newline at end of file diff --git a/prebuilt/win/v8.lib.sha1 b/prebuilt/win/v8.lib.sha1 new file mode 100644 index 0000000000..724cbca6ee --- /dev/null +++ b/prebuilt/win/v8.lib.sha1 @@ -0,0 +1 @@ +052b261b8f8a7fc3f1babeb510d5bd73af0bcece \ No newline at end of file diff --git a/tools/gcloud_upload.py b/tools/gcloud_upload.py new file mode 100755 index 0000000000..ed9c48ec86 --- /dev/null +++ b/tools/gcloud_upload.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# Prereq: +# - gcloud auth login +# - gcloud config set project deno-223616 +# This program uploads the specified file to GCloud Storage in the denoland +# bucket. It places a checksum file into the current directory using the base +# filename of the specified file. + +import os +import sys +import hashlib +from util import root_path, run +from third_party import tp + + +def print_usage(): + print "Usage: ./tools/gcloud_upload.py target/release/obj/third_party/v8/libv8.a" + sys.exit(1) + + +def compute_sha1(filename): + m = hashlib.sha1() + with open(filename) as f: + m.update(f.read()) + return m.hexdigest() + + +def main(argv): + if len(argv) != 2: + print_usage() + os.chdir(root_path) + + filename = sys.argv[1] + basename = os.path.basename(filename) + + sha1 = compute_sha1(filename) + print sha1 + + gs_url = "gs://denoland/" + sha1 + + #gsutil = tp("depot_tools/gsutil.py") + gsutil = "gsutil" # standalone installation + + run([gsutil, "cp", filename, gs_url]) + run([gsutil, "acl", "ch", "-u", "AllUsers:R", gs_url]) + + target_filename = basename + ".sha1" + with open(target_filename, 'w') as f: + f.write(sha1) + print "Wrote", target_filename + + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/tools/prebuilt.py b/tools/prebuilt.py new file mode 100644 index 0000000000..7542d7aa6c --- /dev/null +++ b/tools/prebuilt.py @@ -0,0 +1,31 @@ +import sys +from util import run +from third_party import tp, google_env + + +def download_v8_prebuilt(): + if sys.platform == 'win32': + sha1_file = "prebuilt/win/v8.lib.sha1" + elif sys.platform.startswith('linux'): + sha1_file = "prebuilt/linux64/libv8.a.sha1" + elif sys.platform == 'darwin': + sha1_file = "prebuilt/mac/libv8.a.sha1" + + run([ + "python", + tp('depot_tools/download_from_google_storage.py'), + '--platform=' + sys.platform, + '--no_auth', + '--bucket=denoland', + '--sha1_file', + sha1_file, + ], + env=google_env()) + + +def load(): + download_v8_prebuilt() + + +if __name__ == '__main__': + sys.exit(load())