Skip to content

Commit 7aa05c1

Browse files
committed
Initial commit.
0 parents  commit 7aa05c1

12 files changed

+343
-0
lines changed

.buckconfig

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
[buildfile]
2+
includes = //BUILD_DEFS
3+
[ndk]
4+
ndk_version = r10c
5+
cppflags = \
6+
-std=gnu11 \
7+
-Wall \
8+
-Werror \
9+
-g3 \
10+
-DNEBUG \
11+
-fstack-protector
12+
cflags = \
13+
-std=gnu11 \
14+
-Wall \
15+
-Werror \
16+
-g3 \
17+
-Wa,--noexecstack \
18+
-fstack-protector \
19+
-ffunction-sections \
20+
-funwind-tables \
21+
-fomit-frame-pointer \
22+
-fno-strict-aliasing
23+
cxxppflags = \
24+
-std=gnu++11 \
25+
-Wall \
26+
-Werror \
27+
-Wno-literal-suffix \
28+
-g3 \
29+
-DNEBUG \
30+
-fstack-protector \
31+
-fno-exceptions \
32+
-fno-rtti
33+
cxxflags = \
34+
-std=gnu++11 \
35+
-Wall \
36+
-Werror \
37+
-g3 \
38+
-Wa,--noexecstack \
39+
-fstack-protector \
40+
-ffunction-sections \
41+
-funwind-tables \
42+
-fomit-frame-pointer \
43+
-fno-strict-aliasing \
44+
-fno-exceptions \
45+
-fno-rtti
46+
ldflags = \
47+
-Wl,--build-id \
48+
-Wl,-z,noexecstack \
49+
-Wl,--gc-sections \
50+
-Wl,-z,defs \
51+
-Wl,-z,nocopyreloc \
52+
-Wl,--as-needed
53+
arm_cppflags = \
54+
-mthumb \
55+
-Os
56+
arm_cflags = \
57+
-mtune=xscale \
58+
-msoft-float \
59+
-mthumb \
60+
-Os
61+
arm_cxxppflags = \
62+
-mthumb \
63+
-Os
64+
arm_cxxflags = \
65+
-mtune=xscale \
66+
-msoft-float \
67+
-mthumb \
68+
-Os
69+
arm_ldflags = \
70+
-Wl,--fix-cortex-a8
71+
armv7_cppflags = \
72+
-mfloat-abi=softfp \
73+
-mthumb \
74+
-Os
75+
armv7_cflags = \
76+
-finline-limit=64 \
77+
-mfpu=vfpv3-d16 \
78+
-mfloat-abi=softfp \
79+
-mthumb \
80+
-Os
81+
armv7_cxxppflags = \
82+
-mfloat-abi=softfp \
83+
-mthumb \
84+
-Os
85+
armv7_cxxflags = \
86+
-finline-limit=64 \
87+
-mfpu=vfpv3-d16 \
88+
-mfloat-abi=softfp \
89+
-mthumb \
90+
-Os
91+
x86_cppflags = \
92+
-O2
93+
x86_cflags = \
94+
-funswitch-loops \
95+
-finline-limit=300 \
96+
-O2
97+
x86_cxxppflags = \
98+
-O2
99+
x86_cxxflags = \
100+
-funswitch-loops \
101+
-finline-limit=300 \
102+
-O2
103+
[cxx]
104+
preprocess_mode = piped
105+
cppflags = \
106+
-std=gnu11 \
107+
-pthread \
108+
-O0 \
109+
-g3
110+
cflags = \
111+
-std=gnu11 \
112+
-pthread \
113+
-O0 \
114+
-g3
115+
cxxppflags = \
116+
-std=gnu++11 \
117+
-pthread \
118+
-O0 \
119+
-g3
120+
cxxflags = \
121+
-std=gnu++11 \
122+
-pthread \
123+
-O0 \
124+
-g3

.buckversion

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
993d54556f28ea8890a1b2864b8e3c532646145c

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
buck-out/
2+
.buckd/
3+
icu
4+
!icu/BUCK
5+
jsc
6+
!jsc/BUCK
7+
!jsc/extra_headers
8+
*.gz
9+
*.bz2

