File: components.py

package info (click to toggle)
openmsx 20.0%2Bdfsg-1.2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 27,544 kB
  • sloc: cpp: 236,922; xml: 49,948; tcl: 15,056; python: 5,385; perl: 281; sh: 77; makefile: 53
file content (62 lines) | stat: -rw-r--r-- 1,498 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Defines the building blocks of openMSX and their dependencies.

class Component(object):
	niceName = None
	makeName = None
	dependsOn = None

	@classmethod
	def canBuild(cls, probeVars):
		return all(
			probeVars.get('HAVE_%s_H' % makeName) and
			probeVars.get('HAVE_%s_LIB' % makeName)
			for makeName in cls.dependsOn
			)

class EmulationCore(Component):
	niceName = 'Emulation core'
	makeName = 'CORE'
	dependsOn = ('SDL2', 'SDL2_TTF', 'FREETYPE', 'PNG', 'TCL', 'ZLIB')

class GLRenderer(Component):
	niceName = 'GL renderer'
	makeName = 'GL'
	dependsOn = ('GL', 'GLEW')

class Laserdisc(Component):
	niceName = 'Laserdisc'
	makeName = 'LASERDISC'
	dependsOn = ('OGG', 'VORBIS', 'THEORA')

class ALSAMIDI(Component):
	niceName = 'ALSA MIDI'
	makeName = 'ALSAMIDI'
	dependsOn = ('ALSA', )

def iterComponents():
	'''Iterates through all components of openMSX.
	'''
	yield EmulationCore
	yield GLRenderer
	yield Laserdisc
	yield ALSAMIDI

def iterBuildableComponents(probeVars):
	'''Iterates through those components of openMSX that can be built
	on the probed system.
	'''
	for component in iterComponents():
		if component.canBuild(probeVars):
			yield component

def requiredLibrariesFor(components):
	'''Compute the library packages required to build the given components.
	Only the direct dependencies from openMSX are included, not dependencies
	between libraries.
	Returns a set of Make names.
	'''
	return set(
		makeName
		for comp in components
		for makeName in comp.dependsOn
		)