コード例 #1
0
ファイル: install.py プロジェクト: toughkidcst/openMSX
def installAll(
    installPrefix, binaryDestDir, shareDestDir, docDestDir, binaryBuildPath, targetPlatform, cbios, symlinkForBinary
):
    platformVars = extractMakeVariables(
        "build/platform-%s.mk" % targetPlatform,
        dict.fromkeys(("COMPILE_FLAGS", "LINK_FLAGS", "TARGET_FLAGS", "OPENMSX_TARGET_CPU"), ""),
    )
    binaryFileName = "openmsx" + platformVars.get("EXEEXT", "")

    docNodeVars = extractMakeVariables("doc/node.mk")
    docsToInstall = ["doc/" + fileName for fileName in docNodeVars["INSTALL_DOCS"].split()]

    print "  Executable..."
    installDirs(installPrefix + binaryDestDir)
    installFile(binaryBuildPath, installPrefix + binaryDestDir + "/" + binaryFileName)

    print "  Data files..."
    installDirs(installPrefix + shareDestDir)
    installTree("share", installPrefix + shareDestDir, scanTree("share"))

    print "  Documentation..."
    installDirs(installPrefix + docDestDir)
    for path in docsToInstall:
        installFile(path, installPrefix + docDestDir + "/" + basename(path))
    installDirs(installPrefix + docDestDir + "/manual")
    for fileName in listdir("doc/manual"):
        if splitext(fileName)[1] in (".html", ".css", ".png"):
            installFile("doc/manual/" + fileName, installPrefix + docDestDir + "/manual/" + fileName)

    if cbios:
        print "  C-BIOS..."
        installFile("Contrib/README.cbios", installPrefix + docDestDir + "/cbios.txt")
        installTree("Contrib/cbios", installPrefix + shareDestDir + "/machines", scanTree("Contrib/cbios"))

    if hasattr(os, "symlink"):
        print "  Creating symlinks..."
        for machine, alias in (
            ("Toshiba_HX-10", "msx1"),
            ("Philips_NMS_8250", "msx2"),
            ("Panasonic_FS-A1WSX", "msx2plus"),
            ("Panasonic_FS-A1GT", "turbor"),
        ):
            installSymlink(machine + ".xml", installPrefix + shareDestDir + "/machines/" + alias + ".xml")
        if symlinkForBinary and installPrefix == "":

            def createSymlinkToBinary(linkDir):
                if linkDir != binaryDestDir and isdir(linkDir):
                    try:
                        installSymlink(binaryDestDir + "/" + binaryFileName, linkDir + "/" + binaryFileName)
                    except OSError:
                        return False
                    else:
                        return True
                else:
                    return False

            success = createSymlinkToBinary("/usr/local/bin")
            if not success:
                createSymlinkToBinary(expanduser("~/bin"))
コード例 #2
0
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'
コード例 #3
0
ファイル: components2code.py プロジェクト: Libertium/openmsx
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'
コード例 #4
0
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())
コード例 #5
0
ファイル: components2defs.py プロジェクト: Libertium/openmsx
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()
			)
コード例 #6
0
ファイル: install.py プロジェクト: toughkidcst/openMSX
def main(installPrefix, binaryDestDir, shareDestDir, docDestDir, binaryBuildPath, targetPlatform, verboseStr, cbiosStr):
    customVars = extractMakeVariables("build/custom.mk")

    try:
        verbose = parseBool(verboseStr)
        cbios = parseBool(cbiosStr)
        symlinkForBinary = parseBool(customVars["SYMLINK_FOR_BINARY"])
    except ValueError, ex:
        print >> sys.stderr, "Invalid argument:", ex
        sys.exit(2)
コード例 #7
0
def main(installPrefix, binaryDestDir, shareDestDir, docDestDir,
         binaryBuildPath, targetPlatform, verboseStr, cbiosStr):
    customVars = extractMakeVariables('build/custom.mk')

    try:
        verbose = parseBool(verboseStr)
        cbios = parseBool(cbiosStr)
        symlinkForBinary = parseBool(customVars['SYMLINK_FOR_BINARY'])
    except ValueError, ex:
        print >> sys.stderr, 'Invalid argument:', ex
        sys.exit(2)