AndroidManifest.xml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
package="org.webkit.android_jsc"
5+
android:versionCode="1"
6+
android:versionName="1.0">
7+
<application />
8+
</manifest>

BUCK

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright 2004-present Facebook. All Rights Reserved.
2+
3+
android_aar(
4+
name = 'android-jsc',
5+
manifest_skeleton = 'AndroidManifest.xml',
6+
deps = [
7+
'//jsc:jsc',
8+
],
9+
)

BUILD_DEFS

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# -*- mode: python -*-
2+
3+
import os
4+
5+
original_glob = glob
6+
def glob(*args, **kwargs):
7+
result = original_glob(*args, **kwargs)
8+
result.sort()
9+
return result
10+
11+
def subdir_glob(glob_specs):
12+
"""
13+
Given a list of tuples, the form of (relative-sub-directory, glob-pattern),
14+
return a dict of sub-directory relative paths to full paths. Useful for
15+
defining header maps for C/C++ libraries which should be relative the given
16+
sub-directory.
17+
"""
18+
19+
results = {}
20+
21+
for dirpath, glob_pattern in glob_specs:
22+
files = glob([os.path.join(dirpath, glob_pattern)])
23+
for f in files:
24+
if dirpath:
25+
results[f[len(dirpath) + 1:]] = f
26+
else:
27+
results[f] = f
28+
29+
return results
30+

LICENSE

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
BSD License
2+
3+
For JavaScriptCore build scripts for Android software
4+
5+
Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without modification,
8+
are permitted provided that the following conditions are met:
9+
10+
* Redistributions of source code must retain the above copyright notice, this
11+
list of conditions and the following disclaimer.
12+
13+
* Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
15+
and/or other materials provided with the distribution.
16+
17+
* Neither the name Facebook nor the names of its contributors may be used to
18+
endorse or promote products derived from this software without specific
19+
prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
25+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

