From 7bfb45a8829c75e3c4eab156b3de656fb577eec6 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Tue, 12 Mar 2019 22:28:31 +0100 Subject: [PATCH] llvm: add recipe for version 8.0.0 rc5. --- sys-devel/llvm/llvm8-8.0.0~git.recipe | 537 ++++++++++++++++++ .../llvm/patches/clang-8.0.0~git.patchset | 198 +++++++ .../llvm/patches/llvm-8.0.0~git.patchset | 124 ++++ 3 files changed, 859 insertions(+) create mode 100644 sys-devel/llvm/llvm8-8.0.0~git.recipe create mode 100644 sys-devel/llvm/patches/clang-8.0.0~git.patchset create mode 100644 sys-devel/llvm/patches/llvm-8.0.0~git.patchset diff --git a/sys-devel/llvm/llvm8-8.0.0~git.recipe b/sys-devel/llvm/llvm8-8.0.0~git.recipe new file mode 100644 index 000000000..37b52872d --- /dev/null +++ b/sys-devel/llvm/llvm8-8.0.0~git.recipe @@ -0,0 +1,537 @@ +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, Alpha, CellSPU, 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-2018 University of Illinois at Urbana-Champaign" +LICENSE="UIUC" +REVISION="1" +gitVersion="8.0.0rc5" +SOURCE_URI="https://prereleases.llvm.org/8.0.0/rc5/llvm-$gitVersion.src.tar.xz" +CHECKSUM_SHA256="a91cde79117e17964316cffa7c9714d3568392dd9e26799b286bbeba8f8b65c1" +SOURCE_DIR="llvm-$gitVersion.src" +SOURCE_URI_2="https://prereleases.llvm.org/8.0.0/rc5/cfe-$gitVersion.src.tar.xz" +CHECKSUM_SHA256_2="d7c4c85db8142dc43ce158334e84c71114e2b6cb43515583e8c826673bdb661e" +SOURCE_DIR_2="cfe-$gitVersion.src" +SOURCE_URI_3="https://prereleases.llvm.org/8.0.0/rc5/clang-tools-extra-$gitVersion.src.tar.xz" +CHECKSUM_SHA256_3="4db610a9e827bec5d1278e910f27cb8ccf81e50f85f9f772bb8949ed11ed051c" +SOURCE_DIR_3="clang-tools-extra-$gitVersion.src" +SOURCE_URI_4="https://prereleases.llvm.org/8.0.0/rc5/compiler-rt-$gitVersion.src.tar.xz" +CHECKSUM_SHA256_4="c9f16c2e779616b35fcb0e13796a49e06e1dd88010f1e3c7e4463bdef53c8a9a" +SOURCE_DIR_4="compiler-rt-$gitVersion.src" +PATCHES="llvm-$portVersion.patchset" +PATCHES_2="clang-$portVersion.patchset" + +ARCHITECTURES="!x86_gcc2 ?x86 ?x86_64" +SECONDARY_ARCHITECTURES="?x86" + +PROVIDES=" + llvm8$secondaryArchSuffix = $portVersion compat >= 8 + cmd:bugpoint + cmd:diagtool + cmd:dsymutil + cmd:find_all_symbols + cmd:hmaptool + cmd:llc + cmd:lli + cmd:llvm_ar + cmd:llvm_as + cmd:llvm_bcanalyzer + cmd:llvm_c_test + cmd:llvm_cat + cmd:llvm_cfi_verify + cmd:llvm_config = $portVersion compat >= 8 + cmd:llvm_cov + cmd:llvm_cvtres + cmd:llvm_cxxdump + cmd:llvm_cxxfilt + cmd:llvm_cxxmap + cmd:llvm_diff + cmd:llvm_dis + cmd:llvm_dlltool + cmd:llvm_dwarfdump + cmd:llvm_dwp + cmd:llvm_elfabi + cmd:llvm_exegesis + cmd:llvm_extract + cmd:llvm_lib + cmd:llvm_link + cmd:llvm_lto + cmd:llvm_lto2 + cmd:llvm_mc + cmd:llvm_mca + cmd:llvm_modextract + cmd:llvm_mt + cmd:llvm_nm + cmd:llvm_objcopy + cmd:llvm_objdump + cmd:llvm_opt_report + cmd:llvm_pdbutil + cmd:llvm_profdata + cmd:llvm_ranlib + cmd:llvm_rc + cmd:llvm_readelf + cmd:llvm_readobj + cmd:llvm_rtdyld + cmd:llvm_size + cmd:llvm_split + cmd:llvm_stress + cmd:llvm_strings + cmd:llvm_strip + cmd:llvm_symbolizer + cmd:llvm_tblgen + cmd:llvm_undname + cmd:llvm_xray + cmd:obj2yaml + cmd:opt + cmd:sancov + cmd:sanstats + cmd:verify_uselistorder + cmd:yaml2obj + devel:libfindAllSymbols$secondaryArchSuffix + devel:libLLVM$secondaryArchSuffix = $portVersion compat >= 8 + devel:libLLVM_$portVersion$secondaryArchSuffix = $portVersion compat >= 8 + devel:libLLVM_8$secondaryArchSuffix = $portVersion compat >= 8 + devel:libLLVMAArch64AsmParser$secondaryArchSuffix + devel:libLLVMAArch64AsmPrinter$secondaryArchSuffix + devel:libLLVMAArch64CodeGen$secondaryArchSuffix + devel:libLLVMAArch64Desc$secondaryArchSuffix + devel:libLLVMAArch64Disassembler$secondaryArchSuffix + devel:libLLVMAArch64Info$secondaryArchSuffix + devel:libLLVMAArch64Utils$secondaryArchSuffix + devel:libLLVMAggressiveInstCombine$secondaryArchSuffix + devel:libLLVMAMDGPUAsmParser$secondaryArchSuffix + devel:libLLVMAMDGPUAsmPrinter$secondaryArchSuffix + devel:libLLVMAMDGPUCodeGen$secondaryArchSuffix + devel:libLLVMAMDGPUDesc$secondaryArchSuffix + devel:libLLVMAMDGPUDisassembler$secondaryArchSuffix + devel:libLLVMAMDGPUInfo$secondaryArchSuffix + devel:libLLVMAMDGPUUtils$secondaryArchSuffix + devel:libLLVMAnalysis$secondaryArchSuffix + devel:libLLVMARMAsmParser$secondaryArchSuffix + devel:libLLVMARMAsmPrinter$secondaryArchSuffix + devel:libLLVMARMCodeGen$secondaryArchSuffix + devel:libLLVMARMDesc$secondaryArchSuffix + devel:libLLVMARMDisassembler$secondaryArchSuffix + devel:libLLVMARMInfo$secondaryArchSuffix + devel:libLLVMARMUtils$secondaryArchSuffix + devel:libLLVMAsmParser$secondaryArchSuffix + devel:libLLVMAsmPrinter$secondaryArchSuffix + devel:libLLVMBinaryFormat$secondaryArchSuffix + devel:libLLVMBitReader$secondaryArchSuffix + devel:libLLVMBitWriter$secondaryArchSuffix + devel:libLLVMBPFAsmParser$secondaryArchSuffix + devel:libLLVMBPFAsmPrinter$secondaryArchSuffix + devel:libLLVMBPFCodeGen$secondaryArchSuffix + devel:libLLVMBPFDesc$secondaryArchSuffix + devel:libLLVMBPFDisassembler$secondaryArchSuffix + devel:libLLVMBPFInfo$secondaryArchSuffix + devel:libLLVMCodeGen$secondaryArchSuffix + devel:libLLVMCore$secondaryArchSuffix + devel:libLLVMCoroutines$secondaryArchSuffix + devel:libLLVMCoverage$secondaryArchSuffix + devel:libLLVMDebugInfoCodeView$secondaryArchSuffix + devel:libLLVMDebugInfoDWARF$secondaryArchSuffix + devel:libLLVMDebugInfoMSF$secondaryArchSuffix + devel:libLLVMDebugInfoPDB$secondaryArchSuffix + devel:libLLVMDemangle$secondaryArchSuffix + devel:libLLVMDlltoolDriver$secondaryArchSuffix + devel:libLLVMExecutionEngine$secondaryArchSuffix + devel:libLLVMFuzzMutate$secondaryArchSuffix + devel:libLLVMGlobalISel$secondaryArchSuffix + devel:libLLVMHexagonAsmParser$secondaryArchSuffix + devel:libLLVMHexagonCodeGen$secondaryArchSuffix + devel:libLLVMHexagonDesc$secondaryArchSuffix + devel:libLLVMHexagonDisassembler$secondaryArchSuffix + devel:libLLVMHexagonInfo$secondaryArchSuffix + devel:libLLVMInstCombine$secondaryArchSuffix + devel:libLLVMInstrumentation$secondaryArchSuffix + devel:libLLVMInterpreter$secondaryArchSuffix + devel:libLLVMipo$secondaryArchSuffix + devel:libLLVMIRReader$secondaryArchSuffix + devel:libLLVMLanaiAsmParser$secondaryArchSuffix + devel:libLLVMLanaiAsmPrinter$secondaryArchSuffix + devel:libLLVMLanaiCodeGen$secondaryArchSuffix + devel:libLLVMLanaiDesc$secondaryArchSuffix + devel:libLLVMLanaiDisassembler$secondaryArchSuffix + devel:libLLVMLanaiInfo$secondaryArchSuffix + devel:libLLVMLibDriver$secondaryArchSuffix + devel:libLLVMLineEditor$secondaryArchSuffix + devel:libLLVMLinker$secondaryArchSuffix + devel:libLLVMLTO$secondaryArchSuffix + devel:libLLVMMC$secondaryArchSuffix + devel:libLLVMMCA$secondaryArchSuffix + devel:libLLVMMCDisassembler$secondaryArchSuffix + devel:libLLVMMCJIT$secondaryArchSuffix + devel:libLLVMMCParser$secondaryArchSuffix + devel:libLLVMMipsAsmParser$secondaryArchSuffix + devel:libLLVMMipsAsmPrinter$secondaryArchSuffix + devel:libLLVMMipsCodeGen$secondaryArchSuffix + devel:libLLVMMipsDesc$secondaryArchSuffix + devel:libLLVMMipsDisassembler$secondaryArchSuffix + devel:libLLVMMipsInfo$secondaryArchSuffix + devel:libLLVMMIRParser$secondaryArchSuffix + devel:libLLVMMSP430AsmParser$secondaryArchSuffix + devel:libLLVMMSP430AsmPrinter$secondaryArchSuffix + devel:libLLVMMSP430CodeGen$secondaryArchSuffix + devel:libLLVMMSP430Desc$secondaryArchSuffix + devel:libLLVMMSP430Disassembler$secondaryArchSuffix + devel:libLLVMMSP430Info$secondaryArchSuffix + devel:libLLVMNVPTXAsmPrinter$secondaryArchSuffix + devel:libLLVMNVPTXCodeGen$secondaryArchSuffix + devel:libLLVMNVPTXDesc$secondaryArchSuffix + devel:libLLVMNVPTXInfo$secondaryArchSuffix + devel:libLLVMObjCARCOpts$secondaryArchSuffix + devel:libLLVMObject$secondaryArchSuffix + devel:libLLVMObjectYAML$secondaryArchSuffix + devel:libLLVMOption$secondaryArchSuffix + devel:libLLVMOptRemarks$secondaryArchSuffix + devel:libLLVMOrcJIT$secondaryArchSuffix + devel:libLLVMPasses$secondaryArchSuffix + devel:libLLVMPowerPCAsmParser$secondaryArchSuffix + devel:libLLVMPowerPCAsmPrinter$secondaryArchSuffix + devel:libLLVMPowerPCCodeGen$secondaryArchSuffix + devel:libLLVMPowerPCDesc$secondaryArchSuffix + devel:libLLVMPowerPCDisassembler$secondaryArchSuffix + devel:libLLVMPowerPCInfo$secondaryArchSuffix + devel:libLLVMProfileData$secondaryArchSuffix + devel:libLLVMRuntimeDyld$secondaryArchSuffix + devel:libLLVMScalarOpts$secondaryArchSuffix + devel:libLLVMSelectionDAG$secondaryArchSuffix + devel:libLLVMSparcAsmParser$secondaryArchSuffix + devel:libLLVMSparcAsmPrinter$secondaryArchSuffix + devel:libLLVMSparcCodeGen$secondaryArchSuffix + devel:libLLVMSparcDesc$secondaryArchSuffix + devel:libLLVMSparcDisassembler$secondaryArchSuffix + devel:libLLVMSparcInfo$secondaryArchSuffix + devel:libLLVMSupport$secondaryArchSuffix + devel:libLLVMSymbolize$secondaryArchSuffix + devel:libLLVMSystemZAsmParser$secondaryArchSuffix + devel:libLLVMSystemZAsmPrinter$secondaryArchSuffix + devel:libLLVMSystemZCodeGen$secondaryArchSuffix + devel:libLLVMSystemZDesc$secondaryArchSuffix + devel:libLLVMSystemZDisassembler$secondaryArchSuffix + devel:libLLVMSystemZInfo$secondaryArchSuffix + devel:libLLVMTableGen$secondaryArchSuffix + devel:libLLVMTarget$secondaryArchSuffix + devel:libLLVMTextAPI$secondaryArchSuffix + devel:libLLVMTransformUtils$secondaryArchSuffix + devel:libLLVMVectorize$secondaryArchSuffix + devel:libLLVMWebAssemblyAsmParser$secondaryArchSuffix + devel:libLLVMWebAssemblyAsmPrinter$secondaryArchSuffix + devel:libLLVMWebAssemblyCodeGen$secondaryArchSuffix + devel:libLLVMWebAssemblyDesc$secondaryArchSuffix + devel:libLLVMWebAssemblyDisassembler$secondaryArchSuffix + devel:libLLVMWebAssemblyInfo$secondaryArchSuffix + devel:libLLVMWindowsManifest$secondaryArchSuffix + devel:libLLVMX86AsmParser$secondaryArchSuffix + devel:libLLVMX86AsmPrinter$secondaryArchSuffix + devel:libLLVMX86CodeGen$secondaryArchSuffix + devel:libLLVMX86Desc$secondaryArchSuffix + devel:libLLVMX86Disassembler$secondaryArchSuffix + devel:libLLVMX86Info$secondaryArchSuffix + devel:libLLVMX86Utils$secondaryArchSuffix + devel:libLLVMXCoreAsmPrinter$secondaryArchSuffix + devel:libLLVMXCoreCodeGen$secondaryArchSuffix + devel:libLLVMXCoreDesc$secondaryArchSuffix + devel:libLLVMXCoreDisassembler$secondaryArchSuffix + devel:libLLVMXCoreInfo$secondaryArchSuffix + devel:libLLVMXRay$secondaryArchSuffix + devel:libLTO$secondaryArchSuffix = $portVersion compat >= 8 + devel:libOptRemarks$secondaryArchSuffix = 8.0.0 compat >= 8 + lib:BugpointPasses$secondaryArchSuffix + lib:LLVMHello$secondaryArchSuffix + lib:testplugin$secondaryArchSuffix + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libLLVM_8$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " +CONFLICTS=" + llvm$secondaryArchSuffix + llvm6$secondaryArchSuffix + llvm7$secondaryArchSuffix + " + +PROVIDES_clang=" + llvm8${secondaryArchSuffix}_clang = $portVersion + cmd:c_index_test = $portVersion + cmd:clang = $portVersion + cmd:clang++ = $portVersion + cmd:clang_8 = $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_extdef_mapping = $portVersion + cmd:clang_format = $portVersion + cmd:clang_func_mapping = $portVersion + cmd:clang_import_test = $portVersion + cmd:clang_include_fixer = $portVersion + cmd:clang_offload_bundler = $portVersion + cmd:clang_query = $portVersion + cmd:clang_refactor = $portVersion + cmd:clang_rename = $portVersion + cmd:clang_reorder_fields = $portVersion + cmd:clang_tidy = $portVersion + cmd:clangd = $portVersion + cmd:git_clang_format = $portVersion + cmd:modularize = $portVersion + devel:libclang$secondaryArchSuffix = $portVersion compat >= 8 + devel:libclanganalysis$secondaryArchSuffix = $portVersion + devel:libclangapplyreplacements$secondaryArchSuffix = $portVersion + devel:libclangarcmigrate$secondaryArchSuffix = $portVersion + devel:libclangast$secondaryArchSuffix = $portVersion + devel:libclangastmatchers$secondaryArchSuffix = $portVersion + devel:libclangbasic$secondaryArchSuffix = $portVersion + devel:libclangchangenamespace$secondaryArchSuffix = $portVersion + devel:libclangcodegen$secondaryArchSuffix = $portVersion + devel:libclangcrosstu$secondaryArchSuffix = $portVersion + devel:libclangdaemon$secondaryArchSuffix = $portVersion + devel:libclangdoc$secondaryArchSuffix = $portVersion + devel:libclangdriver$secondaryArchSuffix = $portVersion + devel:libclangdynamicastmatchers$secondaryArchSuffix = $portVersion + devel:libclangedit$secondaryArchSuffix = $portVersion + devel:libclangformat$secondaryArchSuffix = $portVersion + devel:libclangfrontend$secondaryArchSuffix = $portVersion + devel:libclangfrontendtool$secondaryArchSuffix = $portVersion + devel:libclanghandlecxx$secondaryArchSuffix = $portVersion + devel:libclanghandlellvm$secondaryArchSuffix = $portVersion + devel:libclangincludefixer$secondaryArchSuffix = $portVersion + devel:libclangincludefixerplugin$secondaryArchSuffix = $portVersion + devel:libclangindex$secondaryArchSuffix = $portVersion + devel:libclanglex$secondaryArchSuffix = $portVersion + devel:libclangmove$secondaryArchSuffix = $portVersion + devel:libclangparse$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:libclangtidy$secondaryArchSuffix = $portVersion + devel:libclangtidyabseilmodule$secondaryArchSuffix = $portVersion + devel:libclangtidyandroidmodule$secondaryArchSuffix = $portVersion + devel:libclangtidyboostmodule$secondaryArchSuffix = $portVersion + devel:libclangtidybugpronemodule$secondaryArchSuffix = $portVersion + devel:libclangtidycertmodule$secondaryArchSuffix = $portVersion + devel:libclangtidycppcoreguidelinesmodule$secondaryArchSuffix = $portVersion + devel:libclangtidyfuchsiamodule$secondaryArchSuffix = $portVersion + devel:libclangtidygooglemodule$secondaryArchSuffix = $portVersion + devel:libclangtidyhicppmodule$secondaryArchSuffix = $portVersion + devel:libclangtidyllvmmodule$secondaryArchSuffix = $portVersion + devel:libclangtidymiscmodule$secondaryArchSuffix = $portVersion + devel:libclangtidymodernizemodule$secondaryArchSuffix = $portVersion + devel:libclangtidympimodule$secondaryArchSuffix = $portVersion + devel:libclangtidyobjcmodule$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:libclangtoolingrefactor$secondaryArchSuffix = $portVersion + lib:libclang$secondaryArchSuffix = $portVersion compat >= 8 + " +REQUIRES_clang=" + haiku$secondaryArchSuffix + lib:libLLVM_8$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " +CONFLICTS_clang=" + llvm${secondaryArchSuffix}_clang + llvm6${secondaryArchSuffix}_clang + llvm7${secondaryArchSuffix}_clang + " + +PROVIDES_clang_analysis=" + llvm8${secondaryArchSuffix}_clang_analysis = $portVersion + cmd:c++_analyzer = $portVersion + cmd:ccc_analyzer = $portVersion + cmd:scan_build = $portVersion + cmd:scan_view = $portVersion + " +REQUIRES_clang_analysis=" + llvm8${secondaryArchSuffix}_clang == $portVersion base + cmd:python + " +CONFLICTS_clang_analysis=" + llvm${secondaryArchSuffix}_clang_analysis + llvm6${secondaryArchSuffix}_clang_analysis + llvm7${secondaryArchSuffix}_clang_analysis + " + +PROVIDES_libs=" + llvm8${secondaryArchSuffix}_libs = $portVersion + lib:libLLVM_8$secondaryArchSuffix = 8.0.0 compat >= 8.0 + lib:libLTO$secondaryArchSuffix = 8.0.0 compat >= 8 + lib:libOptRemarks$secondaryArchSuffix = 8.0.0 compat >= 8 + " +REQUIRES_libs=" + haiku$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libz$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:cmake + cmd:diff + cmd:find + cmd:gcc$secondaryArchSuffix + cmd:grep + cmd:groff + cmd:ld$secondaryArchSuffix + cmd:make + cmd:ninja + cmd:python + cmd:sed + " + +BUILD() +{ + # Add clang tools + mkdir -p tools/clang + cp -rd $sourceDir2/* tools/clang/ + + # Add clang tools's tool's (really llvm?) + mkdir -p tools/clang/tools/extra + cp -rd $sourceDir3/* tools/clang/tools/extra + + mkdir -p projects/compiler-rt + cp -rd $sourceDir4/* projects/compiler-rt + + local cmakeFlags + if [ -n "$secondaryArchSuffix" ]; then + cmakeFlags=-DHAIKU_HYBRID_SECONDARY="\"${effectiveTargetArchitecture}\"" + cmakeFlags="$cmakeFlags -DLLVM_LIBDIR_SUFFIX=/${effectiveTargetArchitecture}" + fi + + mkdir -p build; cd build + # Haiku C++ requires rtti in a lot of central system components + # such as Mesa + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$prefix \ + -DCMAKE_SKIP_RPATH=YES $cmakeFlags \ + -DLLVM_ENABLE_RTTI=ON -DLLVM_LINK_LLVM_DYLIB=YES \ + -DLLVM_ENABLE_BUILD_TESTS=YES \ + .. + + make $jobArgs PROJ_datadir=$dataDir PROJ_docsdir=$docDir \ + PROJ_mandir=$manDir PROJ_includedir=$includeDir PROJ_libdir=$libDir +} + +INSTALL() +{ + cd build + + mkdir -p $binDir $developDir $dataDir $docDir $includeDir $manDir $libDir + + make install PROJ_datadir=$dataDir PROJ_docsdir=$docDir \ + PROJ_mandir=$manDir PROJ_includedir=$includeDir PROJ_libdir=$libDir + + make -C tools/clang install PROJ_datadir=$dataDir PROJ_docsdir=$docDir \ + PROJ_mandir=$manDir PROJ_includedir=$includeDir PROJ_libdir=$libDir + + make -C projects/compiler-rt install PROJ_datadir=$dataDir PROJ_docsdir=$docDir \ + PROJ_mandir=$manDir PROJ_includedir=$includeDir PROJ_libdir=$libDir + + if [ -n $secondaryArchSuffix ]; then + binDir=$prefix/bin + fi + + # You can try and be fancy here parsing each arch in a for loop... but + # not all arches contain the same libraries. The inventory for each arch + # also changes between releases... so lets KISS. + prepareInstalledDevelLibs \ + libfindAllSymbols \ + libLLVM* \ + libLTO \ + libclang* \ + libOptRemarks + + mv $prefix/include/* $includeDir/ + mv $prefix/libexec/* $binDir/ + mv $prefix/share/man/* $manDir/ + mv $prefix/share/clang $dataDir/ + mv $prefix/share/opt-viewer $dataDir/ + mv $prefix/share/scan-build $dataDir/ + mv $prefix/share/scan-view $dataDir/ + rmdir $prefix/include $prefix/libexec $prefix/share/man $prefix/share + + sed -i 's|/libexec/|/bin/|' $binDir/scan-build + sed -i 's|/share/|/data/|' $binDir/scan-build $binDir/scan-view + + # clang package + packageEntries clang \ + $binDir/c-index-test \ + $binDir/clang* \ + $binDir/git-clang-format \ + $binDir/modularize \ + $dataDir/clang \ + $includeDir/clang* \ + $libDir/libclang* \ + $libDir/clang \ + $libDir/cmake/clang \ + $developLibDir/libclang* + + # analysis package + packageEntries clang_analysis \ + $binDir/scan-build \ + $binDir/scan-view \ + $binDir/c++-analyzer \ + $binDir/ccc-analyzer \ + $dataDir/scan-build \ + $dataDir/scan-view \ + $manDir/man1/scan-build.1 + + # libs package + packageEntries libs \ + $libDir/libLLVM* \ + $libDir/libLTO* \ + $libDir/libOptRemarks* +} + +TEST() +{ + cd build + export LIBRARY_PATH=$LIBRARY_PATH:$sourceDir/build/lib + export LIT_ARGS="-v" + make check-llvm +} diff --git a/sys-devel/llvm/patches/clang-8.0.0~git.patchset b/sys-devel/llvm/patches/clang-8.0.0~git.patchset new file mode 100644 index 000000000..e1c8a9c5c --- /dev/null +++ b/sys-devel/llvm/patches/clang-8.0.0~git.patchset @@ -0,0 +1,198 @@ +From 232161b64d10cea8caeb70c4e91479506d912fab 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: support for secondary arch. + + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c2016a4..d7a6533 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -420,6 +420,10 @@ if (CLANG_ANALYZER_Z3_INSTALL_DIR) + message(FATAL_ERROR "Z3 4.7.1 has not been found in CLANG_ANALYZER_Z3_INSTALL_DIR: ${CLANG_ANALYZER_Z3_INSTALL_DIR}.") + endif() + endif() ++if(DEFINED HAIKU_HYBRID_SECONDARY) ++ add_definitions(-DHAIKU_HYBRID_SECONDARY=${HAIKU_HYBRID_SECONDARY}) ++endif() ++ + + set(CLANG_ANALYZER_ENABLE_Z3_SOLVER_DEFAULT "${Z3_FOUND}") + +diff --git a/lib/Driver/ToolChains/Haiku.cpp b/lib/Driver/ToolChains/Haiku.cpp +index 12461ec..643b62b 100644 +--- a/lib/Driver/ToolChains/Haiku.cpp ++++ b/lib/Driver/ToolChains/Haiku.cpp +@@ -20,6 +20,13 @@ using namespace llvm::opt; + Haiku::Haiku(const Driver &D, const llvm::Triple& Triple, const ArgList &Args) + : Generic_ELF(D, Triple, Args) { + ++#ifdef HAIKU_HYBRID_SECONDARY ++ getProgramPaths().insert(getProgramPaths().begin(), getDriver().SysRoot ++ + "/system/bin/" HAIKU_HYBRID_SECONDARY); ++ getFilePaths().clear(); ++ getFilePaths().push_back(getDriver().SysRoot + "/system/lib/" ++ HAIKU_HYBRID_SECONDARY); ++#endif + } + + void Haiku::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, +@@ -30,6 +37,12 @@ void Haiku::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, + + void Haiku::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const { ++#ifdef HAIKU_HYBRID_SECONDARY ++ addLibStdCXXIncludePaths(getDriver().SysRoot, "/system/develop/headers" ++ HAIKU_HYBRID_SECONDARY "/c++", getTriple().str(), "", "", "", ++ DriverArgs, CC1Args); ++#else + addLibStdCXXIncludePaths(getDriver().SysRoot, "/system/develop/headers/c++", +- getTriple().str(), "", "", "", DriverArgs, CC1Args); ++ getTriple().str(), "", "", "", DriverArgs, CC1Args); ++#endif + } +diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp +index 67842b5..f80bbc2 100644 +--- a/lib/Frontend/InitHeaderSearch.cpp ++++ b/lib/Frontend/InitHeaderSearch.cpp +@@ -238,7 +238,20 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, + if (HSOpts.UseBuiltinIncludes) { + // Ignore the sys root, we *always* look for clang headers relative to + // supplied path. ++#ifdef HAIKU_HYBRID_SECONDARY ++ // Remove version from foo/lib/clang/version ++ StringRef Ver = llvm::sys::path::filename(HSOpts.ResourceDir); ++ StringRef NoVer = llvm::sys::path::parent_path(HSOpts.ResourceDir); ++ // Remove clang from foo/lib/clang ++ StringRef Clang = llvm::sys::path::filename(NoVer); ++ SmallString<128> P = llvm::sys::path::parent_path(NoVer); ++ ++ // Get foo/include/c++/v1 ++ llvm::sys::path::append(P, Clang, Ver); ++#else + SmallString<128> P = StringRef(HSOpts.ResourceDir); ++#endif ++ + llvm::sys::path::append(P, "include"); + AddUnmappedPath(P, ExternCSystem, false); + } +@@ -273,7 +286,12 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, + } + + case llvm::Triple::Haiku: ++#ifdef HAIKU_HYBRID_SECONDARY ++ AddPath("/boot/system/non-packaged/develop/headers/" HAIKU_HYBRID_SECONDARY, ++ System, false); ++#else + AddPath("/boot/system/non-packaged/develop/headers", System, false); ++#endif + AddPath("/boot/system/develop/headers/os", System, false); + AddPath("/boot/system/develop/headers/os/app", System, false); + AddPath("/boot/system/develop/headers/os/arch", System, false); +@@ -305,6 +323,13 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, + AddPath("/boot/system/develop/headers/bsd", System, false); + AddPath("/boot/system/develop/headers/glibc", System, false); + AddPath("/boot/system/develop/headers/posix", System, false); ++#ifdef HAIKU_HYBRID_SECONDARY ++ AddPath("/boot/system/develop/headers/" HAIKU_HYBRID_SECONDARY, System, false); ++ AddPath("/boot/system/develop/headers/" HAIKU_HYBRID_SECONDARY "/os", System, ++ false); ++ AddPath("/boot/system/develop/headers/" HAIKU_HYBRID_SECONDARY "/os/opengl", ++ System, false); ++#endif + AddPath("/boot/system/develop/headers", System, false); + break; + case llvm::Triple::RTEMS: +-- +2.19.1 + + +From 24a5b1a303ef3b899d5c30f833e0ae69a1b4814a Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Thu, 7 Apr 2016 18:30:52 +0000 +Subject: add a test for haiku driver. + +* upstream wants a case for libcxx in ToolChains.cpp, so add it. + +diff --git a/test/Driver/haiku.c b/test/Driver/haiku.c +new file mode 100644 +index 0000000..9591739 +--- /dev/null ++++ b/test/Driver/haiku.c +@@ -0,0 +1,12 @@ ++// RUN: %clang -no-canonical-prefixes -target x86_64-unknown-haiku %s -### 2> %t.log ++// RUN: FileCheck --check-prefix=CHECK-X86_64 -input-file %t.log %s ++ ++// CHECK-X86_64: clang{{.*}}" "-cc1" "-triple" "x86_64-unknown-haiku" ++// CHECK-X86_64: gcc{{.*}}" "-o" "a.out" "{{.*}}.o" ++ ++// RUN: %clang -no-canonical-prefixes -target i586-pc-haiku %s -### 2> %t.log ++// RUN: FileCheck --check-prefix=CHECK-X86 -input-file %t.log %s ++ ++// CHECK-X86: clang{{.*}}" "-cc1" "-triple" "i586-pc-haiku" ++// CHECK-X86: gcc{{.*}}" "-o" "a.out" "{{.*}}.o" ++ +-- +2.19.1 + + +From 7563792bf072390c88e77df5776a936390ceb8fc 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: Enable thread-local storage and disable PIE by default + + +diff --git a/lib/Basic/Targets/OSTargets.h b/lib/Basic/Targets/OSTargets.h +index 09867d8..7741410 100644 +--- a/lib/Basic/Targets/OSTargets.h ++++ b/lib/Basic/Targets/OSTargets.h +@@ -277,7 +277,6 @@ public: + this->IntPtrType = TargetInfo::SignedLong; + this->PtrDiffType = TargetInfo::SignedLong; + this->ProcessIDType = TargetInfo::SignedLong; +- this->TLSSupported = false; + switch (Triple.getArch()) { + default: + break; +diff --git a/lib/Driver/ToolChains/Haiku.h b/lib/Driver/ToolChains/Haiku.h +index a12a48e..9f6eb52 100644 +--- a/lib/Driver/ToolChains/Haiku.h ++++ b/lib/Driver/ToolChains/Haiku.h +@@ -23,9 +23,7 @@ public: + Haiku(const Driver &D, const llvm::Triple &Triple, + const llvm::opt::ArgList &Args); + +- bool isPIEDefault() const override { +- return getTriple().getArch() == llvm::Triple::x86_64; +- } ++ bool isPIEDefault() const override { return false; } + + void addLibCxxIncludePaths( + const llvm::opt::ArgList &DriverArgs, +-- +2.19.1 + + +From 0caa55b50e4916e84eb3a2fb6e3836930092a077 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Tue, 12 Mar 2019 21:08:57 +0100 +Subject: sysexits.h requires _BSD_SOURCE on Haiku beta1. + + +diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp +index a784e21..448639f 100644 +--- a/lib/Driver/Driver.cpp ++++ b/lib/Driver/Driver.cpp +@@ -83,6 +83,9 @@ + #include + #if LLVM_ON_UNIX + #include // getpid ++#ifdef __HAIKU__ ++#define _BSD_SOURCE ++#endif + #include // EX_IOERR + #endif + +-- +2.19.1 + diff --git a/sys-devel/llvm/patches/llvm-8.0.0~git.patchset b/sys-devel/llvm/patches/llvm-8.0.0~git.patchset new file mode 100644 index 000000000..f92300649 --- /dev/null +++ b/sys-devel/llvm/patches/llvm-8.0.0~git.patchset @@ -0,0 +1,124 @@ +From eb6f95dbed91c4a8cb219db19d98ba1d95038743 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Wed, 20 Jan 2016 21:13:28 +0000 +Subject: llvm-config: use /develop/headers instead of /include + +* don't provide obj-root and src-root. + +diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp +index bec89fe..1444561 100644 +--- a/tools/llvm-config/llvm-config.cpp ++++ b/tools/llvm-config/llvm-config.cpp +@@ -333,11 +333,16 @@ int main(int argc, char **argv) { + ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include"); + } else { + ActivePrefix = CurrentExecPrefix; ++#ifdef __HAIKU__ ++ ActiveIncludeDir = ActivePrefix + "/develop/headers"; ++ ActiveLibDir = ActivePrefix + "/develop/lib" + LLVM_LIBDIR_SUFFIX; ++#else + ActiveIncludeDir = ActivePrefix + "/include"; ++ ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; ++#endif + SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR)); + sys::fs::make_absolute(ActivePrefix, path); + ActiveBinDir = path.str(); +- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; + ActiveCMakeDir = ActiveLibDir + "/cmake/llvm"; + ActiveIncludeOption = "-I" + ActiveIncludeDir; + } +@@ -557,10 +562,16 @@ int main(int argc, char **argv) { + OS << (LLVM_HAS_GLOBAL_ISEL ? "ON" : "OFF") << '\n'; + } else if (Arg == "--shared-mode") { + PrintSharedMode = true; +- } else if (Arg == "--obj-root") { +- OS << ActivePrefix << '\n'; +- } else if (Arg == "--src-root") { +- OS << LLVM_SRC_ROOT << '\n'; ++ } else if (Arg == "--obj-root" || Arg == "--src-root") { ++ if (IsInDevelopmentTree) { ++ if (Arg == "--obj-root") ++ OS << ActivePrefix << '\n'; ++ else ++ OS << LLVM_SRC_ROOT << '\n'; ++ } else { ++ llvm::errs() << "llvm-config: sources not installed\n"; ++ exit(1); ++ } + } else if (Arg == "--ignore-libllvm") { + LinkDyLib = false; + LinkMode = BuiltSharedLibs ? LinkModeShared : LinkModeAuto; +-- +2.19.1 + + +From 3411cf7727e15f692d7d310e6e37405ed695010a Mon Sep 17 00:00:00 2001 +From: Calvin Hill +Date: Sun, 9 Sep 2018 16:11:42 +0100 +Subject: import header dir suffix patch from 3dEyes. + + +diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp +index 1444561..8ad7737 100644 +--- a/tools/llvm-config/llvm-config.cpp ++++ b/tools/llvm-config/llvm-config.cpp +@@ -334,7 +334,7 @@ int main(int argc, char **argv) { + } else { + ActivePrefix = CurrentExecPrefix; + #ifdef __HAIKU__ +- ActiveIncludeDir = ActivePrefix + "/develop/headers"; ++ ActiveIncludeDir = ActivePrefix + "/develop/headers" + LLVM_LIBDIR_SUFFIX; + ActiveLibDir = ActivePrefix + "/develop/lib" + LLVM_LIBDIR_SUFFIX; + #else + ActiveIncludeDir = ActivePrefix + "/include"; +-- +2.19.1 + + +From 0cac6f3dfad3612a67d35cb39812ebf5a8671e4d Mon Sep 17 00:00:00 2001 +From: Calvin Hill +Date: Sun, 9 Sep 2018 16:17:33 +0100 +Subject: llvm: allow llvm gtests to build on Haiku. + + +diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-port.h b/utils/unittest/googletest/include/gtest/internal/gtest-port.h +index d36e820..e6dbb2d 100644 +--- a/utils/unittest/googletest/include/gtest/internal/gtest-port.h ++++ b/utils/unittest/googletest/include/gtest/internal/gtest-port.h +@@ -793,7 +793,8 @@ using ::std::tuple_size; + (GTEST_OS_MAC && !GTEST_OS_IOS) || \ + (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \ + GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \ +- GTEST_OS_OPENBSD || GTEST_OS_QNX || GTEST_OS_FREEBSD || GTEST_OS_NETBSD) ++ GTEST_OS_OPENBSD || GTEST_OS_QNX || GTEST_OS_FREEBSD || GTEST_OS_NETBSD \ ++ || GTEST_OS_HAIKU) + # define GTEST_HAS_DEATH_TEST 1 + #endif + +-- +2.19.1 + + +From 1f239330031656ea71da77b52194ef3f48b94e22 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Tue, 12 Mar 2019 21:01:42 +0100 +Subject: llvm: sysexits.h requires _BSD_SOURCE on Haiku beta1. + + +diff --git a/lib/Support/Unix/Signals.inc b/lib/Support/Unix/Signals.inc +index ad88d5e..13f8535 100644 +--- a/lib/Support/Unix/Signals.inc ++++ b/lib/Support/Unix/Signals.inc +@@ -47,6 +47,9 @@ + #include "llvm/Support/raw_ostream.h" + #include + #include ++#ifdef __HAIKU__ ++#define _BSD_SOURCE ++#endif + #include + #ifdef HAVE_BACKTRACE + # include BACKTRACE_HEADER // For backtrace(). +-- +2.19.1 +