~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tools/scons/site_scons/site_tools/emscripten/emscripten.py

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python2
 
2
 
 
3
import os
 
4
 
 
5
def generate(env, emscripten_path=None, **kw):
 
6
        """ SCons tool entry point """
 
7
 
 
8
        if emscripten_path is None:
 
9
                # Try to find emscripten
 
10
                # Use same method as Emscripten's shared.py
 
11
                EM_CONFIG = os.environ.get('EM_CONFIG')
 
12
                if not EM_CONFIG:
 
13
                        EM_CONFIG = '~/.emscripten'
 
14
                
 
15
                CONFIG_FILE = os.path.expanduser(EM_CONFIG)
 
16
                try:
 
17
                        exec(open(CONFIG_FILE, 'r').read())
 
18
                except Exception, e:
 
19
                        print >> sys.stderr, 'Error in evaluating %s (at %s): %s' % (EM_CONFIG, CONFIG_FILE, str(e))
 
20
                        sys.exit(1)
 
21
                
 
22
                emscripten_path = EMSCRIPTEN_ROOT
 
23
 
 
24
        env['EMSCRIPTEN_ROOT'] = emscripten_path
 
25
        
 
26
        try:
 
27
                emscPath = emscripten_path.abspath
 
28
        except:
 
29
                emscPath = emscripten_path
 
30
        
 
31
        env.Replace(CC     = os.path.join(emscPath, "emcc"    ))
 
32
        env.Replace(CXX    = os.path.join(emscPath, "em++"    ))
 
33
        env.Replace(LINK   = os.path.join(emscPath, "emcc"    ))
 
34
        # SHLINK and LDMODULE should use LINK so no
 
35
        # need to change them here
 
36
    
 
37
        env.Replace(AR     = os.path.join(emscPath, "emar"    ))
 
38
        env.Replace(RANLIB = os.path.join(emscPath, "emranlib"))
 
39
 
 
40
        env.Replace(OBJSUFFIX  = [".js", ".bc", ".o"][2])
 
41
        env.Replace(LIBSUFFIX  = [".js", ".bc", ".o"][2])
 
42
        env.Replace(PROGSUFFIX = [".html", ".js"    ][1])
 
43
 
 
44
def exists(env):
 
45
        """ NOOP method required by SCons """
 
46
        return 1