Skip to content

Commit 7204378

Browse files
committed
update scripts, fixes #53
1 parent 8281332 commit 7204378

File tree

6 files changed

+67
-54
lines changed

6 files changed

+67
-54
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ This project is based on [facebook/android-jsc](https://github.com/facebook/andr
2424

2525
1. Clone this repo
2626
1. Update the config section under `package.json` to the desired build configuration
27-
2. `npm run download`: downloads all needed sources
28-
3. `npm run prep`: copies downloaded sources and prepares for compilation
29-
4. `npm run start`: builds jsc (this might take some time...)
27+
1. `npm run download`: downloads all needed sources
28+
1. `npm run start`: builds jsc (this might take some time...)
3029

3130
The zipfile containing the android-jsc AAR will be available at `/dist`.
3231
The library is packaged as a local Maven repository containing AAR files that include the binaries.

measure/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.0",
44
"private": true,
55
"scripts": {
6-
"android": "cd android && ./gradlew clean uninstallRelease installRelease",
6+
"android": "cd android && ./gradlew clean uninstallAll installRelease",
77
"androidi18n": "npm run android -- --project-prop i18n=true",
88
"start": "node ./scripts/measure",
99
"starti18n": "npm run start -- i18n",

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@
2323
"clean": "rm -rf dist; rm -rf build",
2424
"info": "./scripts/info.sh",
2525
"download": "./scripts/download.sh",
26-
"prep": "./scripts/prep.sh",
2726
"start": "./scripts/start.sh"
2827
},
2928
"config": {
3029
"webkitGTK": "2.18.2",
31-
"chromiumICUCommit": "b34251f8b762f8e2112a89c587855ca4297fed96",
32-
"i18n": false
30+
"chromiumICUCommit": "b34251f8b762f8e2112a89c587855ca4297fed96"
3331
}
3432
}

scripts/compile/all.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ SCRIPT_DIR=$(cd `dirname $0`; pwd)
44
export ANDROID_API=21
55

66
compile_arch() {
7-
printf "\n\n\n=================== compiling toolchain for $JSC_ARCH ===================\n\n\n"
7+
printf "\n\n\n\t\t=================== compiling toolchain for $JSC_ARCH $FLAVOR ===================\n\n\n"
88
$SCRIPT_DIR/toolchain.sh
9-
printf "\n\n\n=================== compiling icu for $JSC_ARCH ===================\n\n\n"
9+
printf "\n\n\n\t\t=================== compiling icu for $JSC_ARCH $FLAVOR ===================\n\n\n"
1010
$SCRIPT_DIR/icu.sh
11-
printf "\n\n\n=================== compiling jsc for $JSC_ARCH ===================n\n\n"
11+
printf "\n\n\n\t\t=================== compiling jsc for $JSC_ARCH $FLAVOR ===================n\n\n"
1212
$SCRIPT_DIR/jsc.sh
1313
}
1414

@@ -28,7 +28,7 @@ compile() {
2828
done
2929
}
3030

31-
if ${npm_package_config_i18n}
31+
if ${I18N}
3232
then
3333
export FLAVOR=intl
3434
export ENABLE_INTL=1

scripts/prep.sh

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

scripts/start.sh

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,68 @@
11
#!/bin/bash -e
22

33
ROOTDIR=$PWD
4+
TARGETDIR=$ROOTDIR/build/target
45
REVISION=$(svn info --show-item last-changed-revision "https://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-${npm_package_config_webkitGTK}")
6+
printf $REVISION
57

6-
# compile
7-
rm -rf $ROOTDIR/build/compiled
8-
$ROOTDIR/scripts/compile/all.sh
8+
prep() {
9+
printf "\t\t=============== copy downloaded sources ====================="
10+
rm -rf $TARGETDIR
11+
cp -Rf $ROOTDIR/build/download $TARGETDIR
912

10-
# create aar
11-
cd $ROOTDIR/lib
12-
./gradlew clean createAAR --project-prop revision="$REVISION" --project-prop i18n="$npm_package_config_i18n"
13-
cd $ROOTDIR
13+
printf "\t\t=============== patch and make icu into target/icu/host ====================="
14+
ICU_VERSION_MAJOR="$(awk '/ICU_VERSION_MAJOR_NUM/ {print $3}' $TARGETDIR/icu/source/common/unicode/uvernum.h)"
15+
printf "ICU version: ${ICU_VERSION_MAJOR}"
16+
patch -d $TARGETDIR -p1 < $ROOTDIR/patches/icu.patch
17+
18+
# use compiled .dat archive from Android Chromium
19+
cp $TARGETDIR/icu/android/icudtl.dat $TARGETDIR/icu/source/data/in/icudt${ICU_VERSION_MAJOR}l.dat
20+
rm $TARGETDIR/icu/source/data/translit/root_subset.txt $TARGETDIR/icu/source/data/translit/trnslocal.mk
21+
22+
rm -rf $TARGETDIR/icu/host
23+
mkdir -p $TARGETDIR/icu/host
24+
cd $TARGETDIR/icu/host
25+
$TARGETDIR/icu/source/runConfigureICU Linux --prefix=$PWD/prebuilts CFLAGS="-Os" CXXFLAGS="--std=c++11" --disable-tests --disable-samples
26+
make -j5
27+
cd $ROOTDIR
28+
29+
printf "\t\t=============== patch jsc ====================="
30+
patch -d $TARGETDIR -p1 < $ROOTDIR/patches/jsc.patch
31+
32+
# disable i18n for non-i18n build
33+
if ${I18N}
34+
then
35+
patch -d $TARGETDIR -N -p1 < $ROOTDIR/patches/intl/icu-disabled.patch
36+
fi
37+
38+
#remove icu headers from WTF, so it won't use them instead of the ones from icu/host/common
39+
rm -rf "$TARGETDIR"/webkit/Source/WTF/icu
40+
41+
printf "orig: $(find $ROOTDIR/build/target | grep \.orig || true)"
42+
}
43+
44+
compile() {
45+
printf "\t\t=============== compile jsc ====================="
46+
rm -rf $ROOTDIR/build/compiled
47+
$ROOTDIR/scripts/compile/all.sh
48+
}
49+
50+
createAAR() {
51+
printf "\t\t=============== create aar ====================="
52+
cd $ROOTDIR/lib
53+
./gradlew clean createAAR --project-prop revision="$REVISION" --project-prop i18n="${I18N}"
54+
cd $ROOTDIR
55+
}
56+
57+
export I18N=false
58+
prep
59+
compile
60+
createAAR
61+
62+
export I18N=true
63+
prep
64+
compile
65+
createAAR
1466

1567
npm run info
1668
echo "I am not slacking off, my code is compiling."

0 commit comments

Comments
 (0)