# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Sheila Aman <sheila@vulpine.house>
pkgname=file
pkgver=5.41
pkgrel=0
pkgdesc="File type identification utility"
url="http://www.darwinsys.com/file/"
arch="all"
license="BSD-2-Clause"
depends=""
makedepends="autoconf automake libtool"
subpackages="$pkgname-dev $pkgname-doc libmagic"
source="$pkgname-$pkgver.tar.gz::https://github.com/file/file/archive/FILE${pkgver%.*}_${pkgver#*.}.tar.gz"
builddir="$srcdir/$pkgname-FILE${pkgver%.*}_${pkgver#*.}"

prepare() {
	autoreconf -vif
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--datadir=/usr/share
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

libmagic() {
	pkgdesc="File type identification library"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/lib "$pkgdir"/usr/share "$subpkgdir"/usr
}

sha512sums="efa94eec7f33b6d63e6a835987e83300accc2d81b6ea04e7bc031e4224594f96905bb5ffa8b0b3a5143084a8f5659349dffca9c78d9f444c1fd9b723ecb0c973  file-5.41.tar.gz"