Exemple #1
0
def get():
    gmp_val = overrides.get('CHPL_GMP')
    if not gmp_val:
        target_compiler = chpl_compiler.get('target')
        if target_compiler == 'cray-prgenv-cray':
            gmp_val = 'system'
        else:
            target_platform = chpl_platform.get('target')

            # Detect if gmp has been built for this configuration.
            third_party = get_chpl_third_party()
            uniq_cfg_path = get_uniq_cfg_path()
            gmp_subdir = os.path.join(third_party, 'gmp', 'install',
                                      uniq_cfg_path)

            if os.path.exists(os.path.join(gmp_subdir, 'include', 'gmp.h')):
                gmp_val = 'bundled'
            elif target_platform.startswith('cray-x'):
                gmp_val = 'system'
            elif target_platform == 'aarch64':
                gmp_val = 'system'
            else:
                gmp_val = 'none'
    elif gmp_val == 'gmp':
        sys.stderr.write("Warning: CHPL_GMP=gmp is deprecated. "
                         "Use CHPL_GMP=bundled instead.\n")
        gmp_val = 'bundled'

    return gmp_val
Exemple #2
0
def has_compatible_installed_llvm():
    preferred_vers_file = os.path.join(get_chpl_third_party(), 'llvm',
                                       'LLVM_VERSION')
    preferred_vers = ""
    with open(preferred_vers_file, 'r') as file:
        preferred_vers = file.read().strip()

    find_llvm_config = os.path.join(get_chpl_third_party(), 'llvm',
                                    'find-llvm-config.sh')

    got = run_command([find_llvm_config, preferred_vers])
    got = got.strip()
    if got and got != "missing-llvm-config":
        return True
    else:
        return False
Exemple #3
0
def get():
    """ Detects if re2 was built with CHPL_RE2_VALGRIND_SUPPORT set by checking
        for a sentinel file in the install dir """
    third_party = chpl_home_utils.get_chpl_third_party()
    uniq_cfg_path = chpl_3p_re2_configs.get_uniq_cfg_path()
    re2_valgrind = os.path.join(third_party, 're2', 'install',
                                uniq_cfg_path, 'CHPL_RE2_VALGRIND_SUPPORT')
    return os.path.exists(re2_valgrind)
Exemple #4
0
def get():
    re2 = overrides.get('CHPL_RE2')
    regexp = overrides.get('CHPL_REGEXP')
    if not re2:
        re2_header = os.path.join(get_chpl_third_party(), 're2', 'install',
                                  get_uniq_cfg_path(), 'include', 're2',
                                  're2.h')
        re2 = 'bundled' if os.path.exists(re2_header) else 'none'
    return re2
Exemple #5
0
def is_included_llvm_built():
    chpl_third_party = get_chpl_third_party()
    llvm_target_dir = get_uniq_cfg_path_for('bundled')
    llvm_subdir = os.path.join(chpl_third_party, 'llvm', 'install',
                               llvm_target_dir)
    llvm_header = os.path.join(llvm_subdir, 'include', 'llvm', 'PassSupport.h')
    if os.path.exists(llvm_header):
        return True
    else:
        return False
Exemple #6
0
def get():
    regexp_val = overrides.get('CHPL_REGEXP')
    if not regexp_val:
        third_party = get_chpl_third_party()
        uniq_cfg_path = chpl_3p_re2_configs.get_uniq_cfg_path()
        regexp_subdir = os.path.join(third_party, 're2', 'install',
                                     uniq_cfg_path)
        regexp_header = os.path.join(regexp_subdir, 'include', 're2', 're2.h')
        if os.path.exists(regexp_header):
            regexp_val = 're2'
        else:
            regexp_val = 'none'
    return regexp_val
def get():
    regexp_val = overrides.get('CHPL_REGEXP')
    if not regexp_val:
        third_party = get_chpl_third_party()
        uniq_cfg_path = chpl_3p_re2_configs.get_uniq_cfg_path()
        regexp_subdir = os.path.join(third_party, 're2', 'install',
                                     uniq_cfg_path)
        regexp_header = os.path.join(regexp_subdir, 'include', 're2', 're2.h')
        if os.path.exists(regexp_header):
            regexp_val = 're2'
        else:
            regexp_val = 'none'
    return regexp_val
Exemple #8
0
def get():
    llvm_val = overrides.get('CHPL_LLVM')
    if not llvm_val:
        chpl_third_party = get_chpl_third_party()
        llvm_target_dir = get_uniq_cfg_path()
        llvm_subdir = os.path.join(chpl_third_party, 'llvm', 'install',
                                   llvm_target_dir)
        llvm_header = os.path.join(llvm_subdir, 'include', 'llvm',
                                   'PassSupport.h')
        if os.path.exists(llvm_header):
            llvm_val = 'llvm'
        else:
            llvm_val = 'none'
    return llvm_val
Exemple #9
0
def get():
    llvm_val = overrides.get('CHPL_LLVM')
    if not llvm_val:
        chpl_third_party = get_chpl_third_party()
        llvm_target_dir = get_uniq_cfg_path()
        llvm_subdir = os.path.join(chpl_third_party, 'llvm', 'install',
                                   llvm_target_dir)
        llvm_header = os.path.join(llvm_subdir, 'include', 'llvm',
                                   'PassSupport.h')
        if os.path.exists(llvm_header):
            llvm_val = 'llvm'
        else:
            llvm_val = 'none'
    return llvm_val
