From af71601d67f0ba19cd8aee7092e3e659153ff792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sun, 31 Aug 2025 10:10:02 +0200 Subject: [PATCH] llvm21: new recipe --- sys-devel/llvm/llvm21-21.1.0.recipe | 913 ++++++++++++++++++ sys-devel/llvm/patches/llvm21-21.1.0.patchset | 428 ++++++++ 2 files changed, 1341 insertions(+) create mode 100644 sys-devel/llvm/llvm21-21.1.0.recipe create mode 100644 sys-devel/llvm/patches/llvm21-21.1.0.patchset diff --git a/sys-devel/llvm/llvm21-21.1.0.recipe b/sys-devel/llvm/llvm21-21.1.0.recipe new file mode 100644 index 000000000..493dbb7ac --- /dev/null +++ b/sys-devel/llvm/llvm21-21.1.0.recipe @@ -0,0 +1,913 @@ +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-2025 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="1672e3efb4c2affd62dbbe12ea898b28a451416c7d95c1bd0190c26cbe878825" +SOURCE_DIR="llvm-project-$portVersion.src" +PATCHES="llvm21-$portVersion.patchset" + +ARCHITECTURES="all !x86_gcc2" +SECONDARY_ARCHITECTURES="?x86" + +portVersionCompat="$portVersion compat >= ${portVersion%%.*}" + +PROVIDES=" + llvm21$secondaryArchSuffix = $portVersionCompat + cmd:bugpoint + cmd:dsymutil + 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_cgdata + cmd:llvm_config = $portVersionCompat + cmd:llvm_cov + cmd:llvm_ctxprof_util + 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_ml64 + 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_readtapi + cmd:llvm_reduce + 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_tblgen + cmd:llvm_tli_checker + cmd:llvm_undname + cmd:llvm_windres + cmd:llvm_xray + cmd:offload_arch + cmd:opt + cmd:reduce_chunk_list + cmd:sancov + cmd:sanstats + cmd:verify_uselistorder + devel:libfindAllSymbols$secondaryArchSuffix + devel:libLLVM$secondaryArchSuffix = $portVersionCompat + devel:libLLVM_21$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:libLLVMAVRAsmParser$secondaryArchSuffix + devel:libLLVMAVRCodeGen$secondaryArchSuffix + devel:libLLVMAVRDesc$secondaryArchSuffix + devel:libLLVMAVRDisassembler$secondaryArchSuffix + devel:libLLVMAVRInfo$secondaryArchSuffix + devel:libLLVMAggressiveInstCombine$secondaryArchSuffix + devel:libLLVMAnalysis$secondaryArchSuffix + devel:libLLVMAsmParser$secondaryArchSuffix + devel:libLLVMAsmPrinter$secondaryArchSuffix + devel:libLLVMBPFAsmParser$secondaryArchSuffix + devel:libLLVMBPFCodeGen$secondaryArchSuffix + devel:libLLVMBPFDesc$secondaryArchSuffix + devel:libLLVMBPFDisassembler$secondaryArchSuffix + devel:libLLVMBPFInfo$secondaryArchSuffix + devel:libLLVMBinaryFormat$secondaryArchSuffix + devel:libLLVMBitReader$secondaryArchSuffix + devel:libLLVMBitWriter$secondaryArchSuffix + devel:libLLVMBitstreamReader$secondaryArchSuffix + devel:libLLVMCFGuard$secondaryArchSuffix + devel:libLLVMCGData$secondaryArchSuffix + devel:libLLVMCFIVerify$secondaryArchSuffix + devel:libLLVMCodeGen$secondaryArchSuffix + devel:libLLVMCodeGenData$secondaryArchSuffix + devel:libLLVMCodeGenTypes$secondaryArchSuffix + devel:libLLVMCore$secondaryArchSuffix + devel:libLLVMCoroutines$secondaryArchSuffix + devel:libLLVMCoverage$secondaryArchSuffix + devel:libLLVMDebugInfoBTF$secondaryArchSuffix + devel:libLLVMDebugInfoCodeView$secondaryArchSuffix + devel:libLLVMDebugInfoDWARF$secondaryArchSuffix + devel:libLLVMDebugInfoDWARFLowLevel$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:libLLVMDWARFCFIChecker$secondaryArchSuffix + devel:libLLVMDWARFLinker$secondaryArchSuffix + devel:libLLVMDWARFLinkerClassic$secondaryArchSuffix + devel:libLLVMDWARFLinkerParallel$secondaryArchSuffix + devel:libLLVMDWP$secondaryArchSuffix + devel:libLLVMExecutionEngine$secondaryArchSuffix + devel:libLLVMExegesis$secondaryArchSuffix + devel:libLLVMExegesisAArch64$secondaryArchSuffix + devel:libLLVMExegesisMips$secondaryArchSuffix + devel:libLLVMExegesisPowerPC$secondaryArchSuffix + devel:libLLVMExegesisRISCV$secondaryArchSuffix + devel:libLLVMExegesisX86$secondaryArchSuffix + devel:libLLVMExtensions$secondaryArchSuffix + devel:libLLVMFileCheck$secondaryArchSuffix + devel:libLLVMFrontendAtomic$secondaryArchSuffix + devel:libLLVMFrontendDirective$secondaryArchSuffix + devel:libLLVMFrontendDriver$secondaryArchSuffix + devel:libLLVMFrontendHLSL$secondaryArchSuffix + devel:libLLVMFrontendOffloading$secondaryArchSuffix + devel:libLLVMFrontendOpenAcc$secondaryArchSuffix + devel:libLLVMFrontendOpenMP$secondaryArchSuffix + devel:libLLVMFuzzMutate$secondaryArchSuffix + devel:libLLVMFuzzerCLI$secondaryArchSuffix + devel:libLLVMGlobalISel$secondaryArchSuffix + devel:libLLVMHexagonAsmParser$secondaryArchSuffix + devel:libLLVMHexagonCodeGen$secondaryArchSuffix + devel:libLLVMHexagonDesc$secondaryArchSuffix + devel:libLLVMHexagonDisassembler$secondaryArchSuffix + devel:libLLVMHexagonInfo$secondaryArchSuffix + devel:libLLVMHipStdPar$secondaryArchSuffix + devel:libLLVMIRPrinter$secondaryArchSuffix + devel:libLLVMIRReader$secondaryArchSuffix + devel:libLLVMInstCombine$secondaryArchSuffix + devel:libLLVMInstrumentation$secondaryArchSuffix + devel:libLLVMInterfaceStub$secondaryArchSuffix + devel:libLLVMInterpreter$secondaryArchSuffix + devel:libLLVMJITLink$secondaryArchSuffix + devel:libLLVMLanaiAsmParser$secondaryArchSuffix + devel:libLLVMLanaiCodeGen$secondaryArchSuffix + devel:libLLVMLanaiDesc$secondaryArchSuffix + devel:libLLVMLanaiDisassembler$secondaryArchSuffix + devel:libLLVMLanaiInfo$secondaryArchSuffix + devel:libLLVMLoongArchAsmParser$secondaryArchSuffix + devel:libLLVMLoongArchCodeGen$secondaryArchSuffix + devel:libLLVMLoongArchDesc$secondaryArchSuffix + devel:libLLVMLoongArchDisassembler$secondaryArchSuffix + devel:libLLVMLoongArchInfo$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:libLLVMMSP430AsmParser$secondaryArchSuffix + devel:libLLVMMSP430CodeGen$secondaryArchSuffix + devel:libLLVMMSP430Desc$secondaryArchSuffix + devel:libLLVMMSP430Disassembler$secondaryArchSuffix + devel:libLLVMMSP430Info$secondaryArchSuffix + devel:libLLVMMipsAsmParser$secondaryArchSuffix + devel:libLLVMMipsCodeGen$secondaryArchSuffix + devel:libLLVMMipsDesc$secondaryArchSuffix + devel:libLLVMMipsDisassembler$secondaryArchSuffix + devel:libLLVMMipsInfo$secondaryArchSuffix + devel:libLLVMNVPTXCodeGen$secondaryArchSuffix + devel:libLLVMNVPTXDesc$secondaryArchSuffix + devel:libLLVMNVPTXInfo$secondaryArchSuffix + devel:libLLVMObjCARCOpts$secondaryArchSuffix + devel:libLLVMObjCopy$secondaryArchSuffix + devel:libLLVMObject$secondaryArchSuffix + devel:libLLVMObjectYAML$secondaryArchSuffix + devel:libLLVMOptDriver$secondaryArchSuffix + devel:libLLVMOption$secondaryArchSuffix + devel:libLLVMOrcDebugging$secondaryArchSuffix + devel:libLLVMOrcJIT$secondaryArchSuffix + devel:libLLVMOrcShared$secondaryArchSuffix + devel:libLLVMOrcTargetProcess$secondaryArchSuffix + devel:libLLVMPasses$secondaryArchSuffix + devel:libLLVMPowerPCAsmParser$secondaryArchSuffix + devel:libLLVMPowerPCCodeGen$secondaryArchSuffix + devel:libLLVMPowerPCDesc$secondaryArchSuffix + devel:libLLVMPowerPCDisassembler$secondaryArchSuffix + devel:libLLVMPowerPCInfo$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:libLLVMSPIRVAnalysis$secondaryArchSuffix + devel:libLLVMSPIRVCodeGen$secondaryArchSuffix + devel:libLLVMSPIRVDesc$secondaryArchSuffix + devel:libLLVMSPIRVInfo$secondaryArchSuffix + devel:libLLVMSandboxIR$secondaryArchSuffix + devel:libLLVMScalarOpts$secondaryArchSuffix + devel:libLLVMSelectionDAG$secondaryArchSuffix + devel:libLLVMSparcAsmParser$secondaryArchSuffix + devel:libLLVMSparcCodeGen$secondaryArchSuffix + devel:libLLVMSparcDesc$secondaryArchSuffix + devel:libLLVMSparcDisassembler$secondaryArchSuffix + devel:libLLVMSparcInfo$secondaryArchSuffix + devel:libLLVMSupport$secondaryArchSuffix + devel:libLLVMSymbolize$secondaryArchSuffix + devel:libLLVMSystemZAsmParser$secondaryArchSuffix + devel:libLLVMSystemZCodeGen$secondaryArchSuffix + devel:libLLVMSystemZDesc$secondaryArchSuffix + devel:libLLVMSystemZDisassembler$secondaryArchSuffix + devel:libLLVMSystemZInfo$secondaryArchSuffix + devel:libLLVMTableGen$secondaryArchSuffix + devel:libLLVMTableGenBasic$secondaryArchSuffix + devel:libLLVMTableGenCommon$secondaryArchSuffix + devel:libLLVMTableGenGlobalISel$secondaryArchSuffix + devel:libLLVMTarget$secondaryArchSuffix + devel:libLLVMTargetParser$secondaryArchSuffix + devel:libLLVMTelemetry$secondaryArchSuffix + devel:libLLVMTextAPI$secondaryArchSuffix + devel:libLLVMTextAPIBinaryReader$secondaryArchSuffix + devel:libLLVMTransformUtils$secondaryArchSuffix + devel:libLLVMVEAsmParser$secondaryArchSuffix + devel:libLLVMVECodeGen$secondaryArchSuffix + devel:libLLVMVEDesc$secondaryArchSuffix + devel:libLLVMVEDisassembler$secondaryArchSuffix + devel:libLLVMVEInfo$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:libLLVMXCoreCodeGen$secondaryArchSuffix + devel:libLLVMXCoreDesc$secondaryArchSuffix + devel:libLLVMXCoreDisassembler$secondaryArchSuffix + devel:libLLVMXCoreInfo$secondaryArchSuffix + devel:libLLVMXRay$secondaryArchSuffix + devel:libLLVMipo$secondaryArchSuffix + devel:libLTO$secondaryArchSuffix = $portVersionCompat + devel:libRemarks$secondaryArchSuffix = $portVersionCompat + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libclang_cpp$secondaryArchSuffix + lib:libLLVM$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " +CONFLICTS=" + llvm9$secondaryArchSuffix + llvm12$secondaryArchSuffix + llvm16$secondaryArchSuffix + llvm17$secondaryArchSuffix + llvm18$secondaryArchSuffix + llvm19$secondaryArchSuffix + llvm20$secondaryArchSuffix + " + +PROVIDES_clang=" + llvm21${secondaryArchSuffix}_clang = $portVersion + cmd:amdgpu_arch = $portVersion + cmd:c_index_test = $portVersion + cmd:clang = $portVersion + cmd:clang++ = $portVersion + cmd:clang_21 = $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_installapi = $portVersion + cmd:clang_linker_wrapper = $portVersion + cmd:clang_move = $portVersion + cmd:clang_nvlink_wrapper = $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_sycl_linker = $portVersion + cmd:clang_tblgen = $portVersion + cmd:clang_tidy = $portVersion + cmd:clangd = $portVersion + cmd:diagtool = $portVersion + cmd:find_all_symbols = $portVersion + cmd:git_clang_format = $portVersion + cmd:hmaptool = $portVersion + cmd:modularize = $portVersion + cmd:nvptx_arch = $portVersion + cmd:pp_trace = $portVersion + cmd:run_clang_tidy = $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: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:libclangdocsupport$secondaryArchSuffix = $portVersion + devel:libclangdirectorywatcher$secondaryArchSuffix = $portVersion + devel:libclangdmain$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:libclanginstallapi$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 + lib:libclang$secondaryArchSuffix = $portVersionCompat + lib:libclang_cpp$secondaryArchSuffix = $portVersionCompat + " +REQUIRES_clang=" + haiku$secondaryArchSuffix + cmd:ld.lld + lib:libLLVM$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " +CONFLICTS_clang=" + llvm9${secondaryArchSuffix}_clang + llvm12${secondaryArchSuffix}_clang + llvm16${secondaryArchSuffix}_clang + llvm17${secondaryArchSuffix}_clang + llvm18${secondaryArchSuffix}_clang + llvm19${secondaryArchSuffix}_clang + llvm20${secondaryArchSuffix}_clang + " + +PROVIDES_clang_analysis=" + llvm21${secondaryArchSuffix}_clang_analysis = $portVersion + cmd:analyze_build = $portVersion + cmd:intercept_build = $portVersion + cmd:scan_build = $portVersion + cmd:scan_build_py = $portVersion + cmd:scan_view = $portVersion + " +REQUIRES_clang_analysis=" + llvm21${secondaryArchSuffix}_clang == $portVersion base + cmd:python3 + " +CONFLICTS_clang_analysis=" + llvm9${secondaryArchSuffix}_clang_analysis + llvm12${secondaryArchSuffix}_clang_analysis + llvm16${secondaryArchSuffix}_clang_analysis + llvm17${secondaryArchSuffix}_clang_analysis + llvm18${secondaryArchSuffix}_clang_analysis + llvm19${secondaryArchSuffix}_clang_analysis + llvm20${secondaryArchSuffix}_clang_analysis + " + +PROVIDES_lld=" + llvm21${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:liblldMachO$secondaryArchSuffix = $portVersion + devel:liblldMinGW$secondaryArchSuffix = $portVersion + devel:liblldWasm$secondaryArchSuffix = $portVersion + " +REQUIRES_lld=" + haiku$secondaryArchSuffix + lib:libLLVM$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " + +PROVIDES_libs=" + llvm21${secondaryArchSuffix}_libs = $portVersion + lib:libLLVM$secondaryArchSuffix = $portVersionCompat + lib:libLTO$secondaryArchSuffix = $portVersionCompat + lib:libRemarks$secondaryArchSuffix = $portVersionCompat + " +REQUIRES_libs=" + haiku$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " + +PYTHON3_VERSION="3.10" +PROVIDES_python310=" + llvm21${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=" + llvm21${secondaryArchSuffix}_libunwind = $portVersion + lib:libunwind$secondaryArchSuffix = $libunwindLibVersion compat >= $libunwindSoVersion + " +REQUIRES_libunwind=" + haiku$secondaryArchSuffix + " +CONFLICTS_libunwind=" + llvm12${secondaryArchSuffix}_libunwind + llvm16${secondaryArchSuffix}_libunwind + llvm17${secondaryArchSuffix}_libunwind + llvm18${secondaryArchSuffix}_libunwind + llvm19${secondaryArchSuffix}_libunwind + llvm20${secondaryArchSuffix}_libunwind + " + +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=" + llvm21${secondaryArchSuffix}_libunwind_devel = $portVersion + devel:libunwind$secondaryArchSuffix = $libunwindLibVersion compat >= $libunwindSoVersion + " +REQUIRES_libunwind_devel=" + llvm21${secondaryArchSuffix}_libunwind == $portVersion base + haiku${secondaryArchSuffix}_devel + " + +SUMMARY_openmp="LLVM Openmp implementation" +DESCRIPTION_openmp="Clang fully supports OpenMP 4.5, almost all of 5.0 and \ +most of 5.1/2." +PROVIDES_openmp=" + llvm21${secondaryArchSuffix}_openmp = $portVersion + devel:libarcher$secondaryArchSuffix = 1 + devel:libomp$secondaryArchSuffix = 1 + lib:libarcher$secondaryArchSuffix = 1 + lib:libomp$secondaryArchSuffix = 1 + " +REQUIRES_openmp=" + haiku$secondaryArchSuffix + " + +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 + + 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_INSTALL_BINDIR=bin \ + -DCMAKE_SKIP_RPATH=YES \ + -DLLVM_ENABLE_RTTI=ON -DLLVM_LINK_LLVM_DYLIB=YES \ + -DLIBUNWIND_ENABLE_STATIC=OFF \ + -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;compiler-rt;openmp" \ + -DLLVM_ENABLE_RUNTIMES="libunwind" \ + -DLIBOMP_INSTALL_ALIASES=OFF + + case "$buildArchitecture" in + x86 | x86_gcc2) jobArgs="-j1" ;; + esac + + cmake --build build $jobArgs +} + +INSTALL() +{ + if [ -n "$secondaryArchSuffix" ]; then + binDir=$prefix/bin + fi + + 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 + + # 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 \ + libclang \ + libclang-cpp \ + libclangAPINotes \ + libclangAST \ + libclangASTMatchers \ + libclangAnalysis \ + libclangAnalysisFlowSensitive \ + libclangAnalysisFlowSensitiveModels \ + libclangApplyReplacements \ + libclangBasic \ + libclangChangeNamespace \ + libclangCodeGen \ + libclangCrossTU \ + libclangDaemon \ + libclangDaemonTweaks \ + libclangDependencyScanning \ + libclangDirectoryWatcher \ + libclangDoc \ + libclangDocSupport \ + libclangDriver \ + libclangDynamicASTMatchers \ + libclangEdit \ + libclangExtractAPI \ + libclangFormat \ + libclangFrontend \ + libclangFrontendTool \ + libclangHandleCXX \ + libclangHandleLLVM \ + libclangIncludeCleaner \ + libclangIncludeFixer \ + libclangIncludeFixerPlugin \ + libclangIndex \ + libclangIndexSerialization \ + libclangInstallAPI \ + libclangInterpreter \ + libclangLex \ + libclangMove \ + libclangParse \ + libclangQuery \ + libclangReorderFields \ + libclangRewrite \ + libclangRewriteFrontend \ + libclangSema \ + libclangSerialization \ + libclangStaticAnalyzerCheckers \ + libclangStaticAnalyzerCore \ + libclangStaticAnalyzerFrontend \ + libclangSupport \ + libclangTidy \ + libclangTidyAbseilModule \ + libclangTidyAlteraModule \ + libclangTidyAndroidModule \ + libclangTidyBoostModule \ + libclangTidyBugproneModule \ + libclangTidyCERTModule \ + libclangTidyConcurrencyModule \ + libclangTidyCppCoreGuidelinesModule \ + libclangTidyDarwinModule \ + libclangTidyFuchsiaModule \ + libclangTidyGoogleModule \ + libclangTidyHICPPModule \ + libclangTidyLLVMLibcModule \ + libclangTidyLLVMModule \ + libclangTidyLinuxKernelModule \ + libclangTidyMPIModule \ + libclangTidyMain \ + libclangTidyMiscModule \ + libclangTidyModernizeModule \ + libclangTidyObjCModule \ + libclangTidyOpenMPModule \ + libclangTidyPerformanceModule \ + libclangTidyPlugin \ + libclangTidyPortabilityModule \ + libclangTidyReadabilityModule \ + libclangTidyUtils \ + libclangTidyZirconModule \ + libclangTooling \ + libclangToolingASTDiff \ + libclangToolingCore \ + libclangToolingInclusions \ + libclangToolingInclusionsStdlib \ + libclangToolingRefactoring \ + libclangToolingSyntax \ + libclangTransformer \ + libclangdMain \ + libclangdRemoteIndex \ + libclangdSupport \ + libfindAllSymbols \ + libLLVM* \ + libLTO \ + liblld* \ + libRemarks \ + 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 + + mv $prefix/include/* $includeDir/ + rmdir $prefix/include + rm $libDir/libarcher_static.a + ln -srf $libDir/libomp.so $developLibDir/ + ln -srf $libDir/libarcher.so $developLibDir/ + + # openmp package + packageEntries openmp \ + $developLibDir/libarcher* \ + $developLibDir/libomp* \ + $libDir/clang/21/include/omp*.h \ + $libDir/libarcher* \ + $libDir/libomp* \ + $libDir/cmake/openmp + + # clang package + packageEntries clang \ + $binDir/amdgpu-arch \ + $binDir/c-index-test \ + $binDir/clang* \ + $binDir/diagtool \ + $binDir/find-all-symbols \ + $binDir/git-clang-format \ + $binDir/hmaptool \ + $binDir/modularize \ + $binDir/nvptx-arch \ + $binDir/pp-trace \ + $binDir/run-clang-tidy \ + $dataDir/clang \ + $includeDir/clang* \ + $libDir/clang \ + $libDir/libclang* \ + $libDir/cmake/clang \ + $developLibDir/libclang* + + # analysis package + packageEntries clang_analysis \ + $binDir/analyze-build \ + $binDir/intercept-build \ + $binDir/scan-build \ + $binDir/scan-build-py \ + $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/libLLVM* \ + $libDir/libLTO* \ + $libDir/libRemarks* + + # python310 package + packageEntries python310 \ + $prefix/bin/lit \ + $prefix/lib/python* + + # libunwind package + packageEntries libunwind \ + $libDir/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 + + # Remove empty folders + rmdir $includeDir/mach-o + rmdir $manDir/man1 + rmdir $manDir +} + +TEST() +{ + export DISABLE_ASLR=1 + 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-openmp check-llvm check-compiler-rt check-unwind +} diff --git a/sys-devel/llvm/patches/llvm21-21.1.0.patchset b/sys-devel/llvm/patches/llvm21-21.1.0.patchset new file mode 100644 index 000000000..b4ac0e863 --- /dev/null +++ b/sys-devel/llvm/patches/llvm21-21.1.0.patchset @@ -0,0 +1,428 @@ +From 306c47b0288166c8c952a5dd5dc1933ccd70f88c Mon Sep 17 00:00:00 2001 +From: Calvin Hill +Date: Sun, 9 Sep 2018 16:11:42 +0100 +Subject: llvm: import header dir suffix patch from 3dEyes + + +diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp +index 49df8fd..99acd9d 100644 +--- a/llvm/tools/llvm-config/llvm-config.cpp ++++ b/llvm/tools/llvm-config/llvm-config.cpp +@@ -365,7 +365,11 @@ int main(int argc, char **argv) { + sys::fs::make_absolute(ActivePrefix, Path); + ActiveBinDir = std::string(Path); + } ++#ifdef __HAIKU__ ++ ActiveLibDir = ActivePrefix + "/develop/lib" + LLVM_LIBDIR_SUFFIX; ++#else + ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; ++#endif + { + SmallString<256> Path(LLVM_INSTALL_PACKAGE_DIR); + sys::fs::make_absolute(ActivePrefix, Path); +-- +2.48.1 + + +From 7553fc263b45511accbe3a83e994859e14b8e814 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= +Date: Mon, 18 Jul 2016 14:13:19 +0200 +Subject: clang: support for secondary arch. + + +diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt +index 1bb7359..757e6aa 100644 +--- a/clang/CMakeLists.txt ++++ b/clang/CMakeLists.txt +@@ -368,6 +368,10 @@ if (APPLE AND NOT CMAKE_LINKER MATCHES ".*lld.*") + get_darwin_linker_version(HOST_LINK_VERSION) + message(STATUS "Host linker version: ${HOST_LINK_VERSION}") + endif() ++if(DEFINED HAIKU_HYBRID_SECONDARY) ++ add_definitions(-DHAIKU_HYBRID_SECONDARY=${HAIKU_HYBRID_SECONDARY}) ++endif() ++ + + include(AddClang) + +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +index f5e2655..ed6976a 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -2258,7 +2258,11 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + StringRef SysRoot) { + + if (TargetTriple.isOSHaiku()) { ++#ifdef HAIKU_HYBRID_SECONDARY ++ Prefixes.push_back(concat(SysRoot, "/boot/system/develop/tools/" HAIKU_HYBRID_SECONDARY)); ++#else + Prefixes.push_back(concat(SysRoot, "/boot/system/develop/tools")); ++#endif + return; + } + +diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp b/clang/lib/Driver/ToolChains/Haiku.cpp +index dd6ada8..e5eb778 100644 +--- a/clang/lib/Driver/ToolChains/Haiku.cpp ++++ b/clang/lib/Driver/ToolChains/Haiku.cpp +@@ -163,8 +163,16 @@ Haiku::Haiku(const Driver &D, const llvm::Triple& Triple, const ArgList &Args) + + GCCInstallation.init(Triple, Args); + ++#ifdef HAIKU_HYBRID_SECONDARY ++ getProgramPaths().insert(getProgramPaths().begin(), getDriver().SysRoot ++ + "/boot/system/bin/" HAIKU_HYBRID_SECONDARY); ++ getFilePaths().clear(); ++ getFilePaths().push_back(getDriver().SysRoot + "/boot/system/lib/" HAIKU_HYBRID_SECONDARY); ++ getFilePaths().push_back(getDriver().SysRoot + "/boot/system/develop/lib/" HAIKU_HYBRID_SECONDARY); ++#else + getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/lib")); + getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/develop/lib")); ++#endif + + if (GCCInstallation.isValid()) + getFilePaths().push_back(GCCInstallation.getInstallPath().str()); +@@ -199,8 +207,14 @@ void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, + return; + } + ++#ifdef HAIKU_HYBRID_SECONDARY ++ addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, ++ "/boot/system/non-packaged/develop/headers/" ++ HAIKU_HYBRID_SECONDARY)); ++#else + addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, + "/boot/system/non-packaged/develop/headers")); ++#endif + addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, + "/boot/system/develop/headers/os")); + addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, +@@ -263,6 +277,17 @@ void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, + "/boot/system/develop/headers/gnu")); + addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, + "/boot/system/develop/headers/posix")); ++#ifdef HAIKU_HYBRID_SECONDARY ++ addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, ++ "/boot/system/develop/headers/" ++ HAIKU_HYBRID_SECONDARY)); ++ addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, ++ "/boot/system/develop/headers/" ++ HAIKU_HYBRID_SECONDARY "/os")); ++ addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, ++ "/boot/system/develop/headers/" ++ HAIKU_HYBRID_SECONDARY "/os/opengl")); ++#endif + addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, + "/boot/system/develop/headers/gcc/include")); + addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, +-- +2.48.1 + + +From 757b00f32334fe972be712a32413ffe11a0f2db5 Mon Sep 17 00:00:00 2001 +From: David Karoly +Date: Thu, 21 Sep 2023 17:44:12 +0000 +Subject: fix build on x86 secondary arch + + +diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt +index c96d209..20f5d76 100644 +--- a/clang/lib/Headers/CMakeLists.txt ++++ b/clang/lib/Headers/CMakeLists.txt +@@ -396,7 +396,7 @@ set(zos_wrapper_files + ) + + include(GetClangResourceDir) +-get_clang_resource_dir(output_dir PREFIX ${LLVM_LIBRARY_OUTPUT_INTDIR}/.. SUBDIR include) ++get_clang_resource_dir(output_dir PREFIX ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR} SUBDIR include) + set(out_files) + set(generated_files) + +-- +2.48.1 + + +From aa9735ac501c0db1118f174864c981fff6dede8a Mon Sep 17 00:00:00 2001 +From: David Karoly +Date: Mon, 6 Nov 2023 14:24:21 +0100 +Subject: clang: Haiku: patch for analyzer scripts + + +diff --git a/clang/tools/scan-build/bin/scan-build b/clang/tools/scan-build/bin/scan-build +index da7fe94..434b982 100755 +--- a/clang/tools/scan-build/bin/scan-build ++++ b/clang/tools/scan-build/bin/scan-build +@@ -447,7 +447,7 @@ sub CopyFiles { + + my $Dir = shift; + +- my $JS = Cwd::realpath("$RealBin/../share/scan-build/sorttable.js"); ++ my $JS = Cwd::realpath("$RealBin/../data/scan-build/sorttable.js"); + + DieDiag("Cannot find 'sorttable.js'.\n") + if (! -r $JS); +@@ -457,7 +457,7 @@ sub CopyFiles { + DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n") + if (! -r "$Dir/sorttable.js"); + +- my $CSS = Cwd::realpath("$RealBin/../share/scan-build/scanview.css"); ++ my $CSS = Cwd::realpath("$RealBin/../data/scan-build/scanview.css"); + + DieDiag("Cannot find 'scanview.css'.\n") + if (! -r $CSS); +@@ -1908,8 +1908,8 @@ if ($Clang !~ /\+\+(\.exe)?$/) { + + # Determine the location of ccc-analyzer. + my $AbsRealBin = Cwd::realpath($RealBin); +-my $Cmd = "$AbsRealBin/../libexec/ccc-analyzer"; +-my $CmdCXX = "$AbsRealBin/../libexec/c++-analyzer"; ++my $Cmd = "$AbsRealBin/../lib/ccc-analyzer"; ++my $CmdCXX = "$AbsRealBin/../lib/c++-analyzer"; + + # Portability: use less strict but portable check -e (file exists) instead of + # non-portable -x (file is executable). On some windows ports -x just checks +diff --git a/clang/tools/scan-view/bin/scan-view b/clang/tools/scan-view/bin/scan-view +index d01aebb..43ba8c3 100755 +--- a/clang/tools/scan-view/bin/scan-view ++++ b/clang/tools/scan-view/bin/scan-view +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + from __future__ import print_function + +@@ -64,7 +64,7 @@ def start_browser(port, options): + + def run(port, options, root): + # Prefer to look relative to the installed binary +- share = os.path.dirname(__file__) + "/../share/scan-view" ++ share = os.path.dirname(__file__) + "/../data/scan-view" + if not os.path.isdir(share): + # Otherwise look relative to the source + share = os.path.dirname(__file__) + "/../../scan-view/share" +-- +2.48.1 + + +From 617782d1e411350d4947d48cf2e53e5467d44962 Mon Sep 17 00:00:00 2001 +From: Brad Smith +Date: Mon, 10 Jun 2024 11:13:29 +0200 +Subject: A slightly better llvm-config diff that doesn't use #ifdef. + + +diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp +index 99acd9d..8da9ddf 100644 +--- a/llvm/tools/llvm-config/llvm-config.cpp ++++ b/llvm/tools/llvm-config/llvm-config.cpp +@@ -326,6 +326,7 @@ int main(int argc, char **argv) { + std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir, + ActiveCMakeDir; + std::string ActiveIncludeOption; ++ const Triple HostTriple(Triple::normalize(LLVM_HOST_TRIPLE)); + if (IsInDevelopmentTree) { + ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include"; + ActivePrefix = CurrentExecPrefix; +@@ -365,11 +366,10 @@ int main(int argc, char **argv) { + sys::fs::make_absolute(ActivePrefix, Path); + ActiveBinDir = std::string(Path); + } +-#ifdef __HAIKU__ +- ActiveLibDir = ActivePrefix + "/develop/lib" + LLVM_LIBDIR_SUFFIX; +-#else +- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; +-#endif ++ if (HostTriple.isOSHaiku()) ++ ActiveLibDir = ActivePrefix + "/develop/lib" + LLVM_LIBDIR_SUFFIX; ++ else ++ ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; + { + SmallString<256> Path(LLVM_INSTALL_PACKAGE_DIR); + sys::fs::make_absolute(ActivePrefix, Path); +@@ -388,7 +388,6 @@ int main(int argc, char **argv) { + StringRef SharedExt, SharedVersionedExt, SharedDir, SharedPrefix, StaticExt, + StaticPrefix, StaticDir = "lib"; + std::string DirSep = "/"; +- const Triple HostTriple(Triple::normalize(LLVM_HOST_TRIPLE)); + if (HostTriple.isOSWindows()) { + SharedExt = "dll"; + SharedVersionedExt = LLVM_DYLIB_VERSION ".dll"; +-- +2.48.1 + + +From e3a17257c79d2f1a6d18e5e85f1b13a1a3c92b1a Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Sun, 19 May 2024 10:31:55 +0200 +Subject: Allow linking gcc compiled code with lld + +https://github.com/haikuports/haikuports/issues/10445 + +diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp +index 21d228e..6203428 100644 +--- a/lld/ELF/Driver.cpp ++++ b/lld/ELF/Driver.cpp +@@ -172,8 +172,8 @@ static std::tuple parseEmulation(Ctx &ctx, + .Case("elf64lriscv", {ELF64LEKind, EM_RISCV}) + .Case("elf64ppc", {ELF64BEKind, EM_PPC64}) + .Case("elf64lppc", {ELF64LEKind, EM_PPC64}) +- .Cases("elf_amd64", "elf_x86_64", {ELF64LEKind, EM_X86_64}) +- .Case("elf_i386", {ELF32LEKind, EM_386}) ++ .Cases("elf_amd64", "elf_x86_64", "elf_x86_64_haiku", {ELF64LEKind, EM_X86_64}) ++ .Cases("elf_i386", "elf_i386_haiku", {ELF32LEKind, EM_386}) + .Case("elf_iamcu", {ELF32LEKind, EM_IAMCU}) + .Case("elf64_sparc", {ELF64BEKind, EM_SPARCV9}) + .Case("msp430elf", {ELF32LEKind, EM_MSP430}) +-- +2.48.1 + + +From 0cc00c787a451f5eab5973e1b2d4d00577e09c3d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= +Date: Mon, 24 Mar 2025 21:41:12 +0100 +Subject: install headers in clang/../include/ where clang searches them + + +diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake +index d92bc0e..4268fbb 100644 +--- a/compiler-rt/cmake/base-config-ix.cmake ++++ b/compiler-rt/cmake/base-config-ix.cmake +@@ -119,7 +119,7 @@ endif() + extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_BINDIR}") + set(COMPILER_RT_INSTALL_BINARY_DIR "${default_install_path}" CACHE PATH + "Path where built compiler-rt executables should be installed.") +-extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_INCLUDEDIR}") ++extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "include") + set(COMPILER_RT_INSTALL_INCLUDE_DIR "${default_install_path}" CACHE PATH + "Path where compiler-rt headers should be installed.") + extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_DATADIR}") +-- +2.48.1 + + +From 94c5451166096a63fe314ee13664752c8a75f54a Mon Sep 17 00:00:00 2001 +From: Luc Schrijvers +Date: Thu, 17 Apr 2025 16:38:48 +0200 +Subject: Fix missing PATH for stddef + + +diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp b/clang/lib/Driver/ToolChains/Haiku.cpp +index e5eb778..76fed45 100644 +--- a/clang/lib/Driver/ToolChains/Haiku.cpp ++++ b/clang/lib/Driver/ToolChains/Haiku.cpp +@@ -277,6 +277,14 @@ void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, + "/boot/system/develop/headers/gnu")); + addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, + "/boot/system/develop/headers/posix")); ++#ifdef HAIKU_HYBRID_SECONDARY ++ addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, ++ "/boot/system/develop/headers/" ++ HAIKU_HYBRID_SECONDARY "/gcc/include")); ++#else ++ addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, ++ "/boot/system/develop/headers/gcc/include")); ++#endif + #ifdef HAIKU_HYBRID_SECONDARY + addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, + "/boot/system/develop/headers/" +-- +2.48.1 + + +From 1c877adc5e03f3308108fa58aa9ad58ca2321b25 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= +Date: Sat, 24 May 2025 22:24:52 +0200 +Subject: fix x86 build + +r13 doesn't provide the trap err. + +diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp +index 16caf69..f278d70 100644 +--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp +@@ -1287,7 +1287,7 @@ uptr GetPageSize() { + + uptr ReadBinaryName(/*out*/ char *buf, uptr buf_len) { + # if SANITIZER_HAIKU +- int cookie = 0; ++ int32 cookie = 0; + image_info info; + const char *argv0 = ""; + while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { +@@ -1987,7 +1987,7 @@ SignalContext::WriteFlag SignalContext::GetWriteFlag() const { + # elif SANITIZER_NETBSD + uptr err = ucontext->uc_mcontext.__gregs[_REG_ERR]; + # elif SANITIZER_HAIKU +- uptr err = ucontext->uc_mcontext.r13; ++ uptr err = 0; //ucontext->uc_mcontext.r13; + # elif SANITIZER_SOLARIS && defined(__i386__) + const int Err = 13; + uptr err = ucontext->uc_mcontext.gregs[Err]; +@@ -2617,6 +2617,11 @@ static void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) { + *pc = ucontext->uc_mcontext.mc_eip; + *bp = ucontext->uc_mcontext.mc_ebp; + *sp = ucontext->uc_mcontext.mc_esp; ++# elif SANITIZER_HAIKU ++ ucontext_t *ucontext = (ucontext_t*)context; ++ *pc = ucontext->uc_mcontext.eip; ++ *bp = ucontext->uc_mcontext.ebp; ++ *sp = ucontext->uc_mcontext.esp; + # else + ucontext_t *ucontext = (ucontext_t *)context; + # if SANITIZER_SOLARIS +diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h +index f118d53..ef56d35 100644 +--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h +@@ -605,7 +605,11 @@ typedef unsigned long __sanitizer_sigset_t; + # elif SANITIZER_APPLE + typedef unsigned __sanitizer_sigset_t; + # elif SANITIZER_HAIKU ++# if defined(__x86_64__) + typedef unsigned long __sanitizer_sigset_t; ++# else ++typedef unsigned long long __sanitizer_sigset_t; ++# endif + # elif SANITIZER_LINUX + struct __sanitizer_sigset_t { + // The size is determined by looking at sizeof of real sigset_t on linux. +diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp +index 9a1afd3..d77110f 100644 +--- a/libunwind/src/UnwindCursor.hpp ++++ b/libunwind/src/UnwindCursor.hpp +@@ -41,7 +41,8 @@ + #define _LIBUNWIND_CHECK_LINUX_SIGRETURN 1 + #endif + +-#if defined(_LIBUNWIND_TARGET_HAIKU) && defined(_LIBUNWIND_TARGET_X86_64) ++#if defined(_LIBUNWIND_TARGET_HAIKU) && (defined(_LIBUNWIND_TARGET_X86_64) || \ ++ defined(_LIBUNWIND_TARGET_I386)) + #include + #include + #define _LIBUNWIND_CHECK_HAIKU_SIGRETURN 1 +-- +2.48.1 + + +From cdefbbebfae85d41aa23008a2d06ab1ea15f6a40 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= +Date: Sat, 30 Aug 2025 12:41:02 +0200 +Subject: libclang-cpp needs libnetwork.so + + +diff --git a/clang/tools/clang-shlib/CMakeLists.txt b/clang/tools/clang-shlib/CMakeLists.txt +index 945076e..821fc1a 100644 +--- a/clang/tools/clang-shlib/CMakeLists.txt ++++ b/clang/tools/clang-shlib/CMakeLists.txt +@@ -40,6 +40,9 @@ endforeach () + if (CLANG_LINK_CLANG_DYLIB) + set(INSTALL_WITH_TOOLCHAIN INSTALL_WITH_TOOLCHAIN) + endif() ++if (HAIKU) ++ list(APPEND _DEPS network) ++endif() + + add_clang_library(clang-cpp + SHARED +-- +2.48.1 +