Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .github/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN apt-get update
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get install -y sudo

RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000 ubuntu
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1001 ubuntu
RUN echo "ubuntu ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER ubuntu
WORKDIR /home/ubuntu
5 changes: 4 additions & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Build for Android

on: [push]
on:
push:
workflow_dispatch:

env:
CACHE_KEY_SUFFIX: v2
Expand All @@ -20,6 +22,7 @@ jobs:
TZ: UTC
NO_INTL: ${{ contains(matrix.variant, 'nointl') }}
NO_JIT: ${{ !contains(matrix.variant, 'jit') }}
DEPOT_TOOLS_UPDATE: 0

steps:
- name: Setup docker workspace
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
name: iOS build

on: [push]
on:
push:
workflow_dispatch:

env:
DEPOT_TOOLS_UPDATE: 0

jobs:
build:
runs-on: macOS-latest
runs-on: macos-11
env:
NO_INTL: false
NO_JIT: true
Expand All @@ -18,7 +23,7 @@ jobs:

- name: Setup V8 build environment
run: |
brew install coreutils
brew install coreutils ninja
scripts/setup.sh -r ${V8_VERSION} ios

- name: Patch V8
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/tools_macos_android.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: v8-android tools builder for macos host

on: [push]
on:
workflow_dispatch:

env:
CACHE_KEY_SUFFIX: v2
DEPOT_TOOLS_UPDATE: 0

jobs:
macos:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ To integrate with React Native, please check [react-native-v8](https://github.co
1. Single libv8android.so (or libv8.so on iOS) file.
2. Support i18n and JavaScript [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl).
3. V8 Lite mode (JIT-less mode) https://v8.dev/blog/v8-lite
4. Build by Android official NDK r21e which prevent potential ABI incompatible issue to integrate with React Native.
4. Build by Android official NDK r23e which prevent potential ABI incompatible issue to integrate with React Native.

## Build Guides

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"version": "10.100.1",
"version": "11.1000.4",
"workspaces": [
"packages/*"
],
Expand Down
4 changes: 2 additions & 2 deletions packages/v8-android-jit-nointl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "v8-android-jit-nointl",
"version": "10.100.1",
"version": "11.1000.4",
"description": "Pre-build version of V8 to be used by React Native apps",
"repository": {
"type": "git",
Expand All @@ -18,6 +18,6 @@
},
"homepage": "https://github.com/Kudo/v8-android-buildscripts#readme",
"files": [
"dist/"
"dist/**/*"
]
}
4 changes: 2 additions & 2 deletions packages/v8-android-jit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "v8-android-jit",
"version": "10.100.1",
"version": "11.1000.4",
"description": "Pre-build version of V8 to be used by React Native apps",
"repository": {
"type": "git",
Expand All @@ -18,6 +18,6 @@
},
"homepage": "https://github.com/Kudo/v8-android-buildscripts#readme",
"files": [
"dist/"
"dist/**/*"
]
}
4 changes: 2 additions & 2 deletions packages/v8-android-nointl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "v8-android-nointl",
"version": "10.100.1",
"version": "11.1000.4",
"description": "Pre-build version of V8 to be used by React Native apps (Non Intl supported version)",
"repository": {
"type": "git",
Expand All @@ -18,6 +18,6 @@
},
"homepage": "https://github.com/Kudo/v8-android-buildscripts#readme",
"files": [
"dist/"
"dist/**/*"
]
}
2 changes: 1 addition & 1 deletion packages/v8-android-tools-linux/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "v8-android-tools-linux",
"version": "10.100.1",
"version": "11.1000.4",
"description": "Tools for v8-android",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/v8-android-tools-macos/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "v8-android-tools-macos",
"version": "10.100.1",
"version": "11.1000.4",
"description": "Tools for v8-android",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/v8-android/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "v8-android",
"version": "10.100.1",
"version": "11.1000.4",
"description": "Pre-build version of V8 to be used by React Native apps",
"repository": {
"type": "git",
Expand All @@ -18,6 +18,6 @@
},
"homepage": "https://github.com/Kudo/v8-android-buildscripts#readme",
"files": [
"dist/"
"dist/**/*"
]
}
27 changes: 27 additions & 0 deletions packages/v8-ios/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "v8-ios",
"version": "11.110.0",
"description": "Pre-build version of V8 to be used by React Native apps",
"repository": {
"type": "git",
"url": "git+https://github.com/Kudo/v8-android-buildscripts.git",
"directory": "packages/v8-ios"
},
"keywords": [
"react-native",
"ios",
"v8"
],
"author": "Kudo Chien",
"license": "BSD-2-Clause",
"bugs": {
"url": "https://github.com/Kudo/v8-android-buildscripts/issues"
},
"homepage": "https://github.com/Kudo/v8-android-buildscripts#readme",
"files": [
"v8-ios.podspec",
"include/",
"v8.xcframework/**/*",
"tools/"
]
}
21 changes: 21 additions & 0 deletions packages/v8-ios/v8-ios.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require "json"

package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

Pod::Spec.new do |s|
s.name = package['name']
s.version = package['version']
s.summary = package['description']
s.license = package['license']

s.author = package['author']
s.homepage = package['homepage']
s.platforms = { :ios => "12.0" }

s.source = { :http => "https://registry.npmjs.org/v8-ios/-/v8-ios-#{s.version}.tgz" }

