app-text/enchant: add nuspell backend
[sgilles-overlay.git] / x11-drivers / xf86-video-virtualbox / xf86-video-virtualbox-5.0.20-r2.ebuild
bloba56784a28ae227f02057ba9656e70254da054f68
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
5 EAPI=6
7 PYTHON_COMPAT=( python2_7 )
8 inherit eutils linux-mod multilib python-single-r1 versionator toolchain-funcs
10 MY_PV="${PV/beta/BETA}"
11 MY_PV="${MY_PV/rc/RC}"
12 MY_P=VirtualBox-${MY_PV}
13 DESCRIPTION="VirtualBox video driver"
14 HOMEPAGE="http://www.virtualbox.org/"
15 SRC_URI="http://download.virtualbox.org/virtualbox/${MY_PV}/${MY_P}.tar.bz2"
17 LICENSE="GPL-2"
18 SLOT="0"
19 KEYWORDS="~amd64 ~x86"
20 IUSE="dri"
22 RDEPEND=">=x11-base/xorg-server-1.7:=[-minimal]
23 x11-libs/libXcomposite"
24 DEPEND="${RDEPEND}
25 >=dev-util/kbuild-0.1.9998_pre20131130
26 ${PYTHON_DEPS}
27 >=dev-lang/yasm-0.6.2
28 >=sys-devel/gcc-4.9.0
29 sys-power/iasl
30 x11-proto/fontsproto
31 x11-proto/randrproto
32 x11-proto/renderproto
33 x11-proto/resourceproto
34 x11-proto/scrnsaverproto
35 x11-proto/xextproto
36 x11-proto/xineramaproto
37 x11-proto/xproto
38 x11-libs/libXdmcp
39 x11-libs/libXau
40 x11-libs/libX11
41 x11-libs/libXfixes
42 x11-libs/libXext
43 dri? ( x11-proto/xf86driproto
44 >=x11-libs/libdrm-2.4.5 )"
46 REQUIRED_USE=( "${PYTHON_REQUIRED_USE}" )
48 BUILD_TARGETS="all"
49 BUILD_TARGET_ARCH="${ARCH}"
50 S="${WORKDIR}/${MY_P}"
51 MODULES_SRC_DIR="${S}/src/VBox/Additions/linux/drm"
52 MODULE_NAMES="vboxvideo(misc:${MODULES_SRC_DIR}:${MODULES_SRC_DIR})"
54 PATCHES=(
55 # Ugly hack to build the opengl part of the video driver
56 "${FILESDIR}/${PN}-2.2.0-enable-opengl.patch"
58 # unset useless/problematic checks in configure
59 "${FILESDIR}/${PN}-5.0.0_beta3-configure_checks.patch"
61 # prevent musl from throwing errors everywhere
62 "${FILESDIR}/${P}-remove-references-to-sys-cdefs.h.patch"
63 "${FILESDIR}/${P}-change-sys-poll.h-to-poll.h.patch"
64 "${FILESDIR}/${P}-change-sys-fcntl.h-to-fcntl.h.patch"
65 "${FILESDIR}/${P}-some-Alpine-fixes.patch"
68 QA_TEXTRELS_x86="usr/lib/VBoxOGL.so"
70 pkg_setup() {
71 if [ "${MERGE_TYPE}" != "binary" ]; then
72 version_is_at_least 4.9 $(gcc-version) || die "Please set gcc 4.9 or higher as active in gcc-config to build ${PN}"
75 CONFIG_CHECK="~DRM ~DRM_TTM"
76 linux-mod_pkg_setup
77 BUILD_PARAMS="KERN_DIR=${KV_OUT_DIR} KERNOUT=${KV_OUT_DIR}"
79 python-single-r1_pkg_setup
82 src_prepare() {
83 # Prepare the vboxvideo_drm Makefiles and build dir
84 eapply "${FILESDIR}"/${P}-Makefile.module.kms.patch
86 # Remove shipped binaries (kBuild,yasm), see bug #232775
87 rm -r kBuild/bin tools || die
89 # Disable things unused or splitted into separate ebuilds
90 cp "${FILESDIR}/${PN}-5-localconfig" LocalConfig.kmk || die
92 default
94 # link with lazy on hardened #394757
95 sed '/^TEMPLATE_VBOXR3EXE_LDFLAGS.linux/s/$/ -Wl,-z,lazy/' \
96 -i Config.kmk || die
99 src_configure() {
100 # build the user-space tools, warnings are harmless
101 local cmd=(
102 ./configure
103 --nofatal
104 --disable-xpcom
105 --disable-sdl-ttf
106 --disable-pulse
107 --disable-alsa
108 --with-gcc="$(tc-getCC)"
109 --with-g++="$(tc-getCXX)"
110 --target-arch=${ARCH}
111 --with-linux="${KV_OUT_DIR}"
112 --build-headless
114 echo "${cmd[@]}"
115 "${cmd[@]}" || die "configure failed"
116 source ./env.sh
117 export VBOX_GCC_OPT="${CFLAGS} ${CPPFLAGS}"
120 src_compile() {
121 local each targets=(
122 Runtime
123 Additions/common/VBoxGuestLib
124 GuestHost/OpenGL
125 Additions/x11/x11stubs
126 Additions/common/crOpenGL
127 Additions/x11/vboxvideo
130 # need to use the upstream build system to create necessary objects properly
131 use dri && targets+=( Additions/linux/drm )
133 for each in ${targets[@]} ; do
134 pushd "${S}"/src/VBox/${each} $>/dev/null || die
135 MAKE="kmk" \
136 emake TOOL_YASM_AS=yasm \
137 VBOX_USE_SYSTEM_XORG_HEADERS=1 \
138 KBUILD_PATH="${S}/kBuild" \
139 KBUILD_VERBOSE=2
140 popd &>/dev/null || die
141 done
143 if use dri; then
144 local objdir="out/linux.${ARCH}/release/obj/vboxvideo_drm"
145 # We need a Makefile, so use Makefile.module.kms
146 ln -s Makefile.module.kms "${MODULES_SRC_DIR}"/Makefile || die
147 # All of these are expected to be in $(KBUILD_EXTMOD)/ so symlink them into place
148 targets=(
149 include
150 src/VBox/Runtime/r0drv
151 src/VBox/Installer/linux/Makefile.include.{head,foot}er
152 out/linux.${ARCH}/release/{product,version,revision}-generated.h
154 for each in ${targets[@]} ; do
155 ln -s "${S}"/${each} \
156 "${MODULES_SRC_DIR}"/${each##*/} || die
157 done
158 # see the vboxvideo_drm_SOURCES list in Makefile.kmk for the below,
159 # and replace '..' with 'dt'
160 targets=(
161 dt/dt/common/VBoxVideo/HGSMIBase.o
162 dt/dt/common/VBoxVideo/Modesetting.o
163 dt/dt/common/VBoxVideo/VBVABase.o
164 dt/dt/dt/GuestHost/HGSMI/HGSMICommon.o
165 dt/dt/dt/GuestHost/HGSMI/HGSMIMemAlloc.o
166 dt/dt/dt/Runtime/common/alloc/heapoffset.o
168 for each in ${targets[@]} ; do
169 ln -s "${S}"/${objdir}/${each} \
170 "${MODULES_SRC_DIR}" || die
171 ln -s "${S}"/${objdir}/${each}.dep \
172 "${MODULES_SRC_DIR}" || die
173 done
175 # Now creating the kernel modules. We must do this _after_
176 # we compiled the user-space tools as we need two of the
177 # automatically generated header files. (>=3.2.0)
178 pushd "${MODULES_SRC_DIR}" &>/dev/null || die
179 linux-mod_src_compile
180 popd &>/dev/null || die
184 src_install() {
185 if use dri; then
186 pushd "${MODULES_SRC_DIR}" &>/dev/null || die
187 linux-mod_src_install
188 popd &>/dev/null || die
191 cd "${S}/out/linux.${ARCH}/release/bin/additions" || die
192 insinto /usr/$(get_libdir)/xorg/modules/drivers
193 newins vboxvideo_drv_system.so vboxvideo_drv.so
195 # Guest OpenGL driver
196 insinto /usr/$(get_libdir)
197 doins -r VBoxOGL*
199 if use dri ; then
200 dosym /usr/$(get_libdir)/VBoxOGL.so \
201 /usr/$(get_libdir)/dri/vboxvideo_dri.so
205 pkg_postinst() {
206 elog "You need to edit the file /etc/X11/xorg.conf and set:"
207 elog ""
208 elog " Driver \"vboxvideo\""
209 elog ""
210 elog "in the Graphics device section (Section \"Device\")"
211 elog ""
212 if use dri; then
213 elog "To use the kernel drm video driver, please add:"
214 elog "\"${MODULE_NAMES%(*}\" to:"
215 if has_version sys-apps/openrc ; then
216 elog "/etc/conf.d/modules"
217 else
218 elog "/etc/modules.autoload.d/kernel-${KV_MAJOR}.${KV_MINOR}"
220 elog ""