# Template file for 'mkinitcpio-nfs-utils'
pkgname=mkinitcpio-nfs-utils
version=0.3
revision=1
build_style=gnu-makefile
short_desc="Ipconfig and nfsmount tools for NFS root support in mkinitcpio"
maintainer="Andrea Brancaleoni <miwaxe@gmail.com>"
license="GPL-2"
homepage="http://www.archlinux.org/"
depends="mkinitcpio"
distfiles="https://sources.archlinux.org/other/mkinitcpio/$pkgname-$version.tar.xz"
checksum=d290d489844fae100ca7b848b8eef40078124ff373203086bacc07329d1e8939

case "$XBPS_TARGET_MACHINE" in
*-musl)
	CFLAGS="-DSYS_NMLN=65"
	# http://osxr.org/glibc/source/sysdeps/unix/sysv/linux/bits/utsname.h?v=glibc-2.15; fixes musl not having set this variable
	;;
esac

patch_args="-Np1"

pre_configure() {
	case "$XBPS_TARGET_MACHINE" in
	*-musl)
		sed -i 's|PROGRAMS = ipconfig nfsmount|PROGRAMS = ipconfig|g' Makefile
		# No RPC in musl for now
		;;
	esac
}

post_install() {
	vinstall ${FILESDIR}/initcpio-install-net 644 usr/lib/initcpio/install net
	vinstall ${FILESDIR}/initcpio-hook-net 644 usr/lib/initcpio/hooks net
}
