Upstream version 9.38.198.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_code_data_alloc.c',
31     'irt_fdio.c',
32     'irt_filename.c',
33     'irt_memory.c',
34     'irt_dyncode.c',
35     'irt_thread.c',
36     'irt_futex.c',
37     'irt_mutex.c',
38     'irt_cond.c',
39     'irt_sem.c',
40     'irt_tls.c',
41     'irt_blockhook.c',
42     'irt_clock.c',
43     'irt_dev_getpid.c',
44     'irt_exception_handling.c',
45     'irt_dev_list_mappings.c',
46     'irt_nameservice.c',
47     'irt_random.c',
48     ]
49
50 # These are the objects and libraries that go into every IRT image.
51 irt_support_objs = [blob_env.ComponentObject(x) for x in
52                     (irt_support_sources + irt_common_interfaces)]
53
54 # We also get nc_init_private.c, nc_thread.c and nc_tsd.c via
55 # #includes of .c files.
56 irt_support_objs += [
57     blob_env.ComponentObject(module,
58                              '${MAIN_DIR}/src/untrusted/pthread/%s.c' % module)
59     for module in ['nc_mutex',
60                    'nc_condvar']]
61
62 irt_support_objs += [
63     blob_env.ComponentObject('sys_private',
64                              '${MAIN_DIR}/src/untrusted/nacl/sys_private.c'),
65     blob_env.ComponentObject(
66         'dynamic_annotations.o',
67         '${MAIN_DIR}/src/untrusted/valgrind/dynamic_annotations.c'),
68     ]
69
70 # Build a library so that irt_support_objs can be used in tests that
71 # cover IRT-internal code.
72 env.ComponentLibrary('libirt_support_private', irt_support_objs)
73
74 irt_nonbrowser = ['irt_interfaces.c',
75                   'irt_query_list.c',
76                   'irt_core_resource.c',
77                   ]
78
79 irt_libs = ['srpc',
80             'imc_syscalls',
81             'platform',
82             'gio',
83             'm',
84             ]
85
86 irt_core_raw = blob_env.ComponentProgram(
87     'irt_core_raw', irt_support_objs + irt_nonbrowser, EXTRA_LIBS=irt_libs)
88
89 irt_core_nexe = blob_env.ApplyTLSEdit(
90     'irt_core.nexe',
91     irt_core_raw)
92
93 irt_core_library = blob_env.Install('${STAGING_DIR}', irt_core_nexe)
94 blob_env.Alias('irt_core', irt_core_library)
95 blob_env.ComponentProgramAlias(irt_core_library)
96
97 env.SDKInstallBin('irt_core.nexe', irt_core_library)