Exemple #10
0
def get():
    llvm_val = overrides.get('CHPL_LLVM')
    if not llvm_val:
        # compute a default based on if the included llvm is built
        chpl_third_party = get_chpl_third_party()
        llvm_target_dir = get_uniq_cfg_path_for('llvm')
        llvm_subdir = os.path.join(chpl_third_party, 'llvm', 'install',
                                   llvm_target_dir)
        llvm_header = os.path.join(llvm_subdir, 'include', 'llvm',
                                   'PassSupport.h')
        if os.path.exists(llvm_header):
            llvm_val = 'llvm'
        else:
            llvm_val = 'none'
    return llvm_val
Exemple #11
0
def get():
    llvm_val = overrides.get('CHPL_LLVM')
    if not llvm_val:
        # compute a default based on if the included llvm is built
        chpl_third_party = get_chpl_third_party()
        llvm_target_dir = get_uniq_cfg_path_for('llvm')
        llvm_subdir = os.path.join(chpl_third_party, 'llvm', 'install',
                                   llvm_target_dir)
        llvm_header = os.path.join(llvm_subdir, 'include', 'llvm',
                                   'PassSupport.h')
        if os.path.exists(llvm_header):
            llvm_val = 'llvm'
        else:
            llvm_val = 'none'
    return llvm_val
Exemple #12
0
def get():
    gmp_val = overrides.get('CHPL_GMP')
    if not gmp_val:
        target_platform = chpl_platform.get('target')

        # Detect if gmp has been built for this configuration.
        third_party = get_chpl_third_party()
        uniq_cfg_path = chpl_3p_gmp_configs.get_uniq_cfg_path()
        gmp_subdir = os.path.join(third_party, 'gmp', 'install', uniq_cfg_path)

        if os.path.exists(os.path.join(gmp_subdir, 'include', 'gmp.h')):
            gmp_val = 'gmp'
        elif target_platform.startswith('cray-x'):
            gmp_val = 'system'
        elif target_platform == 'aarch64':
            gmp_val = 'system'
        else:
            gmp_val = 'none'
    return gmp_val
Exemple #13
0
def get_llvm_clang(lang):
    clang_name = get_llvm_clang_command_name(lang)

    llvm_val = get()
    if llvm_val == 'system':
        bindir = get_system_llvm_config_bindir()
        clang = os.path.join(bindir, clang_name)
    elif llvm_val == 'bundled':
        llvm_subdir = get_bundled_llvm_dir()
        clang = os.path.join(llvm_subdir, 'bin', clang_name)
    else:
        return ''
    # tack on the contents of configured-clang-sysroot-arguments
    fname = os.path.join(get_chpl_third_party(), "llvm", "install",
                         get_uniq_cfg_path_for(llvm_val),
                         "configured-clang-sysroot-arguments")
    if os.path.isfile(fname):
        with open(fname) as f:
            for line in f:
                clang += " " + line.rstrip()
    return clang
Exemple #14
0
def handle_la(la_path):
    args = []
    if os.path.isfile(la_path):
        with open(la_path) as f:
            for line in f.readlines():
                if 'old_library=' in line:
                    lib_name = line.split('\'')[1]
                    p = re.compile(r'^lib([^/]+)\.a$')
                    args.append(p.sub(r'-l\1', lib_name))
                elif 'inherited_linker_flags=' in line:
                    for tok in line.split('\'')[1].split():
                        args.append(tok)
                elif 'dependency_libs=' in line:
                    for tok in line.split('\'')[1].split():
                        # paths reflect built env; replace with $CHPL_HOME
                        pat = re.compile(r'^((-L\s*)?).*(/third-party/)')
                        repl = r'\1' + get_chpl_third_party() + '/'
                        tok = pat.sub(repl, tok)
                        if tok.endswith('.la'):
                            args.extend(handle_la(tok))
                        else:
                            args.append(tok)
    return args
def handle_la(la_path):
    args = []
    if os.path.isfile(la_path):
        with open(la_path) as f:
            for line in f.readlines():
                if 'old_library=' in line:
                    lib_name = line.split('\'')[1]
                    p = re.compile(r'^lib([^/]+)\.a$')
                    args.append(p.sub(r'-l\1', lib_name))
                elif 'inherited_linker_flags=' in line:
                    for tok in line.split('\'')[1].split():
                        args.append(tok)
                elif 'dependency_libs=' in line:
                    for tok in line.split('\'')[1].split():
                        # paths reflect built env; replace with $CHPL_HOME
                        pat = re.compile(r'^((-L\s*)?).*(/third-party/)')
                        repl = r'\1' + get_chpl_third_party() + '/'
                        tok = pat.sub(repl, tok)
                        if tok.endswith('.la'):
                            args.extend(handle_la(tok))
                        else:
                            args.append(tok)
    return args
Exemple #16
0
def get_bundled_llvm_dir():
    chpl_third_party = get_chpl_third_party()
    llvm_target_dir = get_uniq_cfg_path_for('bundled')
    llvm_subdir = os.path.join(chpl_third_party, 'llvm', 'install',
                               llvm_target_dir)
    return llvm_subdir
Exemple #17
0
def get_cfg_install_path(pkg, ucp=default_uniq_cfg_path()):
    return os.path.join(get_chpl_third_party(), pkg, 'install', ucp)
def get_cfg_install_path(pkg, ucp=default_uniq_cfg_path()):
    return os.path.join(get_chpl_third_party(), pkg, 'install', ucp)
Exemple #19
0
def get_cfg_install_path(pkg, ucp=default_uniq_cfg_path(), host_or_target=''):
    # some third party packages (like jemalloc) can be built for both host and target
    # in which case they are under jemalloc/install/{host,target}/... for example
    # an empty host_or_target will get removed by os.path.join
    return os.path.join(get_chpl_third_party(), pkg, 'install', host_or_target,
                        ucp)