File: lit.local.cfg

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-11
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,418,840 kB
  • sloc: cpp: 5,290,826; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,898; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,913; xml: 953; cs: 573; fortran: 539
file content (63 lines) | stat: -rw-r--r-- 1,933 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import os
import pipes
import shlex
import sys

if not 'go' in config.root.llvm_bindings:
    config.unsupported = True

if not config.root.include_go_tests:
    config.unsupported = True

if config.have_tf_aot or config.have_tf_api:
    config.unsupported = True

def find_executable(executable, path=None):
    if path is None:
        path = os.environ['PATH']
    paths = path.split(os.pathsep)
    base, ext = os.path.splitext(executable)

    if (sys.platform == 'win32' or os.name == 'os2') and (ext != '.exe'):
        executable = executable + '.exe'

    if not os.path.isfile(executable):
        for p in paths:
            f = os.path.join(p, executable)
            if os.path.isfile(f):
                return f
        return None
    else:
        return executable

# Resolve certain symlinks in the first word of compiler.
#
# This is a Go-specific hack. cgo and other Go tools check $CC and $CXX for the
# substring 'clang' to determine if the compiler is Clang. This won't work if
# $CC is cc and cc is a symlink pointing to clang, as it is on Darwin.
#
# Go tools also have problems with ccache, so we disable it.
def fixup_compiler_path(compiler):
    args = shlex.split(compiler)
    if args[0].endswith('ccache') or args[0].endswith('gomacc'):
        args = args[1:]

    path = find_executable(args[0])

    try:
        if path.endswith('/cc') and os.readlink(path) == 'clang':
            args[0] = path[:len(path)-2] + 'clang'
    except (AttributeError, OSError):
        pass

    try:
        if path.endswith('/c++') and os.readlink(path) == 'clang++':
            args[0] = path[:len(path)-3] + 'clang++'
    except (AttributeError, OSError):
        pass

    return ' '.join([pipes.quote(arg) for arg in args])

config.environment['CC'] = fixup_compiler_path(config.host_cc)
config.environment['CXX'] = fixup_compiler_path(config.host_cxx)
config.environment['CGO_LDFLAGS'] = config.host_ldflags