コード例 #8
0
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())
コード例 #9
0
ファイル: install.py プロジェクト: rderooy/openMSX
def main(
	installPrefix, binaryDestDir, shareDestDir, docDestDir,
	binaryBuildPath, targetPlatform, verboseStr, cbiosStr
	):
	customVars = extractMakeVariables('build/custom.mk')

	try:
		verbose = parseBool(verboseStr)
		cbios = parseBool(cbiosStr)
		symlinkForBinary = parseBool(customVars['SYMLINK_FOR_BINARY'])
	except ValueError as ex:
		print('Invalid argument:', ex, file=sys.stderr)
		sys.exit(2)

	if installPrefix and not installPrefix.endswith('/'):
		# Just in case the destination directories are not absolute.
		installPrefix += '/'

	if verbose:
		print('Installing openMSX:')

	try:
		installAll(
			installPrefix, binaryDestDir, shareDestDir, docDestDir,
			binaryBuildPath, targetPlatform, cbios, symlinkForBinary
			)
	except OSError as ex:
		print('Installation failed:', ex, file=sys.stderr)
		sys.exit(1)

	if verbose:
		print('Installation complete... have fun!')
		print((
			'Notice: if you want to emulate real MSX systems and not only the '
			'free C-BIOS machines, put the system ROMs in one of the following '
			'directories: %s/systemroms or '
			'~/.openMSX/share/systemroms\n'
			'If you want openMSX to find MSX software referred to from replays '
			'or savestates you get from your friends, copy that MSX software to '
			'%s/software or '
			'~/.openMSX/share/software'
			) % (shareDestDir, shareDestDir))
コード例 #10
0
def installAll(
	installPrefix, binaryDestDir, shareDestDir, docDestDir,
	binaryBuildPath, targetPlatform, cbios, symlinkForBinary
	):
	platformVars = extractMakeVariables(
		'build/platform-%s.mk' % targetPlatform,
		dict.fromkeys(
			('COMPILE_FLAGS', 'LINK_FLAGS', 'TARGET_FLAGS',
			 'OPENMSX_TARGET_CPU'),
			''
			)
		)
	binaryFileName = 'openmsx' + platformVars.get('EXEEXT', '')

	docNodeVars = extractMakeVariables('doc/node.mk')
	docsToInstall = [
		'doc/' + fileName for fileName in docNodeVars['INSTALL_DOCS'].split()
		]

	print '  Executable...'
	installDirs(installPrefix + binaryDestDir)
	installFile(
		binaryBuildPath,
		installPrefix + binaryDestDir + '/' + binaryFileName
		)

	print '  Data files...'
	installDirs(installPrefix + shareDestDir)
	installTree('share', installPrefix + shareDestDir, scanTree('share'))

	print '  Documentation...'
	installDirs(installPrefix + docDestDir)
	for path in docsToInstall:
		installFile(path, installPrefix + docDestDir + '/' + basename(path))
	installDirs(installPrefix + docDestDir + '/manual')
	for fileName in listdir('doc/manual'):
		if splitext(fileName)[1] in ('.html', '.css', '.png'):
			installFile(
				'doc/manual/' + fileName,
				installPrefix + docDestDir + '/manual/' + fileName
				)

	if cbios:
		print '  C-BIOS...'
		installFile(
			'Contrib/README.cbios', installPrefix + docDestDir + '/cbios.txt'
			)
		installTree(
			'Contrib/cbios', installPrefix + shareDestDir + '/machines',
			scanTree('Contrib/cbios')
			)
		installDirs(installPrefix + shareDestDir + '/systemroms/cbios-old')
		installTree(
			'Contrib/cbios-old',
			installPrefix + shareDestDir + '/systemroms/cbios-old',
			scanTree('Contrib/cbios-old')
			)

	if hasattr(os, 'symlink'):
		print '  Creating symlinks...'
		for machine, alias in (
			('National_CF-3300', 'msx1'),
			('Toshiba_HX-10', 'msx1_eu'),
			('Sony_HB-F900', 'msx2'),
			('Philips_NMS_8250', 'msx2_eu'),
			('Panasonic_FS-A1WSX', 'msx2plus'),
			('Panasonic_FS-A1GT', 'turbor'),
			):
			installSymlink(
				machine + ".xml",
				installPrefix + shareDestDir + '/machines/' + alias + ".xml"
				)
		if symlinkForBinary and installPrefix == '':
			def createSymlinkToBinary(linkDir):
				if linkDir != binaryDestDir and isdir(linkDir):
					try:
						installSymlink(
							binaryDestDir + '/' + binaryFileName,
							linkDir + '/' + binaryFileName
							)
					except OSError:
						return False
					else:
						return True
				else:
					return False
			success = createSymlinkToBinary('/usr/local/bin')
			if not success:
				createSymlinkToBinary(expanduser('~/bin'))
