llvm16: new recipe (#9141)

* llvm16: new recipe

* llvm16: clean up provides

* llvm16: fix build for secondary arch

* additional patches for lld

* llvm16: Alpha and CellSPU are no longer supported

* formatting

Co-authored-by: Sergei Reznikov <diver@gelios.net>

* llvm16: use python 3.10

* llvm16-clang: add missing GNU headers path

* build separate package for libunwind

* clang: silence warning for -pie

* clang: silence warning for -pthread and -pthreads

---------

Co-authored-by: Sergei Reznikov <diver@gelios.net>
This commit is contained in:
davidkaroly
2023-08-31 14:44:30 +02:00
committed by GitHub
parent 7a808fbcd6
commit b599df8a3c
2 changed files with 1731 additions and 0 deletions

View File

@@ -0,0 +1,692 @@
SUMMARY="Modular and reuseable compiler and toolchain technologies"
DESCRIPTION="LLVM is a collection of modular and reuseable compiler and and \
toolchain technologies. The LLVM compiler system for C and C++ includes the \
following:
- Front-ends for C, C++, Objective-C, Fortran, etc. based on the GCC 4.2 \
parsers. They support the ANSI-standard C and C++ languages to the same \
degree that GCC supports them. Additionally, many GCC extensions are \
supported.
- A stable implementation of the LLVM instruction set, which serves as both \
the online and offline code representation, together with assembly (ASCII) \
and bytecode (binary) readers and writers, and a verifier.
- A powerful pass-management system that automatically sequences passes \
(including analysis, transformation, and code-generation passes) based on \
their dependences, and pipelines them for efficiency.
- A wide range of global scalar optimizations.
- A link-time interprocedural optimization framework with a rich set of \
analyses and transformations, including sophisticated whole-program pointer \
analysis, call graph construction, and support for profile-guided optimizations.
- An easily retargettable code generator, which currently supports X86, \
X86-64, PowerPC, PowerPC-64, ARM, Thumb, SPARC, MIPS, MSP430, SystemZ, and XCore.
- A Just-In-Time (JIT) code generation system, which currently supports X86, \
X86-64, ARM, AArch64, Mips, SystemZ, PowerPC, and PowerPC-64.
- Support for generating DWARF debugging information.
- A C back-end useful for testing and for generating native code on targets \
other than the ones listed above.
- A profiling system similar to gprof.
- A test framework with a number of benchmark codes and applications.
- APIs and debugging tools to simplify rapid development of LLVM components."
HOMEPAGE="https://www.llvm.org/"
COPYRIGHT="2003-2023 University of Illinois at Urbana-Champaign"
LICENSE="Apache v2 with LLVM Exception"
REVISION="1"
SOURCE_URI="https://github.com/llvm/llvm-project/releases/download/llvmorg-$portVersion/llvm-project-$portVersion.src.tar.xz"
CHECKSUM_SHA256="ce5e71081d17ce9e86d7cbcfa28c4b04b9300f8fb7e78422b1feb6bc52c3028e"
SOURCE_DIR="llvm-project-$portVersion.src"
PATCHES="llvm16-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
portVersionCompat="$portVersion compat >= ${portVersion%%.*}"
PROVIDES="
llvm16$secondaryArchSuffix = $portVersionCompat
cmd:amdgpu_arch
cmd:analyze_build
cmd:bugpoint
cmd:diagtool
cmd:dsymutil
cmd:find_all_symbols
cmd:hmaptool
cmd:intercept_build
cmd:llc
cmd:lli
cmd:llvm_addr2line
cmd:llvm_ar
cmd:llvm_as
cmd:llvm_bcanalyzer
cmd:llvm_bitcode_strip
cmd:llvm_c_test
cmd:llvm_cat
cmd:llvm_cfi_verify
cmd:llvm_config = $portVersionCompat
cmd:llvm_cov
cmd:llvm_cvtres
cmd:llvm_cxxdump
cmd:llvm_cxxfilt
cmd:llvm_cxxmap
cmd:llvm_debuginfo_analyzer
cmd:llvm_debuginfod
cmd:llvm_debuginfod_find
cmd:llvm_diff
cmd:llvm_dis
cmd:llvm_dlltool
cmd:llvm_dwarfdump
cmd:llvm_dwarfutil
cmd:llvm_dwp
cmd:llvm_exegesis
cmd:llvm_extract
cmd:llvm_gsymutil
cmd:llvm_ifs
cmd:llvm_install_name_tool
cmd:llvm_jitlink
cmd:llvm_lib
cmd:llvm_libtool_darwin
cmd:llvm_link
cmd:llvm_lipo
cmd:llvm_lto
cmd:llvm_lto2
cmd:llvm_mc
cmd:llvm_mca
cmd:llvm_ml
cmd:llvm_modextract
cmd:llvm_mt
cmd:llvm_nm
cmd:llvm_objcopy
cmd:llvm_objdump
cmd:llvm_opt_report
cmd:llvm_otool
cmd:llvm_pdbutil
cmd:llvm_profdata
cmd:llvm_profgen
cmd:llvm_ranlib
cmd:llvm_rc
cmd:llvm_readelf
cmd:llvm_readobj
cmd:llvm_reduce
cmd:llvm_remark_size_diff
cmd:llvm_remarkutil
cmd:llvm_rtdyld
cmd:llvm_sim
cmd:llvm_size
cmd:llvm_split
cmd:llvm_stress
cmd:llvm_strings
cmd:llvm_strip
cmd:llvm_symbolizer
cmd:llvm_tapi_diff
cmd:llvm_tblgen
cmd:llvm_tli_checker
cmd:llvm_undname
cmd:llvm_windres
cmd:llvm_xray
cmd:nvptx_arch
cmd:opt
cmd:pp_trace
cmd:run_clang_tidy
cmd:sancov
cmd:sanstats
cmd:scan_build_py
cmd:verify_uselistorder
devel:libfindAllSymbols$secondaryArchSuffix
devel:libLLVM$secondaryArchSuffix = $portVersionCompat
devel:libLLVM_$portVersion$secondaryArchSuffix = $portVersionCompat
devel:libLLVM_16$secondaryArchSuffix = $portVersionCompat
devel:libLLVMAArch64AsmParser$secondaryArchSuffix
devel:libLLVMAArch64CodeGen$secondaryArchSuffix
devel:libLLVMAArch64Desc$secondaryArchSuffix
devel:libLLVMAArch64Disassembler$secondaryArchSuffix
devel:libLLVMAArch64Info$secondaryArchSuffix
devel:libLLVMAArch64Utils$secondaryArchSuffix
devel:libLLVMAMDGPUAsmParser$secondaryArchSuffix
devel:libLLVMAMDGPUCodeGen$secondaryArchSuffix
devel:libLLVMAMDGPUDesc$secondaryArchSuffix
devel:libLLVMAMDGPUDisassembler$secondaryArchSuffix
devel:libLLVMAMDGPUInfo$secondaryArchSuffix
devel:libLLVMAMDGPUTargetMCA$secondaryArchSuffix
devel:libLLVMAMDGPUUtils$secondaryArchSuffix
devel:libLLVMARMAsmParser$secondaryArchSuffix
devel:libLLVMARMCodeGen$secondaryArchSuffix
devel:libLLVMARMDesc$secondaryArchSuffix
devel:libLLVMARMDisassembler$secondaryArchSuffix
devel:libLLVMARMInfo$secondaryArchSuffix
devel:libLLVMARMUtils$secondaryArchSuffix
devel:libLLVMAggressiveInstCombine$secondaryArchSuffix
devel:libLLVMAnalysis$secondaryArchSuffix
devel:libLLVMAsmParser$secondaryArchSuffix
devel:libLLVMAsmPrinter$secondaryArchSuffix
devel:libLLVMBinaryFormat$secondaryArchSuffix
devel:libLLVMBitReader$secondaryArchSuffix
devel:libLLVMBitWriter$secondaryArchSuffix
devel:libLLVMBitstreamReader$secondaryArchSuffix
devel:libLLVMCFGuard$secondaryArchSuffix
devel:libLLVMCFIVerify$secondaryArchSuffix
devel:libLLVMCodeGen$secondaryArchSuffix
devel:libLLVMCore$secondaryArchSuffix
devel:libLLVMCoroutines$secondaryArchSuffix
devel:libLLVMCoverage$secondaryArchSuffix
devel:libLLVMDebugInfoCodeView$secondaryArchSuffix
devel:libLLVMDebugInfoDWARF$secondaryArchSuffix
devel:libLLVMDebugInfoGSYM$secondaryArchSuffix
devel:libLLVMDebugInfoLogicalView$secondaryArchSuffix
devel:libLLVMDebugInfoMSF$secondaryArchSuffix
devel:libLLVMDebugInfoPDB$secondaryArchSuffix
devel:libLLVMDebuginfod$secondaryArchSuffix
devel:libLLVMDemangle$secondaryArchSuffix
devel:libLLVMDiff$secondaryArchSuffix
devel:libLLVMDlltoolDriver$secondaryArchSuffix
devel:libLLVMDWARFLinker$secondaryArchSuffix
devel:libLLVMDWARFLinkerParallel$secondaryArchSuffix
devel:libLLVMDWP$secondaryArchSuffix
devel:libLLVMExecutionEngine$secondaryArchSuffix
devel:libLLVMExegesis$secondaryArchSuffix
devel:libLLVMExegesisAArch64$secondaryArchSuffix
devel:libLLVMExegesisX86$secondaryArchSuffix
devel:libLLVMExtensions$secondaryArchSuffix
devel:libLLVMFileCheck$secondaryArchSuffix
devel:libLLVMFrontendHLSL$secondaryArchSuffix
devel:libLLVMFrontendOpenAcc$secondaryArchSuffix
devel:libLLVMFrontendOpenMP$secondaryArchSuffix
devel:libLLVMFuzzMutate$secondaryArchSuffix
devel:libLLVMFuzzerCLI$secondaryArchSuffix
devel:libLLVMGlobalISel$secondaryArchSuffix
devel:libLLVMIRPrinter$secondaryArchSuffix
devel:libLLVMIRReader$secondaryArchSuffix
devel:libLLVMInstCombine$secondaryArchSuffix
devel:libLLVMInstrumentation$secondaryArchSuffix
devel:libLLVMInterfaceStub$secondaryArchSuffix
devel:libLLVMInterpreter$secondaryArchSuffix
devel:libLLVMJITLink$secondaryArchSuffix
devel:libLLVMLTO$secondaryArchSuffix
devel:libLLVMLibDriver$secondaryArchSuffix
devel:libLLVMLineEditor$secondaryArchSuffix
devel:libLLVMLinker$secondaryArchSuffix
devel:libLLVMMC$secondaryArchSuffix
devel:libLLVMMCA$secondaryArchSuffix
devel:libLLVMMCDisassembler$secondaryArchSuffix
devel:libLLVMMCJIT$secondaryArchSuffix
devel:libLLVMMCParser$secondaryArchSuffix
devel:libLLVMMIRParser$secondaryArchSuffix
devel:libLLVMObjCARCOpts$secondaryArchSuffix
devel:libLLVMObjCopy$secondaryArchSuffix
devel:libLLVMObject$secondaryArchSuffix
devel:libLLVMObjectYAML$secondaryArchSuffix
devel:libLLVMOption$secondaryArchSuffix
devel:libLLVMOrcJIT$secondaryArchSuffix
devel:libLLVMOrcShared$secondaryArchSuffix
devel:libLLVMOrcTargetProcess$secondaryArchSuffix
devel:libLLVMPasses$secondaryArchSuffix
devel:libLLVMProfileData$secondaryArchSuffix
devel:libLLVMRISCVAsmParser$secondaryArchSuffix
devel:libLLVMRISCVCodeGen$secondaryArchSuffix
devel:libLLVMRISCVDesc$secondaryArchSuffix
devel:libLLVMRISCVDisassembler$secondaryArchSuffix
devel:libLLVMRISCVInfo$secondaryArchSuffix
devel:libLLVMRISCVTargetMCA$secondaryArchSuffix
devel:libLLVMRemarks$secondaryArchSuffix
devel:libLLVMRuntimeDyld$secondaryArchSuffix
devel:libLLVMScalarOpts$secondaryArchSuffix
devel:libLLVMSelectionDAG$secondaryArchSuffix
devel:libLLVMSupport$secondaryArchSuffix
devel:libLLVMSymbolize$secondaryArchSuffix
devel:libLLVMTableGen$secondaryArchSuffix
devel:libLLVMTableGenGlobalISel$secondaryArchSuffix
devel:libLLVMTarget$secondaryArchSuffix
devel:libLLVMTargetParser$secondaryArchSuffix
devel:libLLVMTextAPI$secondaryArchSuffix
devel:libLLVMTransformUtils$secondaryArchSuffix
devel:libLLVMVectorize$secondaryArchSuffix
devel:libLLVMWebAssemblyAsmParser$secondaryArchSuffix
devel:libLLVMWebAssemblyCodeGen$secondaryArchSuffix
devel:libLLVMWebAssemblyDesc$secondaryArchSuffix
devel:libLLVMWebAssemblyDisassembler$secondaryArchSuffix
devel:libLLVMWebAssemblyInfo$secondaryArchSuffix
devel:libLLVMWebAssemblyUtils$secondaryArchSuffix
devel:libLLVMWindowsDriver$secondaryArchSuffix
devel:libLLVMWindowsManifest$secondaryArchSuffix
devel:libLLVMX86AsmParser$secondaryArchSuffix
devel:libLLVMX86CodeGen$secondaryArchSuffix
devel:libLLVMX86Desc$secondaryArchSuffix
devel:libLLVMX86Disassembler$secondaryArchSuffix
devel:libLLVMX86Info$secondaryArchSuffix
devel:libLLVMX86TargetMCA$secondaryArchSuffix
devel:libLLVMXRay$secondaryArchSuffix
devel:libLLVMipo$secondaryArchSuffix
devel:libLTO$secondaryArchSuffix = $portVersionCompat
devel:libRemarks$secondaryArchSuffix = $portVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libclang_cpp$secondaryArchSuffix
lib:libLLVM_16$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
CONFLICTS="
llvm$secondaryArchSuffix
llvm6$secondaryArchSuffix
llvm7$secondaryArchSuffix
llvm8$secondaryArchSuffix
llvm9$secondaryArchSuffix
llvm12$secondaryArchSuffix
llvm13$secondaryArchSuffix
llvm14$secondaryArchSuffix
llvm15$secondaryArchSuffix
"
PROVIDES_clang="
llvm16${secondaryArchSuffix}_clang = $portVersion
cmd:c_index_test = $portVersion
cmd:clang = $portVersion
cmd:clang++ = $portVersion
cmd:clang_16 = $portVersion
cmd:clang_apply_replacements = $portVersion
cmd:clang_change_namespace = $portVersion
cmd:clang_check = $portVersion
cmd:clang_cl = $portVersion
cmd:clang_cpp = $portVersion
cmd:clang_doc = $portVersion
cmd:clang_extdef_mapping = $portVersion
cmd:clang_format = $portVersion
cmd:clang_include_cleaner = $portVersion
cmd:clang_include_fixer = $portVersion
cmd:clang_linker_wrapper = $portVersion
cmd:clang_move = $portVersion
cmd:clang_offload_bundler = $portVersion
cmd:clang_offload_packager = $portVersion
cmd:clang_pseudo = $portVersion
cmd:clang_query = $portVersion
cmd:clang_refactor = $portVersion
cmd:clang_rename = $portVersion
cmd:clang_reorder_fields = $portVersion
cmd:clang_repl = $portVersion
cmd:clang_scan_deps = $portVersion
cmd:clang_tidy = $portVersion
cmd:clang_tblgen = $portVersion
cmd:clangd = $portVersion
cmd:git_clang_format = $portVersion
cmd:modularize = $portVersion
devel:libclang$secondaryArchSuffix = $portVersionCompat
devel:libclang_cpp$secondaryArchSuffix = $portVersionCompat
devel:libclanganalysis$secondaryArchSuffix = $portVersion
devel:libclanganalysisflowsensitive$secondaryArchSuffix = $portVersion
devel:libclanganalysisflowsensitivemodels$secondaryArchSuffix = $portVersion
devel:libclangapinotes$secondaryArchSuffix = $portVersion
devel:libclangapplyreplacements$secondaryArchSuffix = $portVersion
devel:libclangarcmigrate$secondaryArchSuffix = $portVersion
devel:libclangast$secondaryArchSuffix = $portVersion
devel:libclangastmatchers$secondaryArchSuffix = $portVersion
devel:libclangbasic$secondaryArchSuffix = $portVersion
devel:libclangchangenamespace$secondaryArchSuffix = $portVersion
devel:libclangcodegen$secondaryArchSuffix = $portVersion
devel:libclangcrosstu$secondaryArchSuffix = $portVersion
devel:libclangdaemon$secondaryArchSuffix = $portVersion
devel:libclangdaemontweaks$secondaryArchSuffix = $portVersion
devel:libclangdependencyscanning$secondaryArchSuffix = $portVersion
devel:libclangdoc$secondaryArchSuffix = $portVersion
devel:libclangdirectorywatcher$secondaryArchSuffix = $portVersion
devel:libclangdremoteindex$secondaryArchSuffix = $portVersion
devel:libclangdriver$secondaryArchSuffix = $portVersion
devel:libclangdsupport$secondaryArchSuffix = $portVersion
devel:libclangdynamicastmatchers$secondaryArchSuffix = $portVersion
devel:libclangedit$secondaryArchSuffix = $portVersion
devel:libclangextractapi$secondaryArchSuffix = $portVersion
devel:libclangformat$secondaryArchSuffix = $portVersion
devel:libclangfrontend$secondaryArchSuffix = $portVersion
devel:libclangfrontendtool$secondaryArchSuffix = $portVersion
devel:libclanghandlecxx$secondaryArchSuffix = $portVersion
devel:libclanghandlellvm$secondaryArchSuffix = $portVersion
devel:libclangincludecleaner$secondaryArchSuffix = $portVersion
devel:libclangincludefixer$secondaryArchSuffix = $portVersion
devel:libclangincludefixerplugin$secondaryArchSuffix = $portVersion
devel:libclangindex$secondaryArchSuffix = $portVersion
devel:libclangindexserialization$secondaryArchSuffix = $portVersion
devel:libclanginterpreter$secondaryArchSuffix = $portVersion
devel:libclanglex$secondaryArchSuffix = $portVersion
devel:libclangmove$secondaryArchSuffix = $portVersion
devel:libclangparse$secondaryArchSuffix = $portVersion
devel:libclangpseudo$secondaryArchSuffix = $portVersion
devel:libclangpseudocli$secondaryArchSuffix = $portVersion
devel:libclangpseudocxx$secondaryArchSuffix = $portVersion
devel:libclangpseudogrammar$secondaryArchSuffix = $portVersion
devel:libclangquery$secondaryArchSuffix = $portVersion
devel:libclangreorderfields$secondaryArchSuffix = $portVersion
devel:libclangrewrite$secondaryArchSuffix = $portVersion
devel:libclangrewritefrontend$secondaryArchSuffix = $portVersion
devel:libclangsema$secondaryArchSuffix = $portVersion
devel:libclangserialization$secondaryArchSuffix = $portVersion
devel:libclangstaticanalyzercheckers$secondaryArchSuffix = $portVersion
devel:libclangstaticanalyzercore$secondaryArchSuffix = $portVersion
devel:libclangstaticanalyzerfrontend$secondaryArchSuffix = $portVersion
devel:libclangsupport$secondaryArchSuffix = $portVersion
devel:libclangtidy$secondaryArchSuffix = $portVersion
devel:libclangtidyabseilmodule$secondaryArchSuffix = $portVersion
devel:libclangtidyalteramodule$secondaryArchSuffix = $portVersion
devel:libclangtidyandroidmodule$secondaryArchSuffix = $portVersion
devel:libclangtidyboostmodule$secondaryArchSuffix = $portVersion
devel:libclangtidybugpronemodule$secondaryArchSuffix = $portVersion
devel:libclangtidycertmodule$secondaryArchSuffix = $portVersion
devel:libclangtidyconcurrencymodule$secondaryArchSuffix = $portVersion
devel:libclangtidycppcoreguidelinesmodule$secondaryArchSuffix = $portVersion
devel:libclangtidydarwinmodule$secondaryArchSuffix = $portVersion
devel:libclangtidyfuchsiamodule$secondaryArchSuffix = $portVersion
devel:libclangtidygooglemodule$secondaryArchSuffix = $portVersion
devel:libclangtidyhicppmodule$secondaryArchSuffix = $portVersion
devel:libclangtidylinuxkernelmodule$secondaryArchSuffix = $portVersion
devel:libclangtidyllvmlibcmodule$secondaryArchSuffix = $portVersion
devel:libclangtidyllvmmodule$secondaryArchSuffix = $portVersion
devel:libclangtidymain$secondaryArchSuffix = $portVersion
devel:libclangtidymiscmodule$secondaryArchSuffix = $portVersion
devel:libclangtidymodernizemodule$secondaryArchSuffix = $portVersion
devel:libclangtidympimodule$secondaryArchSuffix = $portVersion
devel:libclangtidyobjcmodule$secondaryArchSuffix = $portVersion
devel:libclangtidyopenmpmodule$secondaryArchSuffix = $portVersion
devel:libclangtidyperformancemodule$secondaryArchSuffix = $portVersion
devel:libclangtidyplugin$secondaryArchSuffix = $portVersion
devel:libclangtidyportabilitymodule$secondaryArchSuffix = $portVersion
devel:libclangtidyreadabilitymodule$secondaryArchSuffix = $portVersion
devel:libclangtidyutils$secondaryArchSuffix = $portVersion
devel:libclangtidyzirconmodule$secondaryArchSuffix = $portVersion
devel:libclangtooling$secondaryArchSuffix = $portVersion
devel:libclangtoolingastdiff$secondaryArchSuffix = $portVersion
devel:libclangtoolingcore$secondaryArchSuffix = $portVersion
devel:libclangtoolinginclusions$secondaryArchSuffix = $portVersion
devel:libclangtoolinginclusionsstdlib$secondaryArchSuffix = $portVersion
devel:libclangtoolingrefactoring$secondaryArchSuffix = $portVersion
devel:libclangtoolingsyntax$secondaryArchSuffix = $portVersion
devel:libclangtransformer$secondaryArchSuffix = $portVersion
"
REQUIRES_clang="
haiku$secondaryArchSuffix
lib:libclang$secondaryArchSuffix
lib:libclang_cpp$secondaryArchSuffix
lib:libLLVM_16$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
CONFLICTS_clang="
llvm${secondaryArchSuffix}_clang
llvm6${secondaryArchSuffix}_clang
llvm7${secondaryArchSuffix}_clang
llvm8${secondaryArchSuffix}_clang
llvm9${secondaryArchSuffix}_clang
llvm12${secondaryArchSuffix}_clang
llvm13${secondaryArchSuffix}_clang
llvm14${secondaryArchSuffix}_clang
llvm15${secondaryArchSuffix}_clang
"
PROVIDES_clang_analysis="
llvm16${secondaryArchSuffix}_clang_analysis = $portVersion
cmd:scan_build = $portVersion
cmd:scan_view = $portVersion
"
REQUIRES_clang_analysis="
llvm16${secondaryArchSuffix}_clang == $portVersion base
cmd:python3
"
CONFLICTS_clang_analysis="
llvm${secondaryArchSuffix}_clang_analysis
llvm6${secondaryArchSuffix}_clang_analysis
llvm7${secondaryArchSuffix}_clang_analysis
llvm8${secondaryArchSuffix}_clang_analysis
llvm9${secondaryArchSuffix}_clang_analysis
llvm12${secondaryArchSuffix}_clang_analysis
llvm13${secondaryArchSuffix}_clang_analysis
llvm14${secondaryArchSuffix}_clang_analysis
llvm15${secondaryArchSuffix}_clang_analysis
"
PROVIDES_lld="
llvm16${secondaryArchSuffix}_lld = $portVersion
cmd:ld.lld = $portVersion
cmd:ld64.lld = $portVersion
cmd:lld = $portVersion
cmd:lld_link = $portVersion
cmd:wasm_ld = $portVersion
devel:liblldCOFF$secondaryArchSuffix = $portVersion
devel:liblldCommon$secondaryArchSuffix = $portVersion
devel:liblldELF$secondaryArchSuffix = $portVersion
devel:liblldMinGW$secondaryArchSuffix = $portVersion
devel:liblldWasm$secondaryArchSuffix = $portVersion
"
REQUIRES_lld="
haiku$secondaryArchSuffix
lib:libLLVM_16$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
PROVIDES_libs="
llvm16${secondaryArchSuffix}_libs = $portVersion
lib:libclang_cpp$secondaryArchSuffix = $portVersionCompat
lib:libLLVM_16$secondaryArchSuffix = $portVersionCompat
lib:libLTO$secondaryArchSuffix = $portVersionCompat
lib:libRemarks$secondaryArchSuffix = $portVersionCompat
"
REQUIRES_libs="
haiku$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
PYTHON3_VERSION="3.10"
PROVIDES_python310="
llvm16${secondaryArchSuffix}_python310 = $portVersion
cmd:lit
"
REQUIRES_python310="
setuptools_python310
cmd:python$PYTHON3_VERSION
"
libunwindSoVersion="1"
libunwindLibVersion="1.0"
SUMMARY_libunwind="LLVM Unwinder - libunwind"
DESCRIPTION_libunwind="libunwind is an implementation of the interface defined \
by the HP libunwind project. It was contributed by Apple as a way to enable \
clang++ to port to platforms that do not have a system unwinder. It is \
intended to be a small and fast implementation of the ABI, leaving off some \
features of HP's libunwind that never materialized (e.g. remote unwinding).
The unwinder has two levels of API. The high level APIs are the _Unwind_* \
functions which implement functionality required by __cxa_* exception \
functions. The low level APIs are the unw_* functions which are an \
interface defined by the old HP libunwind project."
PROVIDES_libunwind="
llvm16${secondaryArchSuffix}_libunwind = $portVersion
lib:libunwind$secondaryArchSuffix = $libunwindLibVersion compat >= $libunwindSoVersion
"
REQUIRES_libunwind="
haiku$secondaryArchSuffix
"
SUMMARY_libunwind_devel="Headers and static libraries for LLVM Unwinder - libunwind"
DESCRIPTION_libunwind_devel="libunwind is an implementation of the interface \
defined by the HP libunwind project. It was contributed by Apple as a way to \
enable clang++ to port to platforms that do not have a system unwinder. It is \
intended to be a small and fast implementation of the ABI, leaving off some \
features of HP's libunwind that never materialized (e.g. remote unwinding).
The unwinder has two levels of API. The high level APIs are the _Unwind_* \
functions which implement functionality required by __cxa_* exception \
functions. The low level APIs are the unw_* functions which are an \
interface defined by the old HP libunwind project."
PROVIDES_libunwind_devel="
llvm16${secondaryArchSuffix}_libunwind_devel = $portVersion
devel:libunwind$secondaryArchSuffix = $libunwindLibVersion compat >= $libunwindSoVersion
"
REQUIRES_libunwind_devel="
llvm16${secondaryArchSuffix}_libunwind == $portVersion base
haiku${secondaryArchSuffix}_devel
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libz$secondaryArchSuffix
setuptools_python310
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:diff
cmd:find
cmd:gcc$secondaryArchSuffix
cmd:grep
cmd:groff
cmd:ld$secondaryArchSuffix
cmd:make
cmd:ninja
cmd:python$PYTHON3_VERSION
cmd:sed
"
BUILD()
{
local cmakeFlags
if [ -n "$secondaryArchSuffix" ]; then
cmakeFlags=-DHAIKU_HYBRID_SECONDARY="\"${effectiveTargetArchitecture}\""
cmakeFlags="$cmakeFlags -DLLVM_LIBDIR_SUFFIX=/${effectiveTargetArchitecture}"
fi
# Haiku C++ requires rtti in a lot of central system components
# such as Mesa
# LLVM in default targets AArch64, AMDGPU, ARM, AVR, BPF, Hexagon, Lanai, \
# Mips, MSP430, NVPTX, PowerPC, RISCV, Sparc, SystemZ, WebAssembly, X86, \
# XCore on Haiku. There is currently no good reason to build all of those.
if [ "$targetArchitecture" = x86_gcc2 ];then
export LIBRARY_PATH=$LIBRARY_PATH:$sourceDir/build/lib/x86
else
export LIBRARY_PATH=$LIBRARY_PATH:$sourceDir/build/lib
fi
cmake -S llvm -B build -G Ninja \
$cmakeDirArgs \
-DCMAKE_BUILD_TYPE=Release \
$cmakeFlags \
-DCMAKE_SKIP_RPATH=YES \
-DCOMPILER_RT_BUILD_SANITIZERS=OFF \
-DLLVM_ENABLE_RTTI=ON -DLLVM_LINK_LLVM_DYLIB=YES \
-DLIBUNWIND_ENABLE_STATIC=OFF \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;compiler-rt" \
-DLLVM_ENABLE_RUNTIMES="libunwind" \
-DLLVM_TARGETS_TO_BUILD="AArch64;AMDGPU;ARM;RISCV;WebAssembly;X86"
cmake --build build $jobArgs
}
INSTALL()
{
cmake --install build
cd build
mkdir -p $binDir $developDir $dataDir $docDir $includeDir $manDir $libDir
# GENERIC: all python_setuptools-based installs need this
local pythonPackageName="${portName}_python310-$portFullVersion"
local packageLinksDir=$(dirname $portPackageLinksDir)
python=$packageLinksDir/${pythonPackageName}/cmd~python$PYTHON3_VERSION/bin/python$PYTHON3_VERSION
pythonVersion=$($python --version 2>&1 | sed 's/Python //' | head -c3)
installLocation=$prefix/lib/python$pythonVersion/vendor-packages/
export PYTHONPATH=$installLocation:$OLDPYTHONPATH
pushd ../llvm/utils/lit
$python setup.py install --root=/ --prefix="$prefix" -O1
popd
if [ -n "$secondaryArchSuffix" ]; then
mv $binDir/* $prefix/bin/
binDir=$prefix/bin
fi
# You can try and be fancy here parsing each arch in a for loop... but
# not all arches contain the same libraries. The inventory for each arch
# also changes between releases... so lets KISS.
prepareInstalledDevelLibs \
libfindAllSymbols \
libLLVM* \
libLTO \
libclang* \
liblld* \
libRemarks \
$effectiveTargetMachineTriple/libunwind
# adjust cmake library paths because prepareInstalledDevelLibs moved them
sed -i 's,\${_IMPORT_PREFIX}/lib/,\${_IMPORT_PREFIX}/develop/lib/,' \
$libDir/cmake/clang/ClangTargets-release.cmake \
$libDir/cmake/lld/LLDTargets-release.cmake \
$libDir/cmake/llvm/LLVMExports-release.cmake
sed -i 's|/libexec/|/bin/|' $binDir/scan-build
sed -i 's|/share/|/data/|' $binDir/scan-build $binDir/scan-view
mv $prefix/include/* $includeDir/
rmdir $prefix/include
# clang package
packageEntries clang \
$binDir/c-index-test \
$binDir/clang* \
$binDir/git-clang-format \
$binDir/modularize \
$dataDir/clang \
$includeDir/clang* \
$libDir/clang \
$libDir/cmake/clang \
$developLibDir/libclang*
# analysis package
packageEntries clang_analysis \
$binDir/scan-build \
$binDir/scan-view \
$libExecDir/c++-analyzer \
$libExecDir/ccc-analyzer \
$dataDir/scan-build \
$dataDir/scan-view \
$manDir/man1/scan-build.1
# lld package
packageEntries lld \
$binDir/ld.lld \
$binDir/ld64.lld \
$binDir/lld \
$binDir/lld-link \
$binDir/wasm-ld \
$includeDir/lld* \
$developLibDir/liblld*
# libs package
packageEntries libs \
$libDir/libclang* \
$libDir/libLLVM* \
$libDir/libLTO* \
$libDir/libRemarks*
# python310 package
packageEntries python310 \
$binDir/lit \
$prefix/lib/python*
# libunwind package
packageEntries libunwind \
$libDir/$effectiveTargetMachineTriple/libunwind*
packageEntries libunwind_devel \
$developLibDir/libunwind* \
$includeDir/unwind*.h \
$includeDir/libunwind*.h \
$includeDir/libunwind.modulemap \
$includeDir/__libunwind*.h \
$includeDir/mach-o/compact_unwind_encoding.h \
$includeDir/mach-o/compact_unwind_encoding.modulemap
}
TEST()
{
export LIT_ARGS="-v"
if [ "$targetArchitecture" = x86_gcc2 ];then
export LIBRARY_PATH=$LIBRARY_PATH:$sourceDir/build/lib/x86
else
export LIBRARY_PATH=$LIBRARY_PATH:$sourceDir/build/lib
fi
ninja -C build check-llvm
}

File diff suppressed because it is too large Load Diff