| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/app-emulation/virtualbox-guest-additions/virtualbox-guest-additions-4.1.14.ebuild,v 1.2 2012/06/01 00:03:28 zmedico Exp $
|
| 4 |
|
| 5 |
EAPI=2
|
| 6 |
|
| 7 |
inherit eutils linux-mod user
|
| 8 |
|
| 9 |
MY_P=VirtualBox-${PV}
|
| 10 |
DESCRIPTION="VirtualBox kernel modules and user-space tools for Linux guests"
|
| 11 |
HOMEPAGE="http://www.virtualbox.org/"
|
| 12 |
SRC_URI="http://download.virtualbox.org/virtualbox/${PV}/${MY_P}.tar.bz2"
|
| 13 |
|
| 14 |
LICENSE="GPL-2"
|
| 15 |
SLOT="0"
|
| 16 |
KEYWORDS="~amd64 ~x86"
|
| 17 |
IUSE="X"
|
| 18 |
|
| 19 |
RDEPEND="X? ( ~x11-drivers/xf86-video-virtualbox-${PV}
|
| 20 |
x11-apps/xrandr
|
| 21 |
x11-apps/xrefresh
|
| 22 |
x11-libs/libXmu
|
| 23 |
x11-libs/libX11
|
| 24 |
x11-libs/libXt
|
| 25 |
x11-libs/libXext
|
| 26 |
x11-libs/libXau
|
| 27 |
x11-libs/libXdmcp
|
| 28 |
x11-libs/libSM
|
| 29 |
x11-libs/libICE )
|
| 30 |
!!x11-drivers/xf86-input-virtualbox"
|
| 31 |
DEPEND="${RDEPEND}
|
| 32 |
>=dev-util/kbuild-0.1.999
|
| 33 |
>=dev-lang/yasm-0.6.2
|
| 34 |
sys-devel/bin86
|
| 35 |
sys-devel/dev86
|
| 36 |
sys-libs/pam
|
| 37 |
sys-power/iasl
|
| 38 |
X? ( x11-proto/renderproto )
|
| 39 |
!X? ( x11-proto/xproto )"
|
| 40 |
|
| 41 |
BUILD_TARGETS="all"
|
| 42 |
BUILD_TARGET_ARCH="${ARCH}"
|
| 43 |
MODULE_NAMES="vboxguest(misc:${WORKDIR}/vboxguest:${WORKDIR}/vboxguest)
|
| 44 |
vboxsf(misc:${WORKDIR}/vboxsf:${WORKDIR}/vboxsf)"
|
| 45 |
|
| 46 |
S="${WORKDIR}/${MY_P}"
|
| 47 |
|
| 48 |
pkg_setup() {
|
| 49 |
linux-mod_pkg_setup
|
| 50 |
BUILD_PARAMS="KERN_DIR=${KV_DIR} KERNOUT=${KV_OUT_DIR}"
|
| 51 |
enewgroup vboxguest
|
| 52 |
enewuser vboxguest -1 /bin/sh /var/run/vboxguest vboxguest
|
| 53 |
}
|
| 54 |
|
| 55 |
src_unpack() {
|
| 56 |
unpack ${A}
|
| 57 |
|
| 58 |
# Create and unpack a tarball with the sources of the Linux guest
|
| 59 |
# kernel modules, to include all the needed files
|
| 60 |
"${S}"/src/VBox/Additions/linux/export_modules "${WORKDIR}/vbox-kmod.tar.gz"
|
| 61 |
unpack ./vbox-kmod.tar.gz
|
| 62 |
|
| 63 |
# Remove shipped binaries (kBuild,yasm), see bug #232775
|
| 64 |
cd "${S}"
|
| 65 |
rm -rf kBuild/bin tools
|
| 66 |
}
|
| 67 |
|
| 68 |
src_prepare() {
|
| 69 |
# PaX fixes (see bug #298988)
|
| 70 |
pushd "${WORKDIR}" &>/dev/null || die
|
| 71 |
epatch "${FILESDIR}"/vboxguest-4.1.0-log-use-c99.patch
|
| 72 |
popd &>/dev/null || die
|
| 73 |
|
| 74 |
# Disable things unused or splitted into separate ebuilds
|
| 75 |
cp "${FILESDIR}/${PN}-3-localconfig" LocalConfig.kmk
|
| 76 |
|
| 77 |
# stupid new header references...
|
| 78 |
for vboxheader in {product,revision}-generated.h ; do
|
| 79 |
for mdir in vbox{guest,sf} ; do
|
| 80 |
ln -sf "${S}"/out/linux.${ARCH}/release/${vboxheader} \
|
| 81 |
"${WORKDIR}/${mdir}/${vboxheader}"
|
| 82 |
done
|
| 83 |
done
|
| 84 |
}
|
| 85 |
|
| 86 |
src_configure() {
|
| 87 |
# build the user-space tools, warnings are harmless
|
| 88 |
./configure --nofatal \
|
| 89 |
--disable-xpcom \
|
| 90 |
--disable-sdl-ttf \
|
| 91 |
--disable-pulse \
|
| 92 |
--disable-alsa \
|
| 93 |
--build-headless || die "configure failed"
|
| 94 |
}
|
| 95 |
|
| 96 |
src_compile() {
|
| 97 |
source ./env.sh
|
| 98 |
|
| 99 |
for each in /src/VBox/{Runtime,Additions/common} \
|
| 100 |
/src/VBox/Additions/linux/{sharedfolders,daemon} ; do
|
| 101 |
cd "${S}"${each}
|
| 102 |
MAKE="kmk" emake TOOL_YASM_AS=yasm \
|
| 103 |
KBUILD_PATH="${S}/kBuild" \
|
| 104 |
|| die "kmk VBoxControl failed"
|
| 105 |
done
|
| 106 |
|
| 107 |
if use X; then
|
| 108 |
cd "${S}"/src/VBox/Additions/x11/VBoxClient
|
| 109 |
MAKE="kmk" emake TOOL_YASM_AS=yasm \
|
| 110 |
KBUILD_PATH="${S}/kBuild" \
|
| 111 |
|| die "kmk VBoxClient failed"
|
| 112 |
fi
|
| 113 |
|
| 114 |
# Now creating the kernel modules. We must do this _after_
|
| 115 |
# we compiled the user-space tools as we need two of the
|
| 116 |
# automatically generated header files. (>=3.2.0)
|
| 117 |
linux-mod_src_compile
|
| 118 |
}
|
| 119 |
|
| 120 |
src_install() {
|
| 121 |
linux-mod_src_install
|
| 122 |
|
| 123 |
cd "${S}"/out/linux.${ARCH}/release/bin/additions
|
| 124 |
|
| 125 |
insinto /sbin
|
| 126 |
newins mount.vboxsf mount.vboxsf
|
| 127 |
fperms 4755 /sbin/mount.vboxsf
|
| 128 |
|
| 129 |
newinitd "${FILESDIR}"/${PN}-7.initd ${PN}
|
| 130 |
|
| 131 |
insinto /usr/sbin/
|
| 132 |
newins VBoxService vboxguest-service
|
| 133 |
fperms 0755 /usr/sbin/vboxguest-service
|
| 134 |
|
| 135 |
insinto /usr/bin
|
| 136 |
doins VBoxControl
|
| 137 |
fperms 0755 /usr/bin/VBoxControl
|
| 138 |
|
| 139 |
# VBoxClient user service and xrandr wrapper
|
| 140 |
if use X; then
|
| 141 |
doins VBoxClient
|
| 142 |
fperms 0755 /usr/bin/VBoxClient
|
| 143 |
|
| 144 |
cd "${S}"/src/VBox/Additions/x11/Installer
|
| 145 |
newins 98vboxadd-xclient VBoxClient-all
|
| 146 |
fperms 0755 /usr/bin/VBoxClient-all
|
| 147 |
fi
|
| 148 |
|
| 149 |
# udev rule for vboxdrv
|
| 150 |
dodir /lib/udev/rules.d
|
| 151 |
echo 'KERNEL=="vboxguest", OWNER="vboxguest", GROUP="vboxguest", MODE="0660"' \
|
| 152 |
>> "${D}/lib/udev/rules.d/60-virtualbox-guest-additions.rules" \
|
| 153 |
|| die
|
| 154 |
echo 'KERNEL=="vboxuser", OWNER="vboxguest", GROUP="vboxguest", MODE="0660"' \
|
| 155 |
>> "${D}/lib/udev/rules.d/60-virtualbox-guest-additions.rules" \
|
| 156 |
|| die
|
| 157 |
|
| 158 |
# VBoxClient autostart file
|
| 159 |
insinto /etc/xdg/autostart
|
| 160 |
doins "${FILESDIR}"/vboxclient.desktop
|
| 161 |
|
| 162 |
# sample xorg.conf
|
| 163 |
insinto /usr/share/doc/${PF}
|
| 164 |
doins "${FILESDIR}"/xorg.conf.vbox
|
| 165 |
}
|
| 166 |
|
| 167 |
pkg_postinst() {
|
| 168 |
linux-mod_pkg_postinst
|
| 169 |
if ! use X ; then
|
| 170 |
elog "use flag X is off, enable it to install the"
|
| 171 |
elog "X Window System input and video drivers"
|
| 172 |
fi
|
| 173 |
elog ""
|
| 174 |
elog "Please add users to the \"vboxguest\" group so they can"
|
| 175 |
elog "benefit from seamless mode, auto-resize and clipboard."
|
| 176 |
elog ""
|
| 177 |
elog "Please add:"
|
| 178 |
elog "/etc/init.d/${PN}"
|
| 179 |
elog "to the default runlevel in order to start"
|
| 180 |
elog "needed services."
|
| 181 |
elog "To use the VirtualBox X drivers, use the following"
|
| 182 |
elog "file as your /etc/X11/xorg.conf:"
|
| 183 |
elog " /usr/share/doc/${PF}/xorg.conf.xorg"
|
| 184 |
elog ""
|
| 185 |
elog "Also make sure you use the Mesa library for OpenGL:"
|
| 186 |
elog " eselect opengl set xorg-x11"
|
| 187 |
elog ""
|
| 188 |
elog "An autostart .desktop file has been installed to start"
|
| 189 |
elog "VBoxClient in desktop sessions."
|
| 190 |
elog ""
|
| 191 |
elog "You can mount shared folders with:"
|
| 192 |
elog " mount -t vboxsf <shared_folder_name> <mount_point>"
|
| 193 |
elog ""
|
| 194 |
elog "Warning:"
|
| 195 |
elog "this ebuild is only needed if you are running gentoo"
|
| 196 |
elog "inside a VirtualBox Virtual Machine, you don't need"
|
| 197 |
elog "it to run VirtualBox itself."
|
| 198 |
elog ""
|
| 199 |
}
|