# Depends on: libffi python2 cmake ninja

description="Low Level Virtual Machine, collection of modular and reusable compiler and toolchain."
url="http://llvm.org/"
maintainer="Chris Lattner <sabre at nondot dot org>"
packager="tnut <tnut@nutyx.org>"
contributors="Pierre B, Tnut, Remy"

name=llvm
version=6.0.1

source=(
	${url}releases/$version/$name-$version.src.tar.xz
	${url}releases/$version/cfe-$version.src.tar.xz
	${url}releases/$version/compiler-rt-$version.src.tar.xz)

build() {

cd $name-$version.src

mv ../compiler-rt-${version}.src projects/compiler-rt
mv ../cfe-$version.src tools/clang

mkdir build
cd    build

CC=gcc CXX=g++ \
cmake -DCMAKE_INSTALL_PREFIX=/usr  \
	-DLLVM_ENABLE_FFI=ON       \
	-DCMAKE_BUILD_TYPE=Release \
	-DLLVM_BUILD_LLVM_DYLIB=ON \
	-DLLVM_LINK_LLVM_DYLIB=ON  \
	-DLLVM_TARGETS_TO_BUILD="host;AMDGPU;" \
	-Wno-dev -G Ninja ..

ninja

DESTDIR=$PKG ninja install
}
