aboutsummaryrefslogtreecommitdiff
path: root/emcc
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-04-03 13:09:48 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-04-03 13:09:48 -0700
commit3d4319101722c40d37d5b104777de3eb4d1a03e3 (patch)
tree7f3beb7f9955df0491f499bf1f0a97db33af3772 /emcc
parentfb83de1869826d475c8318524c3f768bcd43b7a2 (diff)
parent7bcb4e0be286440310f95fcfc2275ab59d5f9288 (diff)
Merge pull request #2232 from abergmeier/empkg_prerequisites
Empkg prerequisites
Diffstat (limited to 'emcc')
-rwxr-xr-xemcc25
1 files changed, 24 insertions, 1 deletions
diff --git a/emcc b/emcc
index fa51e57f..c8e1814b 100755
--- a/emcc
+++ b/emcc
@@ -522,6 +522,8 @@ Options that are modified or new in %s include:
will by default generate an output name 'dir/a.o',
but this cmdline param can be passed to generate a
file with a custom suffix 'dir/a.ext'.
+ --valid_abspath path Whitelist an absolute path to prevent warnings about
+ absolute include paths.
The target file, if specified (-o <target>), defines what will
be generated:
@@ -757,6 +759,15 @@ else:
def in_temp(name):
return os.path.join(temp_dir, os.path.basename(name))
+def in_directory(root, child):
+ # make both path absolute
+ root = os.path.realpath(root)
+ child = os.path.realpath(child)
+
+ # return true, if the common prefix of both is equal to directory
+ # e.g. /a/b/c/d.rst and directory is /a/b, the common prefix is /a/b
+ return os.path.commonprefix([root, child]) == root
+
# Parses the essential suffix of a filename, discarding Unix-style version numbers in the name. For example for 'libz.so.1.2.8' returns '.so'
def filename_type_suffix(filename):
for i in reversed(filename.split('.')[1:]):
@@ -811,6 +822,14 @@ try:
no_heap_copy = False
proxy_to_worker = False
default_object_extension = '.o'
+ valid_abspaths = []
+
+ def is_valid_abspath(path_name):
+ for valid_abspath in valid_abspaths:
+ if in_directory(valid_abspath, path_name):
+ return True
+ return False
+
if use_cxx:
default_cxx_std = '-std=c++03' # Enforce a consistent C++ standard when compiling .cpp files, if user does not specify one on the cmdline.
@@ -1014,9 +1033,13 @@ try:
elif newargs[i] == '--proxy-to-worker':
proxy_to_worker = True
newargs[i] = ''
+ elif newargs[i] == '--valid-abspath':
+ valid_abspaths.append(newargs[i+1])
+ newargs[i] = ''
+ newargs[i+1] = ''
elif newargs[i].startswith(('-I', '-L')):
path_name = newargs[i][2:]
- if not absolute_warning_shown and os.path.isabs(path_name):
+ if not absolute_warning_shown and os.path.isabs(path_name) and not is_valid_abspath(path_name):
logging.warning('-I or -L of an absolute path "' + newargs[i] + '" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript). Pass \'-Wno-warn-absolute-paths\' to emcc to hide this warning.') # Of course an absolute path to a non-system-specific library or header is fine, and you can ignore this warning. The danger are system headers that are e.g. x86 specific and nonportable. The emscripten bundled headers are modified to be portable, local system ones are generally not
absolute_warning_shown = True
elif newargs[i] == '--emrun':