コード例 #11
0
ファイル: probe.py プロジェクト: GabrielRavier/openMSX
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 ''
コード例 #12
0
ファイル: buildinfo2code.py プロジェクト: toninhofwi/openMSX
def iterBuildInfoHeader(targetPlatform, cpuName, flavour, installShareDir):
    platformVars = extractMakeVariables(
        joinpath(dirname(__file__), 'platform-%s.mk' % targetPlatform),
        dict.fromkeys(('COMPILE_FLAGS', 'LINK_FLAGS', 'LDFLAGS',
                       'TARGET_FLAGS', 'OPENMSX_TARGET_CPU'), ''))
    setWindowIcon = parseBool(platformVars.get('SET_WINDOW_ICON', 'true'))

    targetCPU = getCPU(cpuName)

    # TODO: Add support for device-specific configuration.
    platformDingux = targetPlatform == 'dingux'
    platformPandora = targetPlatform == 'pandora'
    platformAndroid = targetPlatform == 'android'

    # Defaults.
    have16BPP = True
    have32BPP = True
    minScaleFactor = 1
    maxScaleFactor = 4

    # Platform overrides.
    if platformDingux:
        maxScaleFactor = 1
    elif platformAndroid:
        # At the moment, libsdl android crashes when trying to dynamically change the scale factor
        # TODO: debug why it crashes and then change the maxScaleFactor parameter here
        # so that people with a powerfull enough android device can use a higher scale factor
        have32BPP = False
        minScaleFactor = 2
        maxScaleFactor = 2
    elif platformPandora:
        have32BPP = False
        maxScaleFactor = 3

    yield '// Automatically generated by build process.'
    yield ''
    yield '#ifndef BUILD_INFO_HH'
    yield '#define BUILD_INFO_HH'
    yield ''
    # Use a macro i.s.o. a boolean to prevent compilation errors on inline asm.
    # Assembly doesn't appear to work with MINGW64... TODO: find out why
    yield '#ifdef __MINGW64__'
    yield '#define ASM_X86 0'
    yield '#define ASM_X86 0'
    yield '#define ASM_X86_32 0'
    yield '#define ASM_X86_64 0'
    yield '#else'
    # A compiler will typically only understand the instruction set that it
    # generates code for.
    yield '#define ASM_X86 %d' % (targetCPU is X86 or targetCPU is X86_64)
    yield '#define ASM_X86_32 %d' % (targetCPU is X86)
    yield '#define ASM_X86_64 %d' % (targetCPU is X86_64)
    yield '#endif'
    # Use a macro iso integer because we really need to exclude code sections
    # based on this.
    yield '#define PLATFORM_DINGUX %d' % platformDingux
    yield '#define PLATFORM_ANDROID %d' % platformAndroid
    yield '#define HAVE_16BPP %d' % have16BPP
    yield '#define HAVE_32BPP %d' % have32BPP
    yield '#define MIN_SCALE_FACTOR %d' % minScaleFactor
    yield '#define MAX_SCALE_FACTOR %d' % maxScaleFactor
    yield ''
    yield 'namespace openmsx {'
    yield ''
    # Note: Don't call it "BIG_ENDIAN", because some system header may #define
    #       that.
    yield 'static const bool OPENMSX_BIGENDIAN = %s;' \
     % str(targetCPU.bigEndian).lower()
    yield 'static const bool OPENMSX_UNALIGNED_MEMORY_ACCESS = %s;' \
     % str(targetCPU.unalignedMemoryAccess).lower()
    yield 'static const bool OPENMSX_SET_WINDOW_ICON = %s;' \
     % str(setWindowIcon).lower()
    yield 'static const char* const DATADIR = "%s";' % installShareDir
    yield 'static const char* const BUILD_FLAVOUR = "%s";' % flavour
    yield 'static const char* const TARGET_PLATFORM = "%s";' % targetPlatform
    yield ''
    yield '} // namespace openmsx'
    yield ''
    yield '#endif // BUILD_INFO_HH'
