Skip to content

Commit 673c006

Browse files
committed
dynamically inject JSC_VERSION to cmake to avoid manually updating each version
1 parent 4f916db commit 673c006

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ This project is based on [facebook/android-jsc](https://github.com/facebook/andr
2424

2525
1. Clone this repo
2626
2. `npm run clean` will clean everything (artifacts, downloaded sources)
27+
3. Update the version in package.json. The version will be printed by JSC lib as soon as it loads.
2728
3. Update the config section under `package.json` to the desired build configuration
2829
4. Update patches if needed (don't forget to update the `printVersion` patch in jsc.patch)
2930
5. `npm run download`: downloads all needed sources

patches/jsc.patch

+4-3
Original file line numberDiff line numberDiff line change
@@ -279,16 +279,17 @@ diff -aur target-org/webkit/Source/JavaScriptCore/API/JSBase.cpp target/webkit/S
279279
+extern "C" int __android_log_print(int prio, const char *tag, const char *fmt, ...);
280280
+__attribute__((constructor))
281281
+void printVersion() {
282-
+ __android_log_print(3, "JavaScriptCore.Version", "%s", "225067.0.0");
282+
+ __android_log_print(3, "JavaScriptCore.Version", "%s", JSC_VERSION);
283283
+}
284284
diff -aur target-org/webkit/Source/JavaScriptCore/CMakeLists.txt target/webkit/Source/JavaScriptCore/CMakeLists.txt
285285
--- target-org/webkit/Source/JavaScriptCore/CMakeLists.txt 2017-10-16 15:19:26.000000000 +0300
286286
+++ target/webkit/Source/JavaScriptCore/CMakeLists.txt 2018-10-09 14:44:23.000000000 +0300
287-
@@ -1073,6 +1073,7 @@
287+
@@ -1073,6 +1073,8 @@
288288
WTF${DEBUG_SUFFIX}
289289
${ICU_I18N_LIBRARIES}
290290
${LLVM_LIBRARIES}
291291
+ log
292292
)
293-
293+
+add_definitions(-DJSC_VERSION="${JSC_VERSION}")
294+
294295
set(JavaScriptCore_SCRIPTS_SOURCES_DIR "${JAVASCRIPTCORE_DIR}/Scripts")

scripts/compile/jsc.sh

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ $TARGETDIR/webkit/Tools/Scripts/build-webkit \
6666
-DCMAKE_EXE_LINKER_FLAGS='${CMAKE_MODULE_LINKER_FLAGS} $CMAKE_LD_FLAGS' \
6767
-DENABLE_API_TESTS=0 \
6868
-DCMAKE_VERBOSE_MAKEFILE=on \
69+
-DJSC_VERSION=\"${JSC_VERSION}\" \
6970
"
7071

7172
cp $TARGETDIR/webkit/WebKitBuild/Release/lib/libjsc.so $INSTALL_DIR

scripts/start.sh

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export ANDROID_API=21
44
export ROOTDIR=$PWD
55
export TARGETDIR=$ROOTDIR/build/target
66
source $ROOTDIR/scripts/info.sh
7+
export JSC_VERSION=${npm_package_version}
78

89
patchAndMakeICU() {
910
printf "\n\n\t\t===================== patch and make icu into target/icu/host =====================\n\n"

0 commit comments

Comments
 (0)