# Maintainer: Dave Reisner <dreisner@archlinux.org>
# Contributor: judd <jvinet@zeroflux.org>

_pkgbasename=util-linux
pkgname=lib32-${_pkgbasename}
_pkgmajor=2.37
_realver=${_pkgmajor}.2
pkgver=${_realver/-/}
pkgrel=1
pkgdesc='Miscellaneous system utilities for Linux (32-bit)'
url='https://github.com/karelzak/util-linux'
arch=('x86_64')
depends=('lib32-glibc' "${_pkgbasename}" 'lib32-libxcrypt')
provides=('libuuid.so' 'libblkid.so' 'libfdisk.so' 'libmount.so' 'libsmartcols.so')
license=('GPL2')
options=('!emptydirs')
validpgpkeys=('B0C64D14301CC6EFAEDF60E4E4B71D5EEC39C284')  # Karel Zak
source=("https://www.kernel.org/pub/linux/utils/util-linux/v${_pkgmajor}/${_pkgbasename}-${_realver}.tar."{xz,sign})
sha256sums=('6a0764c1aae7fb607ef8a6dd2c0f6c47d5e5fd27aa08820abaad9ec14e28e9d9'
            'SKIP')

build() {
  cd "${_pkgbasename}-${_realver}"

  ./configure \
      CC="${CC:-cc} -m32" \
      PKG_CONFIG_PATH="/usr/lib32/pkgconfig" \
      --libdir=/usr/lib32

  make lib{uuid,blkid,fdisk,mount,smartcols}.la
}

package() {
  make -C "${_pkgbasename}-${_realver}" \
    DESTDIR="${pkgdir}" \
    install-usrlib_execLTLIBRARIES \
    install-pkgconfigDATA
}
