2013-06-25 03:00:24 +04:00
|
|
|
#!/usr/bin/env python2
|
|
|
|
|
|
|
|
'''
|
|
|
|
Fast static linker for emscripten outputs. Specifically this links asm.js modules.
|
|
|
|
|
2013-07-04 04:43:39 +04:00
|
|
|
See https://github.com/kripken/emscripten/wiki/Linking
|
2013-06-25 03:00:24 +04:00
|
|
|
'''
|
|
|
|
|
2013-08-02 07:32:10 +04:00
|
|
|
import sys
|
2013-06-25 03:00:24 +04:00
|
|
|
from tools import shared
|
2013-08-02 04:29:06 +04:00
|
|
|
from tools.asm_module import AsmModule
|
2013-06-25 03:00:24 +04:00
|
|
|
|
2013-11-15 15:33:35 +04:00
|
|
|
def run():
|
|
|
|
try:
|
|
|
|
me, main, side, out = sys.argv[:4]
|
|
|
|
except:
|
|
|
|
print >> sys.stderr, 'usage: emlink.py [main module] [side module] [output name]'
|
|
|
|
sys.exit(1)
|
2013-06-25 03:00:24 +04:00
|
|
|
|
2013-11-15 15:33:35 +04:00
|
|
|
print 'Main module:', main
|
|
|
|
print 'Side module:', side
|
|
|
|
print 'Output:', out
|
2013-06-25 03:00:24 +04:00
|
|
|
|
2013-11-15 15:33:35 +04:00
|
|
|
shared.try_delete(out)
|
2013-06-29 21:28:15 +04:00
|
|
|
|
2013-11-15 15:33:35 +04:00
|
|
|
main = AsmModule(main)
|
|
|
|
side = AsmModule(side)
|
2013-06-25 03:36:05 +04:00
|
|
|
|
2013-11-15 15:33:35 +04:00
|
|
|
side.relocate_into(main)
|
|
|
|
main.write(out)
|
2013-06-25 03:36:05 +04:00
|
|
|
|
2013-11-15 15:33:35 +04:00
|
|
|
if __name__ == '__main__':
|
|
|
|
run()
|