Upstream version 7.36.149.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 # TODO(mseaborn): Enable -Wstrict-prototypes here.  Currently
10 # dlmalloc/malloc.c does not build with this warning.
11 env.FilterOut(CFLAGS=['-Wstrict-prototypes'])
12
13 # This module shouldn't be built in an environment that uses glibc.
14 if env.Bit('nacl_glibc'):
15   raise Exception('src/untrusted/irt/nacl.scons in the wrong environment?')
16
17 blob_env = env.Clone()
18 blob_env.Append(LINKFLAGS=['-Wl,-Trodata-segment=${IRT_BLOB_DATA_START}',
19                            '-Wl,-Ttext-segment=${IRT_BLOB_CODE_START}'])
20
21 irt_support_sources = [
22     'irt_entry.c',
23     'irt_entry_core.c',
24     'irt_malloc.c',
25     'irt_private_pthread.c',
26     'irt_private_tls.c',
27     ]
28
29 # NACL_GC_WRAP_SYSCALL uses ({...}) syntax.
30 blob_env.FilterOut(CCFLAGS=['-pedantic'])
31
32 irt_common_interfaces = [
33     'irt_basic.c',
34     'irt_fdio.c',
35     'irt_filename.c',
36     'irt_memory.c',
37     'irt_dyncode.c',
38     'irt_thread.c',
39     'irt_futex.c',
40     'irt_mutex.c',
41     'irt_cond.c',
42     'irt_sem.c',
43     'irt_tls.c',
44     'irt_blockhook.c',
45     'irt_clock.c',
46     'irt_dev_getpid.c',
47     'irt_exception_handling.c',
48     'irt_dev_list_mappings.c',
49     'irt_nameservice.c',
50     'irt_random.c',
51     ]
52
53 # These are the objects and libraries that go into every IRT image.
54 irt_support_objs = [blob_env.ComponentObject(x) for x in
55                     (irt_support_sources + irt_common_interfaces)]
56
57 # We also get nc_init_private.c, nc_thread.c and nc_tsd.c via
58 # #includes of .c files.
59 irt_support_objs += [
60     blob_env.ComponentObject(module,
61                              '${MAIN_DIR}/src/untrusted/pthread/%s.c' % module)
62     for module in ['nc_mutex',
63                    'nc_condvar']]
64
65 irt_support_objs += [
66     blob_env.ComponentObject('sys_private',
67                              '${MAIN_DIR}/src/untrusted/nacl/sys_private.c'),
68     blob_env.ComponentObject(
69         'dynamic_annotations.o',
70         '${MAIN_DIR}/src/untrusted/valgrind/dynamic_annotations.c'),
71     ]
72
73 # Build a library so that irt_support_objs can be used in tests that
74 # cover IRT-internal code.
75 env.ComponentLibrary('libirt_support_private', irt_support_objs)
76
77 irt_nonbrowser = ['irt_interfaces.c',
78                   'irt_core_resource.c',
79                   ]
80
81 irt_libs = ['srpc',
82             'imc_syscalls',
83             'platform',
84             'gio',
85             'm',
86             ]
87
88 irt_core_raw = blob_env.ComponentProgram(
89     'irt_core_raw', irt_support_objs + irt_nonbrowser, EXTRA_LIBS=irt_libs)
90
91 irt_core_nexe = blob_env.ApplyTLSEdit(
92     'irt_core.nexe',
93     irt_core_raw)
94
95 irt_core_library = blob_env.Install('${STAGING_DIR}', irt_core_nexe)
96 blob_env.Alias('irt_core', irt_core_library)
97 blob_env.ComponentProgramAlias(irt_core_library)
98
99 env.SDKInstallBin('irt_core.nexe', irt_core_library)