libraries.py 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. # Some notes about static linking:
  2. # There are two ways of linking to static library: using the -l command line
  3. # option or specifying the full path to the library file as one of the inputs.
  4. # When using the -l option, the library search paths will be searched for a
  5. # dynamic version of the library, if that is not found, the search paths will
  6. # be searched for a static version of the library. This means we cannot force
  7. # static linking of a library this way. It is possible to force static linking
  8. # of all libraries, but we want to control it per library.
  9. # Conclusion: We have to specify the full path to each library that should be
  10. # linked statically.
  11. from executils import captureStdout, shjoin
  12. from msysutils import msysActive, msysPathToNative
  13. from os import listdir
  14. from os.path import isdir, isfile
  15. from os import environ
  16. class Library(object):
  17. libName = None
  18. makeName = None
  19. header = None
  20. configScriptName = None
  21. dynamicLibsOption = '--libs'
  22. staticLibsOption = None
  23. function = None
  24. # TODO: A library can give an application compile time and run time
  25. # dependencies on other libraries. For example SDL_ttf depends on
  26. # FreeType only at run time, but depends on SDL both compile time
  27. # and run time, since SDL is part of its interface and FreeType is
  28. # only used by the implementation. As a result, it is possible to
  29. # compile against SDL_ttf without having the FreeType headers
  30. # installed. But our getCompileFlags() does not support this.
  31. # In pkg-config these are called private dependencies.
  32. dependsOn = ()
  33. @classmethod
  34. def isSystemLibrary(cls, platform): # pylint: disable-msg=W0613
  35. '''Returns True iff this library is a system library on the given
  36. platform.
  37. A system library is a library that is available systemwide in the
  38. minimal installation of the OS.
  39. The default implementation returns False.
  40. '''
  41. return False
  42. @classmethod
  43. def getConfigScript( # pylint: disable-msg=W0613
  44. cls, platform, linkStatic, distroRoot
  45. ):
  46. scriptName = cls.configScriptName
  47. if scriptName is None:
  48. return None
  49. elif platform == 'dingux' and cls.isSystemLibrary(platform):
  50. # TODO: A generic mechanism for locating config scripts in SDKs.
  51. # Note that distroRoot is for non-system libs only.
  52. # Trying a path relative to the compiler location would
  53. # probably work well.
  54. return '/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/bin/%s' % scriptName
  55. elif distroRoot is None:
  56. return scriptName
  57. else:
  58. return '%s/bin/%s' % (distroRoot, scriptName)
  59. @classmethod
  60. def getHeaders(cls, platform): # pylint: disable-msg=W0613
  61. header = cls.header
  62. return header if hasattr(header, '__iter__') else (header, )
  63. @classmethod
  64. def getLibName(cls, platform): # pylint: disable-msg=W0613
  65. return cls.libName
  66. @classmethod
  67. def getCompileFlags(cls, platform, linkStatic, distroRoot):
  68. configScript = cls.getConfigScript(platform, linkStatic, distroRoot)
  69. if configScript is not None:
  70. flags = [ '`%s --cflags`' % configScript ]
  71. elif distroRoot is None or cls.isSystemLibrary(platform):
  72. flags = []
  73. else:
  74. flags = [ '-I%s/include' % distroRoot ]
  75. dependentFlags = [
  76. librariesByName[name].getCompileFlags(
  77. platform, linkStatic, distroRoot
  78. )
  79. for name in cls.dependsOn
  80. ]
  81. return ' '.join(flags + dependentFlags)
  82. @classmethod
  83. def getLinkFlags(cls, platform, linkStatic, distroRoot):
  84. configScript = cls.getConfigScript(platform, linkStatic, distroRoot)
  85. if configScript is not None:
  86. libsOption = (
  87. cls.dynamicLibsOption
  88. if not linkStatic or cls.isSystemLibrary(platform)
  89. else cls.staticLibsOption
  90. )
  91. if libsOption is not None:
  92. return '`%s %s`' % (configScript, libsOption)
  93. if distroRoot is None or cls.isSystemLibrary(platform):
  94. return '-l%s' % cls.getLibName(platform)
  95. else:
  96. flags = [
  97. '%s/lib/lib%s.a' % (distroRoot, cls.getLibName(platform))
  98. ] if linkStatic else [
  99. '-L%s/lib -l%s' % (distroRoot, cls.getLibName(platform))
  100. ]
  101. dependentFlags = [
  102. librariesByName[name].getLinkFlags(
  103. platform, linkStatic, distroRoot
  104. )
  105. for name in cls.dependsOn
  106. ]
  107. return ' '.join(flags + dependentFlags)
  108. @classmethod
  109. def getVersion(cls, platform, linkStatic, distroRoot):
  110. '''Returns the version of this library, "unknown" if there is no
  111. mechanism to retrieve the version, None if there is a mechanism
  112. to retrieve the version but it failed, or a callable that takes a
  113. CompileCommand and a log stream as its arguments and returns the
  114. version or None if retrieval failed.
  115. '''
  116. configScript = cls.getConfigScript(platform, linkStatic, distroRoot)
  117. if configScript is None:
  118. return 'unknown'
  119. else:
  120. return '`%s --version`' % configScript
  121. class ALSA(Library):
  122. libName = 'asound'
  123. makeName = 'ALSA'
  124. header = '<alsa/asoundlib.h>'
  125. function = 'snd_seq_open'
  126. @classmethod
  127. def isSystemLibrary(cls, platform):
  128. return platform in ('dingux',)
  129. @classmethod
  130. def getLinkFlags(cls, platform, linkStatic, distroRoot):
  131. flags = super(ALSA, cls).getLinkFlags(platform, linkStatic, distroRoot)
  132. if linkStatic:
  133. flags += ' -lpthread'
  134. return flags
  135. @classmethod
  136. def getVersion(cls, platform, linkStatic, distroRoot):
  137. def execute(cmd, log):
  138. version = cmd.expand(log, cls.getHeaders(platform),
  139. 'SND_LIB_VERSION_STR'
  140. )
  141. return None if version is None else version.strip('"')
  142. return execute
  143. class FreeType(Library):
  144. libName = 'freetype'
  145. makeName = 'FREETYPE'
  146. header = ('<ft2build.h>', 'FT_FREETYPE_H')
  147. configScriptName = 'freetype-config'
  148. function = 'FT_Open_Face'
  149. @classmethod
  150. def isSystemLibrary(cls, platform):
  151. return platform in ('dingux',)
  152. @classmethod
  153. def getConfigScript(cls, platform, linkStatic, distroRoot):
  154. if platform in ('netbsd', 'openbsd'):
  155. if distroRoot == '/usr/local':
  156. # FreeType is located in the X11 tree, not the ports tree.
  157. distroRoot = '/usr/X11R6'
  158. script = super(FreeType, cls).getConfigScript(
  159. platform, linkStatic, distroRoot
  160. )
  161. if isfile(script):
  162. return script
  163. else:
  164. # FreeType 2.9.1 no longer installs the freetype-config script
  165. # by default and expects pkg-config to be used instead.
  166. return 'pkg-config freetype2'
  167. @classmethod
  168. def getVersion(cls, platform, linkStatic, distroRoot):
  169. configScript = cls.getConfigScript(platform, linkStatic, distroRoot)
  170. return '`%s --ftversion`' % configScript
  171. class GL(Library):
  172. libName = 'GL'
  173. makeName = 'GL'
  174. function = 'glGenTextures'
  175. @classmethod
  176. def isSystemLibrary(cls, platform):
  177. # On *BSD, OpenGL is in ports, not in the base system.
  178. return not platform.endswith('bsd')
  179. @classmethod
  180. def getHeaders(cls, platform):
  181. if platform == 'darwin':
  182. return ('<OpenGL/gl.h>', )
  183. else:
  184. return ('<GL/gl.h>', )
  185. @classmethod
  186. def getCompileFlags(cls, platform, linkStatic, distroRoot):
  187. if platform in ('netbsd', 'openbsd'):
  188. return '-I/usr/X11R6/include -I/usr/X11R7/include'
  189. else:
  190. return super(GL, cls).getCompileFlags(
  191. platform, linkStatic, distroRoot
  192. )
  193. @classmethod
  194. def getLinkFlags(cls, platform, linkStatic, distroRoot):
  195. if platform == 'darwin':
  196. return '-framework OpenGL'
  197. elif platform.startswith('mingw'):
  198. return '-lopengl32'
  199. elif platform in ('netbsd', 'openbsd'):
  200. return '-L/usr/X11R6/lib -L/usr/X11R7/lib -lGL'
  201. else:
  202. return super(GL, cls).getLinkFlags(platform, linkStatic, distroRoot)
  203. @classmethod
  204. def getVersion(cls, platform, linkStatic, distroRoot):
  205. def execute(cmd, log):
  206. versionPairs = tuple(
  207. ( major, minor )
  208. for major in range(1, 10)
  209. for minor in range(0, 10)
  210. )
  211. version = cmd.expand(log, cls.getHeaders(platform), *(
  212. 'GL_VERSION_%d_%d' % pair for pair in versionPairs
  213. ))
  214. try:
  215. return '%d.%d' % max(
  216. ver
  217. for ver, exp in zip(versionPairs, version)
  218. if exp is not None
  219. )
  220. except ValueError:
  221. return None
  222. return execute
  223. class GLEW(Library):
  224. makeName = 'GLEW'
  225. header = '<GL/glew.h>'
  226. function = 'glewInit'
  227. dependsOn = ('GL', )
  228. @classmethod
  229. def getLibName(cls, platform):
  230. if platform.startswith('mingw'):
  231. return 'glew32'
  232. else:
  233. return 'GLEW'
  234. @classmethod
  235. def getCompileFlags(cls, platform, linkStatic, distroRoot):
  236. flags = super(GLEW, cls).getCompileFlags(
  237. platform, linkStatic, distroRoot
  238. )
  239. if platform.startswith('mingw') and linkStatic:
  240. return '%s -DGLEW_STATIC' % flags
  241. else:
  242. return flags
  243. class LibPNG(Library):
  244. libName = 'png16'
  245. makeName = 'PNG'
  246. header = '<png.h>'
  247. configScriptName = 'libpng-config'
  248. dynamicLibsOption = '--ldflags'
  249. function = 'png_write_image'
  250. dependsOn = ('ZLIB', )
  251. @classmethod
  252. def isSystemLibrary(cls, platform):
  253. return platform in ('dingux',)
  254. class OGG(Library):
  255. libName = 'ogg'
  256. makeName = 'OGG'
  257. header = '<ogg/ogg.h>'
  258. function = 'ogg_stream_init'
  259. @classmethod
  260. def isSystemLibrary(cls, platform):
  261. return platform in ('dingux',)
  262. class SDL(Library):
  263. libName = 'SDL'
  264. makeName = 'SDL'
  265. header = '<SDL.h>'
  266. configScriptName = 'sdl-config'
  267. staticLibsOption = '--static-libs'
  268. function = 'SDL_Init'
  269. @classmethod
  270. def isSystemLibrary(cls, platform):
  271. return platform in ('android', 'dingux')
  272. class SDL2(Library):
  273. libName = 'SDL2'
  274. makeName = 'SDL2'
  275. header = '<SDL.h>'
  276. configScriptName = 'sdl2-config'
  277. staticLibsOption = '--static-libs'
  278. function = 'SDL_Init'
  279. @classmethod
  280. def isSystemLibrary(cls, platform):
  281. return platform in ('android', 'dingux')
  282. @classmethod
  283. def getLinkFlags(cls, platform, linkStatic, distroRoot):
  284. flags = super(SDL2, cls).getLinkFlags(
  285. platform, linkStatic, distroRoot
  286. )
  287. if platform == 'android':
  288. # On Android, we explicitly add the commander
  289. # genius lib folder for SDL
  290. flags = '-L%s/project/obj/local/%s %s' % (
  291. environ['SDL_ANDROID_PORT_PATH'],
  292. environ['TARGET_ABI'],
  293. flags
  294. )
  295. return flags
  296. class SDL_ttf(Library):
  297. libName = 'SDL_ttf'
  298. makeName = 'SDL_TTF'
  299. header = '<SDL_ttf.h>'
  300. function = 'TTF_OpenFont'
  301. dependsOn = ('SDL', 'FREETYPE')
  302. @classmethod
  303. def isSystemLibrary(cls, platform):
  304. return platform in ('dingux',)
  305. @classmethod
  306. def getLinkFlags(cls, platform, linkStatic, distroRoot):
  307. flags = super(SDL_ttf, cls).getLinkFlags(
  308. platform, linkStatic, distroRoot
  309. )
  310. if not linkStatic:
  311. # Because of the SDLmain trickery, we need SDL's link flags too
  312. # on some platforms even though we're linking dynamically.
  313. flags += ' ' + SDL.getLinkFlags(platform, linkStatic, distroRoot)
  314. return flags
  315. @classmethod
  316. def getCompileFlags(cls, platform, linkStatic, distroRoot):
  317. flags = super(SDL_ttf, cls).getCompileFlags(
  318. platform, linkStatic, distroRoot
  319. )
  320. if platform == 'android':
  321. # On Android, we don't share an install location with SDL,
  322. # so SDL's compile flags are insufficient.
  323. flags += ' -I%s/include/SDL' % distroRoot
  324. return flags
  325. @classmethod
  326. def getVersion(cls, platform, linkStatic, distroRoot):
  327. def execute(cmd, log):
  328. version = cmd.expand(log, cls.getHeaders(platform),
  329. 'SDL_TTF_MAJOR_VERSION',
  330. 'SDL_TTF_MINOR_VERSION',
  331. 'SDL_TTF_PATCHLEVEL',
  332. )
  333. return None if None in version else '%s.%s.%s' % version
  334. return execute
  335. class SDL2_ttf(Library):
  336. libName = 'SDL2_ttf'
  337. makeName = 'SDL2_TTF'
  338. header = '<SDL_ttf.h>'
  339. function = 'TTF_OpenFont'
  340. dependsOn = ('SDL2', 'FREETYPE')
  341. @classmethod
  342. def isSystemLibrary(cls, platform):
  343. return platform in ('android', 'dingux')
  344. @classmethod
  345. def getLinkFlags(cls, platform, linkStatic, distroRoot):
  346. flags = super(SDL2_ttf, cls).getLinkFlags(
  347. platform, linkStatic, distroRoot
  348. )
  349. if not linkStatic:
  350. # Because of the SDLmain trickery, we need SDL's link flags too
  351. # on some platforms even though we're linking dynamically.
  352. flags += ' ' + SDL2.getLinkFlags(platform, linkStatic, distroRoot)
  353. return flags
  354. @classmethod
  355. def getVersion(cls, platform, linkStatic, distroRoot):
  356. def execute(cmd, log):
  357. version = cmd.expand(log, cls.getHeaders(platform),
  358. 'SDL_TTF_MAJOR_VERSION',
  359. 'SDL_TTF_MINOR_VERSION',
  360. 'SDL_TTF_PATCHLEVEL',
  361. )
  362. return None if None in version else '%s.%s.%s' % version
  363. return execute
  364. class TCL(Library):
  365. libName = 'tcl'
  366. makeName = 'TCL'
  367. header = '<tcl.h>'
  368. function = 'Tcl_CreateInterp'
  369. @classmethod
  370. def getTclConfig(cls, platform, distroRoot):
  371. '''Tcl has a config script that is unlike the typical lib-config script.
  372. Information is gathered by sourcing the config script, instead of
  373. executing it and capturing the queried value from stdout. This script
  374. is located in a library directory, not in a directory in the PATH.
  375. Also, it does not have the executable bit set.
  376. This method returns the location of the Tcl config script, or None if
  377. it could not be found.
  378. '''
  379. if hasattr(cls, 'tclConfig'):
  380. # Return cached value.
  381. return cls.tclConfig
  382. def iterLocations():
  383. # Allow the user to specify the location we should search first,
  384. # by setting an environment variable.
  385. tclpath = environ.get('TCL_CONFIG')
  386. if tclpath is not None:
  387. yield tclpath
  388. if distroRoot is None or cls.isSystemLibrary(platform):
  389. if msysActive():
  390. roots = (msysPathToNative('/mingw32'), )
  391. else:
  392. roots = ('/usr/local', '/usr')
  393. else:
  394. roots = (distroRoot, )
  395. for root in roots:
  396. if isdir(root):
  397. for libdir in ('lib', 'lib64', 'lib/tcl'):
  398. libpath = root + '/' + libdir
  399. if isdir(libpath):
  400. yield libpath
  401. for entry in listdir(libpath):
  402. if entry.startswith('tcl8.'):
  403. tclpath = libpath + '/' + entry
  404. if isdir(tclpath):
  405. yield tclpath
  406. tclConfigs = {}
  407. log = open('derived/tcl-search.log', 'w')
  408. print >> log, 'Looking for Tcl...'
  409. try:
  410. for location in iterLocations():
  411. path = location + '/tclConfig.sh'
  412. if isfile(path):
  413. print >> log, 'Config script:', path
  414. text = captureStdout(
  415. log,
  416. "sh -c '. %s && echo %s'" % (
  417. path, '$TCL_MAJOR_VERSION $TCL_MINOR_VERSION'
  418. )
  419. )
  420. if text is not None:
  421. try:
  422. # pylint: disable-msg=E1103
  423. major, minor = text.split()
  424. version = int(major), int(minor)
  425. except ValueError:
  426. pass
  427. else:
  428. print >> log, 'Found: version %d.%d' % version
  429. tclConfigs[path] = version
  430. try:
  431. # Minimum required version is 8.5.
  432. # Pick the oldest possible version to minimize the risk of
  433. # running into incompatible changes.
  434. tclConfig = min(
  435. ( version, path )
  436. for path, version in tclConfigs.iteritems()
  437. if version >= (8, 5)
  438. )[1]
  439. except ValueError:
  440. tclConfig = None
  441. print >> log, 'No suitable versions found.'
  442. else:
  443. print >> log, 'Selected:', tclConfig
  444. finally:
  445. log.close()
  446. cls.tclConfig = tclConfig
  447. return tclConfig
  448. @classmethod
  449. def evalTclConfigExpr(cls, platform, distroRoot, expr, description):
  450. tclConfig = cls.getTclConfig(platform, distroRoot)
  451. if tclConfig is None:
  452. return None
  453. log = open('derived/tcl-search.log', 'a')
  454. try:
  455. print >> log, 'Getting Tcl %s...' % description
  456. text = captureStdout(
  457. log,
  458. shjoin([
  459. 'sh', '-c',
  460. '. %s && eval "echo \\"%s\\""' % (tclConfig, expr)
  461. ])
  462. )
  463. if text is not None:
  464. print >> log, 'Result: %s' % text.strip()
  465. finally:
  466. log.close()
  467. return None if text is None else text.strip()
  468. @classmethod
  469. def getCompileFlags(cls, platform, linkStatic, distroRoot):
  470. wantShared = not linkStatic or cls.isSystemLibrary(platform)
  471. # The -DSTATIC_BUILD is a hack to avoid including the complete
  472. # TCL_DEFS (see 9f1dbddda2) but still being able to link on
  473. # MinGW (tcl.h depends on this being defined properly).
  474. return cls.evalTclConfigExpr(
  475. platform,
  476. distroRoot,
  477. '${TCL_INCLUDE_SPEC}' + ('' if wantShared else ' -DSTATIC_BUILD'),
  478. 'compile flags'
  479. )
  480. @classmethod
  481. def getLinkFlags(cls, platform, linkStatic, distroRoot):
  482. # Tcl can be built as a shared or as a static library, but not both.
  483. # Check whether the library type of Tcl matches the one we want.
  484. wantShared = not linkStatic or cls.isSystemLibrary(platform)
  485. tclShared = cls.evalTclConfigExpr(
  486. platform,
  487. distroRoot,
  488. '${TCL_SHARED_BUILD}',
  489. 'library type (shared/static)'
  490. )
  491. log = open('derived/tcl-search.log', 'a')
  492. try:
  493. if tclShared == '0':
  494. if wantShared:
  495. print >> log, (
  496. 'Dynamic linking requested, but Tcl installation has '
  497. 'static library.'
  498. )
  499. return None
  500. elif tclShared == '1':
  501. if not wantShared:
  502. print >> log, (
  503. 'Static linking requested, but Tcl installation has '
  504. 'dynamic library.'
  505. )
  506. return None
  507. else:
  508. print >> log, (
  509. 'Unable to determine whether Tcl installation has '
  510. 'shared or static library.'
  511. )
  512. return None
  513. finally:
  514. log.close()
  515. # Now get the link flags.
  516. if wantShared:
  517. return cls.evalTclConfigExpr(
  518. platform,
  519. distroRoot,
  520. '${TCL_LIB_SPEC}',
  521. 'dynamic link flags'
  522. )
  523. else:
  524. return cls.evalTclConfigExpr(
  525. platform,
  526. distroRoot,
  527. '${TCL_EXEC_PREFIX}/lib/${TCL_LIB_FILE} ${TCL_LIBS}',
  528. 'static link flags'
  529. )
  530. @classmethod
  531. def getVersion(cls, platform, linkStatic, distroRoot):
  532. return cls.evalTclConfigExpr(
  533. platform,
  534. distroRoot,
  535. '${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_PATCH_LEVEL}',
  536. 'version'
  537. )
  538. class Theora(Library):
  539. libName = 'theoradec'
  540. makeName = 'THEORA'
  541. header = '<theora/theoradec.h>'
  542. function = 'th_decode_ycbcr_out'
  543. dependsOn = ('OGG', )
  544. @classmethod
  545. def isSystemLibrary(cls, platform):
  546. return platform in ('dingux',)
  547. class Vorbis(Library):
  548. libName = 'vorbis'
  549. makeName = 'VORBIS'
  550. header = '<vorbis/codec.h>'
  551. function = 'vorbis_synthesis_pcmout'
  552. dependsOn = ('OGG', )
  553. @classmethod
  554. def isSystemLibrary(cls, platform):
  555. return platform in ('dingux',)
  556. class ZLib(Library):
  557. libName = 'z'
  558. makeName = 'ZLIB'
  559. header = '<zlib.h>'
  560. function = 'inflate'
  561. @classmethod
  562. def isSystemLibrary(cls, platform):
  563. return platform in ('dingux',)
  564. @classmethod
  565. def getVersion(cls, platform, linkStatic, distroRoot):
  566. def execute(cmd, log):
  567. version = cmd.expand(log, cls.getHeaders(platform), 'ZLIB_VERSION')
  568. return None if version is None else version.strip('"')
  569. return execute
  570. # Build a dictionary of libraries using introspection.
  571. def _discoverLibraries(localObjects):
  572. for obj in localObjects:
  573. if isinstance(obj, type) and issubclass(obj, Library):
  574. if not (obj is Library):
  575. yield obj.makeName, obj
  576. librariesByName = dict(_discoverLibraries(locals().itervalues()))
  577. def allDependencies(makeNames):
  578. '''Compute the set of all directly and indirectly required libraries to
  579. build and use the given set of libraries.
  580. Returns the make names of the required libraries.
  581. '''
  582. # Compute the reflexive-transitive closure.
  583. transLibs = set()
  584. newLibs = set(makeNames)
  585. while newLibs:
  586. transLibs.update(newLibs)
  587. newLibs = set(
  588. depMakeName
  589. for makeName in newLibs
  590. for depMakeName in librariesByName[makeName].dependsOn
  591. if depMakeName not in transLibs
  592. )
  593. return transLibs