virtualization/app-emulation/vmware-server-console/vmware-server-console-1.0.1...

324 lines
9.0 KiB
Bash

# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
# Unlike many other binary packages the user doesn't need to agree to a licence
# to download VMWare. The agreeing to a licence is part of the configure step
# which the user must run manually.
EAPI=2
inherit eutils versionator fdo-mime gnome2-utils
MY_PN=${PN/vm/VM}
MY_PV=$(replace_version_separator 3 '-')
MY_P="${MY_PN}-${MY_PV}"
FN="VMware-server-linux-client-${MY_PV}"
S="${WORKDIR}/${PN}-distrib"
DESCRIPTION="VMware Remote Console for Linux"
HOMEPAGE="http://www.vmware.com/"
SRC_URI="mirror://vmware/software/vmserver/${FN}.zip"
LICENSE="vmware"
IUSE="doc"
SLOT="0"
KEYWORDS="-* ~amd64 ~x86"
RESTRICT="strip"
DEPEND=">=sys-libs/glibc-2.3.5
virtual/os-headers
>=dev-lang/perl-5
>=sys-apps/portage-2.0.54
app-arch/unzip"
# vmware-server-console should not use virtual/libc as this is a
# precompiled binary package thats linked to glibc.
RDEPEND=">=sys-libs/glibc-2.3.5[multilib_abi_x86]
sys-libs/libstdc++-v3[multilib_abi_x86]
dev-cpp/atkmm[multilib_abi_x86]
dev-cpp/glibmm:2[multilib_abi_x86]
dev-cpp/gtkmm:2.4[multilib_abi_x86]
dev-cpp/libgnomecanvasmm:2.6[multilib_abi_x86]
dev-cpp/libsexymm:1[multilib_abi_x86]
dev-cpp/pangomm:1.4[multilib_abi_x86]
dev-libs/atk[multilib_abi_x86]
dev-libs/expat:1.95[multilib_abi_x86]
dev-libs/glib:2[multilib_abi_x86]
dev-libs/libsigc++:2[multilib_abi_x86]
dev-libs/libxml2:2[multilib_abi_x86]
dev-libs/openssl:0.9.7[multilib_abi_x86]
gnome-base/libglade:2.0[multilib_abi_x86]
gnome-base/libgnomecanvas[multilib_abi_x86]
gnome-base/librsvg:2[multilib_abi_x86]
media-libs/fontconfig:1.0[multilib_abi_x86]
media-libs/freetype:2[multilib_abi_x86]
media-libs/libart_lgpl[multilib_abi_x86]
sys-libs/zlib[multilib_abi_x86]
x11-libs/gdk-pixbuf:2[multilib_abi_x86]
x11-libs/gtk+:2[multilib_abi_x86]
x11-libs/libICE[multilib_abi_x86]
x11-libs/libSM[multilib_abi_x86]
x11-libs/libX11[multilib_abi_x86]
x11-libs/libXext[multilib_abi_x86]
x11-libs/libXft[multilib_abi_x86]
x11-libs/libXi[multilib_abi_x86]
x11-libs/libXrender[multilib_abi_x86]
x11-libs/libXt[multilib_abi_x86]
x11-libs/libXtst[multilib_abi_x86]
x11-libs/libsexy:1[multilib_abi_x86]
x11-libs/libview[multilib_abi_x86]
x11-libs/pango[multilib_abi_x86]
>=dev-lang/perl-5
!<sys-apps/dbus-0.62"
S="${WORKDIR}"/${PN}-distrib
VM_INSTALL_DIR="/opt/vmware/server/console"
VMWARE_GROUP=${VMWARE_GROUP:-vmware}
pkg_setup() {
enewgroup "${VMWARE_GROUP}"
}
src_unpack() {
unpack ${A}
unpack ./${MY_P}.tar.gz
}
src_prepare() {
epatch "${FILESDIR}/vmsc-force-included-gtk.patch"
epatch "${FILESDIR}/vmsc-wrapper-gtk24.sh.patch"
# remove unistall script
rm -f bin/vmware-uninstall-server-console.pl
# we dont need the prepacked modules
# rm -Rf lib/libconf/lib
rm -Rf lib/lib/libgcc_s.so.1
# correct the config files for the multilib portage version (lib32)
# ABI=x86 gdk-pixbuf-query-loaders > lib/libconf/etc/gtk-2.0/gdk-pixbuf.loaders
# ABI=x86 gtk-query-immodules-2.0 > lib/libconf/etc/gtk-2.0/gtk.immodules
# ABI=x86 pango-querymodules > lib/libconf/etc/pango/pango.modules
# die
# remove superfluous libraries
# ebegin 'Removing superfluous libraries'
# cd lib/lib || die
# exclude OpenSSL from unbundling until the AES-NI patch gets into the tree
# ldconfig -p | sed 's:^\s\+\([^(]*[^( ]\).*=> /.*$:\1:g;t;d' | \
# fgrep -vx '
#libview.so.2
#libglib-2.0.so.0
#libglibmm_generate_extra_defs-2.4.so.1
#libglibmm-2.4.so.1
#libgmodule-2.0.so.0
#libgobject-2.0.so.0
#libgthread-2.0.so.0
#libatk-1.0.so.0
#libatkmm-1.6.so.1
#libpango-1.0.so.0
#libpangoft2-1.0.so.0
#libpangoxft-1.0.so.0
#libpangox-1.0.so.0
#libpangomm-1.4.so.1
#libgdk-x11-2.0.so.0
#libgdkmm-2.4.so.1
#libgdk_pixbuf-2.0.so.0
#libgtk-x11-2.0.so.0
#libgtkmm-2.4.so.1
#libsexy.so.1
#libsexymm.so.1
#libgnomecanvas-2.so.0
#libgnomecanvasmm-2.6.so.1
#' | xargs -d'\n' -r rm -rf
# eend
#support libs
#libfreetype.so.6
#libXft.so.2
#libXrender.so.1
#libfontconfig.so.1
#libexpat.so.0
#libart_lgpl_2.so.2
#libxml2.so.2
#libglade-2.0.so.0
#libcrypto.so.0.9.7
#libssl.so.0.9.7
#librsvg-2.so.2
}
src_install() {
local major_minor_revision=$(get_version_component_range 1-3 "${PV}")
local build=$(get_version_component_range 4 "${PV}")
# install the binaries
into "${VM_INSTALL_DIR}"
dobin bin/* || die "failed to install bin"
# install the libraries
insinto "${VM_INSTALL_DIR}"/lib
doins -r lib/* || die "failed to install lib"
# commented out until Portage gets OpenSSL 0.9.8 with AES-NI support
# see http://forums.gentoo.org/viewtopic-t-835867.html
## these two libraries do not like to load from /usr/lib*
#local each ; for each in libcrypto.so.0.9.8 libssl.so.0.9.8 ; do
# if [[ ! -f "${VM_INSTALL_DIR}/lib/vmware/lib/${each}" ]] ; then
# dosym "/usr/$(get_libdir)/${each}" \
# "${VM_INSTALL_DIR}/lib/vmware/lib/${each}/${each}"
# fi
#done
# install documentation
if use doc; then
dodoc doc/* || die "failed to install docs"
fi
# fix up permissions
chmod 0755 "${D}${VM_INSTALL_DIR}"/lib/{bin/*,lib/wrapper-gtk24.sh}
# create the environment
local envd="${T}/90vmware-server-console"
cat > "${envd}" <<-EOF
PATH='${VM_INSTALL_DIR}/bin'
ROOTPATH='${VM_INSTALL_DIR}/bin'
EOF
doenvd "${envd}" || die
# create the configuration
dodir /etc/vmware-server-console || die
cat > "${D}"/etc/vmware-server-console/locations <<-EOF
answer BINDIR ${VM_INSTALL_DIR}/bin
answer LIBDIR ${VM_INSTALL_DIR}/lib
answer MANDIR ${VM_INSTALL_DIR}/man
answer DOCDIR ${VM_INSTALL_DIR}/doc
EOF
cat > "${D}"/etc/vmware-server-console/config <<-EOF
bindir = "${VM_INSTALL_DIR}/bin"
libdir = "${VM_INSTALL_DIR}/lib"
EOF
# Copy files from /etc directory.
cp -pPR etc/* "${D}"/etc/vmware-server-console
fowners -R root:${VMWARE_GROUP} /etc/vmware-server-console
fperms 770 /etc/vmware-server-console
# fill in variable placeholders
sed -e "s:@@LIBCONF_DIR@@:${VM_INSTALL_DIR}/lib/libconf:g" \
-i "${D}${VM_INSTALL_DIR}"/lib/libconf/etc/{gtk-2.0/{gdk-pixbuf.loaders,gtk.immodules},pango/pango{.modules,rc}} || die
# sed -e "s:@@BINARY@@:${VM_INSTALL_DIR}/bin/vmplayer:g" \
# -i "${D}/usr/share/applications/${PN}.desktop" || die
doman man/man1/*
# Blame bug #91191 for this one.
insinto "${VM_INSTALL_DIR}"/doc
doins doc/EULA || die "copying EULA"
insinto /usr/share/mime/packages
doins "${FILESDIR}"/${PN}.xml || die "mimetypes"
newicon doc/icon48x48.png ${PN}.png
make_desktop_entry ${PN} "VMWare Remote Console" ${PN} System
dodir /usr/bin
dosym ${VM_INSTALL_DIR}/bin/${PN} /usr/bin/${PN}
}
pkg_config() {
"${VM_INSTALL_DIR}"/bin/vmware-config-server-console.pl
}
pkg_preinst() {
gnome2_icon_savelist
#Note: it's a bit weird to use ${D} in a preinst script but it should work
#(drobbins, 1 Feb 2002)
einfo "Generating /etc/vmware-server-console/locations file."
d=`echo ${D} | wc -c`
for x in `find ${D}${VM_INSTALL_DIR} ${D}/etc/vmware-server-console` ; do
x="`echo ${x} | cut -c ${d}-`"
if [ -d "${D}/${x}" ] ; then
echo "directory ${x}" >> "${D}/etc/vmware-server-console"/locations
else
echo -n "file ${x}" >> "${D}/etc/vmware-server-console"/locations
if [ "${x}" == "/etc/vmware-server-console/locations" ] ; then
echo "" >> "${D}/etc/vmware-server-console"/locations
elif [ "${x}" == "/etc/vmware-server-console/not_configured" ] ; then
echo "" >> "${D}/etc/vmware-server-console"/locations
else
echo -n " " >> "${D}/etc/vmware-server-console"/locations
find "${D}"${x} -printf %T@ >> "${D}/etc/vmware-server-console"/locations
echo "" >> "${D}/etc/vmware-server-console"/locations
fi
fi
done
}
pkg_postinst() {
fdo-mime_desktop_database_update
gnome2_icon_cache_update
update-mime-database /usr/share/mime
ewarn "/etc/env.d was updated. Please run:"
ewarn "env-update && source /etc/profile"
ewarn ""
ewarn "Before you can use vmware-server-console, you must configure a default network setup."
ewarn "You can do this by running 'emerge --config ${PN}'."
chown -R root:${VMWARE_GROUP} /etc/vmware-server-console
# This is to fix the problem where the not_configured file doesn't get
# removed when the configuration is run. This doesn't remove the file
# It just tells the vmware-config.pl script it can delete it.
einfo "Updating /etc/vmware-server-console/locations"
for x in "/etc/vmware-server-console"/._cfg????_locations ; do
if [ -f $x ] ; then
cat $x >> "/etc/vmware-server-console"/locations
rm $x
fi
done
echo
elog "You need to run "
elog " ${VM_INSTALL_DIR}/bin/vmware-config-server-console.pl"
elog "to complete the install."
echo
einfo "For VMware Add-Ons just visit"
einfo "http://www.vmware.com/download/downloadaddons.html"
echo
elog "After configuring, run ${PN} to launch"
echo
ewarn "Remember, in order to run VMware Server Console, you have to"
ewarn "be in the '${VMWARE_GROUP}' group."
echo
}
pkg_postrm() {
fdo-mime_desktop_database_update
gnome2_icon_cache_update
if ! has_version app-emulation/${PN}; then
echo
elog "To remove all traces of Server Console you will need to remove the files"
elog "in /etc/vmware-server-console."
echo
fi
}