linamh/eclass/vmware-mod-2.eclass
2009-06-06 16:01:26 +00:00

168 lines
4.1 KiB
Bash

# 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
inherit eutils linux-mod versionator
DESCRIPTION="Modules for Vmware Programs"
LICENSE="GPL-2"
case ${PN} in
vmware-modules)
# vmware modules greater 208 (Workstation 6.5.* or Player 2.5.* or server 2.0.*) are GPL-2
# the MAJOR version number is from vmmon-only/include/iocontrols.h VMMON_VERSION
# the MINOR version number is the SUBVERSION number of the wkst, player, or server package
# (normally they match) put them into its own package
# older modules are licensed VMware Confidental
# we have to get them from the upstream package
# !!! dont put them into its own package !!!
# this check is a candidad for removal when the last old package is removed
if [[ "$(get_major_version)" -ge "208" ]]; then
VM_SRC_URI="http://ftp.mars.arge.at/vmware/${P}.tar.bz2"
else
LICENSE="vmware"
fi
HOMEPAGE="http://www.vmware.com/"
;;
open-vm-modules)
# the split into SRC and S is required for compile
# the sources of the modules are spread across the package
VM_SRC_URI="mirror://sourceforge/open-vm-tools/open-vm-tools-${PV/_p/-}.tar.gz"
HOMEPAGE="http://open-vm-tools.sourceforge.net/"
SRC="${WORKDIR}"/open-vm-tools-${PV/_p/-}
S="${SRC}/modules/linux"
;;
*)
eerror "unknown modules package"
;;
esac
# check if we need a pachset
if [[ -n ${GENPATCHES_VER} ]]; then
GEN_SRC_URI="http://ftp.mars.arge.at/vmware/${P}-genpatches-${GENPATCHES_VER}.tar.bz2"
else
GEN_SRC_URI=""
fi
SRC_URI="${VM_SRC_URI} ${GEN_SRC_URI}"
SLOT="0"
EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_compile src_install
VMWARE_GROUP="vmware"
vmware-mod-2_pkg_setup() {
linux-mod_pkg_setup
# standard build target
BUILD_TARGETS="auto-build HEADER_DIR=${KERNEL_DIR}/include BUILD_DIR=${KV_OUT_DIR}"
case ${PN} in
vmware-modules)
if [[ -n "${VM_MODULE_LIST}" ]]; then
for mod in ${VM_MODULE_LIST}; do
MODULE_NAMES="${MODULE_NAMES} ${mod}(vmware:${S}/${mod}-only)"
done
else
eerror "Buggy package plz specify VM_MODULE_LIST"
fi
;;
open-vm-modules)
# extend the build target for open-vm-modules
BUILD_TARGETS="${BUILD_TARGETS} OVT_SOURCE_DIR=${SRC}"
if [[ -n "${VM_MODULE_LIST}" ]]; then
for mod in ${VM_MODULE_LIST}; do
# modules should go into right directory
# this should some day be extended for the fs modules vmblock & vmhgfs and pvscsi
if [ "${mod}" == "vmxnet" -o "${mod}" == "vmxnet3" ];
then
MODTARGET="net"
else
MODTARGET="openvmtools"
fi
MODULE_NAMES="${MODULE_NAMES} ${mod}(${MODTARGET}:${S}/${mod})"
done
else
eerror "Buggy package plz specify VM_MODULE_LIST"
fi
;;
*)
eerror "unknown modules package"
;;
esac
}
vmware-mod-2_src_unpack() {
case ${PN} in
vmware-modules)
unpack ${A}
cd "${S}"
for mod in ${VM_MODULE_LIST}; do
unpack ./${mod}.tar
done
;;
open-vm-modules)
unpack ${A}
;;
*)
eerror "unknown modules package"
;;
esac
}
vmware-mod-2_src_prepare() {
case ${PN} in
vmware-modules)
for mod in ${VM_MODULE_LIST}; do
convert_to_m "${S}"/${mod}-only/Makefile
done
;;
open-vm-modules)
for mod in ${VM_MODULE_LIST}; do
convert_to_m "${S}"/${mod}/Makefile
done
;;
*)
eerror "unknown modules package"
;;
esac
if [[ -e "${WORKDIR}/patches" ]]; then
cd "${S}"
EPATCH_FORCE="yes"
EPATCH_SUFFIX="patch"
epatch "${WORKDIR}"/patches
fi
}
vmware-mod-2_src_compile() {
linux-mod_src_compile
}
vmware-mod-2_src_install() {
case ${PN} in
vmware-modules)
dodir /etc/udev/rules.d
for mod in ${VM_MODULE_LIST}; do
echo 'KERNEL=="'$mod'*", GROUP="'$VMWARE_GROUP'" MODE=660' >> "${D}/etc/udev/rules.d/60-vmware.rules" || die
done
;;
open-vm-modules)
einfo "no udev rules required"
;;
*)
eerror "unknown modules package"
;;
esac
linux-mod_src_install
}