240 lines
7.0 KiB
Bash
240 lines
7.0 KiB
Bash
# Template file for 'llvm'
|
|
pkgname=llvm
|
|
version=3.8.1
|
|
revision=1
|
|
wrksrc="llvm-${version}.src"
|
|
lib32disabled=yes
|
|
build_style=cmake
|
|
configure_args="
|
|
-DCMAKE_BUILD_TYPE=Release
|
|
-DLLVM_BUILD_LLVM_DYLIB=ON
|
|
-DLLVM_LINK_LLVM_DYLIB=ON
|
|
-DLLVM_DYLIB_EXPORT_ALL=ON
|
|
-DLLVM_ENABLE_RTTI=ON
|
|
-DLLVM_ENABLE_FFI=ON
|
|
-DLLVM_BINUTILS_INCDIR=/usr/include
|
|
-DCMAKE_INSTALL_DO_STRIP=0"
|
|
short_desc="Low Level Virtual Machine"
|
|
maintainer="Juan RP <xtraeme@voidlinux.eu>"
|
|
homepage="http://www.llvm.org"
|
|
license="BSD"
|
|
distfiles="
|
|
http://www.llvm.org/releases/${version}/llvm-${version}.src.tar.xz
|
|
http://www.llvm.org/releases/${version}/lldb-${version}.src.tar.xz
|
|
http://www.llvm.org/releases/${version}/lld-${version}.src.tar.xz
|
|
http://www.llvm.org/releases/${version}/cfe-${version}.src.tar.xz
|
|
http://www.llvm.org/releases/${version}/clang-tools-extra-${version}.src.tar.xz
|
|
http://www.llvm.org/releases/${version}/compiler-rt-${version}.src.tar.xz"
|
|
checksum="
|
|
6e82ce4adb54ff3afc18053d6981b6aed1406751b8742582ed50f04b5ab475f9
|
|
349148116a47e39dcb5d5042f10d8a6357d2c865034563283ca512f81cdce8a3
|
|
2bd9be8bb18d82f7f59e31ea33b4e58387dbdef0bc11d5c9fcd5ce9a4b16dc00
|
|
4cd3836dfb4b88b597e075341cae86d61c63ce3963e45c7fe6a8bf59bb382cdf
|
|
664a5c60220de9c290bf2a5b03d902ab731a4f95fe73a00856175ead494ec396
|
|
0df011dae14d8700499dfc961602ee0a9572fef926202ade5dcdfe7858411e5c"
|
|
|
|
# XXX Investigate ocaml bindings.
|
|
hostmakedepends="groff perl python zlib-devel libffi-devel swig"
|
|
makedepends="python-devel zlib-devel libffi-devel libedit-devel libxml2-devel binutils-devel"
|
|
depends="libllvm3.8"
|
|
|
|
subpackages="clang clang-analyzer libllvm3.8"
|
|
if [ -z "$CROSS_BUILD" ]; then
|
|
# XXX fails to cross compile due to python
|
|
subpackages+=" lldb lldb-devel"
|
|
fi
|
|
subpackages+=" lld lld-devel"
|
|
|
|
post_extract() {
|
|
# patches
|
|
cd ${XBPS_BUILDDIR}/llvm-${version}.src
|
|
for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
|
|
msg_normal "Applying $i to llvm\n"
|
|
patch -sNp1 -i ${i}
|
|
done
|
|
|
|
cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
|
|
for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
|
|
msg_normal "Applying $i to compiler-rt\n"
|
|
patch -sNp1 -i ${i}
|
|
done
|
|
# FIX BUG 22661
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
i686*) sed -ri "/ifeq.*CompilerTargetArch/s#i386#i686#g" make/platform/clang_linux.mk ;;
|
|
esac
|
|
|
|
cd ${XBPS_BUILDDIR}/cfe-${version}.src
|
|
for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
|
|
msg_normal "Applying $i to cfe\n"
|
|
patch -sNp1 -i ${i}
|
|
done
|
|
|
|
cd ${XBPS_BUILDDIR}/lldb-${version}.src
|
|
for i in ${FILESDIR}/patches/lldb/*.patch; do
|
|
msg_normal "Applying $i to lldb\n"
|
|
patch -sNp1 -i ${i}
|
|
done
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
|
|
esac
|
|
|
|
# Move clang files into the llvm source.
|
|
if [ -d ${XBPS_BUILDDIR}/cfe-${version}.src ]; then
|
|
mv ${XBPS_BUILDDIR}/cfe-${version}.src ${wrksrc}/tools/clang
|
|
fi
|
|
# Move clang-tools-extra files into llvm source.
|
|
if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
|
|
mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/extra
|
|
fi
|
|
# Move lld files into the llvm source.
|
|
if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
|
|
mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
|
|
fi
|
|
# Move lldb files into the llvm source.
|
|
if [ -z "$CROSS_BUILD" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
|
|
mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
|
|
fi
|
|
# Move compiler-rt files into the llvm source.
|
|
if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
|
|
mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
|
|
fi
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
*-musl)
|
|
# Disable sanitizers
|
|
sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
|
|
;;
|
|
esac
|
|
|
|
}
|
|
|
|
pre_configure() {
|
|
if [ "$CROSS_BUILD" ]; then
|
|
msg_normal "Building host tblgen\n"
|
|
mkdir -p build/HOST
|
|
cd build/HOST
|
|
CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
|
|
CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
|
|
cmake ../.. -DCMAKE_BUILD_TYPE=Release
|
|
make ${makejobs} -C utils/TableGen
|
|
make ${makejobs} -C tools/clang/utils/TableGen
|
|
configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
|
|
configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
|
|
cd ../..
|
|
fi
|
|
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
i686*) _arch="X86";;
|
|
x86_64*) _arch="X86";;
|
|
arm*) _arch="ARM";;
|
|
aarch64*) _arch="AArch64";;
|
|
mips*) _arch="Mips";;
|
|
esac
|
|
configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
|
|
configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
|
|
}
|
|
|
|
do_install() {
|
|
vlicense LICENSE.TXT
|
|
|
|
cd build
|
|
cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
|
|
|
|
# Fix permissions of static libs
|
|
chmod -x ${DESTDIR}/usr/lib/*.a
|
|
|
|
# Required for multilib.
|
|
if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
|
|
for _header in llvm-config; do
|
|
mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
|
|
vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
|
|
usr/include/llvm/Config ${_header}.h
|
|
done
|
|
fi
|
|
|
|
ln -s /usr/bin/clang ${DESTDIR}/usr/bin/clang-cpp
|
|
|
|
# Remove llvm-config-host in cross builds.
|
|
if [ "$CROSS_BUILD" ]; then
|
|
rm -f ${DESTDIR}/usr/bin/llvm-config-host
|
|
fi
|
|
}
|
|
|
|
clang-analyzer_package() {
|
|
noarch=yes
|
|
pycompile_dirs="usr/share/scan-view"
|
|
depends="clang-${version}_${revision} python"
|
|
short_desc+=" - A source code analysis framework"
|
|
homepage="http://clang-analyzer.llvm.org/"
|
|
pkg_install() {
|
|
vmove usr/share/man/man1/scan-build.1
|
|
vmove "/usr/bin/scan-*"
|
|
vmove "/usr/share/scan-*"
|
|
vmove "/usr/libexec/*analyzer"
|
|
}
|
|
}
|
|
clang_package() {
|
|
lib32disabled=yes
|
|
depends="libstdc++-devel libgcc-devel binutils"
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
*-musl) depends+=" musl-devel";;
|
|
*) depends+=" glibc-devel";;
|
|
esac
|
|
short_desc+=" - C language family frontend"
|
|
homepage="http://clang.llvm.org/"
|
|
pkg_install() {
|
|
vmove usr/include/clang
|
|
vmove "usr/bin/*clang*"
|
|
vmove usr/bin/c-index-test
|
|
vmove usr/lib/clang
|
|
vmove "usr/lib/libclang*"
|
|
vmove "usr/share/clang"
|
|
}
|
|
}
|
|
lld_package() {
|
|
lib32disabled=yes
|
|
short_desc+=" - linker"
|
|
homepage="http://lld.llvm.org"
|
|
pkg_install() {
|
|
vmove usr/bin/lld*
|
|
vmove usr/bin/ld.lld*
|
|
}
|
|
}
|
|
lld-devel_package() {
|
|
lib32disabled=yes
|
|
short_desc+=" - linker - development files"
|
|
homepage="http://lld.llvm.org"
|
|
pkg_install() {
|
|
vmove usr/include/lld
|
|
vmove "usr/lib/liblld*a"
|
|
}
|
|
}
|
|
lldb_package() {
|
|
lib32disabled=yes
|
|
depends+=" python-six"
|
|
short_desc+=" - LLDB debugger"
|
|
homepage="http://lldb.llvm.org/"
|
|
pkg_install() {
|
|
vmove usr/bin/*lldb*
|
|
vmove usr/lib/liblldb*so.*
|
|
vman tools/lldb/docs/lldb.1
|
|
vmove /usr/lib/python*
|
|
# Depend on python-six instead of conflicting
|
|
rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
|
|
}
|
|
}
|
|
lldb-devel_package() {
|
|
depends="lldb>=${version}_${revision}"
|
|
short_desc+=" - LLDB debugger - development files"
|
|
pkg_install() {
|
|
vmove usr/include/lldb
|
|
vmove "usr/lib/liblldb*.a"
|
|
vmove "usr/lib/liblldb*.so"
|
|
}
|
|
}
|
|
libllvm3.8_package() {
|
|
short_desc+=" - runtime library"
|
|
pkg_install() {
|
|
vmove "usr/lib/libLLVM-*.so*"
|
|
}
|
|
}
|