# Template file for 'file'
pkgname=file
version=5.40
revision=3
bootstrap=yes
build_style=gnu-configure
configure_args="--enable-static $(vopt_enable libseccomp)"
makedepends="zlib-devel $(vopt_if libseccomp libseccomp-devel)"
short_desc="File type identification utility"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="BSD-2-Clause"
homepage="http://www.darwinsys.com/file/"
distfiles="https://astron.com/pub/file/file-${version}.tar.gz"
checksum=167321f43c148a553f68a0ea7f579821ef3b11c27b8cbe158e4df897e4a5dd57

build_options="libseccomp"

if [ -z "$CHROOT_READY" ]; then
	# libseccomp's default=auto and
	# libseccomp is not bootstrap
	# If we're bootstraping from host with libseccomp installed,
	# bootstrap will fail to install shlib required by file.
	if [ "$build_option_libseccomp" ]; then
		msg_error "libseccomp can't be enabled when bootstrapping\n"
	fi
fi

if [ "$CROSS_BUILD" ]; then
	# XXX cross compilation needs exactly the same version for the host
	hostmakedepends="file"
fi

post_install() {
	vlicense COPYING
}

libmagic_package() {
	short_desc="File type identification library"
	pkg_install() {
		vmove "usr/lib/*.so.*"
		vmove usr/share/misc
		vmove usr/share/man/man4
	}
}

file-devel_package() {
	depends="${makedepends} libmagic>=${version}_${revision}"
	short_desc="File type identification library - development files"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
		vmove usr/lib/pkgconfig
		vmove usr/share/man/man3
	}
}
