Upstream version 8.37.180.0
[platform/framework/web/crosswalk.git] / src / native_client / src / untrusted / irt / nacl.scons
1 # -*- python -*-
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6
7 Import('env')
8
9 # This module shouldn't be built in an environment that uses glibc.
10 if env.Bit('nacl_glibc'):
11   raise Exception('src/untrusted/irt/nacl.scons in the wrong environment?')
12
13 blob_env = env.Clone()
14 blob_env.Append(LINKFLAGS=['-Wl,-Trodata-segment=${IRT_BLOB_DATA_START}',
15                            '-Wl,-Ttext-segment=${IRT_BLOB_CODE_START}'])
16
17 irt_support_sources = [
18     'irt_entry.c',
19     'irt_entry_core.c',
20     'irt_malloc.c',
21     'irt_private_pthread.c',
22     'irt_private_tls.c',
23     ]
24
25 # NACL_GC_WRAP_SYSCALL uses ({...}) syntax.
26 blob_env.FilterOut(CCFLAGS=['-pedantic'])
27
28 irt_common_interfaces = [
29     'irt_basic.c',
30     'irt_fdio.c',
31     'irt_filename.c',
32     'irt_memory.c',
33     'irt_dyncode.c',
34     'irt_thread.c',
35     'irt_futex.c',
36     'irt_mutex.c',
37     'irt_cond.c',
38     'irt_sem.c',
39     'irt_tls.c',
40     'irt_blockhook.c',
41     'irt_clock.c',
42     'irt_dev_getpid.c',
43     'irt_exception_handling.c',
44     'irt_dev_list_mappings.c',
45     'irt_nameservice.c',
46     'irt_random.c',
47     ]
48
49 # These are the objects and libraries that go into every IRT image.
50 irt_support_objs = [blob_env.ComponentObject(x) for x in
51                     (irt_support_sources + irt_common_interfaces)]
52
53 # We also get nc_init_private.c, nc_thread.c and nc_tsd.c via
54 # #includes of .c files.
55 irt_support_objs += [
56     blob_env.ComponentObject(module,
57                              '${MAIN_DIR}/src/untrusted/pthread/%s.c' % module)
58     for module in ['nc_mutex',
59                    'nc_condvar']]
60
61 irt_support_objs += [
62     blob_env.ComponentObject('sys_private',
63                              '${MAIN_DIR}/src/untrusted/nacl/sys_private.c'),
64     blob_env.ComponentObject(
65         'dynamic_annotations.o',
66         '${MAIN_DIR}/src/untrusted/valgrind/dynamic_annotations.c'),
67     ]
68
69 # Build a library so that irt_support_objs can be used in tests that
70 # cover IRT-internal code.
71 env.ComponentLibrary('libirt_support_private', irt_support_objs)
72
73 irt_nonbrowser = ['irt_interfaces.c',
74                   'irt_core_resource.c',
75                   ]
76
77 irt_libs = ['srpc',
78             'imc_syscalls',
79             'platform',
80             'gio',
81             'm',
82             ]
83
84 irt_core_raw = blob_env.ComponentProgram(
85     'irt_core_raw', irt_support_objs + irt_nonbrowser, EXTRA_LIBS=irt_libs)
86
87 irt_core_nexe = blob_env.ApplyTLSEdit(
88     'irt_core.nexe',
89     irt_core_raw)
90
91 irt_core_library = blob_env.Install('${STAGING_DIR}', irt_core_nexe)
92 blob_env.Alias('irt_core', irt_core_library)
93 blob_env.ComponentProgramAlias(irt_core_library)
94
95 env.SDKInstallBin('irt_core.nexe', irt_core_library)