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
|
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Wed, 29 Mar 2017 22:02:00 +0200
Subject: [PATCH] Add system-level config /etc/emscripten.cfg
If ~/.emscripten does not exist and /etc/emscripten.cfg do exist, then
/etc/emscripten.cfg will be used.
--- a/emscripten.py
+++ b/emscripten.py
@@ -1791,7 +1791,7 @@
help='Where to write the output; defaults to stdout.')
parser.add_option('-c', '--compiler',
default=None,
- help='Which JS engine to use to run the compiler; defaults to the one in ~/.emscripten.')
+ help='Which JS engine to use to run the compiler; defaults to the one in ~/.emscripten or /etc/emscripten.cfg.')
parser.add_option('-s', '--setting',
dest='settings',
default=[],
--- a/tools/file_packager.py
+++ b/tools/file_packager.py
@@ -24,8 +24,8 @@
it knows that closure is not run.
--crunch=X Will compress dxt files to crn with quality level X. The crunch commandline tool must be present
- and CRUNCH should be defined in ~/.emscripten that points to it. JS crunch decompressing code will
- be added to convert the crn to dds in the browser.
+ and CRUNCH should be defined in ~/.emscripten or /etc/emscripten.cfg that points to it. JS crunch
+ decompressing code will be added to convert the crn to dds in the browser.
crunch-worker.js will be generated in the current directory. You should include that file when
packaging your site.
DDS files will not be crunched if the .crn is more recent than the .dds. This prevents a lot of
--- a/tools/scons/site_scons/site_tools/emscripten/emscripten.py
+++ b/tools/scons/site_scons/site_tools/emscripten/emscripten.py
@@ -10,6 +10,8 @@
EM_CONFIG = os.environ.get('EM_CONFIG')
if not EM_CONFIG:
EM_CONFIG = os.path.expanduser('~/.emscripten')
+ if not os.path.exists(EM_CONFIG) and os.path.exists('/etc/emscripten.cfg'):
+ EM_CONFIG = '/etc/emscripten.cfg'
if emscripten_path is None:
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -209,7 +209,10 @@
EM_CONFIG = EM_CONFIG.replace(';', '\n') + '\n'
if not EM_CONFIG:
- EM_CONFIG = '~/.emscripten'
+ if not os.path.exists(os.path.expanduser('~/.emscripten')) and os.path.exists('/etc/emscripten.cfg'):
+ EM_CONFIG = '/etc/emscripten.cfg'
+ else:
+ EM_CONFIG = '~/.emscripten'
if '\n' in EM_CONFIG:
CONFIG_FILE = None
logging.debug('EM_CONFIG is specified inline without a file')
@@ -271,7 +274,7 @@
# without a file, this hints to "default" location at ~/.emscripten)
def hint_config_file_location():
if CONFIG_FILE: return CONFIG_FILE
- else: return '~/.emscripten'
+ else: return '~/.emscripten' if os.path.exists(os.path.expanduser('~/.emscripten')) else '/etc/emscripten.cfg'
def listify(x):
if type(x) is not list: return [x]
@@ -515,6 +515,8 @@
sanity_file = CONFIG_FILE + '_sanity'
if get_llvm_target() == WASM_TARGET:
sanity_file += '_wasm'
+ if not os.access(os.path.dirname(sanity_file), os.W_OK):
+ sanity_file = os.path.join('/var/tmp', os.path.basename(sanity_file))
if os.path.exists(sanity_file):
try:
sanity_mtime = os.stat(sanity_file).st_mtime
@@ -580,7 +580,8 @@
if not force:
# Only create/update this file if the sanity check succeeded, i.e., we got here
- f = open(sanity_file, 'w')
+ f = open(sanity_file, 'w+')
f.write(generate_sanity())
+ os.chmod(sanity_file, 0o666)
f.close()
|