# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI=4 inherit bsdmk flag-o-matic freebsd DESCRIPTION="Port for package building of virtio kernel lodable modules." HOMEPAGE="http://www.freshports.org/emulators/virtio-kmod/" SRC_URI="mirror://freebsd/ports/local-distfiles/kuriyama/virtio-${PV}.tar.gz" SLOT="0" KEYWORDS="~amd64-fbsd ~x86-fbsd" IUSE="" DEPEND=">=sys-freebsd/freebsd-sources-8.2" RDEPEND="${DEPEND}" RESTRICT="strip" LDFLAGS="$(raw-ldflags)" SYSDIR="${EPREFIX}/usr/src/sys" KMODDIR="${EPREFIX}/boot/modules" DESTDIR="${D}" src_unpack() { cd "${T}" default_src_unpack mkdir -p "${S}/sys/" } src_prepare() { # Workaround limitation where we must build inside the source tree # Use hard links to speed up copy of kernel sources when possible. if [ "$(id -u)" != "0" ] then cd /usr/src/sys/ find | cpio -dumpl --quiet "${S}/sys/" else cp -pR /usr/src/sys/ "${S}/sys" fi cp -pR "${T}/" "${S}/sys" # Prevent recursive operations find "${S}/sys" -name @ -exec rm {} + } src_compile() { append-cflags "-I${S}/sys" cd "${S}/sys/modules/virtio" mkmake DEBUG_FLAGS="-g" || die "mkmake failed" } src_install() { # Upstream does not provide an install target dodir /boot/modules cp "${S}"/sys/modules/virtio/*/*.ko{,.symbols} "${ED}/boot/modules" } pkg_postinst() { # Update linker.hints file /usr/sbin/kldxref "${EPREFIX}/boot/modules" # Print message from FreeBSD Ports elog "$(cat "${FILESDIR}/pkg-message")" } pkg_info() { cat "${FILESDIR}/pkg-descr" }