AV_WORKAROUND=0# Set to 1 to randomize file order and add some padding, to work around silly av false positives
# Set to 1 to randomize file order and add some padding,
# to work around silly av false positives
AV_WORKAROUND=0
data_files=[]
data_files=[]
excluded_patterns=[]
excluded_patterns=[]
...
@@ -112,16 +119,22 @@ plugins = []
...
@@ -112,16 +119,22 @@ plugins = []
jsoutput=None
jsoutput=None
from_emcc=False
from_emcc=False
force=True
force=True
# If set to True, IndexedDB (IDBFS in library_idbfs.js) is used to locally cache VFS XHR so that subsequent
# If set to True, IndexedDB (IDBFS in library_idbfs.js) is used to locally
# page loads can read the data from the offline cache instead.
# cache VFS XHR so that subsequent page loads can read the data from the
# offline cache instead.
use_preload_cache=False
use_preload_cache=False
indexeddb_name='EM_PRELOAD_CACHE'
indexeddb_name='EM_PRELOAD_CACHE'
# If set to True, the blob received from XHR is moved to the Emscripten HEAP, optimizing for mmap() performance.
# If set to True, the blob received from XHR is moved to the Emscripten HEAP,
# If set to False, the XHR blob is kept intact, and fread()s etc. are performed directly to that data. This optimizes for minimal memory usage and fread() performance.
# optimizing for mmap() performance.
# If set to False, the XHR blob is kept intact, and fread()s etc. are performed
# directly to that data. This optimizes for minimal memory usage and fread()
# performance.
no_heap_copy=True
no_heap_copy=True
# If set to True, the package metadata is stored separately from js-output file which makes js-output file immutable to the package content changes.
# If set to True, the package metadata is stored separately from js-output
# If set to False, the package metadata is stored inside the js-output file which makes js-output file to mutate on each invocation of this packager tool.
# file which makes js-output file immutable to the package content changes.
separate_metadata=False
# If set to False, the package metadata is stored inside the js-output file
# which makes js-output file to mutate on each invocation of this packager tool.
separate_metadata=False
lz4=False
lz4=False
use_preload_plugins=False
use_preload_plugins=False
...
@@ -170,16 +183,22 @@ for arg in sys.argv[2:]:
...
@@ -170,16 +183,22 @@ for arg in sys.argv[2:]:
leading=''
leading=''
elifleading=='preload'orleading=='embed':
elifleading=='preload'orleading=='embed':
mode=leading
mode=leading
at_position=arg.replace('@@','__').find('@')# position of @ if we're doing 'src@dst'. '__' is used to keep the index same with the original if they escaped with '@@'.
# position of @ if we're doing 'src@dst'. '__' is used to keep the index
uses_at_notation=(at_position!=-1)# '@@' in input string means there is an actual @ character, a single '@' means the 'src@dst' notation.
# same with the original if they escaped with '@@'.
at_position=arg.replace('@@','__').find('@')
# '@@' in input string means there is an actual @ character, a single '@'
# means the 'src@dst' notation.
uses_at_notation=(at_position!=-1)
ifuses_at_notation:
ifuses_at_notation:
srcpath=arg[0:at_position].replace('@@','@')# split around the @
srcpath=arg[0:at_position].replace('@@','@')# split around the @
dstpath=arg[at_position+1:].replace('@@','@')
dstpath=arg[at_position+1:].replace('@@','@')
else:
else:
srcpath=dstpath=arg.replace('@@','@')# Use source path as destination path.
# Absolutize paths, and check that they make sense
# Absolutize paths, and check that they make sense
curr_abspath=os.path.abspath(os.getcwd())# os.getcwd() always returns the hard path with any symbolic links resolved, even if we cd'd into a symbolic link.
# os.getcwd() always returns the hard path with any symbolic links resolved,
# even if we cd'd into a symbolic link.
curr_abspath=os.path.abspath(os.getcwd())
forfile_indata_files:
forfile_indata_files:
ifnotfile_['explicit_dst_path']:
ifnotfile_['explicit_dst_path']:
# This file was not defined with src@dst, so we inferred the destination from the source. In that case,
# This file was not defined with src@dst, so we inferred the destination
# we require that the destination not be under the current location
# from the source. In that case, we require that the destination not be
# under the current location
path=file_['dstpath']
path=file_['dstpath']
abspath=os.path.realpath(os.path.abspath(path))# Use os.path.realpath to resolve any symbolic links to hard paths, to match the structure in curr_abspath.
# Use os.path.realpath to resolve any symbolic links to hard paths,
print('Error: Embedding "%s" which is below the current directory "%s". This is invalid since the current directory becomes the root that the generated code will see'%(path,curr_abspath),file=sys.stderr)
print('Error: Embedding "%s" which is below the current directory '
'"%s". This is invalid since the current directory becomes the '
'root that the generated code will see'%(path,curr_abspath),
file=sys.stderr)
sys.exit(1)
sys.exit(1)
file_['dstpath']=abspath[len(curr_abspath)+1:]
file_['dstpath']=abspath[len(curr_abspath)+1:]
ifos.path.isabs(path):
ifos.path.isabs(path):
print('Warning: Embedding an absolute file/directory name "'+path+'" to the virtual filesystem. The file will be made available in the relative path "'+file_['dstpath']+'". You can use the explicit syntax --preload-file srcpath@dstpath to explicitly specify the target location the absolute source path should be directed to.',file=sys.stderr)
print('Warning: Embedding an absolute file/directory name "%s" to the '
'virtual filesystem. The file will be made available in the '
'relative path "%s". You can use the explicit syntax '
'--preload-file srcpath@dstpath to explicitly specify the target '
'location the absolute source path should be directed to.'
%(path,file_['dstpath']),file=sys.stderr)
forfile_indata_files:
forfile_indata_files:
file_['dstpath']=file_['dstpath'].replace(os.path.sep,'/')# name in the filesystem, native and emulated
# name in the filesystem, native and emulated
iffile_['dstpath'].endswith('/'):# If user has submitted a directory name as the destination but omitted the destination filename, use the filename from source file
print('warning: file packager is creating an asset bundle of %d MB. this is very large, and browsers might have trouble loading it. see https://hacks.mozilla.org/2015/02/synchronous-execution-and-filesystem-access-in-emscripten/'%(start/(1024*1024)),file=sys.stderr)
print('warning: file packager is creating an asset bundle of %d MB. '
'this is very large, and browsers might have trouble loading it. '
// copy the entire loaded file into a spot in the heap. Files will refer to slices in that. They cannot be freed though
// copy the entire loaded file into a spot in the heap. Files will refer to slices in that. They cannot be freed though
// (we may be allocating before malloc is ready, during startup).
// (we may be allocating before malloc is ready, during startup).
if (Module['SPLIT_MEMORY']) err('warning: you should run the file packager with --no-heap-copy when SPLIT_MEMORY is used, otherwise copying into the heap may fail due to the splitting');
'''%(use_data,shared.JS.escape_for_js_string(data_target))# use basename because from the browser's point of view, we need to find the datafile in the same dir as the html file
# Overwrite the old jsoutput file (if exists) only when its content differs from the current generated one, otherwise leave the file untouched preserving its old timestamp
# Overwrite the old jsoutput file (if exists) only when its content
# differs from the current generated one, otherwise leave the file