Exemplo n.º 1
0
def setup():
	global linkers

	# Get the names and paths for know linkers
	names = ['ld', 'link.exe']
	for name in names:
		paths = Find.program_paths(name)
		if len(paths) == 0:
			continue

		if name == 'link.exe':
			link = Linker(
				name            = 'link.exe',
				setup           = '/nologo',
				out_file        = '/out:',
				shared          = '/dll '
			)
			linkers[link._name] = link
		elif name == 'ld':
			link = Linker(
				name            = 'ld',
				setup           = '',
				out_file        = '-o ',
				shared          = '-G'
			)
			linkers[link._name] = link

	# Make sure there is at least one linker installed
	if len(linkers) == 0:
		Print.status("Setting up Linker module")
		Print.fail()
		Print.exit("No Linker found. Install one and try again.")
Exemplo n.º 2
0
def ldconfig():
	# Setup the message
	Print.status("Running 'ldconfig'")

	# Skip ldconfig on Cygwin
	if Config.os_type in OSType.Cygwin:
		Print.ok()
		return

	# Find ldconfig
	prog = Find.program_paths('ldconfig')
	if not prog:
		Print.fail()
		Print.exit("Could not find 'ldconfig'.")

	# Run the process
	runner = findlib.ProcessRunner(prog[0])
	runner.run()
	runner.is_done
	runner.wait()

	# Success or failure
	if runner.is_failure:
		Print.fail(runner.stdall)
		Print.exit("Failed run 'ldconfig'.")
	elif runner.is_success or runner.is_warning:
		Print.ok()
Exemplo n.º 3
0
def setup():
    global java_compilers
    global missing_compilers

    # Get the names and paths for know Java compilers
    names = ['javac']
    for name in names:
        paths = Find.program_paths(name)
        if len(paths) == 0:
            missing_compilers.append(name)
            continue

        if name in ['javac']:
            comp = JavaCompiler(name=name,
                                path=paths[0],
                                debug='-g',
                                no_warnings='-nowarn',
                                verbose='-verbose',
                                deprecation='-deprecation',
                                runtime='java',
                                jar='jar')
            java_compilers[comp._name] = comp

    # Make sure there is at least one Java compiler installed
    if len(java_compilers) == 0:
        Print.status("Setting up Java module")
        Print.fail()
        Print.exit("No Java compiler found. Install one and try again.")
Exemplo n.º 4
0
def setup():
    global cs_compilers
    global missing_compilers

    # Get the names and paths for know C# compilers
    names = ['dmcs', 'csc']
    for name in names:
        paths = Find.program_paths(name)
        if len(paths) == 0:
            missing_compilers.append(name)
            continue

        if name in ['dmcs']:
            comp = CSCompiler(name=name,
                              path=paths[0],
                              out_file='-out:',
                              debug='-debug',
                              warnings_all='-warn:4',
                              warnings_as_errors='-warnaserror',
                              optimize='-optimize',
                              runtime='mono')
            cs_compilers[comp._name] = comp
        elif name in ['csc']:
            comp = CSCompiler(name=name,
                              path=paths[0],
                              out_file='-out:',
                              debug='-debug',
                              warnings_all='-warn:4',
                              warnings_as_errors='-warnaserror',
                              optimize='-optimize',
                              runtime='')
            cs_compilers[comp._name] = comp

    # Make sure there is at least one C# compiler installed
    if len(cs_compilers) == 0:
        Print.status("Setting up C# module")
        Print.fail()
        Print.exit("No C# compiler found. Install one and try again.")
