app=lld
version=10.0.1
build=1sml
homepage="https://lld.llvm.org/"
download="https://github.com/llvm/llvm-project/releases/download/llvmorg-$version/lld-$version.src.tar.xz"
desc="Drop-in replacement for binutils gold and bfd linkers"
requires="llvm"

build() {
  mkandenterbuilddir
  rm -rf $app-$version.src

  tar xf $srcdir/$app-$version.src.tar.?z*
  cd $app-$version.src 
  fixbuilddirpermissions

  mkdir -p smbuild && cd smbuild

  # We don't want optimisations for small builds
  unset CFLAGS CXXFLAGS
  cmake .. -G Ninja -Wno-dev \
    -DCMAKE_BUILD_TYPE=MinSizeRel \
    -DCMAKE_INSTALL_PREFIX="/" \
    -DLLVM_LINK_LLVM_DYLIB=ON \
    -DLLVM_BUILD_DOCS=OFF

  ninja
  DESTDIR=$pkg ninja install

  cp ../LICENSE.TXT $pkgdocs/

  mkfinalpkg
}

sha512sums="
cc0d206739db4c3876eb4718690e11b3eb1a2278e0d4a17a9576eef2320a2e25e1f548768f74f0877e4d00ef50471af1ce179eae9e514d41a0d93285c537941a  lld-10.0.1.src.tar.xz
"
