mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-24 22:04:19 +08:00
181 lines
5.4 KiB
Python
Executable File
181 lines
5.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
# The values here are copied from the output of llvm-config running under Redox.
|
|
# This is a hack, and should be replaced if possible.
|
|
|
|
# This list can be generated with this ion script:
|
|
# for component in @(llvm-config --components)
|
|
# echo -e \"$component\": \"$(llvm-config --libs $component)\",
|
|
# end
|
|
components = {
|
|
'aggressiveinstcombine': '-lLLVM-21',
|
|
'all': '-lLLVM-21',
|
|
'all-targets': '-lLLVM-21',
|
|
'analysis': '-lLLVM-21',
|
|
'asmparser': '-lLLVM-21',
|
|
'asmprinter': '-lLLVM-21',
|
|
'binaryformat': '-lLLVM-21',
|
|
'bitreader': '-lLLVM-21',
|
|
'bitstreamreader': '-lLLVM-21',
|
|
'bitwriter': '-lLLVM-21',
|
|
'cfguard': '-lLLVM-21',
|
|
'cgdata': '-lLLVM-21',
|
|
'codegen': '-lLLVM-21',
|
|
'codegentypes': '-lLLVM-21',
|
|
'core': '-lLLVM-21',
|
|
'coroutines': '-lLLVM-21',
|
|
'coverage': '-lLLVM-21',
|
|
'debuginfobtf': '-lLLVM-21',
|
|
'debuginfocodeview': '-lLLVM-21',
|
|
'debuginfodwarf': '-lLLVM-21',
|
|
'debuginfodwarflowlevel': '-lLLVM-21',
|
|
'debuginfogsym': '-lLLVM-21',
|
|
'debuginfologicalview': '-lLLVM-21',
|
|
'debuginfomsf': '-lLLVM-21',
|
|
'debuginfopdb': '-lLLVM-21',
|
|
'demangle': '-lLLVM-21',
|
|
'dlltooldriver': '-lLLVM-21',
|
|
'dwarfcfichecker': '-lLLVM-21',
|
|
'dwarflinker': '-lLLVM-21',
|
|
'dwarflinkerclassic': '-lLLVM-21',
|
|
'dwarflinkerparallel': '-lLLVM-21',
|
|
'dwp': '-lLLVM-21',
|
|
'engine': '-lLLVM-21',
|
|
'executionengine': '-lLLVM-21',
|
|
'extensions': '-lLLVM-21',
|
|
'filecheck': '-lLLVM-21',
|
|
'frontendatomic': '-lLLVM-21',
|
|
'frontenddirective': '-lLLVM-21',
|
|
'frontenddriver': '-lLLVM-21',
|
|
'frontendhlsl': '-lLLVM-21',
|
|
'frontendoffloading': '-lLLVM-21',
|
|
'frontendopenacc': '-lLLVM-21',
|
|
'frontendopenmp': '-lLLVM-21',
|
|
'fuzzercli': '-lLLVM-21',
|
|
'fuzzmutate': '-lLLVM-21',
|
|
'globalisel': '-lLLVM-21',
|
|
'hipstdpar': '-lLLVM-21',
|
|
'instcombine': '-lLLVM-21',
|
|
'instrumentation': '-lLLVM-21',
|
|
'interfacestub': '-lLLVM-21',
|
|
'interpreter': '-lLLVM-21',
|
|
'ipo': '-lLLVM-21',
|
|
'irprinter': '-lLLVM-21',
|
|
'irreader': '-lLLVM-21',
|
|
'jitlink': '-lLLVM-21',
|
|
'libdriver': '-lLLVM-21',
|
|
'lineeditor': '-lLLVM-21',
|
|
'linker': '-lLLVM-21',
|
|
'lto': '-lLLVM-21',
|
|
'mc': '-lLLVM-21',
|
|
'mca': '-lLLVM-21',
|
|
'mcdisassembler': '-lLLVM-21',
|
|
'mcjit': '-lLLVM-21',
|
|
'mcparser': '-lLLVM-21',
|
|
'mirparser': '-lLLVM-21',
|
|
'native': '-lLLVM-21',
|
|
'nativecodegen': '-lLLVM-21',
|
|
'objcarcopts': '-lLLVM-21',
|
|
'objcopy': '-lLLVM-21',
|
|
'object': '-lLLVM-21',
|
|
'objectyaml': '-lLLVM-21',
|
|
'option': '-lLLVM-21',
|
|
'orcdebugging': '-lLLVM-21',
|
|
'orcjit': '-lLLVM-21',
|
|
'orcshared': '-lLLVM-21',
|
|
'orctargetprocess': '-lLLVM-21',
|
|
'passes': '-lLLVM-21',
|
|
'profiledata': '-lLLVM-21',
|
|
'remarks': '-lLLVM-21',
|
|
'runtimedyld': '-lLLVM-21',
|
|
'sandboxir': '-lLLVM-21',
|
|
'scalaropts': '-lLLVM-21',
|
|
'selectiondag': '-lLLVM-21',
|
|
'support': '-lLLVM-21',
|
|
'symbolize': '-lLLVM-21',
|
|
'tablegen': '-lLLVM-21',
|
|
'target': '-lLLVM-21',
|
|
'targetparser': '-lLLVM-21',
|
|
'telemetry': '-lLLVM-21',
|
|
'textapi': '-lLLVM-21',
|
|
'textapibinaryreader': '-lLLVM-21',
|
|
'transformutils': '-lLLVM-21',
|
|
'vectorize': '-lLLVM-21',
|
|
'windowsdriver': '-lLLVM-21',
|
|
'windowsmanifest': '-lLLVM-21',
|
|
'x86': '-lLLVM-21',
|
|
'x86asmparser': '-lLLVM-21',
|
|
'x86codegen': '-lLLVM-21',
|
|
'x86desc': '-lLLVM-21',
|
|
'x86disassembler': '-lLLVM-21',
|
|
'x86info': '-lLLVM-21',
|
|
'x86targetmca': '-lLLVM-21',
|
|
'xray': '-lLLVM-21',
|
|
}
|
|
|
|
import os
|
|
import sys
|
|
|
|
def fail(message):
|
|
print("redox llvm-config failure", file=sys.stderr)
|
|
print(message, file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
prefix = os.environ["COOKBOOK_SYSROOT"]
|
|
|
|
args = []
|
|
link_static = False
|
|
for arg in sys.argv[1:]:
|
|
if arg == "--link-static":
|
|
link_static = True
|
|
elif arg == "--link-shared":
|
|
fail("shared linking disabled")
|
|
else:
|
|
args.append(arg)
|
|
|
|
if args == []:
|
|
fail("no arguments")
|
|
elif args == ["--version"]:
|
|
print("21.1.2")
|
|
elif args == ["--bindir"]:
|
|
print(prefix + "/bin")
|
|
elif args == ["--cppflags"]:
|
|
print("-I" + prefix + "/include -DEXPERIMENTAL_KEY_INSTRUCTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS")
|
|
elif args == ["--cxxflags"]:
|
|
print("-I" + prefix + "/include -std=c++17 -fno-exceptions -funwind-tables -DEXPERIMENTAL_KEY_INSTRUCTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS")
|
|
elif args == ["--components"]:
|
|
print(" ".join(components.keys()))
|
|
elif args == ["--includedir"]:
|
|
print(prefix + "/include")
|
|
elif args == ["--ldflags"]:
|
|
print("-L" + prefix + "/lib");
|
|
elif args == ["--libdir"]:
|
|
print(prefix + "/lib")
|
|
elif args == ["--system-libs"]:
|
|
print("")
|
|
elif args == ["--targets-built"]:
|
|
print("X86")
|
|
elif args[0] == "--libs":
|
|
libs = []
|
|
if len(args) == 1:
|
|
args.append("all")
|
|
for component in args[1:]:
|
|
for lib in components[component].split(" "):
|
|
libs.append(lib)
|
|
print(" ".join(libs))
|
|
elif args[0] == "--libfiles":
|
|
libs = []
|
|
if len(args) == 1:
|
|
args.append("all")
|
|
for component in args[1:]:
|
|
for lib in components[component].split(" "):
|
|
file = prefix + "/lib/lib" + lib[2:] + ".a"
|
|
libs.append(file)
|
|
print(" ".join(libs))
|
|
elif args == ["--has-rtti"]:
|
|
print("YES")
|
|
elif args[0] == "--shared-mode":
|
|
print("shared")
|
|
else:
|
|
fail("unknown arguments: " + " ".join(args))
|