s.vendored_framework = 'v8.xcframework'
s.source_files = 'include/**/*.h'
s.preserve_paths = 'include'
s.header_mappings_dir = 'include'
end
17 changes: 17 additions & 0 deletions patches/system_xcode_build_error.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,20 @@ index bc3de06d0..1e96de22c 100644
# TODO(https://crbug.com/1231236): Use -ffile-compilation-dir= here.
cflags += [
"-Xclang",
diff --git a/config/c++/BUILD.gn b/config/c++/BUILD.gn
index e7ed69ec8..cf73e4490 100644
--- a/build/config/c++/BUILD.gn
+++ b/build/config/c++/BUILD.gn
@@ -121,7 +121,11 @@ config("runtime_library") {

# Make sure we don't link against the system libstdc++ or libc++.
if (is_clang) {
- ldflags += [ "-nostdlib++" ]
+ if (target_environment == "simulator" && current_cpu == "arm64") {
+ // noop
+ } else {
+ ldflags += [ "-nostdlib++" ]
+ }
} else {
# Gcc has a built-in abs() definition with default visibility.
# If it was not disabled, it would conflict with libc++'s abs()
47 changes: 0 additions & 47 deletions patches/v8_97_android_unwind_link_error.patch

This file was deleted.

26 changes: 26 additions & 0 deletions patches/v8_android_unwind_link_error.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/build/config/android/BUILD.gn b/build/config/android/BUILD.gn
index 63b37e0c1..10fdb3cbf 100644
--- a/build/config/android/BUILD.gn
+++ b/build/config/android/BUILD.gn
@@ -57,9 +57,18 @@ config("compiler") {
}
}

- # Instead of using an unwind lib from the toolchain,
- # buildtools/third_party/libunwind will be built and used directly.
- ldflags += [ "--unwindlib=none" ]
+ if (current_cpu == "x86") {
+ arch_dir = "i386"
+ } else if (current_cpu == "x64") {
+ arch_dir = "x86_64"
+ } else if (current_cpu == "arm") {
+ arch_dir = "arm"
+ } else if (current_cpu == "arm64") {
+ arch_dir = "aarch64"
+ } else {
+ assert(false, "Unknown Android ABI: " + current_cpu)
+ }
+ lib_dirs = [ "$android_ndk_library_path/clang/12.0.9/lib/linux/$arch_dir"]

# $compile_api_level corresponds to the API level used for the sysroot path
# calculation in //build/config/android/config.gni
53 changes: 41 additions & 12 deletions scripts/archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function makeDistPackageDir() {
}

DIST_PACKAGE_DIR=$(makeDistPackageDir)
mkdir -p "${DIST_PACKAGE_DIR}"

function createAAR() {
printf "\n\n\t\t===================== create aar =====================\n\n"
Expand All @@ -30,16 +31,45 @@ function createAAR() {
popd
}

function createUniversalDylib() {
printf "\n\n\t\t===================== create universal dylib =====================\n\n"
mkdir -p "${BUILD_DIR}/lib/universal"
lipo "${BUILD_DIR}/lib/arm64/libv8.dylib" "${BUILD_DIR}/lib/x64/libv8.dylib" -output "${BUILD_DIR}/lib/universal/libv8.dylib" -create
}

function copyDylib() {
printf "\n\n\t\t===================== copy dylib =====================\n\n"
mkdir -p "${DIST_PACKAGE_DIR}"
cp -Rf "${BUILD_DIR}/lib" "${DIST_PACKAGE_DIR}/"
function createXcframework() {
plist=$(cat << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>v8</string>
<key>CFBundleIdentifier</key>
<string>io.csie.kudo.v8.framework</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleSignature</key>
<string>????</string>
</dict>
</plist>
EOF
)
printf "\n\n\t\t===================== create ios device framework =====================\n\n"
mkdir -p "${BUILD_DIR}/ios-arm64/v8.framework"
echo "${plist}" > "${BUILD_DIR}/ios-arm64/v8.framework/Info.plist"
cp -f "${BUILD_DIR}/lib/device/arm64/libv8.dylib" "${BUILD_DIR}/ios-arm64/v8.framework/v8"
install_name_tool -id "@rpath/v8.framework/v8" "${BUILD_DIR}/ios-arm64/v8.framework/v8"

printf "\n\n\t\t===================== create ios simulator framework =====================\n\n"
mkdir -p "${BUILD_DIR}/ios-arm64_x86_64-simulator/v8.framework"
echo "${plist}" > "${BUILD_DIR}/ios-arm64_x86_64-simulator/v8.framework/Info.plist"
lipo "${BUILD_DIR}/lib/simulator/arm64/libv8.dylib" "${BUILD_DIR}/lib/simulator/x64/libv8.dylib" -output "${BUILD_DIR}/ios-arm64_x86_64-simulator/v8.framework/v8" -create
install_name_tool -id "@rpath/v8.framework/v8" "${BUILD_DIR}/ios-arm64_x86_64-simulator/v8.framework/v8"

printf "\n\n\t\t===================== create ios xcframework =====================\n\n"
rm -rf "${BUILD_DIR}/v8.xcframework"
xcodebuild -create-xcframework -framework "${BUILD_DIR}/ios-arm64/v8.framework" -framework "${BUILD_DIR}/ios-arm64_x86_64-simulator/v8.framework" -output "${BUILD_DIR}/v8.xcframework"

cp -Rf "${BUILD_DIR}/v8.xcframework" "${DIST_PACKAGE_DIR}/v8.xcframework"
}

function createUnstrippedLibs() {
Expand Down Expand Up @@ -87,8 +117,7 @@ if [[ ${PLATFORM} = "android" ]]; then
copyTools
copySnapshotBlobIfNeeded
elif [[ ${PLATFORM} = "ios" ]]; then
createUniversalDylib
copyDylib
createXcframework
copyHeaders
copyTools
copySnapshotBlobIfNeeded
Expand Down
Loading