mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-02-12 02:54:40 +08:00
llvm now split to different packages - llvm, llvm-libs (in dir llvm/): the main llvm lib and functional part - lld: (dynamic) linker of llvm - lldb: debugger of llvm - compiler-rt: runtime compiler lib for clang to build and run - clang: C/C++ compiler from llvm project they should stay in same release version the update sequence is: (optional ocaml group->) llvm -> lld -> compiler-rt -> clang
108 lines
3.4 KiB
Bash
108 lines
3.4 KiB
Bash
# $Id$
|
|
# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
|
|
# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
|
|
|
|
pkgname=clang
|
|
pkgver=6.0.0
|
|
pkgrel=1
|
|
pkgdesc="C language family frontend for LLVM"
|
|
arch=('x86_64')
|
|
url="https://clang.llvm.org/"
|
|
license=('custom:University of Illinois/NCSA Open Source License')
|
|
depends=('llvm-libs' 'gcc' 'compiler-rt')
|
|
makedepends=('llvm' 'cmake' 'ninja' 'python3-sphinx')
|
|
optdepends=('openmp: OpenMP support in clang with -fopenmp'
|
|
'python: for git-clang-format'
|
|
'python2: for scan-view')
|
|
provides=("clang-analyzer=$pkgver" "clang-tools-extra=$pkgver")
|
|
conflicts=('clang-analyzer' 'clang-tools-extra')
|
|
replaces=('clang-analyzer' 'clang-tools-extra')
|
|
source=(https://releases.llvm.org/$pkgver/cfe-$pkgver.src.tar.xz{,.sig}
|
|
https://releases.llvm.org/$pkgver/clang-tools-extra-$pkgver.src.tar.xz{,.sig}
|
|
https://releases.llvm.org/$pkgver/llvm-$pkgver.src.tar.xz{,.sig}
|
|
enable-SSP-and-PIE-by-default.patch)
|
|
sha256sums=('e07d6dd8d9ef196cfc8e8bb131cbd6a2ed0b1caf1715f9d05b0f0eeaddb6df32'
|
|
'SKIP'
|
|
'053b424a4cd34c9335d8918734dd802a8da612d13a26bbb88fcdf524b2d989d2'
|
|
'SKIP'
|
|
'1ff53c915b4e761ef400b803f07261ade637b0c269d99569f18040f3dcee4408'
|
|
'SKIP'
|
|
'28d38b7f4bcaa0c974f8c48d732a0db309ea89ffa901c39de90725ae857946c1')
|
|
validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans@chromium.org>
|
|
validpgpkeys+=('11E521D646982372EB577A1F8F0871F202119294') # Tom Stellard <tom@stellard.net>
|
|
|
|
prepare() {
|
|
cd "$srcdir/cfe-$pkgver.src"
|
|
mkdir build
|
|
mv "$srcdir/clang-tools-extra-$pkgver.src" tools/extra
|
|
patch -Np1 -i ../enable-SSP-and-PIE-by-default.patch
|
|
}
|
|
|
|
build() {
|
|
cd "$srcdir/cfe-$pkgver.src/build"
|
|
|
|
cmake .. -G Ninja \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
|
|
-DBUILD_SHARED_LIBS=ON \
|
|
-DLLVM_LINK_LLVM_DYLIB=ON \
|
|
-DLLVM_ENABLE_RTTI=ON \
|
|
-DLLVM_BUILD_TESTS=ON \
|
|
-DLLVM_INCLUDE_DOCS=ON \
|
|
-DLLVM_BUILD_DOCS=ON \
|
|
-DLLVM_ENABLE_SPHINX=ON \
|
|
-DSPHINX_WARNINGS_AS_ERRORS=OFF \
|
|
-DLLVM_EXTERNAL_LIT=/usr/bin/lit \
|
|
-DLLVM_MAIN_SRC_DIR="$srcdir/llvm-$pkgver.src"
|
|
ninja
|
|
}
|
|
|
|
check() {
|
|
cd "$srcdir/cfe-$pkgver.src/build"
|
|
ninja check-clang{,-tools}
|
|
}
|
|
|
|
_python2_optimize() {
|
|
python2 -m compileall "$@"
|
|
python2 -O -m compileall "$@"
|
|
}
|
|
|
|
_python3_optimize() {
|
|
python3 -m compileall "$@"
|
|
python3 -O -m compileall "$@"
|
|
python3 -OO -m compileall "$@"
|
|
}
|
|
|
|
package() {
|
|
cd "$srcdir/cfe-$pkgver.src/build"
|
|
|
|
DESTDIR="$pkgdir" ninja install
|
|
install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
|
|
|
# Remove documentation sources
|
|
rm -r "$pkgdir"/usr/share/doc/clang{,-tools}/html/{_sources,.buildinfo}
|
|
|
|
# Move analyzer scripts out of /usr/libexec
|
|
mv "$pkgdir"/usr/libexec/{ccc,c++}-analyzer "$pkgdir/usr/lib/clang/"
|
|
rmdir "$pkgdir/usr/libexec"
|
|
sed -i 's|libexec|lib/clang|' "$pkgdir/usr/bin/scan-build"
|
|
|
|
# Install Python bindings
|
|
for _py in 2.7 3.6; do
|
|
install -d "$pkgdir/usr/lib/python$_py/site-packages"
|
|
cp -a ../bindings/python/clang "$pkgdir/usr/lib/python$_py/site-packages/"
|
|
_python${_py%%.*}_optimize "$pkgdir/usr/lib/python$_py"
|
|
done
|
|
|
|
# Fix shebang in Python 2 scripts
|
|
sed -i '1s|/usr/bin/env python$|&2|' \
|
|
"$pkgdir/usr/bin/scan-view" \
|
|
"$pkgdir"/usr/share/$pkgname/*.py
|
|
|
|
# Compile Python scripts
|
|
_python2_optimize "$pkgdir/usr/share"
|
|
}
|
|
|
|
# vim:set ts=2 sw=2 et:
|