From b6209fa29c545d861400624dfae49dcc1ddda4bd Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 18 Jun 2013 15:12:13 +0200 Subject: [PATCH] llvm: cross build support. --- srcpkgs/llvm/template | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template index 1d9fc89fa86..3dc164dc1d6 100644 --- a/srcpkgs/llvm/template +++ b/srcpkgs/llvm/template @@ -3,11 +3,9 @@ pkgname=llvm version=3.3 wrksrc="llvm-${version}.src" revision=4 -build_style=gnu-configure configure_args="--disable-expensive-checks --disable-debug-runtime - --enable-targets=all --enable-bindings=none --enable-optimize - --enable-shared --enable-libffi --enable-llvmc-dynamic - --disable-assertions --enable-experimental-targets=R600" + --enable-bindings=none --enable-optimize --enable-shared --enable-libffi + --enable-llvmc-dynamic --disable-assertions --enable-experimental-targets=R600" short_desc="Low Level Virtual Machine" maintainer="Juan RP " homepage="http://www.llvm.org" @@ -37,14 +35,33 @@ post_extract() { fi } -pre_configure() { +do_configure() { + if [ "$CROSS_BUILD" ]; then + unset CC CXX CPP AR AS RANLIB CFLAGS LDFLAGS CPPFLAGS + fi + # Don't let llvm strip bins. + sed -e '/.Install.StripFlag += -s/d' -i Makefile.rules + # 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} } -post_install() { +do_build() { + unset CC CXX CPP AR AS RANLIB CFLAGS LDFLAGS CPPFLAGS + cd build + make ${makejobs} +} + +do_install() { + cd build + make DESTDIR=${DESTDIR} install + # Fix permissions of static libs chmod -x ${DESTDIR}/usr/lib/*.a @@ -52,13 +69,18 @@ post_install() { rm ${DESTDIR}/usr/lib/*LLVMHello.* # Required for multilib. - if [ "$XBPS_MACHINE" = "x86_64" ]; then + 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() { @@ -83,7 +105,7 @@ clang-analyzer_package() { clang_package() { depends="libstdc++-devel binutils gcc" - short_desc="Low-Level Virtual Machine (LLVM) -- C language family frontend" + short_desc+=" - C language family frontend" homepage="http://clang.llvm.org/" pkg_install() { vmove usr/include/clang @@ -97,7 +119,7 @@ clang_package() { llvm-docs_package() { noarch=yes - short_desc+=" - documentation files" + short_desc+=" - documentation files" pkg_install() { vmove usr/share/doc }