209 lines
6.1 KiB
Bash
209 lines
6.1 KiB
Bash
# Template file for 'llvm'
|
|
pkgname=llvm
|
|
version=3.7.1
|
|
revision=2
|
|
wrksrc="llvm-${version}.src"
|
|
lib32disabled=yes
|
|
configure_args="--disable-expensive-checks --disable-debug-runtime
|
|
--enable-bindings=none --enable-optimized --enable-shared --enable-libffi
|
|
--enable-llvmc-dynamic --disable-assertions --enable-keep-symbols
|
|
--enable-experimental-targets=AMDGPU"
|
|
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}/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="
|
|
be7794ed0cec42d6c682ca8e3517535b54555a3defabec83554dbc74db545ad5
|
|
9a0bc315ef55f44c98cdf92d064df0847f453ed156dd0ef6a87e04f5fd6a0e01
|
|
56e2164c7c2a1772d5ed2a3e57485ff73ff06c97dff12edbeea1acc4412b0674
|
|
4a91edaccad1ce984c7c49a4a87db186b7f7b21267b2b03bcf4bd7820715bc6b
|
|
9d4769e4a927d3824bcb7a9c82b01e307c68588e6de4e7f04ab82d82c5af8181"
|
|
|
|
# XXX Investigate ocaml bindings.
|
|
hostmakedepends="groff perl python zlib-devel libffi-devel swig"
|
|
makedepends="python-devel zlib-devel libffi-devel libedit-devel"
|
|
|
|
subpackages="clang clang-analyzer libllvm3.7 llvm-doc"
|
|
if [ -z "$CROSS_BUILD" ]; then
|
|
# XXX fails to cross compile due to python
|
|
subpackages+=" lldb lldb-devel"
|
|
fi
|
|
|
|
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
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
*-musl) patch -sNp1 -i "${FILESDIR}/patches/compiler-rt/compiler-rt_musl_001-disable-sanitizers.patch" ;;
|
|
esac
|
|
# 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 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
|
|
}
|
|
|
|
do_configure() {
|
|
unset CC CXX CPP AR AS RANLIB CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
|
|
|
|
# Fix installation directories, ./configure doesn't seem to set them right
|
|
sed -i -e 's:\$(PROJ_prefix)/etc/llvm:/etc/llvm:' \
|
|
-e 's:\$(PROJ_prefix)/docs/llvm:$(PROJ_prefix)/share/doc/llvm:' \
|
|
Makefile.config.in
|
|
|
|
mkdir build
|
|
cd build
|
|
../configure ${configure_args}
|
|
}
|
|
|
|
do_build() {
|
|
unset CC CXX CPP AR AS RANLIB CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
|
|
cd build
|
|
make REQUIRES_RTTI=1 ${makejobs}
|
|
}
|
|
|
|
do_install() {
|
|
vlicense LICENSE.TXT
|
|
|
|
cd build
|
|
make DESTDIR=${DESTDIR} install
|
|
|
|
# Fix permissions of static libs
|
|
chmod -x ${DESTDIR}/usr/lib/*.a
|
|
|
|
# Get rid of example Hello transformation
|
|
rm ${DESTDIR}/usr/lib/*LLVMHello.*
|
|
|
|
# Required for multilib.
|
|
if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
|
|
for _header in config 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/lib/clang-analyzer"
|
|
depends="clang-${version}_${revision} python"
|
|
short_desc+=" - A source code analysis framework"
|
|
homepage="http://clang-analyzer.llvm.org/"
|
|
pkg_install() {
|
|
vmkdir usr/bin
|
|
vmkdir usr/lib/clang-analyzer
|
|
|
|
for f in build view; do
|
|
cp -r ${wrksrc}/tools/clang/tools/scan-${f} ${PKGDESTDIR}/usr/lib/clang-analyzer
|
|
cd ${PKGDESTDIR}/usr/bin
|
|
ln -s ../lib/${pkgname}/scan-${f}/scan-${f} scan-${f}
|
|
done
|
|
|
|
ln -sf /usr/bin/clang ${PKGDESTDIR}/usr/lib/${pkgname}/scan-build
|
|
}
|
|
}
|
|
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*"
|
|
}
|
|
}
|
|
lldb_package() {
|
|
lib32disabled=yes
|
|
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*"
|
|
}
|
|
}
|
|
lldb-devel_package() {
|
|
depends="lldb>=${version}_${revision}"
|
|
short_desc+=" - LLDB debugger - development files"
|
|
pkg_install() {
|
|
vmove usr/include/lldb
|
|
vmove "usr/lib/liblldb*.a"
|
|
}
|
|
}
|
|
llvm-doc_package() {
|
|
noarch=yes
|
|
short_desc+=" - documentation files"
|
|
pkg_install() {
|
|
vmove usr/share/doc
|
|
}
|
|
}
|
|
libllvm3.7_package() {
|
|
short_desc+=" - runtime library"
|
|
pkg_install() {
|
|
vmove usr/lib/libLLVM-${version%.*}.so
|
|
vmove usr/lib/libLLVM-${version}.so
|
|
}
|
|
}
|