├── .gitattributes ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── SECURITY.md ├── args_arm.gn ├── args_arm64.gn ├── args_x86.gn ├── args_x86_64.gn ├── clear_docker.sh ├── docker_build.sh ├── docker_explore.sh └── full_clean_build.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | *.so filter=lfs diff=lfs merge=lfs -text 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | v8.zip 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # Dockerfile to build V8 container images 3 | # Based on Ubuntu 4 | ############################################################ 5 | # Set the base image to Ubuntu 6 | FROM ubuntu:16.04 7 | # File Author / Maintainer 8 | MAINTAINER Example prmis@microsoft.com 9 | ################## BEGIN INSTALLATION ###################### 10 | # Update Image 11 | RUN apt-get update 12 | RUN apt-get install -y sudo 13 | RUN apt-get install -y apt-utils 14 | RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo 15 | RUN echo "docker ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers 16 | user docker 17 | # Update depedency of V8 18 | RUN sudo apt-get install -y \ 19 | lsb-core \ 20 | git \ 21 | python \ 22 | lbzip2 \ 23 | curl \ 24 | wget \ 25 | xz-utils \ 26 | zip 27 | RUN sudo echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections 28 | WORKDIR /home/docker 29 | # Get depot_tool 30 | RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git 31 | ENV PATH /home/docker/depot_tools:"$PATH" 32 | RUN echo $PATH 33 | # Fetch V8 code 34 | RUN fetch v8 35 | RUN echo "target_os= ['android']">>.gclient 36 | RUN gclient sync 37 | RUN sudo echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections 38 | # Update V8 depedency 39 | RUN echo y | sudo /home/docker/v8/build/install-build-deps-android.sh 40 | WORKDIR /home/docker/v8 41 | ARG CACHEBUST=1 42 | # checkout required V8 Branch 43 | RUN git checkout 8.1.307.28 44 | RUN gclient sync 45 | #ARG CACHEBUST=1 46 | 47 | # ARM64 48 | RUN python ./tools/dev/v8gen.py arm64.release -vv 49 | RUN rm out.gn/arm64.release/args.gn 50 | COPY ./args_arm64.gn out.gn/arm64.release/args.gn 51 | RUN ls -al out.gn/arm64.release/ 52 | RUN cat out.gn/arm64.release/args.gn 53 | RUN sudo chmod 777 out.gn/arm64.release/args.gn 54 | RUN touch out.gn/arm64.release/args.gn 55 | RUN ninja -C out.gn/arm64.release -t clean 56 | RUN ninja -C out.gn/arm64.release 57 | # Prepare files for archiving 58 | RUN rm -rf target/arm64-v8a 59 | RUN mkdir -p target/arm64-v8a target/symbols/arm64-v8a 60 | RUN cp -rf out.gn/arm64.release/*.so ./target/arm64-v8a 61 | RUN cp -rf out.gn/arm64.release/lib.unstripped/*.so ./target/symbols/arm64-v8a 62 | 63 | # ARM 64 | RUN python ./tools/dev/v8gen.py arm.release -vv 65 | RUN rm out.gn/arm.release/args.gn 66 | COPY ./args_arm.gn out.gn/arm.release/args.gn 67 | RUN ls -al out.gn/arm.release/ 68 | RUN cat out.gn/arm.release/args.gn 69 | RUN sudo chmod 777 out.gn/arm.release/args.gn 70 | RUN touch out.gn/arm.release/args.gn 71 | # Build the V8 liblary 72 | RUN ninja -C out.gn/arm.release -t clean 73 | RUN ninja -C out.gn/arm.release 74 | # Prepare files for archiving 75 | RUN rm -rf target/armeabi-v7a target/symbols/armeabi-v7a 76 | RUN mkdir -p target/armeabi-v7a target/symbols/armeabi-v7a 77 | RUN cp -rf out.gn/arm.release/*.so ./target/armeabi-v7a 78 | RUN cp -rf out.gn/arm.release/lib.unstripped/*.so ./target/symbols/armeabi-v7a 79 | 80 | # X86_64 81 | RUN python ./tools/dev/v8gen.py x64.release -vv 82 | RUN rm out.gn/x64.release/args.gn 83 | COPY ./args_x86_64.gn out.gn/x64.release/args.gn 84 | RUN ls -al out.gn/x64.release/ 85 | RUN cat out.gn/x64.release/args.gn 86 | RUN sudo chmod 777 out.gn/x64.release/args.gn 87 | RUN touch out.gn/x64.release/args.gn 88 | # Build the V8 liblary 89 | RUN ninja -C out.gn/x64.release -t clean 90 | RUN ninja -C out.gn/x64.release 91 | # Prepare files for archiving 92 | RUN rm -rf target/x86_64 93 | RUN mkdir -p target/x86_64 target/symbols/x86_64 94 | RUN cp -rf out.gn/x64.release/*.so ./target/x86_64 95 | RUN cp -rf out.gn/x64.release/lib.unstripped/*.so ./target/symbols/x86_64 96 | 97 | # X86 98 | RUN python ./tools/dev/v8gen.py ia32.release -vv 99 | RUN rm out.gn/ia32.release/args.gn 100 | COPY ./args_x86.gn out.gn/ia32.release/args.gn 101 | RUN ls -al out.gn/ia32.release/ 102 | RUN cat out.gn/ia32.release/args.gn 103 | RUN sudo chmod 777 out.gn/ia32.release/args.gn 104 | RUN touch out.gn/ia32.release/args.gn 105 | # Build the V8 liblary 106 | RUN ninja -C out.gn/ia32.release -t clean 107 | RUN ninja -C out.gn/ia32.release 108 | # Prepare files for archiving 109 | RUN rm -rf target/x86 110 | RUN mkdir -p target/x86 target/symbols/x86 111 | RUN cp -rf out.gn/ia32.release/*.so ./target/x86 112 | RUN cp -rf out.gn/ia32.release/lib.unstripped/*.so ./target/symbols/x86 113 | 114 | # Creating release archive 115 | RUN mkdir ./target/headers 116 | RUN cp -rf include ./target/headers 117 | 118 | # We don't need testing lib in resulting package 119 | RUN find target -name "libv8_for_testing.cr.so" -delete 120 | 121 | # stl lib from android-ndk have no symbols, so why bother copy them? 122 | RUN find target/symbols -name "libc++_shared.so" -delete 123 | 124 | # some V8 versions copy stl to release folder, some not. We need exact version of stl V8 built with to be on the safe side. 125 | RUN cp ./third_party/android_ndk/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so ./target/arm64-v8a/ 126 | RUN cp ./third_party/android_ndk/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so ./target/armeabi-v7a 127 | RUN cp ./third_party/android_ndk/sources/cxx-stl/llvm-libc++/libs/x86/libc++_shared.so ./target/x86/ 128 | RUN cp ./third_party/android_ndk/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_shared.so ./target/x86_64/ 129 | 130 | WORKDIR /home/docker/v8/target/ 131 | RUN zip -r ../v8.zip ./* 132 | RUN ls -al /home/docker/v8/v8.zip 133 | #End of docker Command 134 | 135 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # V8 Docker buildscript for Android platform 2 | 3 | ## Building V8 4 | 5 | 1. [Install docker](https://www.docker.com/community-edition) for your platform. 6 | 1. Run `docker_build.sh` command in couple of hours you will get v8.zip in the same directory 7 | 8 | ## Scripts description 9 | 10 | 1. clear_docker.sh - will remove ALL docker images you have on your machine. If you are using docker for some other purpose don't run it it will bust your cache. 11 | 1. docker_build.sh - Builds V8 for ARM64, ARM and X86. As part of the build process it re-creates v8docker alias which is used by other scripts. 12 | 1. docker_explore.sh - Useful debug tool. Opens the shell session with v8_docker container. In order to use this script `docker_build.sh` should succeed. If it fails by some reason - comment the failing lines and run build script again. 13 | 1. full_clean_build.sh - callds `clear_docker.sh` and then `docker_build.sh`. You could try it if you are desperate or have a couple hours to spare. 14 | 15 | ## Docker Basics 16 | 17 | 1. Every script command result is cached to the small sub-container. 18 | 1. If you add/modify any command - the caches of all commands below will be invalidated. 19 | 1. There is a magic `CACHE_BUST=1` in the script. You might want to modify the value to reset the container to thee state before checking out the branch. 20 | 21 | ## Contributing 22 | 23 | This project welcomes contributions and suggestions. Most contributions require you to agree to a 24 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us 25 | the rights to use your contribution. For details, visit https://cla.microsoft.com. 26 | 27 | When you submit a pull request, a CLA-bot will automatically determine whether you need to provide 28 | a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions 29 | provided by the bot. You will only need to do this once across all repos using our CLA. 30 | 31 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 32 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or 33 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 34 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). 40 | 41 | 42 | -------------------------------------------------------------------------------- /args_arm.gn: -------------------------------------------------------------------------------- 1 | target_os = "android" # These lines need to be changed manually 2 | target_cpu = "arm" 3 | is_debug = false 4 | v8_enable_i18n_support= false 5 | v8_target_cpu = "arm" 6 | is_component_build = true 7 | use_goma = false 8 | v8_use_snapshot = true 9 | v8_use_external_startup_data = false 10 | v8_static_library = false 11 | strip_absolute_paths_from_debug_symbols = false 12 | strip_debug_info = false 13 | symbol_level=1 14 | -------------------------------------------------------------------------------- /args_arm64.gn: -------------------------------------------------------------------------------- 1 | target_os = "android" # These lines need to be changed manually 2 | target_cpu = "arm64" 3 | is_debug = false 4 | v8_enable_i18n_support= false 5 | v8_target_cpu = "arm64" 6 | is_component_build = true 7 | use_goma = false 8 | v8_use_snapshot = true 9 | v8_use_external_startup_data = false 10 | v8_static_library = false 11 | strip_absolute_paths_from_debug_symbols = false 12 | strip_debug_info = false 13 | symbol_level=1 14 | -------------------------------------------------------------------------------- /args_x86.gn: -------------------------------------------------------------------------------- 1 | target_os = "android" # These lines need to be changed manually 2 | target_cpu = "x86" 3 | is_debug = false 4 | v8_enable_i18n_support= false 5 | v8_target_cpu = "x86" 6 | is_component_build = true 7 | use_goma = false 8 | v8_use_snapshot = true 9 | v8_use_external_startup_data = false 10 | v8_static_library = false 11 | strip_absolute_paths_from_debug_symbols = false 12 | strip_debug_info = false 13 | symbol_level=1 14 | -------------------------------------------------------------------------------- /args_x86_64.gn: -------------------------------------------------------------------------------- 1 | target_os = "android" # These lines need to be changed manually 2 | target_cpu = "x64" 3 | is_debug = false 4 | v8_enable_i18n_support= false 5 | v8_target_cpu = "x64" 6 | is_component_build = true 7 | use_goma = false 8 | v8_use_snapshot = true 9 | v8_use_external_startup_data = false 10 | v8_static_library = false 11 | strip_absolute_paths_from_debug_symbols = false 12 | strip_debug_info = false 13 | symbol_level=1 14 | -------------------------------------------------------------------------------- /clear_docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | for container in $(docker ps -aq); do 3 | echo deleting container: $container 4 | docker rm $container 5 | done 6 | 7 | for image in $(docker images --format "{{.ID}}"); do 8 | echo deleting $image 9 | docker rmi -f $image 10 | done 11 | -------------------------------------------------------------------------------- /docker_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # removing old alias 3 | docker rm v8docker 4 | # CACHEBUST=`date +%s` 5 | docker build . -t v8_docker --build-arg CACHEBUST=1 6 | # point v8docker to the latest version 7 | docker run -d --name v8docker v8_docker:latest 8 | # copy results out of the container 9 | docker cp v8docker:/home/docker/v8/v8.zip . 10 | -------------------------------------------------------------------------------- /docker_explore.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | docker run -t -i v8_docker /bin/bash 4 | -------------------------------------------------------------------------------- /full_clean_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./clear_docker.sh 3 | ./docker_build.sh 4 | --------------------------------------------------------------------------------