# Tanım: LLVM derleyicisi
# URL:         http://llvm.org/
# Paketçi:    milisarge
# Gerekler:  python cmake

isim=llvm
surum=4.0.0
devir=1
kaynak=(http://llvm.org/releases/$surum/$isim-$surum.src.tar.xz \
		llvm-config.h)

derle() {
  export CC=gcc
  export CXX=g++

  cd $isim-$surum.src

  mkdir build
  cd build

  cmake -DLLVM_ENABLE_CXX1Y=1 \
    -DLLVM_INCLUDE_EXAMPLES=0 \
    -DLLVM_INCLUDE_TESTS=0 \
    -DLLVM_ENABLE_OCAMLDOC=0 \
    -DLLVM_TARGETS_TO_BUILD='X86;AMDGPU;BPF' \
    -DLLVM_BUILD_LLVM_DYLIB=1 \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr ..

  MAKEFLAGS="$MAKEFLAGS" make
  make DESTDIR=$PKG install

  # multilib stub
  mv $PKG/usr/include/llvm/Config/llvm-config{,-64}.h

  install -m 0644 $SRC/llvm-config.h $PKG/usr/include/llvm/Config/

}
