|
1 | 1 | #!/bin/bash
|
2 | 2 | set -e
|
| 3 | +source "$(dirname "$0")/build_utils.sh" |
3 | 4 |
|
4 | 5 | pushd v8
|
5 | 6 |
|
6 | 7 | ARCH_ARR=(x64-simulator arm64-simulator arm64-device)
|
7 |
| -MODULES=(v8_base_without_compiler v8_compiler v8_libplatform v8_libbase v8_bigint v8_snapshot v8_heap_base v8_heap_base_headers torque_generated_initializers torque_generated_definitions) |
| 8 | +MODULES=( |
| 9 | + cppgc_base |
| 10 | + torque_generated_definitions |
| 11 | + torque_generated_initializers |
| 12 | + v8_base_without_compiler |
| 13 | + v8_bigint |
| 14 | + v8_compiler |
| 15 | + v8_heap_base |
| 16 | + v8_heap_base_headers |
| 17 | + v8_libbase |
| 18 | + v8_libplatform |
| 19 | + v8_snapshot |
| 20 | +) |
| 21 | +GN_ARGS_BASE=" |
| 22 | + treat_warnings_as_errors=false |
| 23 | +
|
| 24 | + icu_use_data_file=false |
| 25 | + use_custom_libcxx=false |
| 26 | + use_xcode_clang=true |
| 27 | +
|
| 28 | + is_component_build=false |
| 29 | + is_debug=false |
| 30 | +
|
| 31 | + enable_ios_bitcode=false |
| 32 | + ios_deployment_target=12 |
| 33 | + ios_enable_code_signing=false |
| 34 | + target_os=\"ios\" |
| 35 | +
|
| 36 | + v8_control_flow_integrity=false |
| 37 | + v8_monolithic=true |
| 38 | + v8_static_library=true |
| 39 | + v8_use_external_startup_data=false |
| 40 | +
|
| 41 | + v8_enable_sandbox=false |
| 42 | + v8_enable_debugging_features=false |
| 43 | + v8_enable_i18n_support=false |
| 44 | + v8_enable_lite_mode=true |
| 45 | + v8_enable_pointer_compression=false |
| 46 | + v8_enable_v8_checks=false |
| 47 | + v8_enable_webassembly=false |
| 48 | +" |
| 49 | +# is_official_build=true |
| 50 | +# clang_base_path=\"/Applications/Xcode-14.2.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr\" |
| 51 | + |
| 52 | +# GN_ARGS_BASE = "$GN_ARGS_BASE v8_embedder_string=\"-nativescript\"" |
| 53 | + |
| 54 | +DIST="../v8_build" |
| 55 | +mkdir -p $DIST |
| 56 | + |
| 57 | + |
| 58 | +function archiveLib() { |
| 59 | + MODULE=$1 |
| 60 | + OBJECTS=$2 |
| 61 | + ARCH=$3 |
| 62 | + MODULE_DEST=$DIST/$ARCH/_lib/$MODULE.a |
| 63 | + checkpoint "Archiving $MODULE" |
| 64 | + echo "MODULE= $MODULE" |
| 65 | + echo "OBJECTS= $OBJECTS" |
| 66 | + echo "ARCH= $ARCH" |
| 67 | + echo "MODULE_DEST= $MODULE_DEST" |
| 68 | + ar r $MODULE_DEST $OBJECTS || echo "Failed to archive $MODULE..." |
| 69 | + echo "" |
| 70 | + echo "Archiving $MODULE done." |
| 71 | + |
| 72 | + checkpoint "Stripping $MODULE" |
| 73 | + strip $MODULE_DEST || echo "Failed to strip $MODULE..." |
| 74 | +} |
8 | 75 |
|
9 | 76 | for CURRENT_ARCH in ${ARCH_ARR[@]}
|
10 | 77 | do
|
| 78 | + mkdir -p "$DIST/$CURRENT_ARCH/_lib" |
11 | 79 | OUTFOLDER=out.gn/$CURRENT_ARCH-release
|
12 | 80 | ARCH_PARTS=(${CURRENT_ARCH//-/ })
|
13 | 81 | TARGET_ENV=${ARCH_PARTS[1]}
|
14 |
| - echo "Building for $OUTFOLDER ($TARGET_ENV)" |
| 82 | + checkpoint "Building V8 for $OUTFOLDER ($TARGET_ENV)" |
15 | 83 | ARCH=${ARCH_PARTS[0]}
|
16 |
| - gn gen $OUTFOLDER --args="v8_enable_webassembly=false treat_warnings_as_errors=false v8_enable_pointer_compression=false is_official_build=true use_custom_libcxx=false is_component_build=false symbol_level=0 v8_enable_v8_checks=false v8_enable_debugging_features=false is_debug=false v8_use_external_startup_data=false use_xcode_clang=true enable_ios_bitcode=true v8_enable_i18n_support=false target_environment=\"$TARGET_ENV\" target_cpu=\"$ARCH\" v8_target_cpu=\"$ARCH\" target_os=\"ios\" ios_deployment_target=\"9.0\"" |
17 |
| - ninja -C $OUTFOLDER ${MODULES[@]} inspector |
| 84 | + # gn args --list $OUTFOLDER |
| 85 | + gn gen $OUTFOLDER --args="${GN_ARGS_BASE} target_environment=\"$TARGET_ENV\" target_cpu=\"$ARCH\" v8_target_cpu=\"$ARCH\"" |
| 86 | + # exit 0; |
| 87 | + echo "Started building v8: $(date)" |
| 88 | + ninja $@ -C $OUTFOLDER ${MODULES[@]} inspector |
| 89 | + echo "Finished building v8: $(date)" |
18 | 90 |
|
19 | 91 | for MODULE in ${MODULES[@]}
|
20 | 92 | do
|
21 |
| - ar r $OUTFOLDER/obj/$MODULE/lib$MODULE.a $OUTFOLDER/obj/$MODULE/*.o |
| 93 | + archiveLib "lib$MODULE" "$OUTFOLDER/obj/$MODULE/*.o" $CURRENT_ARCH |
22 | 94 | done
|
23 | 95 |
|
24 | 96 | # Those libraries are needed if we set v8_enable_i18n_support=true
|
|
27 | 99 | # OBJECTS="$OBJECTS $OUTFOLDER/obj/third_party/icu/icui18n/*.o"
|
28 | 100 | # OBJECTS="$OBJECTS $OUTFOLDER/obj/v8_crash_keys/*.o"
|
29 | 101 |
|
30 |
| - # ar r $OUTFOLDER/libv8.a $OBJECTS |
31 |
| -done |
32 |
| - |
33 |
| -DIST="./dist" |
34 |
| -mkdir -p $DIST |
35 |
| -for MODULE in ${MODULES[@]} |
36 |
| -do |
37 |
| - for CURRENT_ARCH in ${ARCH_ARR[@]} |
38 |
| - do |
39 |
| - mkdir -p "$DIST/$CURRENT_ARCH" |
40 |
| - OUTFOLDER=out.gn/$CURRENT_ARCH-release |
41 |
| - cp "$OUTFOLDER/obj/$MODULE/lib$MODULE.a" "$DIST/$CURRENT_ARCH" |
42 |
| - done |
| 102 | + # archiveLib "libv8" "$OBJECTS" $CURRENT_ARCH |
43 | 103 | done
|
44 | 104 |
|
45 | 105 | for CURRENT_ARCH in ${ARCH_ARR[@]}
|
46 | 106 | do
|
47 |
| - mkdir -p "$DIST/$CURRENT_ARCH" |
48 |
| - OUTFOLDER=out.gn/$CURRENT_ARCH-release |
49 |
| - ar r $OUTFOLDER/obj/third_party/inspector_protocol/libinspector_protocol.a $OUTFOLDER/obj/third_party/inspector_protocol/crdtp/*.o $OUTFOLDER/obj/third_party/inspector_protocol/crdtp_platform/*.o |
50 |
| - cp "$OUTFOLDER/obj/third_party/inspector_protocol/libinspector_protocol.a" "$DIST/$CURRENT_ARCH" |
| 107 | + checkpoint "Packaging libraries for $CURRENT_ARCH..." |
51 | 108 |
|
52 |
| - ZLIB_INPUT="$OUTFOLDER/obj/third_party/zlib/zlib/*.o" |
53 | 109 | ARCH_PARTS=(${CURRENT_ARCH//-/ })
|
54 | 110 | ARCH=${ARCH_PARTS[0]}
|
| 111 | + |
| 112 | + mkdir -p "$DIST/$CURRENT_ARCH" |
| 113 | + OUTFOLDER=out.gn/$CURRENT_ARCH-release |
| 114 | + |
| 115 | + ZLIB_INPUT="$OUTFOLDER/obj/third_party/zlib/zlib/*.o" |
| 116 | + |
55 | 117 | if [ $ARCH = "arm64" ]; then
|
56 | 118 | ZLIB_INPUT="$ZLIB_INPUT $OUTFOLDER/obj/third_party/zlib/zlib_adler32_simd/*.o"
|
57 | 119 | ZLIB_INPUT="$ZLIB_INPUT $OUTFOLDER/obj/third_party/zlib/zlib_inflate_chunk_simd/*.o"
|
58 | 120 | fi
|
59 | 121 |
|
60 | 122 | ZLIB_INPUT="$ZLIB_INPUT $OUTFOLDER/obj/third_party/zlib/google/compression_utils_portable/*.o"
|
61 | 123 |
|
62 |
| - ar r $OUTFOLDER/obj/third_party/zlib/libzip.a $ZLIB_INPUT |
63 |
| - cp "$OUTFOLDER/obj/third_party/zlib/libzip.a" "$DIST/$CURRENT_ARCH" |
64 |
| - |
65 |
| - ar r $OUTFOLDER/obj/cppgc_base/libcppgc_base.a $OUTFOLDER/obj/cppgc_base/*.o |
66 |
| - cp "$OUTFOLDER/obj/cppgc_base/libcppgc_base.a" "$DIST/$CURRENT_ARCH" |
67 |
| - |
68 |
| - ar r $OUTFOLDER/obj/v8_cppgc_shared/libv8_cppgc_shared.a $OUTFOLDER/obj/v8_cppgc_shared/*.o |
69 |
| - cp "$OUTFOLDER/obj/v8_cppgc_shared/libv8_cppgc_shared.a" "$DIST/$CURRENT_ARCH" |
| 124 | + archiveLib "libzip" "$ZLIB_INPUT" $CURRENT_ARCH |
| 125 | + archiveLib "libcrdtp" "$OUTFOLDER/obj/third_party/inspector_protocol/crdtp/*.o" $CURRENT_ARCH |
| 126 | + archiveLib "libcrdtp_platform" "$OUTFOLDER/obj/third_party/inspector_protocol/crdtp_platform/*.o" $CURRENT_ARCH |
| 127 | + archiveLib "libcppgc_base" "$OUTFOLDER/obj/cppgc_base/*.o" $CURRENT_ARCH |
70 | 128 |
|
71 |
| - cp "$OUTFOLDER/obj/src/inspector/libinspector.a" "$DIST/$CURRENT_ARCH" |
72 |
| - cp "$OUTFOLDER/obj/src/inspector/libinspector_string_conversions.a" "$DIST/$CURRENT_ARCH" |
| 129 | + checkpoint "Copying libinspector and libinspector_string_conversions" |
| 130 | + cp "$OUTFOLDER/obj/src/inspector/libinspector.a" "$DIST/$CURRENT_ARCH/_lib" || echo "Skip" |
| 131 | + cp "$OUTFOLDER/obj/src/inspector/libinspector_string_conversions.a" "$DIST/$CURRENT_ARCH/_lib" || echo "Skip" |
73 | 132 | done
|
74 | 133 |
|
75 | 134 | popd
|
0 commit comments