pkgname="libelf"
_pkgbase="elfutils"
pkgver=0.193
pkgdesc="Handle ELF object files and DWARF debugging information (lib)"
license=("GPL-2.0-or-later OR LGPL-3.0-or-later")
homepage="https://sourceware.org/elfutils/"
sources=("${_pkgbase}-${pkgver}.tar.bz2")
urls=("https://sourceware.org/ftp/${_pkgbase}/${pkgver}/${sources[0]}")
md5sums="ceefa052ded950a4c523688799193a44"

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  CFLAGS+=" -g"
  ./configure --prefix=/usr                \
              --disable-debuginfod         \
              --enable-libdebuginfod=dummy
  make
}

src_check() {
  leaf_record_message "dwarf_srclang_check is known to fail."
  make -k check
}

src_install() {
  make -C ${pkgname} DESTDIR="${pkgdir}" install
  install -vDm644 config/libelf.pc -t "${pkgdir}/usr/lib/pkgconfig/"
  rm -v "${pkgdir}/usr/lib/libelf.a"
}

