Skip to content

Commit

Permalink
moved from puerts main repo
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieyang committed Mar 23, 2022
0 parents commit 3853ba9
Show file tree
Hide file tree
Showing 21 changed files with 1,197 additions and 0 deletions.
237 changes: 237 additions & 0 deletions .github/workflows/build_v8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
name: build v8

on:
workflow_dispatch:
inputs:
tag_date:
description: 'tag date'
required: true

#https://docs.google.com/document/d/1oFPHyNb_eXg6NzrE6xJDNPdJrHMZvx0LqsD6wpbd9vY/edit#heading=h.4tfb7x3beh2l
#libwee8按设计只支持wasm,不支持js,但8.4.371.19版本尚未移除js功能,还能用,如果升级v8版本要注意
#libmonolith会稳妥一些,但静态库大小会大些
env:
VERSION: 8.4.371.19

jobs:
build_android_arm_v8:
name: Android (arm64-v8a)
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Run build script
run: |
cd $GITHUB_WORKSPACE
sh ./android_armv8.sh ${{env.VERSION}}
- uses: actions/upload-artifact@v2
with:
name: v8_bin
path: ~/v8/v8/output/**/*

build_android_arm_v7:
name: Android (armeabi-v7a)
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Run build script
run: |
cd $GITHUB_WORKSPACE
sh ./android_armv7.sh ${{env.VERSION}}
- uses: actions/upload-artifact@v2
with:
name: v8_bin
path: ~/v8/v8/output/**/*

build_android_x86_64:
name: Android (x86_64)
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Run build script
run: |
cd $GITHUB_WORKSPACE
sh ./android_x64.sh ${{env.VERSION}}
- uses: actions/upload-artifact@v2
with:
name: v8_bin
path: ~/v8/v8/output/**/*

build_linux:
name: Linux
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Run build script
run: |
cd $GITHUB_WORKSPACE
sh ./linux.sh ${{env.VERSION}}
- uses: actions/upload-artifact@v2
with:
name: v8_bin
path: ~/v8/v8/output/**/*

build_windows:
name: Windows
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Run build script
shell: cmd
run: |
cd %GITHUB_WORKSPACE%
call .\windows_64.cmd ${{env.VERSION}}
- uses: actions/upload-artifact@v2
with:
name: v8_bin
path: v8/v8/output/**/*

- uses: actions/upload-artifact@v2
with:
name: v8_bin_win64
path: v8/v8/output/**/*

build_windows_md:
name: Windows-MD
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Run build script
shell: cmd
run: |
cd %GITHUB_WORKSPACE%
call .\windows_64MD.cmd ${{env.VERSION}}
- uses: actions/upload-artifact@v2
with:
name: v8_bin
path: v8/v8/output/**/*

build_windows_md_dll:
name: Windows-MD-DLL
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Run build script
shell: cmd
run: |
cd %GITHUB_WORKSPACE%
call .\windows_64MD_DLL.cmd ${{env.VERSION}}
- uses: actions/upload-artifact@v2
with:
name: v8_bin
path: v8/v8/output/**/*

build_windows_32:
name: Windows-32
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Run build script
shell: cmd
run: |
cd %GITHUB_WORKSPACE%
call .\windows_32.cmd ${{env.VERSION}}
- uses: actions/upload-artifact@v2
with:
name: v8_bin
path: v8/v8/output/**/*

build_macos:
name: macOS
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- name: Use Xcode 12.0 to use SDK 10.15
run: sudo xcode-select -switch "/Applications/Xcode_12.app"
- name: Run build script
run: |
cd $GITHUB_WORKSPACE
sh ./macos.sh ${{env.VERSION}}
- uses: actions/upload-artifact@v2
with:
name: v8_bin
path: ~/v8/v8/output/**/*

build_macos_dll:
name: macOS-DLL
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- name: Use Xcode 12.0 to use SDK 10.15
run: sudo xcode-select -switch "/Applications/Xcode_12.app"
- name: Run build script
run: |
cd $GITHUB_WORKSPACE
sh ./macos_DLL.sh ${{env.VERSION}}
- uses: actions/upload-artifact@v2
with:
name: v8_bin
path: ~/v8/v8/output/**/*

build_ios:
name: iOS
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- name: Use Xcode 12.0 to use SDK 10.15
run: sudo xcode-select -switch "/Applications/Xcode_12.app"
- name: Run build script
run: |
cd $GITHUB_WORKSPACE
sh ./ios.sh ${{env.VERSION}}
- uses: actions/upload-artifact@v2
with:
name: v8_bin
path: ~/v8/v8/output/**/*

#build_ios_simulator:
# name: iOS simulator
# runs-on: macos-10.15
# steps:
# - uses: actions/checkout@v2
# - name: Use Xcode 12.0 to use SDK 10.15
# run: sudo xcode-select -switch "/Applications/Xcode_12.app"
# - name: Run build script
# run: |
# cd $GITHUB_WORKSPACE
# sh ./ios_simulator.sh ${{env.VERSION}}
# - uses: actions/upload-artifact@v2
# with:
# name: v8_bin
# path: ~/v8/v8/output/**/*

publish:
runs-on: ubuntu-latest
needs: [build_android_arm_v8,build_android_arm_v7,build_android_x86_64,build_linux,build_windows,build_windows_md,build_windows_32,build_macos,build_ios,build_windows_md_dll,build_macos_dll]
steps:
- uses: actions/download-artifact@v1
with:
name: v8_bin
path: v8_bin/

