Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
run: |
export CI_PROJECT_DIR=`pwd`
cd /root/v8
git checkout remotes/origin/8.3-lkgr
git checkout remotes/origin/9.3-lkgr
cp -R /root/v8/include $CI_PROJECT_DIR/v8-build/v8
cd $CI_PROJECT_DIR/v8-build/v8/src
echo "1. build v8 project."
python build_v8.py --target android --v8-source /root/v8 --remote-branch remotes/origin/8.3-lkgr
python build_v8.py --target android --v8-source /root/v8 --remote-branch remotes/origin/9.3-lkgr
- name: "build jsenv"
run: |
mkdir -p third_party/android_tools/
Expand Down
6 changes: 3 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ build:
script:
# build v8
- cd /root/v8
- git checkout remotes/origin/8.3-lkgr
- git checkout remotes/origin/9.3-lkgr
- cp -R /root/v8/include $CI_PROJECT_DIR/v8-build/v8
- cd $CI_PROJECT_DIR/v8-build/v8/src
- echo "1. build v8 project."
- python build_v8.py --target android --v8-source /root/v8 --remote-branch remotes/origin/8.3-lkgr
- python build_v8.py --target android --v8-source /root/v8 --remote-branch remotes/origin/9.3-lkgr
# build jsenv
- cd $CI_PROJECT_DIR
- mkdir -p third_party/android_tools/
Expand All @@ -37,7 +37,7 @@ release:
- tags
script:
- cd /root/v8
- git checkout remotes/origin/8.3-lkgr
- git checkout remotes/origin/9.3-lkgr
- cd $CI_PROJECT_DIR
- mkdir -p third_party/android_tools/
- ln -s /root/v8/third_party/android_ndk third_party/android_tools/ndk
Expand Down
26 changes: 15 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:19.10
FROM ubuntu:20.04

ENV PATH=${PATH}:/root/depot_tools:/root/v8/tools/dev

Expand All @@ -20,16 +20,24 @@ RUN apt update -qq && apt upgrade -y && apt-get install -qq -y --no-install-reco
git

RUN apt-get install -y npm && \
npm i -g n && \
npm i -g yarn && \
n latest
npm i -g n && \
npm i -g yarn && \
n latest

RUN cd ~ && git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git --depth=1

RUN cd ~ && fetch v8 && cd ~/v8 && gclient sync
# Solve the problem of not being able to download android_ndk
RUN cd ~ && fetch v8 \
&& cd v8 && git checkout remotes/origin/9.3-lkgr \
&& sed -i 's/2c2138e811487b13020eb331482fb991fd399d4e/083aa67a0d3309ebe37eafbe7bfd96c235a019cf/g' DEPS \
&& echo "target_os = ['android']" >> ../.gclient \
&& gclient sync

RUN apt install gcc-9-arm-linux-gnueabihf -y
RUN apt autoremove -y

RUN cd ~/v8 && sed -i 's/${dev_list} snapcraft/${dev_list}/g' build/install-build-deps.sh && build/install-build-deps.sh --lib32
RUN cd ~/v8 && sed -i 's/${dev_list} snapcraft/${dev_list}/g' build/install-build-deps.sh \
&& build/install-build-deps.sh --lib32

CMD [ "fish" ]

Expand All @@ -39,13 +47,9 @@ ENV ANDROID_NDK_HOME=/root/v8/third_party/android_ndk
RUN apt install openjdk-8-jdk -y && update-java-alternatives -s java-1.8.0-openjdk-amd64

RUN cd ~/v8 && build/install-build-deps-android.sh
RUN cd ~/v8/build && git reset HEAD --hard

RUN cd ~/v8 && echo "target_os = ['android']" >> ../.gclient \
&& gclient sync


RUN apt update && apt install libatomic1:i386 -y
RUN apt install ninja-build