コード例 #13
0
ファイル: buildinfo2code.py プロジェクト: erbodega/openMSX
def iterBuildInfoHeader(targetPlatform, cpuName, flavour, installShareDir):
	platformVars = extractMakeVariables(
		'build/platform-%s.mk' % targetPlatform,
		dict.fromkeys(
			('COMPILE_FLAGS', 'LINK_FLAGS', 'TARGET_FLAGS',
				'ANDROID_LDFLAGS', 'ANDROID_CXXFLAGS',
				'OPENMSX_TARGET_CPU'),
			''
			)
		)
	setWindowIcon = parseBool(platformVars.get('SET_WINDOW_ICON', 'true'))

	targetCPU = getCPU(cpuName)

	# TODO: Add support for device-specific configuration.
	platformDingux = targetPlatform == 'dingux'
	platformMaemo5 = targetPlatform == 'maemo5'
	platformPandora = targetPlatform == 'pandora'
	platformAndroid = targetPlatform == 'android'

	# Defaults.
	have16BPP = True
	have32BPP = True
	minScaleFactor = 1
	maxScaleFactor = 4

	# Platform overrides.
	if platformDingux:
		maxScaleFactor = 1
	elif platformAndroid:
		# At the moment, libsdl android crashes when trying to dynamically change the scale factor
		# TODO: debug why it crashes and then change the maxScaleFactor parameter here
		# so that people with a powerfull enough android device can use a higher scale factor
		have32BPP = False
		maxScaleFactor = 1
	elif platformMaemo5:
		# TODO: These are in fact N900 specific settings, but we have no
		#       support yet for device specific configuration and the N900
		#       is the most popular Maemo device currently.
		have32BPP = False
		maxScaleFactor = 2
	elif platformPandora:
		have32BPP = False
		maxScaleFactor = 3

	yield '// Automatically generated by build process.'
	yield ''
	yield '#ifndef BUILD_INFO_HH'
	yield '#define BUILD_INFO_HH'
	yield ''
	# Use a macro i.s.o. a boolean to prevent compilation errors on inline asm.
	# Assembly doesn't appear to work with MINGW64... TODO: find out why
	yield '#ifdef __MINGW64__'
	yield '#define ASM_X86 0'
	yield '#define ASM_X86 0'
	yield '#define ASM_X86_32 0'
	yield '#define ASM_X86_64 0'
	yield '#else'
	# A compiler will typically only understand the instruction set that it
	# generates code for.
	yield '#define ASM_X86 %d' % (targetCPU is X86 or targetCPU is X86_64)
	yield '#define ASM_X86_32 %d' % (targetCPU is X86)
	yield '#define ASM_X86_64 %d' % (targetCPU is X86_64)
	yield '#endif'
	# Use a macro iso integer because we really need to exclude code sections
	# based on this.
	yield '#define PLATFORM_DINGUX %d' % platformDingux
	yield '#define PLATFORM_MAEMO5 %d' % platformMaemo5
	yield '#define PLATFORM_ANDROID %d' % platformAndroid
	yield '#define HAVE_16BPP %d' % have16BPP
	yield '#define HAVE_32BPP %d' % have32BPP
	yield '#define MIN_SCALE_FACTOR %d' % minScaleFactor
	yield '#define MAX_SCALE_FACTOR %d' % maxScaleFactor
	yield ''
	yield 'namespace openmsx {'
	yield ''
	# Note: Don't call it "BIG_ENDIAN", because some system header may #define
	#       that.
	yield 'static const bool OPENMSX_BIGENDIAN = %s;' \
		% str(targetCPU.bigEndian).lower()
	yield 'static const bool OPENMSX_UNALIGNED_MEMORY_ACCESS = %s;' \
		% str(targetCPU.unalignedMemoryAccess).lower()
	yield 'static const bool OPENMSX_SET_WINDOW_ICON = %s;' \
		% str(setWindowIcon).lower()
	yield 'static const char* const DATADIR = "%s";' % installShareDir
	yield 'static const char* const BUILD_FLAVOUR = "%s";' % flavour
	yield 'static const char* const TARGET_PLATFORM = "%s";' % targetPlatform
	yield ''
	yield '} // namespace openmsx'
	yield ''
	yield '#endif // BUILD_INFO_HH'
