OLD | NEW |
1 # -*- python -*- | 1 # -*- python -*- |
2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 Import('env') | 6 Import('env') |
7 | 7 |
8 env.ComponentLibrary('libppapi_stub', [ | 8 env.ComponentLibrary('libppapi_stub', [ |
9 'ppapi_plugin_main.c', | 9 'ppapi_plugin_main.c', |
10 'ppapi_plugin_start.c', | 10 'ppapi_plugin_start.c', |
11 'plugin_main_irt.c', | 11 'plugin_main_irt.c', |
12 'thread_creator.c' | 12 'thread_creator.c' |
13 ]) | 13 ]) |
14 env.AddLibraryToSdk(['libppapi_stub']) | 14 lib = env.AddLibraryToSdk(['libppapi_stub']) |
15 env.AddObjectToSdk(['libppapi.a']) | |
16 | |
17 if not env.Bit('nacl_disable_shared'): | |
18 env.AddObjectToSdk(['libppapi.so']) | |
19 | 15 |
20 gap_env = env.Clone() | 16 gap_env = env.Clone() |
21 gap_env.Append(CPPDEFINES=[ | 17 gap_env.Append(CPPDEFINES=[ |
22 ['IRT_DATA_REGION_START', '${IRT_DATA_REGION_START}'] | 18 ['IRT_DATA_REGION_START', '${IRT_DATA_REGION_START}'] |
23 ]) | 19 ]) |
24 if gap_env.Bit('bitcode'): | 20 if gap_env.Bit('bitcode'): |
25 # This is not actually a platform-specific, it's generic to any assembler | 21 # This is not actually a platform-specific, it's generic to any assembler |
26 # for an ELF target. But it can't be compiled to LLVM bitcode. | 22 # for an ELF target. But it can't be compiled to LLVM bitcode. |
27 gap_env.Replace(OBJSUFFIX='.o') | 23 gap_env.Replace(OBJSUFFIX='.o') |
28 gap_env.Append(ASFLAGS=['-arch', '${TARGET_FULLARCH}']) | 24 gap_env.Append(ASFLAGS=['-arch', '${TARGET_FULLARCH}']) |
29 | 25 |
30 link_segment_gap = gap_env.ComponentObject( | 26 link_segment_gap = gap_env.ComponentObject( |
31 'link_segment_gap', | 27 'link_segment_gap', |
32 '${SCONSTRUCT_DIR}/src/untrusted/irt/link_segment_gap.S' | 28 '${SCONSTRUCT_DIR}/src/untrusted/irt/link_segment_gap.S' |
33 ) | 29 ) |
34 gap_env.AddObjectToSdk(link_segment_gap, is_platform=True) | 30 gap_obj = gap_env.AddObjectToSdk(link_segment_gap, is_platform=True) |
| 31 |
| 32 static_script = env.AddObjectToSdk(['libppapi.a']) |
| 33 |
| 34 # Anything that links with -lppapi (i.e. ${PPAPI_LIBS}) needs not just the |
| 35 # libppapi.a or libppapi.so linker script file, but also the object and |
| 36 # library it refers to. By telling scons that libppapi.a depends on these |
| 37 # objects, we ensure that it builds them before something using ${PPAPI_LIBS}. |
| 38 script_deps = [gap_obj, lib] |
| 39 env.Depends(static_script, script_deps) |
| 40 |
| 41 # The static libppapi.a refers to libpthread.a, and in the non-glibc |
| 42 # build, we are the one providing that too. |
| 43 if not env.Bit('nacl_glibc'): |
| 44 env.Depends(static_script, env.File('${LIB_DIR}/libpthread.a')) |
| 45 |
| 46 if not env.Bit('nacl_disable_shared'): |
| 47 dyn_script = env.AddObjectToSdk(['libppapi.so']) |
| 48 env.Depends(dyn_script, script_deps) |
OLD | NEW |