Exemplo n.º 1
0
def use_system_libcxx_workaround():
    host_platform = chpl_platform.get('host')
    if host_platform == "darwin":
        # If the variable for this is set to something other that '0' or 'no'
        # then do the workaround.
        # This variable exists to support building the Homebrew formula
        # from source because during that build, `brew` is not available.
        override_var = overrides.get('CHPL_HOST_USE_SYSTEM_LIBCXX', '')
        if override_var != '':
            return (override_var != "0" and override_var != "no")

        # otherwise, do the workaround if we detect homebrew
        homebrew_prefix = chpl_platform.get_homebrew_prefix()

        if homebrew_prefix:
            return True

    return False
Exemplo n.º 2
0
def find_system_llvm_config():
    llvm_config = overrides.get('CHPL_LLVM_CONFIG', 'none')
    if llvm_config != 'none':
        return llvm_config

    homebrew_prefix = chpl_platform.get_homebrew_prefix()

    paths = [ ]
    for vers in llvm_versions():
        paths.append("llvm-config-" + vers + ".0")
        paths.append("llvm-config-" + vers)
        # this format used by freebsd
        paths.append("llvm-config" + vers)
        if homebrew_prefix:
            # look for homebrew install of LLVM
            paths.append(homebrew_prefix +
                         "/opt/llvm@" + vers + ".0/bin/llvm-config")
            paths.append(homebrew_prefix +
                         "/opt/llvm@" + vers + "/bin/llvm-config")

    # check also unversioned commands
    paths.append("llvm-config")
    if homebrew_prefix:
        paths.append(homebrew_prefix + "/opt/llvm/bin/llvm-config")

    by_version = defaultdict(list)
    errs = []

    for command in paths:
        version, config_err = check_llvm_config(command)
        if not config_err:
            by_version[version].append(command)
        else:
            errs.append((command, config_err))

    for version in llvm_versions():
        commands = by_version[version]
        if commands:
            return commands[0]

    return ''
Exemplo n.º 3
0
def get_system_link_args(flag):
    platform_val = chpl_platform.get(flag)
    compiler_val = get(flag)

    paths = []

    # For PrgEnv compilation with LLVM, gather arguments from PrgEnv driver
    if compiler_val == 'llvm' and flag == 'target':
        import chpl_llvm
        (comp_args, link_args) = chpl_llvm.get_clang_prgenv_args()
        paths.extend(link_args)

    # FreeBSD uses /usr/local but compilers don't search there by default
    if platform_val == 'freebsd':
        paths.append('-L/usr/local/lib')

    # Add Homebrew lib directory if Homebrew is installed
    homebrew_prefix = chpl_platform.get_homebrew_prefix()
    if homebrew_prefix:
        paths.append('-L' + homebrew_prefix + '/lib')

    return paths