コード例 #14
0
ファイル: probe.py プロジェクト: meesokim/openMSX
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 ''
コード例 #15
0
def iterBuildInfoHeader(targetPlatform, cpuName, flavour, installShareDir):
    platformVars = extractMakeVariables(
        'build/platform-%s.mk' % targetPlatform,
        dict.fromkeys(('COMPILE_FLAGS', 'LINK_FLAGS', 'TARGET_FLAGS',
                       'COMPILE_ENV', 'LINK_ENV'), ''))
    setWindowIcon = parseBool(platformVars.get('SET_WINDOW_ICON', 'true'))

    targetCPU = getCPU(cpuName)

    # TODO: Add support for device-specific configuration.
    platformDingux = targetPlatform == 'dingux'
    platformGP2X = False
    platformMaemo5 = targetPlatform == 'maemo5'
    platformPandora = targetPlatform == 'pandora'

    # Defaults.
    have16BPP = True
    have32BPP = True
    minScaleFactor = 1
    maxScaleFactor = 4

    # Platform overrides.
    if platformDingux or platformGP2X:
        have32BPP = False
        maxScaleFactor = 1
    elif platformMaemo5:
        # TODO: These are in fact N900 specific settings, but we have no
        #       support yet for device specific configuration and the N900
        #       is the most popular Maemo device currently.
        have32BPP = False
        maxScaleFactor = 2
    elif platformPandora:
        have32BPP = False
        maxScaleFactor = 3

    yield '// Automatically generated by build process.'
    yield ''
    yield '#ifndef BUILD_INFO_HH'
    yield '#define BUILD_INFO_HH'
    yield ''
    yield '#include <string>'
    yield ''
    # Use a macro i.s.o. a boolean to prevent compilation errors on inline asm.
    # A compiler will typically only understand the instruction set that it
    # generates code for.
    yield '#define ASM_X86 %d' % (targetCPU is X86 or targetCPU is X86_64)
    yield '#define ASM_X86_32 %d' % (targetCPU is X86)
    yield '#define ASM_X86_64 %d' % (targetCPU is X86_64)
    # Use a macro iso integer because we really need to exclude code sections
    # based on this.
    yield '#define PLATFORM_DINGUX %d' % platformDingux
    yield '#define PLATFORM_GP2X %d' % platformGP2X
    yield '#define PLATFORM_MAEMO5 %d' % platformMaemo5
    yield '#define HAVE_16BPP %d' % have16BPP
    yield '#define HAVE_32BPP %d' % have32BPP
    yield '#define MIN_SCALE_FACTOR %d' % minScaleFactor
    yield '#define MAX_SCALE_FACTOR %d' % maxScaleFactor
    yield ''
    yield 'namespace openmsx {'
    yield ''
    # Note: Don't call it "BIG_ENDIAN", because some system header may #define
    #       that.
    yield 'static const bool OPENMSX_BIGENDIAN = %s;' \
     % str(targetCPU.bigEndian).lower()
    yield 'static const bool OPENMSX_UNALIGNED_MEMORY_ACCESS = %s;' \
     % str(targetCPU.unalignedMemoryAccess).lower()
    yield 'static const bool OPENMSX_SET_WINDOW_ICON = %s;' \
     % str(setWindowIcon).lower()
    yield 'static const std::string DATADIR = "%s";' % installShareDir
    yield 'static const std::string BUILD_FLAVOUR = "%s";' % flavour
    yield ''
    yield '} // namespace openmsx'
    yield ''
    yield '#endif // BUILD_INFO_HH'
