summaryrefslogtreecommitdiff
path: root/repo/devel
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-05-17 19:10:55 +0100
committerdavidovski <david@davidovski.xyz>2022-05-17 19:10:55 +0100
commit50fb6c032e72a26b3fd881a18e1d1f535c95e0fc (patch)
tree67e7043022f14f601dddd87be911d38a4d58269c /repo/devel
parent213021de0aaf5439db7d58ca1447db4ae6af92be (diff)
fixed packages for llvm based toolchain
Diffstat (limited to 'repo/devel')
-rw-r--r--repo/devel/automake/automake.xibuild2
-rw-r--r--repo/devel/clang/clang.xibuild57
-rw-r--r--repo/devel/clang/patches/10-add-musl-triples.patch35
-rw-r--r--repo/devel/clang/patches/30-Enable-stack-protector-by-default-for-Alpine-Linux.patch81
-rw-r--r--repo/devel/cmake/cmake.xibuild2
-rw-r--r--repo/devel/compiler-rt/compiler-rt.xibuild38
-rw-r--r--repo/devel/compiler-rt/link-execinfo.patch11
-rw-r--r--repo/devel/libunwind/libcxx-musl.patch28
-rw-r--r--repo/devel/libunwind/libunwind-link-libssp.patch20
-rw-r--r--repo/devel/libunwind/libunwind.xibuild48
-rw-r--r--repo/devel/libunwind/toolchain-libunwind.xibuild0
-rw-r--r--repo/devel/lld/lld.xibuild29
-rw-r--r--repo/devel/llvm/llvm.xibuild82
13 files changed, 60 insertions, 373 deletions
diff --git a/repo/devel/automake/automake.xibuild b/repo/devel/automake/automake.xibuild
index 8b8951f..689d63c 100644
--- a/repo/devel/automake/automake.xibuild
+++ b/repo/devel/automake/automake.xibuild
@@ -1,7 +1,7 @@
#!/bin/sh
MAKEDEPS="make autoconf"
-DEPS="perl bash"
+DEPS="perl"
PKG_VER=1.16.5
SOURCE=https://ftp.gnu.org/gnu/automake/automake-$PKG_VER.tar.xz
diff --git a/repo/devel/clang/clang.xibuild b/repo/devel/clang/clang.xibuild
deleted file mode 100644
index 3b93ba3..0000000
--- a/repo/devel/clang/clang.xibuild
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/sh
-
-MAKEDEPS="cmake llvm libxml2 ninja python python-markupsafe python-pygments"
-DEPS="curl gcc libssh2 openssl"
-
-PKG_VER=13.0.0
-SOURCE=https://github.com/llvm/llvm-project/releases/download/llvmorg-$PKG_VER/clang-$PKG_VER.src.tar.xz
-DESC="Systems programming language focused on safety, speed and concurrency"
-
-ADDITIONAL="
- patches/30-Enable-stack-protector-by-default-for-Alpine-Linux.patch
- patches/10-add-musl-triples.patch
-"
-
-prepare () {
- apply_patches
-
- # link in /usr/inlcude/llvm to include
- ln -s /usr/include/llvm include/llvm
- # (there should be a better way to do this, since tblgen does look in /include rather than /usr/include)
-
-}
-
-build () {
- mkdir build
- cd build
-
- python_version=$(python3 -V | sed 's/.*\([0-9]\{1,\}\.[0-9]\{1,\}\)\..*/\1/')
-
- cmake .. -G Ninja -Wno-dev \
- -DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_C_FLAGS_RELEASE_INIT="$CFLAGS -O2" \
- -DCMAKE_CXX_FLAGS_RELEASE_INIT="$CXXFLAGS" \
- -DCMAKE_EXE_LINKER_FLAGS_RELEASE_INIT="$LDFLAGS -Wl,-z,stack-size=2097152" \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DCMAKE_VERBOSE_MAKEFILE=OFF \
- -DCLANG_VENDOR=XiLinux \
- -DLLVM_EXTERNAL_LIT=/usr/bin/lit \
- -DCLANG_BUILD_EXAMPLES=OFF \
- -DCLANG_INCLUDE_DOCS=ON \
- -DCLANG_PYTHON_BINDINGS_VERSIONS="$python_version" \
- -DLLVM_BUILD_DOCS=ON \
- -DLLVM_ENABLE_SPHINX=ON \
- -DSPHINX_WARNINGS_AS_ERRORS=OFF \
- -DCLANG_INCLUDE_TESTS=ON \
- -DCLANG_PLUGIN_SUPPORT=ON \
- -DLIBCLANG_BUILD_STATIC=ON \
- -DLLVM_ENABLE_EH=ON \
- -DLLVM_ENABLE_RTTI=ON
-
- ninja clang-tblgen
- ninja
-}
-
-package () {
- DESTDIR=$PKG_DEST ninja install
-}
diff --git a/repo/devel/clang/patches/10-add-musl-triples.patch b/repo/devel/clang/patches/10-add-musl-triples.patch
deleted file mode 100644
index b11ca84..0000000
--- a/repo/devel/clang/patches/10-add-musl-triples.patch
+++ /dev/null
@@ -1,35 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -2077,6 +2077,7 @@
- static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
- static const char *const AArch64Triples[] = {
- "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
-+ "aarch64-linux-musl",
- "aarch64-suse-linux", "aarch64-linux-android"};
- static const char *const AArch64beLibDirs[] = {"/lib"};
- static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
-@@ -2086,6 +2087,8 @@
- static const char *const ARMTriples[] = {"arm-linux-gnueabi",
- "arm-linux-androideabi"};
- static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-+ "arm-linux-musleabihf",
-+ "armv7l-linux-musleabihf",
- "armv7hl-redhat-linux-gnueabi",
- "armv6hl-suse-linux-gnueabi",
- "armv7hl-suse-linux-gnueabi"};
-@@ -2105,6 +2108,7 @@
- "x86_64-redhat-linux", "x86_64-suse-linux",
- "x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
- "x86_64-slackware-linux", "x86_64-unknown-linux",
-+ "x86_64-linux-musl",
- "x86_64-amazon-linux", "x86_64-linux-android"};
- static const char *const X32Triples[] = {"x86_64-linux-gnux32",
- "x86_64-pc-linux-gnux32"};
-@@ -2116,6 +2120,7 @@
- "i686-redhat-linux", "i386-redhat-linux",
- "i586-suse-linux", "i686-montavista-linux",
- "i686-linux-android", "i686-gnu",
-+ "i686-linux-musl",
- };
-
- static const char *const M68kLibDirs[] = {"/lib"};
diff --git a/repo/devel/clang/patches/30-Enable-stack-protector-by-default-for-Alpine-Linux.patch b/repo/devel/clang/patches/30-Enable-stack-protector-by-default-for-Alpine-Linux.patch
deleted file mode 100644
index f2895ce..0000000
--- a/repo/devel/clang/patches/30-Enable-stack-protector-by-default-for-Alpine-Linux.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-Based on original patchset from Jakub Jirutka <jakub@jirutka.cz>
-Updated by Eric Molitor <eric@molitor.org>
-Updated by Natanael Copa <ncopa@alpinelinux.org>
-Updated by omni <omni+alpine@hack.org>
-
---- a/lib/Driver/ToolChains/Linux.h
-+++ b/lib/Driver/ToolChains/Linux.h
-@@ -11,6 +11,7 @@
-
- #include "Gnu.h"
- #include "clang/Driver/ToolChain.h"
-+#include "clang/Basic/LangOptions.h"
-
- namespace clang {
- namespace driver {
-@@ -38,6 +39,18 @@
- CXXStdlibType GetDefaultCXXStdlibType() const override;
- bool isPIEDefault() const override;
- bool isNoExecStackDefault() const override;
-+
-+ LangOptions::StackProtectorMode
-+ GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
-+ StringRef VendorName = Linux::getTriple().getVendorName();
-+ if (VendorName.compare("alpine") == 0)
-+ return LangOptions::SSPStrong;
-+
-+ return LangOptions::SSPOff;
-+ }
-+
-+
-+
- bool IsMathErrnoDefault() const override;
- SanitizerMask getSupportedSanitizers() const override;
- void addProfileRTLibs(const llvm::opt::ArgList &Args,
---- a/test/Driver/fsanitize.c
-+++ b/test/Driver/fsanitize.c
-@@ -667,18 +667,17 @@
- // RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NOSP
- // NOSP-NOT: "-fsanitize=safe-stack"
-
--// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
-+// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
- // RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP-ASAN
- // RUN: %clang -target x86_64-linux-gnu -fstack-protector -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
- // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP
--// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
--// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
-+// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
-+// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
- // RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
- // NO-SP-NOT: stack-protector
- // NO-SP: "-fsanitize=safe-stack"
- // SP-ASAN: error: invalid argument '-fsanitize=safe-stack' not allowed with '-fsanitize=address'
- // SP: "-fsanitize=safe-stack"
--// SP: -stack-protector
- // NO-SP-NOT: stack-protector
-
- // RUN: %clang -target powerpc64-unknown-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-SANM
---- a/test/Driver/stack-protector.c
-+++ b/test/Driver/stack-protector.c
-@@ -35,6 +35,20 @@
-
- // Test default stack protector values for Darwin platforms
-
-+// RUN: %clang -target x86_64-alpine-linux-musl -### %s 2>&1 | FileCheck %s -check-prefix=ALPINE
-+// ALPINE: "-stack-protector" "2"
-+
-+// RUN: %clang -target x86_64-alpine-linux-musl -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=ALPINE_SPS
-+// ALPINE_SPS: "-stack-protector" "2"
-+
-+// RUN: %clang -target x86_64-alpine-linux-musl -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=ALPINE_ALL
-+// ALPINE_ALL: "-stack-protector" "3"
-+// ALPINE_ALL-NOT: "-stack-protector-buffer-size"
-+
-+// RUN: %clang -target x86_64-alpine-linux-musl -fno-stack-protector -### %s 2>&1 | FileCheck %s -check-prefix=ALPINE_NOSSP
-+// ALPINE_NOSSP-NOT: "-stack-protector"
-+// ALPINE_NOSSP-NOT: "-stack-protector-buffer-size"
-+
- // RUN: %clang -target armv7k-apple-watchos2.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_WATCHOS
- // RUN: %clang -ffreestanding -target armv7k-apple-watchos2.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_WATCHOS
- // SSP_WATCHOS: "-stack-protector" "1"
diff --git a/repo/devel/cmake/cmake.xibuild b/repo/devel/cmake/cmake.xibuild
index 41be69c..01be547 100644
--- a/repo/devel/cmake/cmake.xibuild
+++ b/repo/devel/cmake/cmake.xibuild
@@ -1,7 +1,7 @@
#!/bin/sh
MAKEDEPS="make"
-DEPS="curl libarchive jsoncpp libuv rhash"
+DEPS="curl libarchive jsoncpp libuv rhash openssl"
PKG_VER=3.22.1
SOURCE=https://github.com/Kitware/CMake/releases/download/v$PKG_VER/cmake-$PKG_VER.tar.gz
diff --git a/repo/devel/compiler-rt/compiler-rt.xibuild b/repo/devel/compiler-rt/compiler-rt.xibuild
deleted file mode 100644
index abff3dc..0000000
--- a/repo/devel/compiler-rt/compiler-rt.xibuild
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-
-NAME="compiler-rt"
-DESC="LLVM compiler-rt runtime libraries"
-
-MAKEDEPS="cmake libexecinfo"
-DEPS="musl "
-
-PKG_VER=13.0.0
-SOURCE="https://github.com/llvm/llvm-project/releases/download/llvmorg-$PKG_VER/compiler-rt-$PKG_VER.src.tar.xz"
-ADDITIONAL="link-execinfo.patch "
-
-prepare () {
- apply_patches
-}
-
-build () {
- cmake -B build \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DCMAKE_INSTALL_LIBDIR=/usr/lib \
- -DBUILD_SHARED_LIBS=True \
- -DBUILD_STATIC_LIBS=OFF \
- -DCMAKE_C_COMPILER=clang \
- -DCMAKE_CXX_COMPILER=clang++ \
- -DCMAKE_BUILD_TYPE=MinSizeRel \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DCOMPILER_RT_INCLUDE_TESTS=OFF \
- -DCOMPILER_RT_BUILD_SANITIZERS=ON \
- -DCOMPILER_RT_BUILD_XRAY=ON \
- -DCOMPILER_RT_INSTALL_PATH="/usr/lib/clang/$PKG_VER" \
- -DLLVM_EXTERNAL_LIT="/usr/bin/lit" \
-
- cmake --build build
-}
-
-package () {
- DESTDIR="$PKG_DEST" cmake --install build
-}
diff --git a/repo/devel/compiler-rt/link-execinfo.patch b/repo/devel/compiler-rt/link-execinfo.patch
deleted file mode 100644
index 8da49fb..0000000
--- a/repo/devel/compiler-rt/link-execinfo.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/lib/scudo/standalone/CMakeLists.txt
-+++ b/lib/scudo/standalone/CMakeLists.txt
-@@ -137,6 +137,8 @@
-
- append_list_if(FUCHSIA zircon SCUDO_LINK_LIBS)
-
-+list(APPEND SCUDO_LINK_LIBS execinfo)
-+
- if(COMPILER_RT_HAS_SCUDO_STANDALONE)
- add_compiler_rt_object_libraries(RTScudoStandalone
- ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
diff --git a/repo/devel/libunwind/libcxx-musl.patch b/repo/devel/libunwind/libcxx-musl.patch
deleted file mode 100644
index 358d4a3..0000000
--- a/repo/devel/libunwind/libcxx-musl.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-Patch-Source: https://github.com/void-linux/void-packages/blob/74f16232621ca8dfb6d244beff1df35a6df1647f/srcpkgs/llvm12/patches/libcxx-musl.patch
-
---- 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<decltype(errno)>::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<decltype(errno)>::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<decltype(errno)>::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<decltype(errno)>::type __current_errno = errno;
- if (__current_errno == 0)
- errno = __save_errno;
diff --git a/repo/devel/libunwind/libunwind-link-libssp.patch b/repo/devel/libunwind/libunwind-link-libssp.patch
deleted file mode 100644
index ae819fe..0000000
--- a/repo/devel/libunwind/libunwind-link-libssp.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/libunwind/src/CMakeLists.txt
-+++ b/libunwind/src/CMakeLists.txt
-@@ -129,7 +129,7 @@
- else()
- target_compile_options(unwind_shared PRIVATE -fno-rtti)
- endif()
-- target_link_libraries(unwind_shared PRIVATE ${LIBUNWIND_LIBRARIES})
-+ target_link_libraries(unwind_shared PRIVATE ${LIBUNWIND_LIBRARIES} -lssp_nonshared)
- set_target_properties(unwind_shared
- PROPERTIES
- CXX_EXTENSIONS OFF
-@@ -157,7 +157,7 @@
- else()
- target_compile_options(unwind_static PRIVATE -fno-rtti)
- endif()
-- target_link_libraries(unwind_static PRIVATE ${LIBUNWIND_LIBRARIES})
-+ target_link_libraries(unwind_static PRIVATE ${LIBUNWIND_LIBRARIES} -lssp_nonshared)
- set_target_properties(unwind_static
- PROPERTIES
- CXX_EXTENSIONS OFF
diff --git a/repo/devel/libunwind/libunwind.xibuild b/repo/devel/libunwind/libunwind.xibuild
deleted file mode 100644
index 067a91d..0000000
--- a/repo/devel/libunwind/libunwind.xibuild
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-
-NAME="libunwind"
-DESC="LLVM version of libunwind library"
-
-MAKEDEPS="cmake "
-DEPS="musl "
-
-PKG_VER=13.0.0
-SOURCE="https://github.com/llvm/llvm-project/releases/download/llvmorg-$PKG_VER/libunwind-$PKG_VER.src.tar.xz"
-
-ADDITIONAL="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-$PKG_VER/llvm-$PKG_VER.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-$PKG_VER/libcxx-$PKG_VER.src.tar.xz
- libunwind-link-libssp.patch
- libcxx-musl.patch
-"
-
-prepare () {
- tar xvf libunwind-$PKG_VER.src.tar.xz
- tar xvf llvm-$PKG_VER.src.tar.xz
- tar xvf libcxx-$PKG_VER.src.tar.xz
- mv libunwind-$PKG_VER.src libunwind
- mv llvm-$PKG_VER.src llvm
- mv libcxx-$PKG_VER.src libcxx
-
- apply_patches
-}
-
-build () {
- cmake -B build -G Ninja -S libunwind \
- -DCMAKE_BUILD_TYPE=MinSizeRel \
- -DCMAKE_C_FLAGS_MINSIZEREL_INIT="$CFLAGS" \
- -DCMAKE_CXX_FLAGS_MINSIZEREL_INIT="$CXXFLAGS" \
- -DCMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT="$LDFLAGS" \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DLIBUNWIND_HAS_NODEFAULTLIBS_FLAG=OFF \
- -DLIBUNWIND_STANDALONE_BUILD=ON
- cmake --build build
-}
-
-package () {
- DESTDIR="$PKG_DEST" cmake --install build
- mkdir -p "$PKG_DEST"/usr/include/mach-o
- cp libunwind/include/*.h "$PKG_DEST"/usr/include/
- cp libunwind/include/mach-o/*.h "$PKG_DEST"/usr/include/mach-o/
-
-}
diff --git a/repo/devel/libunwind/toolchain-libunwind.xibuild b/repo/devel/libunwind/toolchain-libunwind.xibuild
deleted file mode 100644
index e69de29..0000000
--- a/repo/devel/libunwind/toolchain-libunwind.xibuild
+++ /dev/null
diff --git a/repo/devel/lld/lld.xibuild b/repo/devel/lld/lld.xibuild
deleted file mode 100644
index c2dff7f..0000000
--- a/repo/devel/lld/lld.xibuild
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-NAME="lld"
-DESC="The LLVM Linker"
-
-MAKEDEPS="cmake llvm-libunwind"
-DEPS="musl llvm "
-
-PKG_VER=13.0.0
-SOURCE="https://github.com/llvm/llvm-project/releases/download/llvmorg-$PKG_VER/lld-$PKG_VER.src.tar.xz"
-
-build () {
- cmake -B build \
- -DCMAKE_BUILD_TYPE=MinSizeRel \
- -DCMAKE_VERBOSE_MAKEFILE=OFF \
- -DCMAKE_C_FLAGS_MINSIZEREL_INIT="$CFLAGS" \
- -DCMAKE_CXX_FLAGS_MINSIZEREL_INIT="$CXXFLAGS" \
- -DCMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT="$LDFLAGS -Wl,-z,stack-size=2097152" \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DCMAKE_SKIP_INSTALL_RPATH=ON \
- -DLLVM_INCLUDE_TESTS=ON \
- -DLLVM_EXTERNAL_LIT=/usr/bin/lit
- cmake --build build
-}
-
-package () {
- DESTDIR="$PKG_DEST" cmake --install build
- install -Dm 644 docs/ld.lld.1 $PKG_DEST/usr/share/man/man1/
-}
diff --git a/repo/devel/llvm/llvm.xibuild b/repo/devel/llvm/llvm.xibuild
index f1eaf13..e2a4943 100644
--- a/repo/devel/llvm/llvm.xibuild
+++ b/repo/devel/llvm/llvm.xibuild
@@ -4,51 +4,85 @@ MAKEDEPS="make ninja cmake libedit libffi libxml2 ncurses python-setuptools pyth
DEPS="perl zlib libffi libedit ncurses"
PKG_VER=13.0.0
-SOURCE=https://github.com/llvm/llvm-project/releases/download/llvmorg-$PKG_VER/llvm-$PKG_VER.src.tar.xz
-DESC="Collection of modular and reusable compiler and toolchain technologies"
+SOURCE="https://github.com/llvm/llvm-project/releases/download/llvmorg-$PKG_VER/llvm-project-$PKG_VER.src.tar.xz"
+DESC="Low Level Virtual Machine"
-package () {
- grep -rl '#!.*python' | xargs sed -i '1s/python$/python3/'
+ADDITIONAL="
+clang-001-fix-unwind-chain-inclusion.patch
+clang-002-add-musl-triples.patch
+libcxx-musl.patch
+libcxx-ssp-nonshared.patch
+libcxxabi-dl.patch
+lldb-musl.patch
+llvm-001-musl.patch
+llvm-004-override-opt.patch"
+
+prepare () {
+ 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
- CC=gcc CXX=g++ \
- cmake \
- -DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_INSTALL_PREFIX=/usr \
+ cmake \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DENABLE_LINKER_BUILD_ID=YES \
+ -DLLVM_USE_LINKER=lld \
+ -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_EXTERNAL_COMPILER_RT=ON \
- -DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_BUILD_TESTS=ON \
-DLLVM_DEFAULT_TARGET_TRIPLE="x86_64-linux-musl" \
-DLLVM_ENABLE_ASSERTIONS=OFF \
- -DLLVM_ENABLE_FFI=ON \
- -DLLVM_ENABLE_LIBCXX=OFF \
-DLLVM_ENABLE_PIC=ON \
- -DLLVM_ENABLE_RTTI=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_INSTALL_UTILS=ON \
- -DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_APPEND_VC_REV=OFF \
- -Wno-dev -G Ninja .. &&
- ninja llvm-tblgen &&
- ninja &&
- cd ..
+ -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libcxx;libcxxabi;libunwind;lldb;lld;openmp" \
+ -Wno-dev -G Ninja .. &&
- python3 utils/lit/setup.py build
+ ninja llvm-tblgen &&
+ ninja
}
package () {
- DESTDIR=$PKG_DEST ninja -C build install
-
- cd build
- python3 ../utils/lit/setup.py install --prefix=/usr --root=$PKG_DEST
+ DESTDIR=$PKG_DEST ninja install
}