Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Add arm64 x86_64 support #30

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .buckconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[buildfile]
includes = //BUILD_DEFS
[ndk]
ndk_version = r10c
cpu_abis = armv7, arm64, x86, x86_64
gcc_version = 4.9
app_platform = android-21
cppflags = \
-std=gnu11 \
-Wall \
Expand Down Expand Up @@ -88,6 +90,18 @@
-mfloat-abi=softfp \
-mthumb \
-Os
x86_64_cppflags = \
-O2
x86_64_cflags = \
-funswitch-loops \
-finline-limit=300 \
-O2
x86_64_cxxppflags = \
-O2
x86_64_cxxflags = \
-funswitch-loops \
-finline-limit=300 \
-O2
x86_cppflags = \
-O2
x86_cflags = \
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.idea
*.iml
gen
buck-out/
.buckd/
icu
Expand Down
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
dist: trusty
sudo: required
env:
global:
- _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"

language: c

services:
- docker

script:
- travis_wait 60 docker run --rm --name hei -v $PWD:/pwd -w /pwd gengjiawen/android-jsc:feature_abi_support /bin/sh -c "./fetch_sources.sh && buck build :android-jsc"

28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM gengjiawen/android-ndk

# use old ndk
ENV ANDROID_NDK_HOME /opt/android-ndk
ENV ANDROID_NDK /opt/android-ndk
ENV NDK_HOME /opt/android-ndk
ENV ANDROID_NDK_VERSION r10e
RUN rm -rf ${ANDROID_HOME}/ndk-bundle

RUN mkdir /opt/android-ndk-tmp && \
cd /opt/android-ndk-tmp && \
wget -q https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip && \
unzip -q android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip && \
mv ./android-ndk-${ANDROID_NDK_VERSION} ${ANDROID_NDK_HOME} && \
cd ${ANDROID_NDK_HOME} && \
rm -rf /opt/android-ndk-tmp

ENV PATH ${ANDROID_NDK_HOME}:$PATH

RUN apt-get install git ant python-dev ruby zip subversion -y

#install buck and checkout jsc
RUN wget "https://github.com/facebook/buck/releases/download/v2018.03.26.01/buck_2018.03.26_all.deb" && \
dpkg -i buck_2018.03.26_all.deb && \
buck --version && \
svn export https://svn.webkit.org/repository/webkit/trunk/@174650


16 changes: 16 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
jobs:
build:
working_directory: ~/android-jsc
docker:
- image: gengjiawen/android-jsc:feature_abi_support
environment:
- ANDROID_NDK: '/opt/android-ndk'
- _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
steps:
- checkout
- run:
name: build aar
command: |
./fetch_sources.sh
buck build :android-jsc
8 changes: 3 additions & 5 deletions fetch_sources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ curl -o icu4c.tar.gz https://android.googlesource.com/platform/external/icu/+arc
echo "Extracting ICU"
tar -zxf icu4c.tar.gz -C icu

echo "Downloading JSC"
curl -O https://builds-nightly.webkit.org/files/trunk/src/WebKit-r174650.tar.bz2

echo "Extracting JSC"
tar -jxf WebKit-r174650.tar.bz2 -C jsc --strip 2 WebKit-r174650/Source/JavaScriptCore WebKit-r174650/Source/WTF
echo "set JSC"
cp -r /trunk/Source/JavaScriptCore jsc
cp -r /trunk/Source/WTF jsc

18 changes: 3 additions & 15 deletions jsc/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import os

SUPPORTED_PLATFORMS = '^android-(armv7|x86)$'
SUPPORTED_PLATFORMS = '^android-(armv7|arm64|x86|x86_64)$'

def unpack_rule(source, from_rule):
genrule(
Expand All @@ -26,19 +26,6 @@ WTF_EXPORTED_PREPROCESSOR_FLAGS = [
'-DENABLE_GLOBAL_FASTMALLOC_NEW=0',
]

# Dirty hack, StdLibExtras.h assumes incorrectly that is_trivially_destructible
# have been added in 4.8.1 version while it was added in 4.8.0. We emulate PATCH
# version to be 1 so that StdLibExtra.h doesn't try to declare
# is_trivially_destructible
# Except from this single place JSC code doesn't check for 4.8.1 anywhere else
WTF_EXPORTED_PREPROCESSOR_FLAGS.extend([
'-U__GNUC_PATCHLEVEL__',
'-D__GNUC_PATCHLEVEL__=1',
'-DPTHREAD_KEYS_MAX=1024',
'-DINTPTR_MAX=LONG_MAX',
'-Dlog2(x)=(log(x)/log(2.0))',
])

cxx_library(
name = 'wtfassertions',
force_static = True,
Expand Down Expand Up @@ -165,6 +152,7 @@ cxx_library(
supported_platforms_regex = SUPPORTED_PLATFORMS,
header_namespace = '',
headers = subdir_glob([
('WTF', '*.h'),
('WTF/wtf', '*.h'),
('', 'extra_headers/*.h'),
]),
Expand Down Expand Up @@ -936,7 +924,7 @@ SOURCES = glob([
'JavaScriptCore/*.asm',
])
SOURCES.append(':InitBytecodes.asm')
for platform in ('android-armv7', 'android-x86'):
for platform in ('android-armv7', 'android-arm64', 'android-x86', 'android-x86_64'):
source = 'LLIntAssembly.{0}.h'.format(platform)
genrule(
name = source,
Expand Down
4 changes: 4 additions & 0 deletions jsc/extra_headers/LLIntAssembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#include "LLIntAssembly.android-armv7.h"
#elif defined(__ANDROID__) && defined(__i386__)
#include "LLIntAssembly.android-x86.h"
#elif defined(__ANDROID__) && defined(__x86_64__)
#include "LLIntAssembly.android-x86_64.h"
#elif defined(__ANDROID__) && defined(__aarch64__)
#include "LLIntAssembly.android-arm64.h"
#else
#error "Platform not supported"
#endif