void-packages/srcpkgs/llvm/template

135 lines
3.7 KiB
Plaintext

# Template file for 'llvm'
pkgname=llvm
version=3.5.1
wrksrc="llvm-${version}.src"
revision=1
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=R600"
conflicts="llvm-git>=0"
short_desc="Low Level Virtual Machine"
maintainer="Juan RP <xtraeme@gmail.com>"
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}/cfe-${version}.src.tar.xz
http://www.llvm.org/releases/${version}/compiler-rt-${version}.src.tar.xz"
checksum="
bf3275d2d7890015c8d8f5e6f4f882f8cf3bf51967297ebe74111d6d8b53be15
6773f3f9cf815631cc7e779ec134ddd228dc8e9a250e1ea3a910610c59eb8f5c
adf4b526f33e681aff5961f0821f5b514d3fc375410008842640b56a2e6a837a"
# XXX Investigate ocaml bindings.
hostmakedepends="groff perl python zlib-devel libffi-devel"
makedepends="zlib-devel libffi-devel"
post_extract() {
# 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 compiler-rt files into the llvm source.
if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version%.*} ]; then
mv ${XBPS_BUILDDIR}/compiler-rt-${version%.*} ${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 ${makejobs}
}
do_install() {
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
# 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="Low-Level Virtual Machine (LLVM) - 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 binutils gcc"
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/man/man1/*clang*"
}
}
llvm-docs_package() {
noarch=yes
short_desc+=" - documentation files"
pkg_install() {
vmove usr/share/doc
}
}
libllvm_package() {
short_desc+=" - runtime library"
pkg_install() {
vmove usr/lib/libLLVM-${version%.*}.so
vmove usr/lib/libLLVM-${version}.so
}
}