| 1 |
|
| 2 |
|
| 3 |
class Component(object): |
| 4 |
niceName = None |
| 5 |
makeName = None |
| 6 |
dependsOn = None |
| 7 |
|
| 8 |
@classmethod |
| 9 |
def canBuild(cls, probeVars): |
| 10 |
return all( |
| 11 |
probeVars.get('HAVE_%s_H' % makeName) and |
| 12 |
probeVars.get('HAVE_%s_LIB' % makeName) |
| 13 |
for makeName in cls.dependsOn |
| 14 |
) |
| 15 |
|
| 16 |
class EmulationCore(Component): |
| 17 |
niceName = 'Emulation core' |
| 18 |
makeName = 'CORE' |
| 19 |
dependsOn = ('SDL2', 'SDL2_TTF', 'FREETYPE', 'PNG', 'TCL', 'ZLIB') |
| 20 |
|
| 21 |
class GLRenderer(Component): |
| 22 |
niceName = 'GL renderer' |
| 23 |
makeName = 'GL' |
| 24 |
dependsOn = ('GL', 'GLEW') |
| 25 |
|
| 26 |
class Laserdisc(Component): |
| 27 |
niceName = 'Laserdisc' |
| 28 |
makeName = 'LASERDISC' |
| 29 |
dependsOn = ('OGG', 'VORBIS', 'THEORA') |
| 30 |
|
| 31 |
class ALSAMIDI(Component): |
| 32 |
niceName = 'ALSA MIDI' |
| 33 |
makeName = 'ALSAMIDI' |
| 34 |
dependsOn = ('ALSA', ) |
| 35 |
|
| 36 |
def iterComponents(): |
| 37 |
|
| 38 |
|
| 39 |
yield EmulationCore |
| 40 |
yield GLRenderer |
| 41 |
yield Laserdisc |
| 42 |
yield ALSAMIDI |
| 43 |
|
| 44 |
def iterBuildableComponents(probeVars): |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
for component in iterComponents(): |
| 49 |
if component.canBuild(probeVars): |
| 50 |
yield component |
| 51 |
|
| 52 |
def requiredLibrariesFor(components): |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
return set( |
| 59 |
makeName |
| 60 |
for comp in components |
| 61 |
for makeName in comp.dependsOn |
| 62 |
) |