# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/llvm/llvm.conf # Copyright (C) 2009 - 2024 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2. # --- T2-COPYRIGHT-NOTE-END --- runconf=0 cmake_mod() { tar $taropt `match_source_file -p cmake` -C .. mv -vf ../cmake-*src ../../cmake } hook_add preconf 5 cmake_mod [ "$SDECFG_SPARC64_32BIT" = 1 ] && var_append patchfiles " " "$confdir/*sparcv9*.diff" create_llvm_config_x() { # TODO: check -lz -lnucrses deps! local host=x86 [[ $arch = x86* ]] && host=NaN # TODO: != native llvm target cat <<-EOT > $root/TOOLCHAIN/$toolsdir/bin/llvm-config-x #!/bin/bash llvm-config "\$@" | sed \ -e 's, $host[^ ]*,,g' \\ -e 's,-L$root/TOOLCHAIN/cross/lib,-L$root$libdir,g' \\ -e 's,-I$root/TOOLCHAIN/cross/include,,g' \\ -e 's,-lLLVM,-lz -lncurses &,' EOT chmod +x $root/TOOLCHAIN/$toolsdir/bin/llvm-config-x } # TODO: Lanai MSP430 NVPTX VE DirectX # keep in sync w/ rustc! ;-) targets="AMDGPU;BPF;WebAssembly;host" # host for cross compilation xtargets="SPIRV" target="$arch_target" case $arch in arc) var_insert xtargets ';' 'ARC' ;; arm) var_insert targets ';' 'ARM' ;; avr) var_insert targets ';' 'AVR' ;; arm64) var_insert targets ';' 'AArch64' ;; csky) var_insert xtargets ';' 'CSKY' ;; hexagon) var_insert targets ';' 'Hexagon' ;; loongarch*) var_insert targets ';' 'Loongarch' ;; #m68k*) var_insert xtargets ';' 'M68k' ;; mips*) var_insert targets ';' 'Mips' ;; powerpc*) var_insert targets ';' 'PowerPC' ;; riscv*) var_insert targets ';' 'RISCV' ;; s390*) var_insert targets ';' 'SystemZ' ;; sparc*) var_insert targets ';' 'Sparc' ;; x86*) var_insert targets ';' 'X86' ;; xtensa) var_insert xtargets ';' 'Xtensa' ;; *) var_insert targets ';' 'X86'; target=x86-t2-linux-gnu ;; esac # TODO: fix and maybe add a config.in option? #var_append cmakeopt " " "-DLLVM_TARGETS_TO_BUILD='$targets'" var_append cmakeopt " " "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD='$xtargets'" var_append cmakeopt " " "-DLLVM_DEFAULT_TARGET_TRIPLE=$target" if atstage toolchain; then var_append cmakeopt " " "-DLLVM_HOST_TRIPLE=$arch_build" elif atstage cross; then var_append cmakeopt " " "-DLLVM_TABLEGEN=$root/TOOLCHAIN/$toolsdir/bin/llvm-tblgen" var_append cmakeopt " " "-DLLVM_CONFIG_PATH=$root/TOOLCHAIN/$toolsdir/bin/llvm-config" var_append GCC_WRAPPER_FILTER '|' "sed 's,^/lib64/libcurses.so,-lcurses,'" var_append GCC_WRAPPER_FILTER '|' "sed 's,$root/lib64/libcurses.so,-lcurses,'" hook_add premake 5 "create_llvm_config_x" fi [ "${libdir##*/lib}" ] && var_append cmakeopt " " "-DLLVM_LIBDIR_SUFFIX=${libdir##*/lib}" # builds libraries as static and links all of them into an unique shared one var_append cmakeopt " " "-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON" #var_append cmakeopt " " "-DBUILD_SHARED_LIBS=ON" var_append cmakeopt " " "-DLLVM_ENABLE_ZLIB=ON" var_append cmakeopt " " "-DLLVM_ENABLE_TERMINFO=OFF" var_append cmakeopt " " "-DLLVM_ENABLE_BACKTRACES=OFF" if pkginstalled binutils; then [ $stagelevel -gt 1 ] && var_append cmakeopt " " "-DLLVM_BINUTILS_INCDIR=$root/usr/include" atstage toolchain && var_append cmakeopt " " "-DLLVM_BINUTILS_INCDIR=$root/TOOLCHAIN/cross/usr/$arch_build/$arch_target/include" fi var_append cmakeopt " " "-DLLVM_ENABLE_RTTI=ON" # for Mesa? var_append cmakeopt " " "-DLLVM_BUILD_TESTS=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_INCLUDE_TESTS=OFF" var_append cmakeopt " " "-DLLVM_ENABLE_BINDINGS=OFF -DLLVM_INCLUDE_GO_TESTS=OFF" var_append cmakeopt " " "-DLLVM_ENABLE_ZSTD=OFF" # TODO: .a's need -lzstd? # required by rustc-1.81.x to link against the "llvm::machineinstr::dump() const" function var_append cmakeopt " " -DLLVM_ENABLE_DUMP=ON