linamh/eclass/vmware-mod-2.eclass

173 lines
4.2 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 version number is from vmmon-only/include/iocontrols.h VMMON_VERSION
# 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"
;;
*)
ewarn "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}"
if [[ -z "${VMWARE_MODULE_LIST}" ]]; then
case ${PN} in
vmware-modules)
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
for mod in ${VMWARE_MODULE_LIST}; do
MODULE_NAMES="${MODULE_NAMES} ${mod}(vmware:${S}/${mod}-only)"
done
;;
open-vm-modules)
# extend the build target for open-vm-modules
BUILD_TARGETS="${BUILD_TARGETS} OVT_SOURCE_DIR=${SRC}"
VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} pvscsi vmblock vmci vmhgfs vmmemctl vmsync vmxnet vmxnet3 vsock"
for mod in ${VMWARE_MODULE_LIST}; do
# modules should go into right directory
# this should 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
;;
*)
ewarn "unknown modules package"
;;
esac
fi
}
vmware-mod-2_src_unpack() {
case ${PN} in
vmware-modules)
unpack ${A}
cd "${S}"
for mod in ${VMWARE_MODULE_LIST}; do
unpack ./${mod}.tar
done
;;
open-vm-modules)
unpack ${A}
;;
*)
ewarn "unknown modules package"
;;
esac
}
vmware-mod-2_src_prepare() {
case ${PN} in
vmware-modules)
for mod in ${VMWARE_MODULE_LIST}; do
convert_to_m "${S}"/${mod}-only/Makefile
done
;;
open-vm-modules)
for mod in ${VMWARE_MODULE_LIST}; do
convert_to_m "${S}"/${mod}/Makefile
done
;;
*)
ewarn "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 ${VMWARE_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"
;;
*)
ewarn "unknown modules package"
;;
esac
linux-mod_src_install
}