PATENTS

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Additional Grant of Patent Rights Version 2
2+
3+
"Software" means the JavaScriptCore build scripts for Android software distributed by Facebook, Inc.
4+
5+
Facebook, Inc. ("Facebook") hereby grants to each recipient of the Software
6+
("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable
7+
(subject to the termination provision below) license under any Necessary
8+
Claims, to make, have made, use, sell, offer to sell, import, and otherwise
9+
transfer the Software. For avoidance of doubt, no license is granted under
10+
Facebook’s rights in any patent claims that are infringed by (i) modifications
11+
to the Software made by you or any third party or (ii) the Software in
12+
combination with any software or other technology.
13+
14+
The license granted hereunder will terminate, automatically and without notice,
15+
if you (or any of your subsidiaries, corporate affiliates or agents) initiate
16+
directly or indirectly, or take a direct financial interest in, any Patent
17+
Assertion: (i) against Facebook or any of its subsidiaries or corporate
18+
affiliates, (ii) against any party if such Patent Assertion arises in whole or
19+
in part from any software, technology, product or service of Facebook or any of
20+
its subsidiaries or corporate affiliates, or (iii) against any party relating
21+
to the Software. Notwithstanding the foregoing, if Facebook or any of its
22+
subsidiaries or corporate affiliates files a lawsuit alleging patent
23+
infringement against you in the first instance, and you respond by filing a
24+
patent infringement counterclaim in that lawsuit against that party that is
25+
unrelated to the Software, the license granted hereunder will not terminate
26+
under section (i) of this paragraph due to such counterclaim.
27+
28+
A "Necessary Claim" is a claim of a patent owned by Facebook that is
29+
necessarily infringed by the Software standing alone.
30+
31+
A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
32+
or contributory infringement or inducement to infringe any patent, including a
33+
cross-claim or counterclaim.

README.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# JSC build scripts for Android
2+
3+
This repository contains makefile and scripts for building JSC library for Android. Build scripts bundles JSC as a shared library into [android AAR](http://tools.android.com/tech-docs/new-build-system/aar-format) archive, which makes it easy to use it in Android projects build with [Buck](https://buckbuild.com) or [Gradle](https://gradle.org).
4+
5+
## Requirements
6+
* OS X or Linux - build process have not been tested on other platforms.
7+
* Android dev environment setup ([SDK](https://developer.android.com/sdk/installing/index.html?pkg=tools) + [NDK](https://developer.android.com/ndk/guides/setup.html))
8+
* [Buck](https://buckbuild.com) - configured to work with android (see [Quick Start](https://buckbuild.com/setup/quick_start.html) for instructions)
9+
* [Maven](https://maven.apache.org/download.cgi) (3.2+)
10+
* Used command line utilities: [ruby](https://www.ruby-lang.org/) (2.0+), zip, curl
11+
12+
## Build instructions
13+
14+
**1. Use the following script to pull in sources for [JSC](https://www.webkit.org) and [ICU](http://site.icu-project.org)**
15+
```bash
16+
./fetch_sources.sh
17+
```
18+
19+
**2. Build AAR with buck (this may take a while)**
20+
```bash
21+
buck build :android-jsc
22+
```
23+
As build step may take a while, consider using `--num-threads` or `--load-limit` options of `buck` command. This may slow the build process down, but should let you use your computer with less hiccups while the build command is running.
24+
25+
**3. Install android AAR in you local maven repository use:**
26+
```bash
27+
./install.sh
28+
```
29+
30+
## Use android-jsc AAR
31+
32+
After installation, android-jsc AAR file should be accessible through maven:
33+
34+
**1. Using BUCK**
35+
```python
36+
remote_file(
37+
name = 'android-jsc',
38+
url = 'mvn://org.webkit:android-jsc:r174650',
39+
sha1 = 'd4b32ee79922794b04bfbbcde0cf9572baaa1b84',
40+
)
41+
```
42+
43+
**2. Using gradle**
44+
```groovy
45+
compile 'org.webkit:android-jsc:r174650'
46+
```
47+
48+
Resulting AAR can be also located in your local maven repository (usually under `~/.m2/repository/org/webkit/android-jsc/`)

android-jsc.pom

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>org.webkit</groupId>
6+
<artifactId>android-jsc</artifactId>
7+
<version>r174650</version>
8+
<packaging>aar</packaging>
9+
10+
<name>android-jsc</name>
11+
<description>JavaScriptCore library for android</description>
12+
<url>https://www.webkit.org</url>
13+
14+
</project>

fetch_sources.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
# Copyright 2004-present Facebook. All Rights Reserved.
4+
5+
cd "$(dirname "$0")"
6+
7+
echo "Downloading ICU"
8+
curl -o icu4c.tar.gz https://android.googlesource.com/platform/external/icu/+archive/master/icu4c/source.tar.gz
9+
10+
echo "Extracting ICU"
11+
tar -zxf icu4c.tar.gz -C icu
12+
13+
echo "Downloading JSC"
14+
curl -O http://builds.nightly.webkit.org/files/trunk/src/WebKit-r174650.tar.bz2
15+
16+
echo "Extracting JSC"
17+
tar -jxf WebKit-r174650.tar.bz2 -C jsc --strip 2 WebKit-r174650/Source/JavaScriptCore WebKit-r174650/Source/WTF
18+

install.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Copyright 2004-present Facebook. All Rights Reserved.
4+
5+
cd "$(dirname "$0")"
6+
7+
AAR_PATH=buck-out/gen/android-jsc.aar
8+
9+
# Make sure that AAR is build, call buck
10+
echo "Building JSC & ICU for Android"
11+
buck build :android-jsc
12+
13+
# Remove gnustl_shared binaries from AAR. This is due to gradle inability to
14+
# handle native libraries with conflicting names coming from multiple
15+
# dependecies. See https://code.google.com/p/android/issues/detail?id=158630
16+
zip -d $AAR_PATH '**/libgnustl_shared.so'
17+
18+
echo "Installing JSC & ICU in local maven repo"
19+
mvn install:install-file -Dfile=$AAR_PATH -DpomFile=android-jsc.pom

0 commit comments

Comments
 (0)