コード例 #16
0
ファイル: install.py プロジェクト: rderooy/openMSX
def installAll(
	installPrefix, binaryDestDir, shareDestDir, docDestDir,
	binaryBuildPath, targetPlatform, cbios, symlinkForBinary
	):
	platformVars = extractMakeVariables(
		'build/platform-%s.mk' % targetPlatform,
		dict.fromkeys(
			('COMPILE_FLAGS', 'LINK_FLAGS', 'TARGET_FLAGS',
			 'OPENMSX_TARGET_CPU'),
			''
			)
		)
	binaryFileName = 'openmsx' + platformVars.get('EXEEXT', '')

	docNodeVars = extractMakeVariables('doc/node.mk')
	docsToInstall = [
		'doc/' + fileName for fileName in docNodeVars['INSTALL_DOCS'].split()
		]

	print('  Executable...')
	installDirs(installPrefix + binaryDestDir)
	installFile(
		binaryBuildPath,
		installPrefix + binaryDestDir + '/' + binaryFileName
		)

	print('  Data files...')
	installDirs(installPrefix + shareDestDir)
	installTree('share', installPrefix + shareDestDir, scanTree('share'))

	print('  Documentation...')
	installDirs(installPrefix + docDestDir)
	for path in docsToInstall:
		installFile(path, installPrefix + docDestDir + '/' + basename(path))
	installDirs(installPrefix + docDestDir + '/manual')
	for fileName in listdir('doc/manual'):
		if splitext(fileName)[1] in ('.html', '.css', '.png'):
			installFile(
				'doc/manual/' + fileName,
				installPrefix + docDestDir + '/manual/' + fileName
				)

	if platform.system() == 'Linux':
		if 'XDG_DATA_HOME' in os.environ:
			desktopShareDestDir = os.environ['XDG_DATA_HOME']
		elif os.geteuid() == 0:
			desktopShareDestDir = '/usr/share'
		else:
			desktopShareDestDir = os.path.expanduser('~/.local/share')
		if isdir(desktopShareDestDir):
			print('  Desktop icons...')
			for i in ['16', '32', '48', '64', '128', '256']:
				Path(desktopShareDestDir + '/icons/hicolor/' + i + 'x' + i + '/apps').mkdir(parents=True, exist_ok=True)
				installFile(
					'share/icons/openMSX-logo-' + i + '.png', desktopShareDestDir + '/icons/hicolor/' + i + 'x' + i + '/apps/openmsx.png'
				)

			print('  Desktop file...')
			Path(desktopShareDestDir + '/applications').mkdir(parents=True, exist_ok=True)
			installFile(
				'Contrib/linux/org.openmsx.openMSX.desktop', desktopShareDestDir + '/applications/org.openmsx.openMSX.desktop'
				)
			print('  Metainfo file...')
			Path(desktopShareDestDir + '/metainfo').mkdir(parents=True, exist_ok=True)
			installFile(
				'Contrib/linux/org.openmsx.openMSX.metainfo.xml', desktopShareDestDir + '/metainfo/org.openmsx.openMSX.metainfo.xml'
				)
		else:
			print('  Failed to install icon, desktop and metainfo files. ' + desktopShareDestDir + ' does not exist.')

	if cbios:
		print('  C-BIOS...')
		installFile(
			'Contrib/README.cbios', installPrefix + docDestDir + '/cbios.txt'
			)
		installTree(
			'Contrib/cbios', installPrefix + shareDestDir + '/machines',
			scanTree('Contrib/cbios')
			)
		installDirs(installPrefix + shareDestDir + '/systemroms/cbios-old')
		installTree(
			'Contrib/cbios-old',
			installPrefix + shareDestDir + '/systemroms/cbios-old',
			scanTree('Contrib/cbios-old')
			)

	if hasattr(os, 'symlink') and os.name != 'nt':
		print('  Creating symlinks...')
		for machine, alias in (
			('National_CF-3300', 'msx1'),
			('Toshiba_HX-10', 'msx1_eu'),
			('Sony_HB-F900', 'msx2'),
			('Philips_NMS_8250', 'msx2_eu'),
			('Panasonic_FS-A1WSX', 'msx2plus'),
			('Panasonic_FS-A1GT', 'turbor'),
			):
			installSymlink(
				machine + ".xml",
				installPrefix + shareDestDir + '/machines/' + alias + ".xml"
				)
		if symlinkForBinary and installPrefix == '':
			def createSymlinkToBinary(linkDir):
				if linkDir != binaryDestDir and isdir(linkDir):
					try:
						installSymlink(
							binaryDestDir + '/' + binaryFileName,
							linkDir + '/' + binaryFileName
							)
					except OSError:
						return False
					else:
						return True
				else:
					return False
			success = createSymlinkToBinary('/usr/local/bin')
			if not success:
				createSymlinkToBinary(expanduser('~/bin'))