Skip to content

Commit

Permalink
7.3-lkgr (#44)
Browse files Browse the repository at this point in the history
* initial commit for 7.3-lkgr
* optimize for speed using -O3
* fix native module compatibility
  • Loading branch information
garymathews authored and sgtcoolguy committed Apr 8, 2019
1 parent 4fd43ec commit 7e9b836
Show file tree
Hide file tree
Showing 10 changed files with 3,276 additions and 19 deletions.
12 changes: 7 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ def build(scm, arch, mode) {
def expectedLibraries = ['monolith']
def labels = 'ninja && git && android-ndk && android-sdk && python'
if (arch.equals('ia32') || arch.equals('arm')) {
labels += ' && (linux || (osx && xcode-9))' // Need xcode-9 or older on mac, as 32-bit x86 was removed in xcode 10
labels += ' && (osx && xcode-9)' // Need xcode-9 or older on mac, as 32-bit x86 was removed in xcode 10
} else {
// 64-bit can be built on xcode 10, so we can use linux or osx
labels += ' && (linux || osx)'
labels += ' && osx'
}

node(labels) {
Expand Down Expand Up @@ -41,18 +41,20 @@ def build(scm, arch, mode) {
// Force a git clean on everything under v8
sh '../depot_tools/gclient recurse git clean -fdx'
// Then apply our patch to avoid grabbing android sdk/ndk
sh 'git apply ../ndkr16b_7.1.patch'
sh 'git apply ../ndkr19c_7.3.patch'
sh 'git apply ../compat.patch'
sh 'git apply ../optimize.patch'
// Now let gclient get the dependencies.
sh '../depot_tools/gclient sync --shallow --no-history --reset --force' // needs python
}
} // withEnv

// clean, but be ok with non-zero exit code
sh returnStatus: true, script: "./build_v8.sh -n ${env.ANDROID_NDK_R16B} -s ${env.ANDROID_SDK} -c"
sh returnStatus: true, script: "./build_v8.sh -n ${env.ANDROID_NDK_R19C} -s ${env.ANDROID_SDK} -c"
// Now manually clean since that usually fails trying to clean non-existant tags dir
sh 'rm -rf build/' // wipe any previously built libraries
// Now build
sh "./build_v8.sh -n ${env.ANDROID_NDK_R16B} -s ${env.ANDROID_SDK} -j8 -l ${arch} -m ${mode}"
sh "./build_v8.sh -n ${env.ANDROID_NDK_R19C} -s ${env.ANDROID_SDK} -j8 -l ${arch} -m ${mode}"
// Now run a sanity check to make sure we built the static libraries we expect
// We want to fail the build overall if we didn't
for (int l = 0; l < expectedLibraries.size(); l++) {
Expand Down
18 changes: 16 additions & 2 deletions build_mac_v8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,36 @@ else
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
fi

rm -rf build/

export PATH=`pwd`/depot_tools:"$PATH"
cd v8
git checkout -- . # "clean" the v8 directory
rm -rf out.gn/
git apply ../ndkr16b_6.7.patch
echo "Asking gclient to clean v8 dependencies"
../depot_tools/gclient recurse git clean -fdx
echo "Applying patches"
git apply ../ndkr19c_7.3.patch
git apply ../compat.patch
git apply ../optimize.patch
echo "Asking gclient to update v8 dependencies"
gclient sync --shallow --no-history
../depot_tools/gclient sync --shallow --no-history --reset --force
cd ..
# wget http://dl.google.com/android/repository/android-ndk-r16b-darwin-x86_64.zip
# unzip android-ndk-r16b-darwin-x86_64.zip
# export ANDROID_NDK=${PWD}/android-ndk-r16b

echo "Cleaning v8 build"
./build_v8.sh -c
# Now manually clean since that usually fails trying to clean non-existant tags dir
rm -rf build/

echo "Building v8 for x86..."
./build_v8.sh "-j" "8" "-l" "ia32" "-m" "release"
echo "Building v8 for ARM..."
./build_v8.sh "-j" "8" "-l" "arm" "-m" "release"
echo "Building v8 for ARM-64..."
./build_v8.sh "-j" "8" "-l" "arm64" "-m" "release"

echo "Packaging built v8 into tarball..."
./build_v8.sh "-t" "-m" "release"
25 changes: 22 additions & 3 deletions build_v8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,34 @@ buildV8()

# Build V8
MAKE_TARGET="android_$BUILD_LIB_VERSION.$BUILD_MODE"
tools/dev/v8gen.py gen --no-goma -b "$BUILDER_NAME" -m $BUILDER_GROUP $MAKE_TARGET -- use_goma=false v8_use_snapshot=false v8_static_library=true v8_enable_i18n_support=false icu_use_data_file=false android_sdk_root=\"$SDK_DIR\" android_ndk_root=\"$NDK_DIR\" android_ndk_major_version=16 android_ndk_version=\"r16b\" v8_monolithic=true target_os=\"android\" v8_android_log_stdout=true
tools/dev/v8gen.py gen --no-goma -b "$BUILDER_NAME" -m $BUILDER_GROUP $MAKE_TARGET -- use_goma=false v8_use_snapshot=true v8_enable_embedded_builtins=false v8_use_external_startup_data=false v8_static_library=true v8_enable_i18n_support=false android_sdk_root=\"$SDK_DIR\" android_ndk_root=\"$NDK_DIR\" android_ndk_major_version=19 android_ndk_version=\"r19c\" v8_monolithic=true target_os=\"android\" use_custom_libcxx=false v8_android_log_stdout=false
# Hack one of the toolchain items to fix AR executable used for android
cp ../overrides/build/toolchain/android/BUILD.gn "$V8_DIR/build/toolchain/android/BUILD.gn"
ninja -C out.gn/$MAKE_TARGET -j $NUM_CPUS v8_monolith
cp -f ../overrides/build/toolchain/android/BUILD.gn "$V8_DIR/build/toolchain/android/BUILD.gn"
cp -f ../overrides/build/config/android/BUILD.gn "$V8_DIR/build/config/android/BUILD.gn"
cp -f ../overrides/build/config/compiler/BUILD.gn "$V8_DIR/build/config/compiler/BUILD.gn"
ninja -v -C out.gn/$MAKE_TARGET -j $NUM_CPUS v8_monolith

# Copy the static libraries to our staging area.
DEST_DIR="$BUILD_DIR/$BUILD_MODE"
mkdir -p "$DEST_DIR/libs/$ARCH" 2>/dev/null || echo
cp "$V8_DIR/out.gn/$MAKE_TARGET/obj/libv8_monolith.a" "$DEST_DIR/libs/$ARCH/libv8_monolith.a"

MKSNAPSHOT_X86="$V8_DIR/out.gn/$MAKE_TARGET/clang_x86/mksnapshot"
if [ -f $MKSNAPSHOT_X86 ]; then
cp $MKSNAPSHOT_X86 "$DEST_DIR/libs/$ARCH/mksnapshot"
fi
MKSNAPSHOT_X64="$V8_DIR/out.gn/$MAKE_TARGET/clang_x64/mksnapshot"
if [ -f $MKSNAPSHOT_X64 ]; then
cp $MKSNAPSHOT_X64 "$DEST_DIR/libs/$ARCH/mksnapshot"
fi
MKSNAPSHOT_ARM="$V8_DIR/out.gn/$MAKE_TARGET/clang_x86_v8_arm/mksnapshot"
if [ -f $MKSNAPSHOT_ARM ]; then
cp $MKSNAPSHOT_ARM "$DEST_DIR/libs/$ARCH/mksnapshot"
fi
MKSNAPSHOT_ARM64="$V8_DIR/out.gn/$MAKE_TARGET/clang_x64_v8_arm64/mksnapshot"
if [ -f $MKSNAPSHOT_ARM64 ]; then
cp $MKSNAPSHOT_ARM64 "$DEST_DIR/libs/$ARCH/mksnapshot"
fi
}

buildThirdparty()
Expand Down

0 comments on commit 7e9b836

Please sign in to comment.