redesign vmware-mod-2 eclass to use the upstrem module sources

git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@1281 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
geos_one 2009-05-31 10:52:47 +00:00
parent 72e17d32a2
commit 6bb07b5f9a
2 changed files with 118 additions and 49 deletions

View File

@ -56,7 +56,7 @@ vmware-2_determine_product() {
product="vmware-console"
config_program="vmware-config-console.pl"
;;
workstation-tools|esx-tools|gsx-tools|server-tools)
vm-tools)
product="vmware-tools"
config_program="vmware-config-tools.pl"
;;

View File

@ -2,7 +2,6 @@
# 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
@ -10,41 +9,62 @@ case ${EAPI:-0} in
*) 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
inherit eutils linux-mod versionator
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"
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"
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_compile src_install
EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_install
VMWARE_GROUP="vmware"
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}"
# standard build target
BUILD_TARGETS="auto-build HEADER_DIR=${KERNEL_DIR}/include BUILD_DIR=${KV_OUT_DIR}"
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 ${PN} in
vmware-modules)
case ${PV} in
138.*)
VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} vmmon vmnet"
@ -56,48 +76,97 @@ vmware-mod-2_pkg_setup() {
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
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
;;
*)
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() {
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
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() {
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
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
}