Skip to content

Commit 6b1ec06

Browse files
authored
Upgrade to WebKitGTK 2.36.3 (#169)
# Why upgrade to latest WebKitGTK 2.36.3 (svn r294992). mostly from community requests and hopefully to fix the crashes on samsung android 12 devices. # How - upgrade NDK to 23.2.8568313. we need newer versions because the newer webkit needs std::filesystem that doesn't support on NDK r21. also, because the NDK r23 libc++_shared.so has std::filesystem symbols that older version doesn't have. to prevent developers use pickFirst to pick wrong libc++_shared.so, i turned to use link static c++ runtime instead. - **[BREAKING CHANGE]** remove non Intl variant, because newer JSC doesn't have a build flag to turn it off. - **[BREAKING CHANGE]** Bump minimum supported Android SDK to 21 - remove outdated patches for older jsc or ndk - remove some platform specific cflags, let ndk to do it. size changes: | - | r250230 Intl | r294992 Intl | | :---------: | :----------: | :----------: | | armeabi-v7a | 14 MB | 17 MB | | arm64-v8a | 18 MB | 19 MB | | x86 | 17 MB | 20 MB | | x86_64 | 19 MB | 21 MB | # Test Plan - ci passed. - launch test on arm64 devices
1 parent ef2df99 commit 6b1ec06

25 files changed

+140
-505
lines changed

.github/workflows/build_and_test.yml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,42 @@
11
name: Build jsc-android and test
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
47

58
jobs:
69
build:
710
runs-on: ubuntu-latest
8-
container: reactnativecommunity/react-native-android:2019-9-4
11+
container: reactnativecommunity/react-native-android:5.4
912

1013
steps:
1114
- uses: actions/checkout@v1
1215

1316
- name: Install packages
1417
run: |
1518
apt-get update
16-
apt-get install coreutils realpath curl git subversion python3.5 python3.5-dev ruby gperf -y
17-
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
18-
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash
19+
apt-get install coreutils curl git subversion wget python3 ruby gperf -y
20+
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
1921
echo 'export NVM_DIR="$HOME/.nvm"' >> "${HOME}/.bashrc"
2022
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> "${HOME}/.bashrc"
2123
source "${HOME}/.bashrc"
22-
nvm install 10
23-
nvm use 10
24-
nvm alias default 10
24+
nvm install 16
25+
nvm use 16
26+
nvm alias default 16
2527
shell: bash
2628

2729
- name: Install Android packages
2830
run: |
2931
sdkmanager \
30-
"cmake;3.10.2.4988404"
32+
"cmake;3.10.2.4988404" \
33+
"cmake;3.18.1" \
34+
"ndk;23.2.8568313"
35+
# move out builtin icu headers from ndk and prevent icu build errors
36+
mv "${ANDROID_HOME}/ndk/23.2.8568313/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/unicode" "${ANDROID_HOME}/ndk/23.2.8568313/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/unicode2"
37+
echo "ANDROID_NDK=$ANDROID_HOME/ndk/23.2.8568313" >> $GITHUB_ENV
3138
shell: bash
39+
3240
- name: Build
3341
run: |
3442
yarn clean
@@ -64,7 +72,7 @@ jobs:
6472
- name: Run test
6573
uses: reactivecircus/android-emulator-runner@v2
6674
with:
67-
api-level: 16
68-
arch: x86
75+
api-level: 21
76+
arch: x86_64
6977
disable-animations: false
7078
script: mv archive/dist . && cd test && yarn && cd android && ./gradlew assembleRelease assembleAndroidTest connectedAndroidTest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package-lock.json
22
/build
33
/dist
4+
/dist.unstripped
45

56
# Created by https://www.gitignore.io/api/node,android,reactnative,intellij+all,androidstudio,visualstudiocode
67

lib/cppruntime/build.gradle

Lines changed: 0 additions & 45 deletions
This file was deleted.

lib/cppruntime/src/main/AndroidManifest.xml

Lines changed: 0 additions & 2 deletions
This file was deleted.

lib/settings.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
rootProject.name = 'JavaScriptCore Lib'
22

33
include ':android-jsc'
4-
include ':cppruntime'

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jsc-android",
3-
"version": "250230.2.1",
3+
"version": "294992.0.0",
44
"description": "Pre-build version of JavaScriptCore to be used by React Native apps",
55
"repository": {
66
"type": "git",
@@ -26,8 +26,8 @@
2626
"start": "./scripts/start.sh"
2727
},
2828
"config": {
29-
"webkitGTK": "2.26.1",
30-
"chromiumICUCommit": "64e5d7d43a1ff205e3787ab6150bbc1a1837332b"
29+
"webkitGTK": "2.36.3",
30+
"chromiumICUCommit": "85814e1af52482199a13d284545623ffbc9eef83"
3131
},
3232
"devDependencies": {
3333
"commander": "^4.0.1",

patches/jsc.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,16 @@
88

99
# Force staging of shared scripts, even if they aren't directly used to build JavaScriptCore.
1010

11+
--- target-org/webkit/Source/cmake/OptionsJSCOnly.cmake 2022-07-09 15:31:32.000000000 +0800
12+
+++ target/webkit/Source/cmake/OptionsJSCOnly.cmake 2022-07-10 12:40:43.000000000 +0800
13+
@@ -58,8 +58,8 @@
14+
# https://bugs.webkit.org/show_bug.cgi?id=172862
15+
if (NOT ENABLE_STATIC_JSC AND NOT WIN32)
16+
set(JavaScriptCore_LIBRARY_TYPE SHARED)
17+
- set(bmalloc_LIBRARY_TYPE OBJECT)
18+
- set(WTF_LIBRARY_TYPE OBJECT)
19+
+ set(bmalloc_LIBRARY_TYPE STATIC)
20+
+ set(WTF_LIBRARY_TYPE STATIC)
21+
endif ()
22+
23+
if (WIN32)

patches/jsc_features.patch

Lines changed: 24 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,34 @@
1-
diff -aur target-org/webkit/CMakeLists.txt target/webkit/CMakeLists.txt
2-
--- target-org/webkit/CMakeLists.txt 2017-12-22 19:18:43.000000000 +0200
3-
+++ target/webkit/CMakeLists.txt 2018-06-14 15:41:59.000000000 +0300
4-
@@ -177,13 +177,13 @@
1+
--- target-org/webkit/CMakeLists.txt 2021-03-06 03:12:45.000000000 +0800
2+
+++ target/webkit/CMakeLists.txt 2022-07-09 18:13:01.000000000 +0800
3+
@@ -38,9 +38,9 @@
54
add_subdirectory(Tools)
65
endif ()
7-
8-
-if ("${PORT}" STREQUAL "GTK" OR "${PORT}" STREQUAL "WPE")
9-
- if (DEVELOPER_MODE)
10-
- add_subdirectory(PerformanceTests)
11-
- endif ()
12-
-else ()
6+
7+
-if (DEVELOPER_MODE)
138
- add_subdirectory(PerformanceTests)
149
-endif ()
15-
+#if ("${PORT}" STREQUAL "GTK" OR "${PORT}" STREQUAL "WPE")
16-
+# if (DEVELOPER_MODE)
17-
+# add_subdirectory(PerformanceTests)
18-
+# endif ()
19-
+#else ()
20-
+# add_subdirectory(PerformanceTests)
21-
+#endif ()
22-
10+
+# if (DEVELOPER_MODE)
11+
+# add_subdirectory(PerformanceTests)
12+
+# endif ()
13+
2314
# -----------------------------------------------------------------------------
2415
# Print the features list last, for maximum visibility.
25-
diff -aur target-org/webkit/Source/cmake/OptionsJSCOnly.cmake target/webkit/Source/cmake/OptionsJSCOnly.cmake
26-
--- target-org/webkit/Source/cmake/OptionsJSCOnly.cmake 2019-03-26 11:25:17.000000000 +0800
27-
+++ target/webkit/Source/cmake/OptionsJSCOnly.cmake 2019-03-26 11:28:29.000000000 +0800
28-
@@ -35,12 +35,7 @@
29-
set(ENABLE_WEBCORE OFF)
30-
set(ENABLE_WEBKIT_LEGACY OFF)
31-
set(ENABLE_WEBKIT OFF)
32-
-
33-
-if (WIN32)
34-
- set(ENABLE_API_TESTS OFF)
35-
-else ()
16+
--- target-org/webkit/Source/cmake/OptionsJSCOnly.cmake 2022-07-09 15:31:32.000000000 +0800
17+
+++ target/webkit/Source/cmake/OptionsJSCOnly.cmake 2022-07-09 15:29:24.000000000 +0800
18+
@@ -47,7 +47,7 @@
19+
if (WIN32)
20+
set(ENABLE_API_TESTS OFF)
21+
else ()
3622
- set(ENABLE_API_TESTS ON)
37-
-endif ()
38-
+set(ENABLE_API_TESTS OFF)
39-
23+
+ set(ENABLE_API_TESTS OFF)
24+
endif ()
25+
4026
if (WTF_CPU_ARM OR WTF_CPU_MIPS)
41-
SET_AND_EXPOSE_TO_BUILD(USE_CAPSTONE TRUE)
42-
diff -aur target-org/webkit/Source/JavaScriptCore/CMakeLists.txt target/webkit/Source/JavaScriptCore/CMakeLists.txt
43-
--- target-org/webkit/Source/JavaScriptCore/CMakeLists.txt 2017-05-02 21:13:03.000000000 +0200
44-
+++ target/webkit/Source/JavaScriptCore/CMakeLists.txt 2017-07-11 11:34:55.962374878 +0200
45-
@@ -1291,7 +1291,7 @@
46-
)
47-
target_include_directories(LLIntOffsetsExtractor SYSTEM PRIVATE ${JavaScriptCore_SYSTEM_INCLUDE_DIRECTORIES})
48-
27+
--- target-org/webkit/Source/JavaScriptCore/CMakeLists.txt 2022-07-09 15:31:21.000000000 +0800
28+
+++ target/webkit/Source/JavaScriptCore/CMakeLists.txt 2022-07-09 15:31:50.000000000 +0800
29+
@@ -1564,4 +1565,4 @@
30+
VERBATIM)
31+
endif ()
32+
4933
-add_subdirectory(shell)
5034
+# add_subdirectory(shell)
51-
52-
WEBKIT_COMPUTE_SOURCES(JavaScriptCore)
53-
WEBKIT_WRAP_SOURCELIST(${JavaScriptCore_SOURCES})
54-

patches/jsc_fix_build_error_getline.patch

Lines changed: 0 additions & 20 deletions
This file was deleted.

patches/jsc_fix_build_error_log2.patch

Lines changed: 0 additions & 21 deletions
This file was deleted.

patches/jsc_fix_build_error_memalign.patch

Lines changed: 0 additions & 40 deletions
This file was deleted.

patches/jsc_fix_build_error_mulodi4.patch

Lines changed: 0 additions & 29 deletions
This file was deleted.

patches/jsc_fix_build_error_statvfs.patch

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)