blob: e2a494316946cf6ed9fa914c0656dc0484497dd8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#!/bin/sh
MAKEDEPS="make ninja cmake libedit libffi libxml2 ncurses python-setuptools python-sphinx"
DEPS="perl zlib libffi libedit ncurses"
PKG_VER=13.0.0
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
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
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_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="clang;clang-tools-extra;libcxx;libcxxabi;libunwind;lldb;lld;openmp" \
-Wno-dev -G Ninja .. &&
ninja llvm-tblgen &&
ninja
}
package () {
DESTDIR=$PKG_DEST ninja install
}
|