aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/file_packager.py11
-rw-r--r--tools/shared.py8
2 files changed, 18 insertions, 1 deletions
diff --git a/tools/file_packager.py b/tools/file_packager.py
index 575e5957..0fa6a529 100644
--- a/tools/file_packager.py
+++ b/tools/file_packager.py
@@ -198,6 +198,17 @@ for file_ in data_files:
os.path.walk(file_['srcpath'], add, [file_['mode'], file_['srcpath'], file_['dstpath']])
data_files = filter(lambda file_: not os.path.isdir(file_['srcpath']), data_files)
+# Absolutize paths, and check that they make sense
+curr_abspath = os.path.abspath(os.getcwd())
+for file_ in data_files:
+ path = file_['dstpath']
+ abspath = os.path.abspath(path)
+ print >> sys.stderr, path, abspath, curr_abspath
+ if not abspath.startswith(curr_abspath):
+ print >> sys.stderr, 'Error: Embedding "%s" which is below the current directory. This is invalid since the current directory becomes the root that the generated code will see' % path
+ sys.exit(1)
+ file_['dstpath'] = abspath[len(curr_abspath)+1:]
+
for file_ in data_files:
file_['dstpath'] = file_['dstpath'].replace(os.path.sep, '/') # name in the filesystem, native and emulated
if file_['dstpath'].endswith('/'): # If user has submitted a directory name as the destination but omitted the destination filename, use the filename from source file
diff --git a/tools/shared.py b/tools/shared.py
index 007c2ee8..ba926f72 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -509,6 +509,7 @@ COMPILER_OPTS = COMPILER_OPTS + ['-m32', '-U__i386__', '-U__i386', '-Ui386',
'-target', LLVM_TARGET]
if LLVM_TARGET == 'le32-unknown-nacl':
+ COMPILER_OPTS = filter(lambda opt: opt != '-m32', COMPILER_OPTS) # le32 target is 32-bit anyhow, no need for -m32
COMPILER_OPTS += ['-U__native_client__', '-U__pnacl__', '-U__ELF__'] # The nacl target is originally used for Google Native Client. Emscripten is not NaCl, so remove the platform #define, when using their triple.
USE_EMSDK = not os.environ.get('EMMAKEN_NO_SDK')
@@ -516,7 +517,7 @@ USE_EMSDK = not os.environ.get('EMMAKEN_NO_SDK')
if USE_EMSDK:
# Disable system C and C++ include directories, and add our own (using -idirafter so they are last, like system dirs, which
# allows projects to override them)
- EMSDK_OPTS = ['-nostdinc', '-nostdinc++', '-Xclang', '-nobuiltininc', '-Xclang', '-nostdsysteminc',
+ EMSDK_OPTS = ['-nostdinc', '-Xclang', '-nobuiltininc', '-Xclang', '-nostdsysteminc',
'-Xclang', '-isystem' + path_from_root('system', 'local', 'include'),
'-Xclang', '-isystem' + path_from_root('system', 'include', 'libcxx'),
'-Xclang', '-isystem' + path_from_root('system', 'include'),
@@ -529,9 +530,14 @@ if USE_EMSDK:
] + [
'-U__APPLE__', '-U__linux__'
]
+ if LLVM_TARGET != 'le32-unknown-nacl':
+ EMSDK_CXX_OPTS = ['-nostdinc++'] # le32 target does not need -nostdinc++
+ else:
+ EMSDK_CXX_OPTS = []
COMPILER_OPTS += EMSDK_OPTS
else:
EMSDK_OPTS = []
+ EMSDK_CXX_OPTS = []
#print >> sys.stderr, 'SDK opts', ' '.join(EMSDK_OPTS)
#print >> sys.stderr, 'Compiler opts', ' '.join(COMPILER_OPTS)