# Build template for 'busybox-ntpd'.
pkgname=busybox-ntpd
version=1.23.2
revision=1
wrksrc="busybox-$version"
hostmakedepends="perl"
short_desc="The Swiss Army Knife of Embedded Linux (ntpd)"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-2"
homepage="http://www.busybox.net"
distfiles="${homepage}/downloads/busybox-$version.tar.bz2"
checksum=05a6f9e21aad8c098e388ae77de7b2361941afa7157ef74216703395b14e319a

pre_build() {
	mkdir -p src
	mv * src || true

	local t="busybox-ntpd"
	mkdir -p $t
	make -C $t CFLAGS="$CFLAGS" KBUILD_SRC=${wrksrc}/src \
		-f ${wrksrc}/src/Makefile defconfig
	cp -f ${FILESDIR}/${t}.dotconfig ${t}/.config

	case "$XBPS_TARGET_MACHINE" in
	*-musl) sed -i -e /CONFIG_FEATURE_VI_REGEX_SEARCH/s/y/n/ \
			-e /CONFIG_FEATURE_MOUNT_NFS/s/y/n/ \
			${t}/.config;;
	esac

	if [ "$CROSS_BUILD" ]; then
		sed -e \
			"s,\(CONFIG_CROSS_COMPILER_PREFIX\).*,\1=\"${XBPS_CROSS_TRIPLET}-\",g" \
			-i ${t}/.config
	fi
}
do_build() {
	local t="busybox-ntpd"
	make -C $t SKIP_STRIP=y CFLAGS="$CFLAGS" ${makejobs}
}
do_install() {
	vbin busybox-ntpd/busybox_unstripped busybox-ntpd
	vsv busybox-ntpd
}