def iterComponentsHeader(probeMakePath): probeVars = extractMakeVariables(probeMakePath) buildComponents = set( component.makeName for component in iterComponents() if component.canBuild(probeVars) ) yield '// Automatically generated by build process.' yield '' yield '#ifndef COMPONENTS_HH' yield '#define COMPONENTS_HH' yield '' yield '#include <string>' yield '' for component in iterComponents(): varName = component.makeName yield '#define COMPONENT_%s %d' % (varName, varName in buildComponents) yield '' yield 'namespace openmsx {' yield '' yield 'static const std::string BUILD_COMPONENTS = "%s";' \ % ' '.join(sorted(buildComponents)) yield '' yield '} // namespace openmsx' yield '' yield '#endif // COMPONENTS_HH'
def iterComponentsHeader(probeMakePath): probeVars = extractMakeVariables(probeMakePath) buildComponents = set( component.makeName for component in iterComponents() if component.canBuild(probeVars) ) yield '// Automatically generated by build process.' yield '' yield '#ifndef COMPONENTS_HH' yield '#define COMPONENTS_HH' yield '' for component in iterComponents(): varName = component.makeName yield '#define COMPONENT_%s %d' % (varName, varName in buildComponents) yield '' yield 'namespace openmsx {' yield '' yield 'static const char* const BUILD_COMPONENTS = "%s";' \ % ' '.join(sorted(buildComponents)) yield '' yield '} // namespace openmsx' yield '' yield '#endif // COMPONENTS_HH'
def getConfiguration(name): if name == 'SYS_DYN': requiredComponents = set((EmulationCore, )) optionalComponents = set(iterComponents()) - requiredComponents linkStatic = False elif name == '3RD_STA': requiredComponents = set((EmulationCore, GLRenderer)) optionalComponents = set(iterComponents()) - requiredComponents linkStatic = True elif name == '3RD_STA_MIN': requiredComponents = set((EmulationCore, )) optionalComponents = set((AODriver, )) linkStatic = True else: raise ValueError('No configuration named "%s"' % name) return Configuration(requiredComponents, optionalComponents, linkStatic)
def iterComponentDefs(probeMakePath): probeVars = extractMakeVariables(probeMakePath) yield '# Automatically generated by build process.' yield 'CORE_LIBS:=%s' % ' '.join(EmulationCore.dependsOn) for component in iterComponents(): yield 'COMPONENT_%s:=%s' % (component.makeName, str(component.canBuild(probeVars)).lower())
def iterComponentDefs(probeMakePath): probeVars = extractMakeVariables(probeMakePath) yield '# Automatically generated by build process.' yield 'CORE_LIBS:=%s' % ' '.join(EmulationCore.dependsOn) for component in iterComponents(): yield 'COMPONENT_%s:=%s' % ( component.makeName, str(component.canBuild(probeVars)).lower() )
def getConfiguration(name): if name == 'SYS_DYN': requiredComponents = set((EmulationCore, )) optionalComponents = set(iterComponents()) - requiredComponents linkStatic = False elif name == '3RD_STA': requiredComponents = set((EmulationCore, GLRenderer)) optionalComponents = set(iterComponents()) - requiredComponents linkStatic = True elif name == '3RD_STA_GLES': # TODO: We don't have an OpenGL ES component yet. requiredComponents = set((EmulationCore, )) optionalComponents = \ set(iterComponents()) - requiredComponents - set((GLRenderer, )) linkStatic = True elif name == '3RD_STA_MIN': requiredComponents = set((EmulationCore, )) optionalComponents = set() linkStatic = True else: raise ValueError('No configuration named "%s"' % name) return Configuration(requiredComponents, optionalComponents, linkStatic)
def iterComponentDefs(probeMakePath): probeVars = extractMakeVariables(probeMakePath) yield '# Automatically generated by build process.' yield '' yield 'LIBRARY_COMPILE_FLAGS:=' yield 'LIBRARY_LINK_FLAGS:=' for libName in requiredLibrariesFor(iterBuildableComponents(probeVars)): yield '# %s' % libName yield 'LIBRARY_COMPILE_FLAGS+=' + probeVars.get( libName + '_CFLAGS', '') yield 'LIBRARY_LINK_FLAGS+=' + probeVars.get(libName + '_LDFLAGS', '') yield '' for component in iterComponents(): yield 'COMPONENT_%s:=%s' % (component.makeName, str(component.canBuild(probeVars)).lower())
def iterNiceNames(): for package in packages: yield package.niceName for component in iterComponents(): yield component.niceName
def iterProbeResults(probeVars, configuration, logPath): '''Present probe results, so user can decide whether to start the build, or to change system configuration and rerun "configure". ''' desiredComponents = set(configuration.iterDesiredComponents()) requiredComponents = set(configuration.iterRequiredComponents()) buildableComponents = set(configuration.iterBuildableComponents(probeVars)) packages = sorted( (getPackage(makeName) for makeName in requiredLibrariesFor(desiredComponents)), key=lambda package: package.niceName.lower()) customVars = extractMakeVariables('build/custom.mk') yield '' if not parseBool(probeVars['COMPILER']): yield 'No working C++ compiler was found.' yield "Please install a C++ compiler, such as GCC's g++." yield 'If you have a C++ compiler installed and openMSX did not ' \ 'detect it, please set the environment variable CXX to the name ' \ 'of your C++ compiler.' yield 'After you have corrected the situation, rerun "configure".' yield '' else: # Compute how wide the first column should be. def iterNiceNames(): for package in packages: yield package.niceName for component in iterComponents(): yield component.niceName maxLen = max(len(niceName) for niceName in iterNiceNames()) formatStr = ' %-' + str(maxLen + 3) + 's %s' yield 'Found libraries:' for package in packages: makeName = package.getMakeName() if probeVars['HAVE_%s_LIB' % makeName]: found = 'version %s' % probeVars['VERSION_%s' % makeName] elif probeVars['HAVE_%s_H' % makeName]: # Dependency resolution of a typical distro will not allow # this situation. Most likely we got the link flags wrong. found = 'headers found, link test failed' else: found = 'no' yield formatStr % (package.niceName + ':', found) yield '' yield 'Components overview:' for component in iterComponents(): if component in desiredComponents: status = 'yes' if component in buildableComponents else 'no' else: status = 'disabled' yield formatStr % (component.niceName + ':', status) yield '' yield 'Customisable options:' yield formatStr % ('Install to', customVars['INSTALL_BASE']) yield ' (you can edit these in build/custom.mk)' yield '' if buildableComponents == desiredComponents: yield 'All required and optional components can be built.' elif requiredComponents.issubset(buildableComponents): yield 'If you are satisfied with the probe results, ' \ 'run "make" to start the build.' yield 'Otherwise, install some libraries and headers ' \ 'and rerun "configure".' else: yield 'Please install missing libraries and headers ' \ 'and rerun "configure".' yield '' yield 'If the detected libraries differ from what you think ' \ 'is installed on this system, please check the log file: %s' \ % logPath yield ''
def iterProbeResults(probeVars, configuration, logPath): '''Present probe results, so user can decide whether to start the build, or to change system configuration and rerun "configure". ''' desiredComponents = set(configuration.iterDesiredComponents()) requiredComponents = set(configuration.iterRequiredComponents()) buildableComponents = set(configuration.iterBuildableComponents(probeVars)) packages = sorted( ( getPackage(makeName) for makeName in requiredLibrariesFor(desiredComponents) ), key = lambda package: package.niceName.lower() ) customVars = extractMakeVariables('build/custom.mk') yield '' if not parseBool(probeVars['COMPILER']): yield 'No working C++ compiler was found.' yield "Please install a C++ compiler, such as GCC's g++." yield 'If you have a C++ compiler installed and openMSX did not ' \ 'detect it, please set the environment variable CXX to the name ' \ 'of your C++ compiler.' yield 'After you have corrected the situation, rerun "configure".' yield '' else: # Compute how wide the first column should be. def iterNiceNames(): for package in packages: yield package.niceName for component in iterComponents(): yield component.niceName maxLen = max(len(niceName) for niceName in iterNiceNames()) formatStr = ' %-' + str(maxLen + 3) + 's %s' yield 'Found libraries:' for package in packages: makeName = package.getMakeName() if probeVars['HAVE_%s_LIB' % makeName]: found = 'version %s' % probeVars['VERSION_%s' % makeName] elif probeVars['HAVE_%s_H' % makeName]: # Dependency resolution of a typical distro will not allow # this situation. Most likely we got the link flags wrong. found = 'headers found, link test failed' else: found = 'no' yield formatStr % (package.niceName + ':', found) yield '' yield 'Components overview:' for component in iterComponents(): if component in desiredComponents: status = 'yes' if component in buildableComponents else 'no' else: status = 'disabled' yield formatStr % (component.niceName + ':', status) yield '' yield 'Customisable options:' yield formatStr % ('Install to', customVars['INSTALL_BASE']) yield ' (you can edit these in build/custom.mk)' yield '' if buildableComponents == desiredComponents: yield 'All required and optional components can be built.' elif requiredComponents.issubset(buildableComponents): yield 'If you are satisfied with the probe results, ' \ 'run "make" to start the build.' yield 'Otherwise, install some libraries and headers ' \ 'and rerun "configure".' else: yield 'Please install missing libraries and headers ' \ 'and rerun "configure".' yield '' yield 'If the detected libraries differ from what you think ' \ 'is installed on this system, please check the log file: %s' \ % logPath yield ''