Exemplo n.º 5
0
def setup():
    global cxx_compilers
    global missing_compilers

    # Figure out if OS X has the dev tools installed
    OSX_HAS_TOOLS = False
    if Config.os_type in OSType.MacOS:
        result = findlib.run_and_get_stdout(
            'pkgutil --pkg-info=com.apple.pkg.CLTools_Executables')
        if result:
            OSX_HAS_TOOLS = True

    # Get the names and paths for known C++ compilers
    compilers = {
        'g++': ['g++', r'g++[0-9]*', r'g++-[0-9|\.]*'],
        'clang++': ['clang++'],
        'cl.exe': ['cl.exe']
    }
    for name, alt_names in compilers.items():
        paths = Find.program_paths(*alt_names)
        if len(paths) == 0:
            missing_compilers.append(name)
            continue

        standards = {
            Standard.std1998: '-std=c++98',
            Standard.std2003: '-std=c++03',
            Standard.std2011: '-std=c++11',
            Standard.std201x: '-std=c++1x',
            Standard.gnu1998: '-std=gnu++98',
            Standard.gnu2003: '-std=gnu++03',
            Standard.gnu2011: '-std=gnu++11',
            Standard.gnu201x: '-std=gnu++1x'
        }

        if name == 'g++':
            # On Mac OS X skip this compiler if it is clang pretending to be g++
            if Config.os_type in OSType.MacOS and OSX_HAS_TOOLS:
                version = findlib.run_and_get_stdout('g++ --version')
                if version and 'clang' in version.lower():
                    missing_compilers.append(name)
                    continue

            comp = CXXCompiler(name='g++',
                               path=paths[0],
                               standards=standards,
                               setup='',
                               out_file='-o ',
                               no_link='-c',
                               debug='-g',
                               position_independent_code='-fPIC',
                               warnings_all='-Wall',
                               warnings_extra='-Wextra',
                               warnings_as_errors='-Werror',
                               optimize_zero='-O0',
                               optimize_one='-O1',
                               optimize_two='-O2',
                               optimize_three='-O3',
                               optimize_size='-Os',
                               compile_time_flags='-D',
                               link='-shared -Wl,-as-needed')
            cxx_compilers[comp._name] = comp
        elif name == 'clang++':
            comp = CXXCompiler(name='clang++',
                               path=paths[0],
                               standards=standards,
                               setup='',
                               out_file='-o ',
                               no_link='-c',
                               debug='-g',
                               position_independent_code='-fPIC',
                               warnings_all='-Wall',
                               warnings_extra='-Wextra',
                               warnings_as_errors='-Werror',
                               optimize_zero='-O0',
                               optimize_one='-O1',
                               optimize_two='-O2',
                               optimize_three='-O3',
                               optimize_size='-Os',
                               compile_time_flags='-D',
                               link='-shared')
            cxx_compilers[comp._name] = comp
        elif name == 'cl.exe':
            # http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
            comp = CXXCompiler(name='cl.exe',
                               path=paths[0],
                               standards=None,
                               setup='/nologo /EHsc',
                               out_file='/Fe',
                               no_link='/c',
                               debug='/Zi',
                               position_independent_code='',
                               warnings_all='/Wall',
                               warnings_extra=None,
                               warnings_as_errors='/WX',
                               optimize_zero='/Od',
                               optimize_one='/O1',
                               optimize_two='/O2',
                               optimize_three='/Ox',
                               optimize_size='/Os',
                               compile_time_flags='/D',
                               link='/LDd')
            cxx_compilers[comp._name] = comp

    # Make sure there is at least one C++ compiler installed
    if len(cxx_compilers) == 0:
        Print.status("Setting up C++ module")
        Print.fail()
        Print.exit("No C++ compiler found. Install one and try again.")
Exemplo n.º 6
0
def setup():
    global d_compilers
    global missing_compilers

    # Get the names and paths for know D compilers
    compilers = {
        'dmd': ['dmd', r'dmd[0-9]*'],
        'ldc': ['ldc', r'ldc[0-9]*'],
        #gdc
    }
    for name, alt_names in compilers.items():
        paths = Find.program_paths(*alt_names)
        if len(paths) == 0:
            missing_compilers.append(name)
            continue

        if name in ['dmd2', 'dmd']:
            comp = DCompiler(name=name,
                             path=paths[0],
                             setup='',
                             out_file='-of',
                             no_link='-c',
                             lib='-lib',
                             debug='-g',
                             warnings_all='-w',
                             optimize='-O',
                             compile_time_flags='-version=',
                             link='-Wl,-as-needed',
                             interface='-H',
                             interface_file='-Hf',
                             interface_dir='-Hd',
                             unittest='-unittest')
            d_compilers[comp._name] = comp
        elif name in ['ldc2', 'ldc']:
            comp = DCompiler(name=name,
                             path=paths[0],
                             setup='',
                             out_file='-of',
                             no_link='-c',
                             lib='-lib',
                             debug='-g',
                             warnings_all='-w',
                             optimize='-O2',
                             compile_time_flags='-d-version=',
                             link='-Wl,-as-needed',
                             interface='-H',
                             interface_file='-Hf=',
                             interface_dir='-Hd=',
                             unittest='-unittest')
            d_compilers[comp._name] = comp
        elif name in ['gdc']:
            # http://wiki.dlang.org/GDC/Using_GDC
            comp = DCompiler(name=name,
                             path=paths[0],
                             setup='',
                             out_file='-o ',
                             no_link='-c',
                             lib='-lib',
                             debug='-g',
                             warnings_all='-Werror',
                             optimize='-O2',
                             compile_time_flags='-f-version=',
                             link='-Wl,-as-needed',
                             interface='-fintfc=',
                             interface_file='-fintfc-file=',
                             interface_dir='-fintfc-dir=',
                             unittest='-unittest')
            d_compilers[comp._name] = comp

    # Make sure there is at least one D compiler installed
    if len(d_compilers) == 0:
        Print.status("Setting up D module")
        Print.fail()
        Print.exit("No D compiler found. Install one and try again.")
Exemplo n.º 7
0
 def init_prereqs(cls):
     cls.found_prereqs = []
     for prog in cls.known_prereqs:
         if Find.program_paths(prog):
             cls.found_prereqs.append(prog)