linamh/eclass/vmware-mod-2.eclass

104 lines
2.7 KiB
Bash
Raw Normal View History

# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
# By default this eclasses wants eapi 2 which might be redefinable to newer
# versions.
case ${EAPI:-0} in
2) : ;;
*) die "No way! EAPI other than 2 is not supported for now." ;;
esac
# Ensure vmware comes before linux-mod since we want linux-mod's pkg_preinst and
# pkg_postinst, along with our own pkg_setup, src_unpack and src_compile
inherit flag-o-matic eutils vmware-2 linux-mod
DESCRIPTION="Modules for Vmware Programs"
HOMEPAGE="http://www.vmware.com/"
SRC_URI="http://ftp.mars.arge.at/vmware/${P}.tar.bz2
http://ftp.mars.arge.at/vmware/${P}-genpatches-${GENPATCHES_VER}.tar.bz2"
LICENSE="GPL-2 vmware"
SLOT="0"
IUSE=""
# We needn't restrict this since it was only required to read
# /etc/vmware/locations to determine the version (which is now fixed by
# VMWARE_VER)
# RESTRICT="userpriv"
EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_install
vmware-mod-2_pkg_setup() {
linux-mod_pkg_setup
BUILD_TARGETS="auto-build KERNEL_DIR=${KERNEL_DIR} KBUILD_OUTPUT=${KV_OUT_DIR}"
vmware-2_determine_product
# We create a group for VMware users due to bugs #104480 and #106170
enewgroup "${VMWARE_GROUP}"
if [[ -z "${VMWARE_MODULE_LIST}" ]]; then
case ${product} in
open-vm-tools)
VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} vmxnet"
[ "$shortname" != "server-tools" ] && VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} vmhgfs vmmemctl"
use amd64 || VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} vmdesched"
;;
*)
case ${PV} in
138.*)
VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} vmmon vmnet"
;;
169.*)
VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} vmmon vmnet vmblock"
;;
208.*)
VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} vmmon vmnet vmblock vmci vsock"
;;
esac
;;
esac
fi
filter-flags -mfpmath=sse
for mod in ${VMWARE_MODULE_LIST}; do
MODULE_NAMES="${MODULE_NAMES}
${mod}(misc:${S}/${mod}-only)"
done
}
vmware-mod-2_src_unpack() {
case ${product} in
open-vm-tools)
# Do nothing, this should be dealt with by vmware.eclass unpack
;;
*)
unpack ${A}
cd "${S}"
for mod in ${VMWARE_MODULE_LIST}; do
unpack ./${mod}.tar
done
;;
esac
}
vmware-mod-2_src_prepare() {
for mod in ${VMWARE_MODULE_LIST}; do
convert_to_m "${S}"/${mod}-only/Makefile
done
cd "${S}"
EPATCH_FORCE="yes"
EPATCH_SUFFIX="patch"
epatch "${WORKDIR}"/patches
}
vmware-mod-2_src_install() {
dodir /etc/udev/rules.d
echo 'KERNEL=="vmmon*", GROUP="'$VMWARE_GROUP'" MODE=660' >> "${D}/etc/udev/rules.d/60-vmware.rules" || die
echo 'KERNEL=="vmnet*", GROUP="'$VMWARE_GROUP'" MODE=660' >> "${D}/etc/udev/rules.d/60-vmware.rules" || die
linux-mod_src_install
}