- name: Create Release Asset
run: |
cd v8_bin/ && tar cvfz ../v8_bin_${{env.VERSION}}.tgz v8 && cd -
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: V8_${{env.VERSION}}_${{ github.event.inputs.tag_date }}
release_name: V8_${{env.VERSION}}_${{ github.event.inputs.tag_date }}
draft: false
prerelease: false

- name: Upload V8
#id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./v8_bin_${{env.VERSION}}.tgz
asset_name: v8_bin_${{env.VERSION}}.tgz
asset_content_type: application/tgz


4 changes: 4 additions & 0 deletions CRLF2LF.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const fs = require('fs');
var file = process.argv[2];

fs.writeFileSync(file, fs.readFileSync(file, {encoding: 'utf-8'}).toString().replace(/\r\n/g, '\n'));
64 changes: 64 additions & 0 deletions android_armv7.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
VERSION=$1
[ -z "$GITHUB_WORKSPACE" ] && GITHUB_WORKSPACE="$( cd "$( dirname "$0" )"/.. && pwd )"

sudo apt-get install -y \
pkg-config \
git \
subversion \
curl \
wget \
build-essential \
python \
xz-utils \
zip

cd ~
echo "=====[ Getting Depot Tools ]====="
git clone -q https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=$(pwd)/depot_tools:$PATH
gclient


mkdir v8
cd v8

echo "=====[ Fetching V8 ]====="
fetch v8
echo "target_os = ['android']" >> .gclient
cd ~/v8/v8
./build/install-build-deps-android.sh
git checkout refs/tags/$VERSION
gclient sync


# echo "=====[ Patching V8 ]====="
# git apply --cached $GITHUB_WORKSPACE/patch/builtins-puerts.patch
# git checkout -- .

echo "=====[ Building V8 ]====="
python ./tools/dev/v8gen.py arm.release -vv -- '
target_os = "android"
target_cpu = "arm"
is_debug = false
v8_enable_i18n_support= false
v8_target_cpu = "arm"
use_goma = false
v8_use_snapshot = true
v8_use_external_startup_data = true
v8_static_library = true
strip_absolute_paths_from_debug_symbols = false
strip_debug_info = false
symbol_level=1
use_custom_libcxx=false
use_custom_libcxx_for_host=true
'
ninja -C out.gn/arm.release -t clean
ninja -C out.gn/arm.release wee8
third_party/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin/strip -g -S -d --strip-debug --verbose out.gn/arm.release/obj/libwee8.a

node $GITHUB_WORKSPACE/genBlobHeader.js "android armv7" out.gn/arm.release/snapshot_blob.bin

mkdir -p output/v8/Lib/Android/armeabi-v7a
cp out.gn/arm.release/obj/libwee8.a output/v8/Lib/Android/armeabi-v7a/
mkdir -p output/v8/Inc/Blob/Android/armv7a
cp SnapshotBlob.h output/v8/Inc/Blob/Android/armv7a/
64 changes: 64 additions & 0 deletions android_armv8.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
VERSION=$1
[ -z "$GITHUB_WORKSPACE" ] && GITHUB_WORKSPACE="$( cd "$( dirname "$0" )"/.. && pwd )"

sudo apt-get install -y \
pkg-config \
git \
subversion \
curl \
wget \
build-essential \
python \
xz-utils \
zip

cd ~
echo "=====[ Getting Depot Tools ]====="
git clone -q https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=$(pwd)/depot_tools:$PATH
gclient


mkdir v8
cd v8

echo "=====[ Fetching V8 ]====="
fetch v8
echo "target_os = ['android']" >> .gclient
cd ~/v8/v8
./build/install-build-deps-android.sh
git checkout refs/tags/$VERSION
gclient sync


# echo "=====[ Patching V8 ]====="
# git apply --cached $GITHUB_WORKSPACE/patch/builtins-puerts.patch
# git checkout -- .

echo "=====[ Building V8 ]====="
python ./tools/dev/v8gen.py arm64.release -vv -- '
target_os = "android"
target_cpu = "arm64"
is_debug = false
v8_enable_i18n_support= false
v8_target_cpu = "arm64"
use_goma = false
v8_use_snapshot = true
v8_use_external_startup_data = true
v8_static_library = true
strip_debug_info = false
symbol_level=1
use_custom_libcxx=false
use_custom_libcxx_for_host=true
v8_enable_pointer_compression=false
'
ninja -C out.gn/arm64.release -t clean
ninja -C out.gn/arm64.release wee8
third_party/android_ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/aarch64-linux-android/bin/strip -g -S -d --strip-debug --verbose out.gn/arm64.release/obj/libwee8.a

node $GITHUB_WORKSPACE/genBlobHeader.js "android arm64" out.gn/arm64.release/snapshot_blob.bin

mkdir -p output/v8/Lib/Android/arm64-v8a
cp out.gn/arm64.release/obj/libwee8.a output/v8/Lib/Android/arm64-v8a/
mkdir -p output/v8/Inc/Blob/Android/arm64
cp SnapshotBlob.h output/v8/Inc/Blob/Android/arm64/
Loading

0 comments on commit 3853ba9

Please sign in to comment.