# Template file for 'popt'
pkgname=popt
version=1.19
revision=0
short_desc="Command-line option parsing library"
maintainer="finwo <finwo@pm.me>"
license="MIT"
homepage="https://github.com/rpm-software-management/popt"
# NOTE: TOFU pin; https to ftp.rpm.org fails from here, http works.
distfiles="http://ftp.rpm.org/popt/releases/popt-1.x/popt-1.19.tar.gz"
checksum=c25a4838fc8e4c1c8aacb8bd620edb3084a3d63bf8987fdad3ca2758c63240f9
# glibc + busybox first: the post-install runs /sbin/ldconfig under
# /bin/sh (ordering, not just runtime truth - see libmnl).
depends="glibc busybox"

# Notes:
# - Shared-only per packages/README.md. Sysroot seed (second install +
#   .pc prefix rewrite) so efibootmgr's build finds it via PKG_CONFIG_PATH.
# - Every UNOS library package carries the ldconfig post-install.

do_configure() {
  cd "${WRKSRC}"
  ./configure --prefix=/usr --disable-static
}

do_build() {
  cd "${WRKSRC}"
  make -j"$(nproc)"
}

do_install() {
  cd "${WRKSRC}"
  make install DESTDIR="${DESTDIR}"
  make install DESTDIR="${SYSROOT}"
  rm -f "${DESTDIR}"/usr/lib/*.la "${SYSROOT}"/usr/lib/*.la
  [ -f "${SYSROOT}/usr/lib/pkgconfig/popt.pc" ] || die "popt: no sysroot .pc"
}
