# Template file for 'facter'
pkgname=facter
version=3.14.16
revision=2
build_style=cmake
configure_args="-DRUBY_CONFIG_INCLUDE_DIR=${XBPS_CROSS_BASE}/usr/include
 -DENABLE_CXX_WERROR=OFF -DCMAKE_INSTALL_LIBDIR=/usr/lib"
hostmakedepends="ruby-devel"
makedepends="boost-devel cpp-hocon leatherman-devel libblkid-devel libcurl-devel
 ruby-devel yaml-cpp-devel"
depends="net-tools ruby"
short_desc="Collect and display system facts"
maintainer="Orphaned <orphan@voidlinux.org>"
license="Apache-2.0"
homepage="https://puppet.com/docs/puppet/latest/facter.html"
distfiles="https://downloads.puppetlabs.com/${pkgname}/${pkgname}-${version}.tar.gz"
checksum=196c69b1ae325dbf11f68025eb12b9c53c054bee9112bd4f3e2ece8c5fe76571

pre_configure() {
	case "$XBPS_TARGET_MACHINE" in
		mips*)	sed -i lib/CMakeLists.txt -e'/add_subdirectory(tests)/d' ;;
	esac
}

post_build() {
	# fixup vendor_ruby usr/lib{32,64} install path to always use usr/lib
	vsed -i build/lib/cmake_install.cmake -e "s;lib32;lib;g" -e "s;lib64;lib;g"
}

facter-devel_package() {
	short_desc+=" - development files"
	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.so"
	}
}
