Skip to content

Commit 9f8a2d7

Browse files
author
Alan Jeffrey
committed
Allow overriding of files within the Android NDK
1 parent 61a10fb commit 9f8a2d7

File tree

2 files changed

+113
-7
lines changed

2 files changed

+113
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
diff --git a/mozjs/build/moz.configure/android-ndk.configure b/mozjs/build/moz.configure/android-ndk.configure
2+
index 5193332f3..21f7e2767 100644
3+
--- a/mozjs/build/moz.configure/android-ndk.configure
4+
+++ b/mozjs/build/moz.configure/android-ndk.configure
5+
@@ -8,6 +8,15 @@
6+
js_option('--with-android-ndk', nargs=1,
7+
help='location where the Android NDK can be found')
8+
9+
+js_option('--with-android-ndk-version', nargs=1,
10+
+ help='android NDK version')
11+
+
12+
+js_option('--with-android-platform', nargs=1,
13+
+ help='location of the Android platform')
14+
+
15+
+js_option('--with-android-clang', nargs=1,
16+
+ help='location of the Android clang compiler')
17+
+
18+
js_option('--with-android-toolchain', nargs=1,
19+
help='location of the Android toolchain')
20+
21+
@@ -66,13 +75,17 @@ set_config('ANDROID_NDK', ndk)
22+
add_old_configure_assignment('android_ndk', ndk)
23+
24+
25+
-@depends(ndk)
26+
+@depends('--with-android-ndk-version', ndk)
27+
@checking('for android ndk version')
28+
@imports(_from='__builtin__', _import='open')
29+
-def ndk_version(ndk):
30+
+def ndk_version(value, ndk):
31+
if not ndk:
32+
# Building 'js/src' for non-Android.
33+
return
34+
+
35+
+ if value:
36+
+ return value[0]
37+
+
38+
with open(os.path.join(ndk, 'source.properties'), 'r') as f:
39+
for line in f:
40+
if not line.startswith('Pkg.Revision'):
41+
@@ -112,13 +125,16 @@ def ndk_minor_version(ndk_version):
42+
set_config('ANDROID_NDK_MINOR_VERSION', ndk_minor_version)
43+
44+
45+
-@depends(target, android_version, ndk, '--help')
46+
+@depends('--with-android-platform', target, android_version, ndk, '--help')
47+
@checking('for android platform directory')
48+
@imports(_from='os.path', _import='isdir')
49+
-def android_platform(target, android_version, ndk, _):
50+
+def android_platform(value, target, android_version, ndk, _):
51+
if target.os != 'Android':
52+
return
53+
54+
+ if value:
55+
+ return value[0]
56+
+
57+
if 'mips' in target.cpu:
58+
target_dir_name = 'mips'
59+
elif 'aarch64' == target.cpu:
60+
@@ -257,7 +273,7 @@ option(env='STLPORT_CPPFLAGS',
61+
@imports(_from='os.path', _import='isdir')
62+
def stlport_cppflags(value, ndk, _):
63+
if value and len(value):
64+
- return value.split()
65+
+ return value[0].split()
66+
if not ndk:
67+
return
68+
69+
@@ -339,13 +355,16 @@ def bindgen_cflags_defaults(toolchain_flags, toolchain, toolchain_prefix, _):
70+
os.path.join(gcc_include, 'include-fixed'))
71+
72+
73+
-@depends(host, ndk)
74+
+@depends('--with-android-clang', host, ndk)
75+
@imports(_from='os.path', _import='exists')
76+
@imports(_from='os.path', _import='isdir')
77+
-def android_clang_compiler(host, ndk):
78+
+def android_clang_compiler(value, host, ndk):
79+
if not ndk:
80+
return
81+
82+
+ if value:
83+
+ return value[0]
84+
+
85+
llvm_path = '%s/toolchains/llvm/prebuilt/%s-%s/bin' % (ndk,
86+
host.kernel.lower(),
87+
host.cpu)

mozjs/build/moz.configure/android-ndk.configure

+26-7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
js_option('--with-android-ndk', nargs=1,
99
help='location where the Android NDK can be found')
1010

11+
js_option('--with-android-ndk-version', nargs=1,
12+
help='android NDK version')
13+
14+
js_option('--with-android-platform', nargs=1,
15+
help='location of the Android platform')
16+
17+
js_option('--with-android-clang', nargs=1,
18+
help='location of the Android clang compiler')
19+
1120
js_option('--with-android-toolchain', nargs=1,
1221
help='location of the Android toolchain')
1322

@@ -66,13 +75,17 @@ set_config('ANDROID_NDK', ndk)
6675
add_old_configure_assignment('android_ndk', ndk)
6776

6877

69-
@depends(ndk)
78+
@depends('--with-android-ndk-version', ndk)
7079
@checking('for android ndk version')
7180
@imports(_from='__builtin__', _import='open')
72-
def ndk_version(ndk):
81+
def ndk_version(value, ndk):
7382
if not ndk:
7483
# Building 'js/src' for non-Android.
7584
return
85+
86+
if value:
87+
return value[0]
88+
7689
with open(os.path.join(ndk, 'source.properties'), 'r') as f:
7790
for line in f:
7891
if not line.startswith('Pkg.Revision'):
@@ -112,13 +125,16 @@ def ndk_minor_version(ndk_version):
112125
set_config('ANDROID_NDK_MINOR_VERSION', ndk_minor_version)
113126

114127

115-
@depends(target, android_version, ndk, '--help')
128+
@depends('--with-android-platform', target, android_version, ndk, '--help')
116129
@checking('for android platform directory')
117130
@imports(_from='os.path', _import='isdir')
118-
def android_platform(target, android_version, ndk, _):
131+
def android_platform(value, target, android_version, ndk, _):
119132
if target.os != 'Android':
120133
return
121134

135+
if value:
136+
return value[0]
137+
122138
if 'mips' in target.cpu:
123139
target_dir_name = 'mips'
124140
elif 'aarch64' == target.cpu:
@@ -257,7 +273,7 @@ option(env='STLPORT_CPPFLAGS',
257273
@imports(_from='os.path', _import='isdir')
258274
def stlport_cppflags(value, ndk, _):
259275
if value and len(value):
260-
return value.split()
276+
return value[0].split()
261277
if not ndk:
262278
return
263279

@@ -339,13 +355,16 @@ def bindgen_cflags_defaults(toolchain_flags, toolchain, toolchain_prefix, _):
339355
os.path.join(gcc_include, 'include-fixed'))
340356

341357

342-
@depends(host, ndk)
358+
@depends('--with-android-clang', host, ndk)
343359
@imports(_from='os.path', _import='exists')
344360
@imports(_from='os.path', _import='isdir')
345-
def android_clang_compiler(host, ndk):
361+
def android_clang_compiler(value, host, ndk):
346362
if not ndk:
347363
return
348364

365+
if value:
366+
return value[0]
367+
349368
llvm_path = '%s/toolchains/llvm/prebuilt/%s-%s/bin' % (ndk,
350369
host.kernel.lower(),
351370
host.cpu)

0 commit comments

Comments
 (0)