ENV PATH=${PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin
ARG ANDROID_BUILD_VERSION=28
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ Public GN documents can be found at: [https://chromium.googlesource.com/chromium

## 1. Pull docker image and enter container.
```
docker pull quickapp/v8-build:200513
docker pull quickapp/v8-build:230901
```

## 2. build v8
```
export CI_PROJECT_DIR="/root/jsenv-runtime"
cd /root/v8
git checkout remotes/origin/8.3-lkgr
git checkout remotes/origin/9.3-lkgr
cp -R /root/v8/include $CI_PROJECT_DIR/v8-build/v8
cd $CI_PROJECT_DIR/v8-build/v8/src
python build_v8.py --target android --v8-source /root/v8 --remote-branch remotes/origin/8.3-lkgr
python build_v8.py --target android --v8-source /root/v8 --remote-branch remotes/origin/9.3-lkgr
```
## 3. Link third_party.
```
Expand Down
70 changes: 7 additions & 63 deletions build/config/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -34,74 +34,25 @@ config("compiler") {
"__ANDROID_API__=$compile_api_level",
]

ldflags = [
]
ldflags = []

android_compile_sysroot = "$android_ndk_root/sysroot"
android_linker_sysroot = android_compile_sysroot
if (target_cpu == "arm") {
abi_target = "arm-linux-androideabi"
arm_android_sysroot_subdir = "platforms/android-${android32_ndk_api_level}/arch-arm"
android_linker_sysroot = "$android_ndk_root/$arm_android_sysroot_subdir"
} else if (target_cpu == "arm64") {
abi_target = "aarch64-linux-android"
arm64_android_sysroot_subdir = "platforms/android-${android64_ndk_api_level}/arch-arm64"
android_linker_sysroot = "$android_ndk_root/$arm64_android_sysroot_subdir"
} else if (target_cpu == "x86") {
abi_target = "i686-linux-android"
x86_android_sysroot_subdir = "platforms/android-${android32_ndk_api_level}/arch-x86"
android_linker_sysroot = "$android_ndk_root/$x86_android_sysroot_subdir"
} else if (target_cpu == "x64") {
abi_target = "x86_64-linux-android"
x86_64_android_sysroot_subdir = "platforms/android-${android64_ndk_api_level}/arch-x86_64"
android_linker_sysroot = "$android_ndk_root/$x86_64_android_sysroot_subdir"
} else {
assert(false, "Target ABI not supported.")
}

if (is_clang) {
cflags += [
"--target=$abi_target",
]
ldflags += [
"--target=$abi_target",
]
}

cflags += [
"-isystem" +
rebase_path("$android_ndk_root/sysroot/usr/include/$abi_target", root_build_dir),
"--sysroot=" + rebase_path(android_compile_sysroot, root_build_dir),
]

ldflags += [
"--sysroot=" + rebase_path(android_linker_sysroot, root_build_dir),
]

if (android_ndk_major_version >= 13) {
libcxx_include_path =
rebase_path("$android_libcpp_root/include", root_build_dir)
libcxxabi_include_path =
rebase_path("$android_ndk_root/sources/cxx-stl/llvm-libc++abi/include",
root_build_dir)
} else {
libcxx_include_path =
rebase_path("$android_libcpp_root/libcxx/include", root_build_dir)
libcxxabi_include_path = rebase_path(
"$android_ndk_root/sources/cxx-stl/llvm-libc++abi/libcxxabi/include",
root_build_dir)
cflags += [ "--target=$abi_target$compile_api_level" ]
ldflags += [ "--target=$abi_target$compile_api_level" ]
}

android_support_include_path = rebase_path(
"$android_ndk_root/sources/android/support/include",
root_build_dir)

cflags_cc += [
"-isystem" + libcxx_include_path,
"-isystem" + libcxxabi_include_path,
"-isystem" + android_support_include_path,
]

# Android Linker settings
ldflags += [
"-nostdlib++",
Expand All @@ -110,25 +61,22 @@ config("compiler") {
"-Wl,--warn-shared-textrel",
]

if (is_clang) {
ldflags += [ "--gcc-toolchain=" + rebase_path(android_toolchain_root, root_build_dir) ]
}

# Use shared C++
libs = [ "c" ]
libs += [ "m" ]
libs += [ "dl" ]
libs += [ "c++abi" ]
libs += [ "android" ]
libs += [ "log" ]

# FIXME(liushouqun): Use llvm shared libc++, need to process the "libc++_shared.so".
libs += [ "c++_shared" ]
libs += [ android_libgcc_file ]

if (current_cpu == "arm" || current_cpu == "x86") {
# In Android NDK r17, libunwind and libandroid_support are only required in
# 32-bit build.
if(current_cpu == "arm") {
if (current_cpu == "arm") {
libs += [ "unwind" ]
}
libs += [ "android_support" ]
Expand All @@ -139,13 +87,9 @@ config("compiler") {

copy("libc++_shared") {
soname = "libc++_shared.so"
sources = [
"${android_libcpp_lib_dir}/${soname}",
]
sources = [ "${android_libcpp_lib_dir}/${soname}" ]

outputs = [
"${root_out_dir}/${soname}",
]
outputs = [ "${root_out_dir}/${soname}" ]
}

config("executatble_config") {
Expand Down
20 changes: 13 additions & 7 deletions build/config/android/config.gni
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (is_android) {
android64_ndk_api_level = 21

# TODO(liushouqun): Fix this by reading the 'source.properties' file to get version.
android_ndk_major_version = 20
android_ndk_major_version = 22

android_sdk_root = rebase_path("//third_party/android_tools/sdk")
android_sdk_version = "28"
Expand Down Expand Up @@ -73,19 +73,22 @@ if (is_android) {
android_toolchain_prefix = ""
android_app_abi = ""
if (target_cpu == "arm") {
android_toolchain_root = android_ndk_root + "/toolchains/arm-linux-androideabi-4.9/prebuilt"
android_toolchain_root =
android_ndk_root + "/toolchains/arm-linux-androideabi-4.9/prebuilt"
android_toolchain_prefix = "arm-linux-androideabi"
android_app_abi = "armeabi-v7a"
} else if (target_cpu == "arm64") {
android_toolchain_root = android_ndk_root + "/toolchains/aarch64-linux-android-4.9/prebuilt"
android_toolchain_root =
android_ndk_root + "/toolchains/aarch64-linux-android-4.9/prebuilt"
android_toolchain_prefix = "aarch64-linux-android"
android_app_abi = "arm64-v8a"
} else if (target_cpu == "x86") {
android_toolchain_root = android_ndk_root + "/toolchains/x86-4.9/prebuilt"
android_toolchain_prefix = "i686-linux-android"
android_app_abi = "x86"
} else if (target_cpu == "x64") {
android_toolchain_root = android_ndk_root + "/toolchains/x86_64-4.9/prebuilt"
android_toolchain_root =
android_ndk_root + "/toolchains/x86_64-4.9/prebuilt"
android_toolchain_prefix = "x86_64-linux-android"
android_app_abi = "x86_64"
} else {
Expand All @@ -96,12 +99,15 @@ if (is_android) {
android_libcpp_root = "$android_ndk_root/sources/cxx-stl/llvm-libc++"
android_libcpp_lib_dir = "${android_libcpp_root}/libs/${android_app_abi}"

android_libgcc_file = android_toolchain_root + "/" + android_toolchain_host_path + "/lib/gcc/" +
android_libgcc_file =
android_toolchain_root + "/" + android_toolchain_host_path + "/lib/gcc/" +
android_toolchain_prefix + "/4.9.x/" + "libgcc.a"

android_toolchain_root = android_toolchain_root + "/" + android_toolchain_host_path
android_toolchain_root =
android_toolchain_root + "/" + android_toolchain_host_path

android_clang_path = android_ndk_root + "/toolchains/llvm/prebuilt/" + android_toolchain_host_path + "/bin"
android_clang_path = android_ndk_root + "/toolchains/llvm/prebuilt/" +
android_toolchain_host_path + "/bin"

android_tool_prefix = "$android_toolchain_root/bin/$android_toolchain_prefix-"
android_readelf = "${android_tool_prefix}readelf"
Expand Down
Loading