From 48ca75555522716f0f686dcae3dd6cf3d8ad714d Mon Sep 17 00:00:00 2001 From: davidovski Date: Tue, 31 May 2022 11:05:19 +0100 Subject: removed idea of repos --- .../clang-001-fix-unwind-chain-inclusion.patch | 44 +++++++++ repo/llvm/clang-002-add-musl-triples.patch | 110 +++++++++++++++++++++ repo/llvm/clang-tools-extra.xibuild | 24 +++++ repo/llvm/clang.xibuild | 18 ++++ repo/llvm/libclang.xibuild | 8 ++ repo/llvm/libcxx-musl.patch | 26 +++++ repo/llvm/libcxx-ssp-nonshared.patch | 11 +++ repo/llvm/libcxx.xibuild | 12 +++ repo/llvm/libcxxabi-dl.patch | 25 +++++ repo/llvm/libcxxabi.xibuild | 10 ++ repo/llvm/libunwind.xibuild | 14 +++ repo/llvm/lld.xibuild | 15 +++ repo/llvm/lldb-musl.patch | 31 ++++++ repo/llvm/llvm-001-musl.patch | 57 +++++++++++ repo/llvm/llvm-004-override-opt.patch | 18 ++++ repo/llvm/llvm.xibuild | 88 +++++++++++++++++ 16 files changed, 511 insertions(+) create mode 100644 repo/llvm/clang-001-fix-unwind-chain-inclusion.patch create mode 100644 repo/llvm/clang-002-add-musl-triples.patch create mode 100644 repo/llvm/clang-tools-extra.xibuild create mode 100644 repo/llvm/clang.xibuild create mode 100644 repo/llvm/libclang.xibuild create mode 100644 repo/llvm/libcxx-musl.patch create mode 100644 repo/llvm/libcxx-ssp-nonshared.patch create mode 100644 repo/llvm/libcxx.xibuild create mode 100644 repo/llvm/libcxxabi-dl.patch create mode 100644 repo/llvm/libcxxabi.xibuild create mode 100644 repo/llvm/libunwind.xibuild create mode 100644 repo/llvm/lld.xibuild create mode 100644 repo/llvm/lldb-musl.patch create mode 100644 repo/llvm/llvm-001-musl.patch create mode 100644 repo/llvm/llvm-004-override-opt.patch create mode 100644 repo/llvm/llvm.xibuild (limited to 'repo/llvm') diff --git a/repo/llvm/clang-001-fix-unwind-chain-inclusion.patch b/repo/llvm/clang-001-fix-unwind-chain-inclusion.patch new file mode 100644 index 0000000..e4eaa77 --- /dev/null +++ b/repo/llvm/clang-001-fix-unwind-chain-inclusion.patch @@ -0,0 +1,44 @@ +From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +Date: Tue, 8 Sep 2015 22:14:57 +0200 +Subject: [PATCH 2/7] fix unwind chain inclusion + +--- + lib/Headers/unwind.h | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h +index 303d792..44e10cc 100644 +--- a/clang/lib/Headers/unwind.h ++++ b/clang/lib/Headers/unwind.h +@@ -9,9 +9,6 @@ + + /* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/ + +-#ifndef __CLANG_UNWIND_H +-#define __CLANG_UNWIND_H +- + #if defined(__APPLE__) && __has_include_next() + /* Darwin (from 11.x on) provide an unwind.h. If that's available, + * use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE, +@@ -39,6 +36,9 @@ + # endif + #else + ++#ifndef __CLANG_UNWIND_H ++#define __CLANG_UNWIND_H ++ + #include + + #ifdef __cplusplus +@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *); + } + #endif + ++#endif /* __CLANG_UNWIND_H */ ++ + #endif + +-#endif /* __CLANG_UNWIND_H */ +-- +2.5.1 diff --git a/repo/llvm/clang-002-add-musl-triples.patch b/repo/llvm/clang-002-add-musl-triples.patch new file mode 100644 index 0000000..25688d4 --- /dev/null +++ b/repo/llvm/clang-002-add-musl-triples.patch @@ -0,0 +1,110 @@ +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -2086,7 +2086,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf", + "armv7hl-redhat-linux-gnueabi", + "armv6hl-suse-linux-gnueabi", +- "armv7hl-suse-linux-gnueabi"}; ++ "armv7hl-suse-linux-gnueabi", ++ "armv7l-linux-gnueabihf"}; + static const char *const ARMebLibDirs[] = {"/lib"}; + static const char *const ARMebTriples[] = {"armeb-linux-gnueabi", + "armeb-linux-androideabi"}; +@@ -2153,8 +2154,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + "powerpc64-suse-linux", "powerpc-montavista-linuxspe"}; + static const char *const PPCLELibDirs[] = {"/lib32", "/lib"}; + static const char *const PPCLETriples[] = {"powerpcle-linux-gnu", +- "powerpcle-unknown-linux-gnu", +- "powerpcle-linux-musl"}; ++ "powerpcle-unknown-linux-gnu"}; + + static const char *const PPC64LibDirs[] = {"/lib64", "/lib"}; + static const char *const PPC64Triples[] = { +@@ -2235,6 +2235,87 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + return; + } + ++ if (TargetTriple.isMusl()) { ++ static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"}; ++ static const char *const ARMHFMuslTriples[] = { ++ "arm-linux-musleabihf", "armv7l-linux-musleabihf" ++ }; ++ static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"}; ++ static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"}; ++ static const char *const X86MuslTriples[] = {"i686-linux-musl"}; ++ static const char *const MIPSMuslTriples[] = { ++ "mips-linux-musl", "mipsel-linux-musl", ++ "mipsel-linux-muslhf", "mips-linux-muslhf" ++ }; ++ static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"}; ++ static const char *const PPCLEMuslTriples[] = {"powerpcle-linux-musl"}; ++ static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"}; ++ static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"}; ++ ++ switch (TargetTriple.getArch()) { ++ case llvm::Triple::aarch64: ++ LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs)); ++ TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples)); ++ BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs)); ++ BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples)); ++ break; ++ case llvm::Triple::arm: ++ LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs)); ++ if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) { ++ TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples)); ++ } else { ++ TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples)); ++ } ++ break; ++ case llvm::Triple::x86_64: ++ LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs)); ++ TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples)); ++ BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs)); ++ BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples)); ++ break; ++ case llvm::Triple::x86: ++ LibDirs.append(begin(X86LibDirs), end(X86LibDirs)); ++ TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples)); ++ BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs)); ++ BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples)); ++ break; ++ case llvm::Triple::mips: ++ LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs)); ++ TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples)); ++ break; ++ case llvm::Triple::ppc: ++ LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs)); ++ TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples)); ++ BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs)); ++ BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples)); ++ break; ++ case llvm::Triple::ppcle: ++ LibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs)); ++ TripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples)); ++ BiarchLibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs)); ++ BiarchTripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples)); ++ break; ++ case llvm::Triple::ppc64: ++ LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs)); ++ TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples)); ++ BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs)); ++ BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples)); ++ break; ++ case llvm::Triple::ppc64le: ++ LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs)); ++ TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples)); ++ BiarchLibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs)); ++ BiarchTripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples)); ++ break; ++ default: ++ break; ++ } ++ TripleAliases.push_back(TargetTriple.str()); ++ if (TargetTriple.str() != BiarchTriple.str()) ++ BiarchTripleAliases.push_back(BiarchTriple.str()); ++ return; ++ } ++ + // Android targets should not use GNU/Linux tools or libraries. + if (TargetTriple.isAndroid()) { + static const char *const AArch64AndroidTriples[] = { diff --git a/repo/llvm/clang-tools-extra.xibuild b/repo/llvm/clang-tools-extra.xibuild new file mode 100644 index 0000000..0058ac9 --- /dev/null +++ b/repo/llvm/clang-tools-extra.xibuild @@ -0,0 +1,24 @@ +#!/bin/sh + +DESC="$DESC - Extra Clang Tools" + +package () { + add_from_main usr/include/clang-tidy + add_from_main usr/bin/clang-apply-replacements + add_from_main usr/bin/clang-query + add_from_main usr/bin/clang-rename + add_from_main usr/bin/clang-tidy + add_from_main usr/bin/diagtool + add_from_main usr/bin/find-all-symbols + add_from_main usr/bin/hmaptool + add_from_main usr/bin/modularize + add_from_main usr/bin/pp-trace + add_from_main usr/bin/sancov + add_from_main "usr/lib/libclangApplyReplacements*" + add_from_main "usr/lib/libclangQuery*" + add_from_main "usr/lib/libclangTidy*" + add_from_main "usr/share/clang/*tidy*" + add_from_main usr/share/doc/clang-tools + add_from_main usr/share/man/man1/extraclangtools.1 + add_from_main usr/share/man/man1/diagtool.1 +} diff --git a/repo/llvm/clang.xibuild b/repo/llvm/clang.xibuild new file mode 100644 index 0000000..4a3f4f4 --- /dev/null +++ b/repo/llvm/clang.xibuild @@ -0,0 +1,18 @@ +#!/bin/sh + +DESC="$DESC - C language frontend" +DEPS="libclang" + +package () { + add_from_main usr/include/clang + add_from_main usr/include/clang-c + add_from_main "usr/bin/*clang*" + add_from_main usr/bin/c-index-test + add_from_main usr/lib/clang + add_from_main usr/lib/cmake/clang + add_from_main "usr/lib/libclang*.a" + add_from_main "usr/lib/libclang*.so" + add_from_main usr/share/clang + add_from_main usr/share/doc/clang + add_from_main usr/share/man/man1/clang.1 +} diff --git a/repo/llvm/libclang.xibuild b/repo/llvm/libclang.xibuild new file mode 100644 index 0000000..1acdb84 --- /dev/null +++ b/repo/llvm/libclang.xibuild @@ -0,0 +1,8 @@ +#!/bin/sh + +DESC="$DESC - C frontend runtime library" + +package () { + add_from_main "usr/lib/libclang.so.*" + add_from_main "usr/lib/libclang-cpp.so.*" +} diff --git a/repo/llvm/libcxx-musl.patch b/repo/llvm/libcxx-musl.patch new file mode 100644 index 0000000..bbd31ff --- /dev/null +++ b/repo/llvm/libcxx-musl.patch @@ -0,0 +1,26 @@ +--- a/libcxx/include/locale ++++ b/libcxx/include/locale +@@ -742,7 +742,11 @@ __num_get_signed_integral(const char* __a, const char* __a_end, + typename remove_reference::type __save_errno = errno; + errno = 0; + char *__p2; ++#if defined(__linux__) && !defined(__GLIBC__) ++ long long __ll = strtoll(__a, &__p2, __base); ++#else + long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE); ++#endif + typename remove_reference::type __current_errno = errno; + if (__current_errno == 0) + errno = __save_errno; +@@ -782,7 +786,11 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end, + typename remove_reference::type __save_errno = errno; + errno = 0; + char *__p2; ++#if defined(__linux__) && !defined(__GLIBC__) ++ unsigned long long __ll = strtoull(__a, &__p2, __base); ++#else + unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE); ++#endif + typename remove_reference::type __current_errno = errno; + if (__current_errno == 0) + errno = __save_errno; diff --git a/repo/llvm/libcxx-ssp-nonshared.patch b/repo/llvm/libcxx-ssp-nonshared.patch new file mode 100644 index 0000000..70292be --- /dev/null +++ b/repo/llvm/libcxx-ssp-nonshared.patch @@ -0,0 +1,11 @@ +--- a/libcxx/CMakeLists.txt ++++ b/libcxx/CMakeLists.txt +@@ -769,6 +769,8 @@ function(cxx_link_system_libraries target) + target_link_libraries(${target} PRIVATE atomic) + endif() + ++#ssp target_link_libraries(${target} PRIVATE ssp_nonshared) ++ + if (MINGW) + target_link_libraries(${target} PRIVATE "${MINGW_LIBRARIES}") + endif() diff --git a/repo/llvm/libcxx.xibuild b/repo/llvm/libcxx.xibuild new file mode 100644 index 0000000..9e84e7f --- /dev/null +++ b/repo/llvm/libcxx.xibuild @@ -0,0 +1,12 @@ +#!/bin/sh + +DESC="C++ standard library from LLVM" + +package () { + add_from_main usr/lib/libc++.so.* + add_from_main usr/lib/libc++.a + add_from_main usr/lib/libc++experimental.a + add_from_main usr/include/c++ + add_from_main usr/share/doc/libcxx + +} diff --git a/repo/llvm/libcxxabi-dl.patch b/repo/llvm/libcxxabi-dl.patch new file mode 100644 index 0000000..3a15f9d --- /dev/null +++ b/repo/llvm/libcxxabi-dl.patch @@ -0,0 +1,25 @@ +Also link to -ldl to prevent undefined references. + +--- a/libcxxabi/src/CMakeLists.txt ++++ b/libcxxabi/src/CMakeLists.txt +@@ -73,6 +73,7 @@ + endif() + + add_library_flags_if(LIBCXXABI_HAS_C_LIB c) ++ add_library_flags_if(LIBCXXABI_HAS_C_LIB dl) + endif() + + if (LIBCXXABI_USE_LLVM_UNWINDER) +--- a/libcxx/CMakeLists.txt ++++ b/libcxx/CMakeLists.txt +@@ -745,6 +745,10 @@ + target_link_libraries(${target} PRIVATE m) + endif() + ++ if (LIBCXX_HAS_C_LIB) ++ target_link_libraries(${target} PRIVATE dl) ++ endif() ++ + if (LIBCXX_HAS_RT_LIB) + target_link_libraries(${target} PRIVATE rt) + endif() diff --git a/repo/llvm/libcxxabi.xibuild b/repo/llvm/libcxxabi.xibuild new file mode 100644 index 0000000..71f36ba --- /dev/null +++ b/repo/llvm/libcxxabi.xibuild @@ -0,0 +1,10 @@ +#!/bin/sh + +DESC="Low level support for libc++" + +package () { + add_from_main "usr/lib/libc++abi.so.*" \ + usr/lib/libc++abi.so \ + usr/lib/libc++abi.a \ + "usr/include/*cxxabi*" +} diff --git a/repo/llvm/libunwind.xibuild b/repo/llvm/libunwind.xibuild new file mode 100644 index 0000000..b4e8b42 --- /dev/null +++ b/repo/llvm/libunwind.xibuild @@ -0,0 +1,14 @@ +#!/bin/sh + +DESC="C++ standard library from LLVM" + +package () { + add_from_main "usr/lib/libunwind.so.*" \ + usr/lib/libunwind.so \ + usr/lib/libunwind.a + + add_from_main "usr/include/*unwind*" + add_from_main usr/include/mach-o + add_from_main usr/share/doc/libunwind + +} diff --git a/repo/llvm/lld.xibuild b/repo/llvm/lld.xibuild new file mode 100644 index 0000000..ff5dc5a --- /dev/null +++ b/repo/llvm/lld.xibuild @@ -0,0 +1,15 @@ +#!/bin/sh + +DESC="LLVM linker" + +package () { + add_from_main usr/bin/lld* + add_from_main usr/bin/wasm-ld + add_from_main usr/bin/ld.lld* + add_from_main usr/bin/ld64.lld* + add_from_main usr/share/doc/lld + + add_from_main usr/include/lld + add_from_main usr/lib/cmake/lld + add_from_main "usr/lib/liblld*a" +} diff --git a/repo/llvm/lldb-musl.patch b/repo/llvm/lldb-musl.patch new file mode 100644 index 0000000..601c0d1 --- /dev/null +++ b/repo/llvm/lldb-musl.patch @@ -0,0 +1,31 @@ +--- a/lldb/source/Plugins/Process/Linux/Procfs.h ++++ b/lldb/source/Plugins/Process/Linux/Procfs.h +@@ -10,21 +10,12 @@ + // sys/procfs.h on Android/Linux for all supported architectures. + + #include ++#include + +-#ifdef __ANDROID__ +-#if defined(__arm64__) || defined(__aarch64__) +-typedef unsigned long elf_greg_t; +-typedef elf_greg_t +- elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))]; +-typedef struct user_fpsimd_state elf_fpregset_t; +-#ifndef NT_FPREGSET +-#define NT_FPREGSET NT_PRFPREG +-#endif // NT_FPREGSET +-#elif defined(__mips__) +-#ifndef NT_FPREGSET +-#define NT_FPREGSET NT_PRFPREG +-#endif // NT_FPREGSET +-#endif +-#else // __ANDROID__ ++#if !defined(__GLIBC__) && defined(__powerpc__) ++#define pt_regs musl_pt_regs ++#include ++#undef pt_regs ++#else + #include +-#endif // __ANDROID__ ++#endif diff --git a/repo/llvm/llvm-001-musl.patch b/repo/llvm/llvm-001-musl.patch new file mode 100644 index 0000000..f2a3f8d --- /dev/null +++ b/repo/llvm/llvm-001-musl.patch @@ -0,0 +1,57 @@ +From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +Date: Tue, 8 Sep 2015 22:03:02 +0200 +Subject: [PATCH 3/3] musl + +--- + include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++ + lib/Support/DynamicLibrary.cpp | 2 +- + lib/Support/Unix/Signals.inc | 6 +++--- + utils/unittest/googletest/src/gtest.cc | 1 + + 5 files changed, 17 insertions(+), 6 deletions(-) + +diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h +index 34a8a1e3..1214ece5 100644 +--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h ++++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h +@@ -18,6 +18,15 @@ + #include "llvm/IR/PassManager.h" + #include "llvm/Pass.h" + ++#undef fopen64 ++#undef fseeko64 ++#undef fstat64 ++#undef fstatvfs64 ++#undef ftello64 ++#undef lstat64 ++#undef stat64 ++#undef tmpfile64 ++ + namespace llvm { + template class ArrayRef; + class Triple; +diff --git a/lib/Support/Unix/DynamicLibrary.inc b/lib/Support/Unix/DynamicLibrary.inc +index a2a37996..2f86c470 100644 +--- a/llvm/lib/Support/Unix/DynamicLibrary.inc ++++ b/llvm/lib/Support/Unix/DynamicLibrary.inc +@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) { + + // This macro returns the address of a well-known, explicit symbol + #define EXPLICIT_SYMBOL(SYM) \ +- if (!strcmp(SymbolName, #SYM)) return &SYM ++ if (!strcmp(SymbolName, #SYM)) return (void *)&SYM + + // Under glibc we have a weird situation. The stderr/out/in symbols are both + // macros and global variables because of standards requirements. So, we +diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc +index d882ab2e..f1fb12d0 100644 +--- a/llvm/utils/unittest/googletest/src/gtest.cc ++++ b/llvm/utils/unittest/googletest/src/gtest.cc +@@ -128,6 +128,7 @@ + + #if GTEST_CAN_STREAM_RESULTS_ + # include // NOLINT ++# include // NOLINT + # include // NOLINT + # include // NOLINT + # include // NOLINT diff --git a/repo/llvm/llvm-004-override-opt.patch b/repo/llvm/llvm-004-override-opt.patch new file mode 100644 index 0000000..51d0e4b --- /dev/null +++ b/repo/llvm/llvm-004-override-opt.patch @@ -0,0 +1,18 @@ +This allows us to override the optimization level as not all platforms can +deal with -O3. + +--- a/llvm/CMakeLists.txt ++++ b/llvm/CMakeLists.txt +@@ -918,6 +918,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) + llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2") + endif() + ++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use") ++ ++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "") ++ llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}") ++endif() ++ + # Put this before tblgen. Else we have a circular dependence. + add_subdirectory(lib/Demangle) + add_subdirectory(lib/Support) diff --git a/repo/llvm/llvm.xibuild b/repo/llvm/llvm.xibuild new file mode 100644 index 0000000..9d42a9c --- /dev/null +++ b/repo/llvm/llvm.xibuild @@ -0,0 +1,88 @@ +#!/bin/sh + +MAKEDEPS="make ninja cmake libedit libffi libxml2 ncurses python-sphinx binutils lua python-six" +DEPS="perl zlib libffi libedit ncurses" + +PKG_VER=13.0.1 +SOURCE="https://github.com/llvm/llvm-project/releases/download/llvmorg-$PKG_VER/llvm-project-$PKG_VER.src.tar.xz" +DESC="Low Level Virtual Machine" + +ADDITIONAL=" +clang-001-fix-unwind-chain-inclusion.patch +clang-002-add-musl-triples.patch +libcxx-musl.patch +libcxx-ssp-nonshared.patch +libcxxabi-dl.patch +llvm-001-musl.patch +llvm-004-override-opt.patch" + +prepare () { + enabled_projects="clang;clang-tools-extra;libcxx;libcxxabi;libunwind;openmp;lld" + + apply_patches + cd llvm + #sed -i 's|__ptrace_request|int|g' \ + #../lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp + + # disable lldb docs, since they fail to generate + #sed -i '/add_subdirectory(docs)/d' \ + #../lldb/CMakeLists.txt + + + sed -i 's,check_library_exists(gcc_s .*,set(LIBCXXABI_HAS_GCC_S_LIB ON),' \ + ../libcxxabi/cmake/config-ix.cmake + sed -i 's,check_library_exists(gcc .*,set(LIBCXXABI_HAS_GCC_LIB ON),' \ + ../libcxxabi/cmake/config-ix.cmake + + + sed -i 's,# Set common link flags.,list(APPEND SANITIZER_COMMON_LINK_LIBS execinfo),' \ + ../compiler-rt/CMakeLists.txt + + export CFLAGS="$CFLAGS -g1" + export CXXFLAGS="$CXXFLAGS -g1" +} + +build () { + mkdir build + cd build + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DENABLE_LINKER_BUILD_ID=YES \ + -DLLDB_USE_SYSTEM_SIX=YES \ + -DLIBCXX_CXX_ABI=libcxxabi \ + -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=YES \ + -DLIBCXXABI_USE_LLVM_UNWINDER=YES \ + -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES \ + -DLIBOMP_ENABLE_SHARED=YES \ + -DLIBOMP_INSTALL_ALIASES=NO \ + -DLLVM_INCLUDE_DOCS=YES \ + -DLLVM_INSTALL_UTILS=YES \ + -DLLVM_BUILD_LLVM_DYLIB=YES \ + -DLLVM_LINK_LLVM_DYLIB=YES \ + -DLLVM_ENABLE_RTTI=YES \ + -DLLVM_ENABLE_FFI=YES \ + -DLLVM_BINUTILS_INCDIR=/usr/include \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DLLVM_BUILD_DOCS=OFF \ + -DLIBCXX_HAS_MUSL_LIBC=YES \ + -DLLVM_BUILD_EXAMPLES=OFF \ + -DLLVM_BUILD_TESTS=ON \ + -DLLVM_DEFAULT_TARGET_TRIPLE="x86_64-linux-musl" \ + -DLLVM_ENABLE_ASSERTIONS=OFF \ + -DLLVM_ENABLE_PIC=ON \ + -DLLVM_ENABLE_SPHINX=OFF \ + -DLLVM_ENABLE_TERMINFO=ON \ + -DLLVM_ENABLE_ZLIB=ON \ + -DLLVM_HOST_TRIPLE="x86_64-linux-musl" \ + -DLLVM_INCLUDE_EXAMPLES=OFF \ + -DLLVM_APPEND_VC_REV=OFF \ + -DLLVM_ENABLE_PROJECTS="$enabled_projects" \ + -Wno-dev -G Ninja .. && + + ninja llvm-tblgen && + ninja +} + +package () { + DESTDIR=$PKG_DEST ninja install +} -- cgit v1.2.1