PKGBUILDs/community/libc++/PKGBUILD
2021-11-16 19:59:37 +00:00

92 lines
3.9 KiB
Bash

# Maintener: Anatol Pomozov
# Contributor: Llewelyn Trahaearn <woefulderelict [at] gmail [dot] com>
# Contributor: Daniel Micay <danielmicay [at] gmail [dot] com>
# Contributor: MThinkCpp <mtc [dot] maintainer [at] outlook [dot] com>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - atomic fixes for v5
pkgbase=libc++
pkgname=(libc++ libc++abi libc++experimental)
pkgver=13.0.0
pkgrel=1
url="https://libcxx.llvm.org/"
license=('custom:Apache 2.0 with LLVM Exception')
arch=('x86_64')
depends=('gcc-libs')
makedepends=('clang' 'cmake' 'llvm' 'libunwind' 'ninja' 'python')
source=("https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/llvm-$pkgver.src.tar.xz"{,.sig}
"https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/libcxx-$pkgver.src.tar.xz"{,.sig}
"https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/libcxxabi-$pkgver.src.tar.xz"{,.sig}
'atomic.patch')
noextract=("${source[@]##*/}")
sha512sums=('c307500a5fdc2bf6d768a808cf879d33914e24437f4f794361eccedb28ac6a98ebc41ca6140d09364c9bdec565fabd049e364d3f5b39f1751ecff51b687c4eff'
'SKIP'
'deaf166ea9b5ffe4d7d1ace86fb4ed33317c610ff41947d2b0b18934b2a54601521f1021c5fd43bdba3a08779f3be98e13d2565c0d4374d849c5eff487eda2dd'
'SKIP'
'e7c8177898f344d4a16bf199ddbae4c8ae0d31e2961c5946934abb30631c386d2d28bf4804e65faa9f6298aca01e6e925fd88a13c918d8e5d1b175720e600823'
'SKIP'
'd4dd60345d59690e5fb332ec8c4b600615a6a2f3b50c748876b713e39c0e21800e021358a32920c7954e62c2224954c6f2cd2054d531420da3f696957d21e7f6')
validpgpkeys=('474E22316ABF4785A88C6E8EA2C794A986419D8A' # Tom Stellard <tstellar@redhat.com> (.1 releases)
'B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans@chromium.org> (.0 releases)
prepare() {
mkdir -p build llvm/projects/libcxx llvm/projects/libcxxabi
bsdtar --strip-components 1 -zxf "${source[0]##*/}" -C llvm
bsdtar --strip-components 1 -zxf "${source[2]##*/}" -C llvm/projects/libcxx
bsdtar --strip-components 1 -zxf "${source[4]##*/}" -C llvm/projects/libcxxabi
sed -i 's/CREDITS.TXT/CREDITS/' llvm/projects/libcxx/LICENSE.TXT llvm/projects/libcxxabi/LICENSE.TXT
if [[ $CARCH == "arm" ]]; then
patch -p1 -d llvm -i ../atomic.patch
echo "target_link_libraries(cxxabi_shared PRIVATE atomic)" >> llvm/projects/libcxxabi/src/CMakeLists.txt
fi
}
build() {
cd build
cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=NO \
"$srcdir"/llvm
ninja cxx cxx_experimental
}
check() {
ninja -C build check-cxx check-cxxabi
}
# Do not remove the space before the () or commitpkg will
# accidentally to run this function on the system (!!!)
package_libc++ () {
pkgdesc='LLVM C++ standard library.'
depends=("libc++abi=$pkgver-$pkgrel")
options=('staticlibs')
DESTDIR="$pkgdir" ninja -C build install-cxx
install -Dm0644 "$srcdir"/llvm/projects/libcxx/CREDITS.TXT "$pkgdir"/usr/share/licenses/"$pkgname"/CREDITS
install -Dm0644 "$srcdir"/llvm/projects/libcxx/LICENSE.TXT "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE
}
package_libc++abi() {
pkgdesc='Low level support for the LLVM C++ standard library.'
options=('staticlibs')
DESTDIR="$pkgdir" ninja -C build install-cxxabi
install -Dm0644 "$srcdir"/llvm/projects/libcxxabi/CREDITS.TXT "$pkgdir"/usr/share/licenses/"$pkgname"/CREDITS
install -Dm0644 "$srcdir"/llvm/projects/libcxxabi/LICENSE.TXT "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE
}
package_libc++experimental() {
depends=("libc++=$pkgver-$pkgrel")
pkgdesc='LLVM C++ experimental library.'
install -Dm0644 -t "$pkgdir"/usr/lib/ build/lib/libc++experimental.a
install -Dm0644 llvm/projects/libcxx/CREDITS.TXT "$pkgdir"/usr/share/licenses/"$pkgname"/CREDITS
install -Dm0644 llvm/projects/libcxx/LICENSE.TXT "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE
}