| OLD | NEW |
| 1 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 1 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Harness for defining library dependencies for scons files.""" | 5 """Harness for defining library dependencies for scons files.""" |
| 6 | 6 |
| 7 | 7 |
| 8 # The following is a map from a library, to the corresponding | 8 # The following is a map from a library, to the corresponding |
| 9 # list of dependent libraries that must be included after that library, in | 9 # list of dependent libraries that must be included after that library, in |
| 10 # the list of libraries. | 10 # the list of libraries. |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 ], | 179 ], |
| 180 'validators': [ | 180 'validators': [ |
| 181 'ncvalidate_arm_v2', | 181 'ncvalidate_arm_v2', |
| 182 ], | 182 ], |
| 183 }, | 183 }, |
| 184 'arm-thumb2': { | 184 'arm-thumb2': { |
| 185 'ncvalidate_arm_v2': [ | 185 'ncvalidate_arm_v2': [ |
| 186 'arm_validator_core', | 186 'arm_validator_core', |
| 187 ], | 187 ], |
| 188 }, | 188 }, |
| 189 'mips32': { |
| 190 'ncvalidate_mips': [ |
| 191 'mips_validator_core', |
| 192 ], |
| 193 'validators': [ |
| 194 'ncvalidate_mips', |
| 195 ], |
| 196 }, |
| 189 } | 197 } |
| 190 | 198 |
| 191 | 199 |
| 192 def AddLibDeps(env, platform, libraries): | 200 def AddLibDeps(env, platform, libraries): |
| 193 """ Adds dependent libraries to list of libraries. | 201 """ Adds dependent libraries to list of libraries. |
| 194 | 202 |
| 195 Computes the transitive closure of library dependencies for each library | 203 Computes the transitive closure of library dependencies for each library |
| 196 in the given list. Dependent libraries are added after libraries | 204 in the given list. Dependent libraries are added after libraries |
| 197 as defined in LIBRARY_DEPENDENCIES, unless there is a cycle. If | 205 as defined in LIBRARY_DEPENDENCIES, unless there is a cycle. If |
| 198 a cycle occurs, it is broken and the remaining (acyclic) graph | 206 a cycle occurs, it is broken and the remaining (acyclic) graph |
| (...skipping 11 matching lines...) Expand all Loading... |
| 210 def VisitList(libraries): | 218 def VisitList(libraries): |
| 211 for library in reversed(libraries): | 219 for library in reversed(libraries): |
| 212 if library not in visited: | 220 if library not in visited: |
| 213 VisitLibrary(library) | 221 VisitLibrary(library) |
| 214 | 222 |
| 215 def GetLibraryDeps(library): | 223 def GetLibraryDeps(library): |
| 216 ret = (LIBRARY_DEPENDENCIES_DEFAULT.get(library, []) + | 224 ret = (LIBRARY_DEPENDENCIES_DEFAULT.get(library, []) + |
| 217 PLATFORM_LIBRARY_DEPENDENCIES.get(platform, {}).get(library, [])) | 225 PLATFORM_LIBRARY_DEPENDENCIES.get(platform, {}).get(library, [])) |
| 218 if env['NACL_BUILD_FAMILY'] != 'TRUSTED': | 226 if env['NACL_BUILD_FAMILY'] != 'TRUSTED': |
| 219 ret.extend(UNTRUSTED_LIBRARY_DEPENDENCIES.get(library, [])) | 227 ret.extend(UNTRUSTED_LIBRARY_DEPENDENCIES.get(library, [])) |
| 220 if library == 'validators' and not env.Bit('target_arm'): | 228 if library == 'validators' and env.Bit('target_x86'): |
| 221 if env.Bit('validator_ragel'): | 229 if env.Bit('validator_ragel'): |
| 222 ret.append(env.NaClTargetArchSuffix('dfa_validate_caller')) | 230 ret.append(env.NaClTargetArchSuffix('dfa_validate_caller')) |
| 223 else: | 231 else: |
| 224 ret.append(env.NaClTargetArchSuffix('ncvalidate')) | 232 ret.append(env.NaClTargetArchSuffix('ncvalidate')) |
| 225 return ret | 233 return ret |
| 226 | 234 |
| 227 def VisitLibrary(library): | 235 def VisitLibrary(library): |
| 228 visited.add(library) | 236 visited.add(library) |
| 229 VisitList(GetLibraryDeps(library)) | 237 VisitList(GetLibraryDeps(library)) |
| 230 closure.append(library) | 238 closure.append(library) |
| 231 | 239 |
| 232 # Ideally we would just do "VisitList(libraries)" here, but some | 240 # Ideally we would just do "VisitList(libraries)" here, but some |
| 233 # PPAPI tests (specifically, tests/ppapi_gles_book) list "ppapi_cpp" | 241 # PPAPI tests (specifically, tests/ppapi_gles_book) list "ppapi_cpp" |
| 234 # twice in the link line, and we need to maintain these duplicates. | 242 # twice in the link line, and we need to maintain these duplicates. |
| 235 for library in reversed(libraries): | 243 for library in reversed(libraries): |
| 236 VisitLibrary(library) | 244 VisitLibrary(library) |
| 237 | 245 |
| 238 closure.reverse() | 246 closure.reverse() |
| 239 return closure | 247 return closure |
| OLD | NEW |