llvm22: new recipe

This commit is contained in:
Jérôme Duval
2026-02-25 12:10:57 +01:00
parent ef06e797e4
commit 59d17494b7
2 changed files with 1310 additions and 0 deletions

View File

@@ -0,0 +1,936 @@
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-2026 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="25d2e2adc4356d758405dd885fcfd6447bce82a90eb78b6b87ce0934bd077173"
SOURCE_DIR="llvm-project-$portVersion.src"
PATCHES="llvm22-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
portVersionCompat="$portVersion compat >= ${portVersion%%.*}"
PROVIDES="
llvm22$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_cas
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_ir2vec
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_offload_binary
cmd:llvm_offload_wrapper
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_22$secondaryArchSuffix = $portVersionCompat
devel:libLLVMAArch64AsmParser$secondaryArchSuffix
devel:libLLVMAArch64CodeGen$secondaryArchSuffix
devel:libLLVMAArch64Desc$secondaryArchSuffix
devel:libLLVMAArch64Disassembler$secondaryArchSuffix
devel:libLLVMAArch64Info$secondaryArchSuffix
devel:libLLVMAArch64Utils$secondaryArchSuffix
devel:libLLVMABI$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:libLLVMCAS$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:libLLVMDTLTO$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: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:libLLVMHipStdPar$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:libLLVMOptDriver$secondaryArchSuffix
devel:libLLVMOption$secondaryArchSuffix
devel:libLLVMOrcDebugging$secondaryArchSuffix
devel:libLLVMOrcJIT$secondaryArchSuffix
devel:libLLVMOrcShared$secondaryArchSuffix
devel:libLLVMOrcTargetProcess$secondaryArchSuffix
devel:libLLVMPasses$secondaryArchSuffix
devel:libLLVMPlugins$secondaryArchSuffix
devel:libLLVMProfileData$secondaryArchSuffix
devel:libLLVMRemarks$secondaryArchSuffix
devel:libLLVMRuntimeDyld$secondaryArchSuffix
devel:libLLVMSandboxIR$secondaryArchSuffix
devel:libLLVMScalarOpts$secondaryArchSuffix
devel:libLLVMSelectionDAG$secondaryArchSuffix
devel:libLLVMSupport$secondaryArchSuffix
devel:libLLVMSupportLSP$secondaryArchSuffix
devel:libLLVMSymbolize$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:libLLVMVectorize$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
"
if [ "$targetArchitecture" != x86_gcc2 ];then
PROVIDES+="
devel:libLLVMAMDGPUAsmParser$secondaryArchSuffix
devel:libLLVMAMDGPUCodeGen$secondaryArchSuffix
devel:libLLVMAMDGPUDesc$secondaryArchSuffix
devel:libLLVMAMDGPUDisassembler$secondaryArchSuffix
devel:libLLVMAMDGPUInfo$secondaryArchSuffix
devel:libLLVMAMDGPUTargetMCA$secondaryArchSuffix
devel:libLLVMAMDGPUUtils$secondaryArchSuffix
devel:libLLVMAVRAsmParser$secondaryArchSuffix
devel:libLLVMAVRCodeGen$secondaryArchSuffix
devel:libLLVMAVRDesc$secondaryArchSuffix
devel:libLLVMAVRDisassembler$secondaryArchSuffix
devel:libLLVMAVRInfo$secondaryArchSuffix
devel:libLLVMBPFAsmParser$secondaryArchSuffix
devel:libLLVMBPFCodeGen$secondaryArchSuffix
devel:libLLVMBPFDesc$secondaryArchSuffix
devel:libLLVMBPFDisassembler$secondaryArchSuffix
devel:libLLVMBPFInfo$secondaryArchSuffix
devel:libLLVMExegesisMips$secondaryArchSuffix
devel:libLLVMExegesisPowerPC$secondaryArchSuffix
devel:libLLVMExegesisRISCV$secondaryArchSuffix
devel:libLLVMHexagonAsmParser$secondaryArchSuffix
devel:libLLVMHexagonCodeGen$secondaryArchSuffix
devel:libLLVMHexagonDesc$secondaryArchSuffix
devel:libLLVMHexagonDisassembler$secondaryArchSuffix
devel:libLLVMHexagonInfo$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: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:libLLVMPowerPCAsmParser$secondaryArchSuffix
devel:libLLVMPowerPCCodeGen$secondaryArchSuffix
devel:libLLVMPowerPCDesc$secondaryArchSuffix
devel:libLLVMPowerPCDisassembler$secondaryArchSuffix
devel:libLLVMPowerPCInfo$secondaryArchSuffix
devel:libLLVMRISCVAsmParser$secondaryArchSuffix
devel:libLLVMRISCVCodeGen$secondaryArchSuffix
devel:libLLVMRISCVDesc$secondaryArchSuffix
devel:libLLVMRISCVDisassembler$secondaryArchSuffix
devel:libLLVMRISCVInfo$secondaryArchSuffix
devel:libLLVMRISCVTargetMCA$secondaryArchSuffix
devel:libLLVMSPIRVAnalysis$secondaryArchSuffix
devel:libLLVMSPIRVCodeGen$secondaryArchSuffix
devel:libLLVMSPIRVDesc$secondaryArchSuffix
devel:libLLVMSPIRVInfo$secondaryArchSuffix
devel:libLLVMSparcAsmParser$secondaryArchSuffix
devel:libLLVMSparcCodeGen$secondaryArchSuffix
devel:libLLVMSparcDesc$secondaryArchSuffix
devel:libLLVMSparcDisassembler$secondaryArchSuffix
devel:libLLVMSparcInfo$secondaryArchSuffix
devel:libLLVMSystemZAsmParser$secondaryArchSuffix
devel:libLLVMSystemZCodeGen$secondaryArchSuffix
devel:libLLVMSystemZDesc$secondaryArchSuffix
devel:libLLVMSystemZDisassembler$secondaryArchSuffix
devel:libLLVMSystemZInfo$secondaryArchSuffix
devel:libLLVMVEAsmParser$secondaryArchSuffix
devel:libLLVMVECodeGen$secondaryArchSuffix
devel:libLLVMVEDesc$secondaryArchSuffix
devel:libLLVMVEDisassembler$secondaryArchSuffix
devel:libLLVMVEInfo$secondaryArchSuffix
devel:libLLVMWebAssemblyAsmParser$secondaryArchSuffix
devel:libLLVMWebAssemblyCodeGen$secondaryArchSuffix
devel:libLLVMWebAssemblyDesc$secondaryArchSuffix
devel:libLLVMWebAssemblyDisassembler$secondaryArchSuffix
devel:libLLVMWebAssemblyInfo$secondaryArchSuffix
devel:libLLVMWebAssemblyUtils$secondaryArchSuffix
devel:libLLVMXCoreCodeGen$secondaryArchSuffix
devel:libLLVMXCoreDesc$secondaryArchSuffix
devel:libLLVMXCoreDisassembler$secondaryArchSuffix
devel:libLLVMXCoreInfo$secondaryArchSuffix
"
fi
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
llvm21$secondaryArchSuffix
"
PROVIDES_clang="
llvm22${secondaryArchSuffix}_clang = $portVersion
cmd:amdgpu_arch = $portVersion
cmd:c_index_test = $portVersion
cmd:clang = $portVersion
cmd:clang++ = $portVersion
cmd:clang_22 = $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:libclanganalysislifetimesafety$secondaryArchSuffix = $portVersion
devel:libclanganalysisscalable$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:libclangoptions$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:libclangtidycustommodule$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
llvm21${secondaryArchSuffix}_clang
"
PROVIDES_clang_analysis="
llvm22${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="
llvm22${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
llvm21${secondaryArchSuffix}_clang_analysis
"
PROVIDES_lld="
llvm22${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="
llvm22${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="
llvm22${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="
llvm22${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
llvm21${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="
llvm22${secondaryArchSuffix}_libunwind_devel = $portVersion
devel:libunwind$secondaryArchSuffix = $libunwindLibVersion compat >= $libunwindSoVersion
"
REQUIRES_libunwind_devel="
llvm22${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="
llvm22${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
cmakeFlags="$cmakeFlags -DLLVM_TARGETS_TO_BUILD=AArch64\;X86"
cmakeFlags="$cmakeFlags -DLLVM_PARALLEL_TABLEGEN_JOBS=1"
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;openmp" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libunwind" \
-DLIBOMP_INSTALL_ALIASES=OFF
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 \
libclangAnalysisLifetimeSafety \
libclangAnalysisScalable \
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 \
libclangOptions \
libclangParse \
libclangQuery \
libclangReorderFields \
libclangRewrite \
libclangRewriteFrontend \
libclangSema \
libclangSerialization \
libclangStaticAnalyzerCheckers \
libclangStaticAnalyzerCore \
libclangStaticAnalyzerFrontend \
libclangSupport \
libclangTidy \
libclangTidyAbseilModule \
libclangTidyAlteraModule \
libclangTidyAndroidModule \
libclangTidyBoostModule \
libclangTidyBugproneModule \
libclangTidyCERTModule \
libclangTidyConcurrencyModule \
libclangTidyCppCoreGuidelinesModule \
libclangTidyCustomModule \
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/22/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
}

View File

@@ -0,0 +1,374 @@
From 16abcbf609f0ab454ac7e4d7793a34a91f10b7a6 Mon Sep 17 00:00:00 2001
From: Calvin Hill <calvin@hakobaito.co.uk>
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 24ea264..5ec0940 100644
--- a/llvm/tools/llvm-config/llvm-config.cpp
+++ b/llvm/tools/llvm-config/llvm-config.cpp
@@ -367,7 +367,11 @@ int main(int argc, char **argv) {
sys::path::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::path::make_absolute(ActivePrefix, Path);
--
2.51.0
From 0c257653e61d0ea9c76aed62cc8a476eb3764c2a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= <jerome.duval@gmail.com>
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 e4cb1a3..c7528be 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -374,6 +374,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 cb6a9b2..5008c66 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2253,7 +2253,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.51.0
From 9f14a5d6247f686bce69b6605f0d15a7d5a103f2 Mon Sep 17 00:00:00 2001
From: David Karoly <karolyd577@gmail.com>
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 c92b370..9ad74d8 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -402,7 +402,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.51.0
From 9352d446880ae86f0ca122c91266dae0d28ac223 Mon Sep 17 00:00:00 2001
From: David Karoly <david.karoly@outlook.com>
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.51.0
From 23af659216612b241319048fce31b39c2e86b0bc Mon Sep 17 00:00:00 2001
From: Brad Smith <brad@comstyle.com>
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 5ec0940..054b33b 100644
--- a/llvm/tools/llvm-config/llvm-config.cpp
+++ b/llvm/tools/llvm-config/llvm-config.cpp
@@ -327,6 +327,7 @@ int main(int argc, char **argv) {
// information.
std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir,
ActiveCMakeDir;
+ const Triple HostTriple(Triple::normalize(LLVM_HOST_TRIPLE));
std::vector<std::string> ActiveIncludeOptions;
if (IsInDevelopmentTree) {
ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include";
@@ -367,11 +368,10 @@ int main(int argc, char **argv) {
sys::path::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::path::make_absolute(ActivePrefix, Path);
@@ -390,7 +390,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.51.0
From 30ee839ac1dc2df05435bf0fb2ed4e80a9d80c03 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 9944cf2..d12a00d 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -172,8 +172,8 @@ static std::tuple<ELFKind, uint16_t, uint8_t> 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.51.0
From a79d2233fba1729ecdc615dcf4c78d25ed02ab7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= <jerome.duval@gmail.com>
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 37dfa55..b64e124 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.51.0
From db17792096989f8d969351751559a0c759249d2d Mon Sep 17 00:00:00 2001
From: Luc Schrijvers <begasus@gmail.com>
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.51.0
From 47d1fef170f438cef039cc88134bd7dbc338bf39 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= <jerome.duval@gmail.com>
Date: Wed, 25 Feb 2026 21:31:48 +0100
Subject: compiler-rt: make sure i386 doesn't get _Float16 incorrectly
diff --git a/compiler-rt/cmake/builtin-config-ix.cmake b/compiler-rt/cmake/builtin-config-ix.cmake
index 569582a..a55c830 100644
--- a/compiler-rt/cmake/builtin-config-ix.cmake
+++ b/compiler-rt/cmake/builtin-config-ix.cmake
@@ -284,10 +284,12 @@ else()
# COMPILER_RT_HAS_${arch}_* defines that are shared between lib/builtins/ and test/builtins/
foreach (arch ${BUILTIN_SUPPORTED_ARCH})
+ if(NOT ${arch} MATCHES "i386")
# NOTE: The corresponding check for if(APPLE) is in CompilerRTDarwinUtils.cmake
- check_c_source_compiles("_Float16 foo(_Float16 x) { return x; }
- int main(void) { return 0; }"
- COMPILER_RT_HAS_${arch}_FLOAT16)
+ check_c_source_compiles("_Float16 foo(_Float16 x) { return x; }
+ int main(void) { return 0; }"
+ COMPILER_RT_HAS_${arch}_FLOAT16)
+ endif()
endforeach()
endif()
diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index c3dbd65..9c41025 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -994,7 +994,9 @@ else ()
endif()
endif()
endif()
- append_list_if(COMPILER_RT_HAS_${arch}_FLOAT16 -DCOMPILER_RT_HAS_FLOAT16 BUILTIN_CFLAGS_${arch})
+ if(NOT "${arch}" MATCHES "i386")
+ append_list_if(COMPILER_RT_HAS_${arch}_FLOAT16 -DCOMPILER_RT_HAS_FLOAT16 BUILTIN_CFLAGS_${arch})
+ endif()
check_c_source_compiles("__bf16 foo(__bf16 x) { return x; }
int main(void) { return 0; }"
COMPILER_RT_HAS_${arch}_BFLOAT16)
--
2.51.0