FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
livecode/util/emscripten-javascriptify.py at develop · livecode/livecode · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
livecode
/
livecode
Public archive
Notifications
You must be signed in to change notification settings
Fork
223
Star
517
Code
Pull requests
189
Actions
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
livecode
/
util
/
emscripten-javascriptify.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
90 lines (71 loc) · 2.29 KB
Breadcrumbs
livecode
/
util
/
emscripten-javascriptify.py
Copy path
File metadata and controls
executable file
·
90 lines (71 loc) · 2.29 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env python
# This script runs the command that converts the LLVM bitcode files
# produced by the emscripten compiler to JavaScript.
import
sys
import
os
import
subprocess
# Compiler settings
# -----------------
#
# These should generally match the settings in config/emscripten-settings.gypi
settings
=
{
'ALLOW_MEMORY_GROWTH'
:
1
,
'ASSERTIONS'
:
1
,
'DEMANGLE_SUPPORT'
:
1
,
'EMTERPRETIFY'
:
1
,
'EMTERPRETIFY_ASYNC'
:
1
,
'LINKABLE'
:
1
,
'RESERVED_FUNCTION_POINTERS'
:
1024
,
'TOTAL_MEMORY'
:
67108864
,
'WARN_ON_UNDEFINED_SYMBOLS'
:
1
,
}
# Get the build type and the compiler command
# -------------------------------------------
env_verbose
=
os
.
getenv
(
'V'
,
'0'
)
env_emcc
=
os
.
getenv
(
'EMCC'
,
'emcc'
)
env_build_type
=
os
.
getenv
(
'BUILDTYPE'
,
'Debug'
)
env_cflags
=
os
.
getenv
(
'CFLAGS'
, [])
if
env_build_type
==
'Release'
:
optimisation_flags
=
[
'-Os'
,
'-g0'
]
else
:
optimisation_flags
=
[
'-O2'
,
'-g3'
]
# Separate out separate elements of command line
emcc
=
env_emcc
.
split
()
cflags
=
env_cflags
.
split
()
# Process command line options
# ----------------------------
#
# Each option absorbs all subsequent arguments up to the next option.
# Options are identified by the fact they start with "--".
option
=
None
options
=
{}
for
arg
in
sys
.
argv
[
1
:]:
if
arg
.
startswith
(
'--'
):
option
=
arg
[
2
:]
options
[
option
]
=
[]
else
:
if
option
is
None
:
print
(
'ERROR: unrecognized option
\'
{}
\'
'
.
format
(
arg
))
sys
.
exit
(
1
)
options
[
option
].
append
(
arg
)
# Special handling for "--whitelist"
if
options
.
has_key
(
'whitelist'
):
settings
[
'EMTERPRETIFY_WHITELIST'
]
=
'@{}'
.
format
(
options
[
'whitelist'
][
0
])
# Construct emcc command line
# ---------------------------
command
=
emcc
+
[
"--emrun"
]
+
optimisation_flags
+
cflags
for
input
in
options
[
'input'
]:
command
.
append
(
input
)
command
+=
[
'-o'
,
options
[
'output'
][
0
]]
for
setting
in
sorted
(
settings
.
keys
()):
command
+=
[
'-s'
,
'{}={}'
.
format
(
setting
,
settings
[
setting
])]
for
option
in
[
'pre-js'
,
'shell-file'
,
'js-library'
]:
if
options
.
has_key
(
option
):
for
value
in
options
[
option
]:
command
+=
[
'--'
+
option
,
value
]
# Run emcc
# --------
if
env_verbose
.
strip
()
is
not
'0'
:
print
(
" "
.
join
(
command
))
emcc_result
=
subprocess
.
call
(
command
)
sys
.
exit
(
emcc_result
)
Back
|
FazBrowse Home
|
New Git URL