From f0199578bacab30d54c97ac096532623b26a062d Mon Sep 17 00:00:00 2001 From: jensp Date: Thu, 27 Jan 2011 20:29:13 +0000 Subject: [PATCH] xf86-video-virtualbox: filter PIE flag, untested --- x11-drivers/xf86-video-virtualbox/Manifest | 6 + ...video-virtualbox-2.2.0-enable-opengl.patch | 13 + .../files/xf86-video-virtualbox-3-localconfig | 30 +++ ...-video-virtualbox-3-vboxvideo_drm.makefile | 240 ++++++++++++++++++ ...86-video-virtualbox-3.2.8-mesa-check.patch | 36 +++ .../xf86-video-virtualbox-3.2.12.ebuild | 154 +++++++++++ 6 files changed, 479 insertions(+) create mode 100644 x11-drivers/xf86-video-virtualbox/Manifest create mode 100644 x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-2.2.0-enable-opengl.patch create mode 100644 x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-3-localconfig create mode 100755 x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-3-vboxvideo_drm.makefile create mode 100644 x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-3.2.8-mesa-check.patch create mode 100644 x11-drivers/xf86-video-virtualbox/xf86-video-virtualbox-3.2.12.ebuild diff --git a/x11-drivers/xf86-video-virtualbox/Manifest b/x11-drivers/xf86-video-virtualbox/Manifest new file mode 100644 index 000000000..11d931f4a --- /dev/null +++ b/x11-drivers/xf86-video-virtualbox/Manifest @@ -0,0 +1,6 @@ +AUX xf86-video-virtualbox-2.2.0-enable-opengl.patch 303 RMD160 c8c8e6a9aaea1ec53f3c0cb285750921287959a6 SHA1 7d68f5529a921f7d9786b232e8ecc7ebe7ba0e1b SHA256 194b7bca875f18e1621f065640d1c1a1364640e17475c493ec3b56f6e7e5ce66 +AUX xf86-video-virtualbox-3-localconfig 996 RMD160 4e986699d9484a3b7d9b11eb1bb30ca9d3a33fb3 SHA1 52d13e385d75d55aac64697eb715421df856c728 SHA256 ff777086ae7d0337e59066b4f7d6538823ca1804b57906e07cd562c8a48e054f +AUX xf86-video-virtualbox-3-vboxvideo_drm.makefile 6810 RMD160 55758e73adef9924a9bcea5da465fc93a1ea03df SHA1 fce332db7b3f9fd337b26e2165441aaeb2193b48 SHA256 ccf3eaaa8e1ed4a9c816a9a944c3ce6f289d002f03ce72d796500d209e26ae7e +AUX xf86-video-virtualbox-3.2.8-mesa-check.patch 701 RMD160 061b6eaf0b3cdbcaac7258d85909d1e9d89cdeb3 SHA1 7e5cf6d11421d392d4f2a7bf9846cc71d9688d03 SHA256 6b4ce64673cda33631e7a60ac94f23ab2d020d52b6160bb072ad8d6f9547c251 +DIST VirtualBox-3.2.12-OSE.tar.bz2 58239733 RMD160 9bcb80327655d77cede13b1f76b1fa6c763b1a25 SHA1 73ddd9365588ea56a54ff81117719ac818e842f9 SHA256 064eb382e5b752a3f9189c930734393765125e70b5f99679a63ff4eb6186e261 +EBUILD xf86-video-virtualbox-3.2.12.ebuild 4317 RMD160 b4edc88fb6f6e41abd1aa7a82b2b2cb834e73667 SHA1 56a5246f58fed447292478f979f65c6b5950a25e SHA256 0d8c40976427a6a666a7d1fd636f394676eef37b05040aaf5d2eb3b8f426eade diff --git a/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-2.2.0-enable-opengl.patch b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-2.2.0-enable-opengl.patch new file mode 100644 index 000000000..ad66ff204 --- /dev/null +++ b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-2.2.0-enable-opengl.patch @@ -0,0 +1,13 @@ +--- configure.orig 2009-04-11 19:30:06.000000000 +0200 ++++ configure 2009-04-11 20:46:05.000000000 +0200 +@@ -1955,8 +1955,8 @@ + HEADLESS=1 + WITH_SDL=0 + WITH_SDL_TTF=0 +- WITH_X11=0 +- WITH_OPENGL=0 ++ WITH_X11=1 ++ WITH_OPENGL=1 + WITH_QT4=0 + ;; + --ose) diff --git a/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-3-localconfig b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-3-localconfig new file mode 100644 index 000000000..535c3f914 --- /dev/null +++ b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-3-localconfig @@ -0,0 +1,30 @@ +# -*- Makefile -*- +# +# Overwrite some default kBuild settings +# + +# +# Copyright (C) 2006-2008 Sun Microsystems, Inc. +# +# This file is part of VirtualBox Open Source Edition (OSE), as +# available from http://www.virtualbox.org. This file is free software; +# you can redistribute it and/or modify it under the terms of the GNU +# General Public License as published by the Free Software Foundation, +# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE +# distribution. VirtualBox OSE is distributed in the hope that it will +# be useful, but WITHOUT ANY WARRANTY of any kind. +# + +# don't build testcases to save time, they are not needed for the package +VBOX_WITH_TESTCASES := +VBOX_WITH_TESTSUITE := + +KBUILD_MSG_STYLE := brief + +## paths, origin, hardening +VBOX_WITH_HARDENING := 2 +VBOX_WITH_ORIGIN := +VBOX_ONLY_ADDITIONS := 1 + +TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.release = +TEMPLATE_VBOXGUESTR3XORGMOD_LDFLAGS = $(TEMPLATE_VBOXGUESTR3DLL_LDFLAGS) diff --git a/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-3-vboxvideo_drm.makefile b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-3-vboxvideo_drm.makefile new file mode 100755 index 000000000..a09e58c00 --- /dev/null +++ b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-3-vboxvideo_drm.makefile @@ -0,0 +1,240 @@ +# +# VirtualBox Guest Additions Module Makefile. +# +# (For 2.6.x this file must be 'Makefile'!) +# +# Copyright (C) 2006-2007 Sun Microsystems, Inc. +# +# This file is part of VirtualBox Open Source Edition (OSE), as +# available from http://www.virtualbox.org. This file is free software; +# you can redistribute it and/or modify it under the terms of the GNU +# General Public License (GPL) as published by the Free Software +# Foundation, in version 2 as it comes in the "COPYING" file of the +# VirtualBox OSE distribution. VirtualBox OSE is distributed in the +# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. +# +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa +# Clara, CA 95054 USA or visit http://www.sun.com if you need +# additional information or have any questions. +# + +## @todo We must make this into a common template *soon*. + +# +# First, figure out which architecture we're targeting and the build type. +# (We have to support basic cross building (ARCH=i386|x86_64).) +# While at it, warn about BUILD_* vars found to help with user problems. +# +ifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),) + BUILD_TARGET_ARCH_DEF := amd64 +else + BUILD_TARGET_ARCH_DEF := x86 +endif +ifneq ($(filter-out amd64 x86,$(BUILD_TARGET_ARCH)),) + $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.) + BUILD_TARGET_ARCH := +endif +ifeq ($(BUILD_TARGET_ARCH),) + ifeq ($(ARCH),x86_64) + BUILD_TARGET_ARCH := amd64 + else + ifeq ($(ARCH),i386) + BUILD_TARGET_ARCH := x86 + else + BUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH_DEF) + endif + endif +else + ifneq ($(BUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH_DEF)) + $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).) + endif +endif + +ifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),) + $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.) + BUILD_TYPE := +endif +ifeq ($(BUILD_TYPE),) + BUILD_TYPE := release +else + ifneq ($(BUILD_TYPE),release) + $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).) + endif +endif + +EXTRA_CFLAGS = -fshort-wchar + +ifneq ($(MAKECMDGOALS),clean) + +ifeq ($(KERNELRELEASE),) + + # + # building from this directory + # + + # kernel base directory + ifndef KERN_DIR + KERN_DIR := /lib/modules/$(shell uname -r)/build + ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes) + KERN_DIR := /usr/src/linux + ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes) + $(error Error: unable to find the sources of your current Linux kernel. \ + Specify KERN_DIR= and run Make again) + endif + $(warning Warning: using /usr/src/linux as the source directory of your \ + Linux kernel. If this is not correct, specify \ + KERN_DIR= and run Make again.) + endif + else + ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes) + $(error Error: KERN_DIR does not point to a directory) + endif + endif + + # includes + ifndef KERN_INCL + KERN_INCL = $(KERN_DIR)/include + endif + ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes) + $(error Error: unable to find the include directory for your current Linux \ + kernel. Specify KERN_INCL= and run Make again) + endif + + # module install dir. + ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),) + ifndef MODULE_DIR + MODULE_DIR_TST := /lib/modules/$(shell uname -r) + ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes) + MODULE_DIR := $(MODULE_DIR_TST)/misc + else + $(error Unable to find the folder to install the DRM driver to) + endif + endif # MODULE_DIR unspecified + endif + + # guess kernel version (24 or 26) + ifeq ($(shell if grep '"2\.4\.' $(KERN_INCL)/linux/version.h > /dev/null; then echo yes; fi),yes) + KERN_VERSION := 24 + else + KERN_VERSION := 26 + endif + +else # neq($(KERNELRELEASE),) + + # + # building from kbuild (make -C M=`pwd`) + # + + # guess kernel version (24 or 26) + ifeq ($(shell if echo "$(VERSION).$(PATCHLEVEL)." | grep '2\.4\.' > /dev/null; then echo yes; fi),yes) + KERN_VERSION := 24 + else + KERN_VERSION := 26 + endif + +endif # neq($(KERNELRELEASE),) + +# debug - show guesses. +ifdef DEBUG +$(warning dbg: KERN_DIR = $(KERN_DIR)) +$(warning dbg: KERN_INCL = $(KERN_INCL)) +$(warning dbg: MODULE_DIR = $(MODULE_DIR)) +$(warning dbg: KERN_VERSION = $(KERN_VERSION)) +endif + +KBUILD_VERBOSE ?= 1 + +# +# Compiler options +# +ifndef INCL + INCL := $(addprefix -I,$(KERN_INCL) $(EXTRA_INCL)) + ifndef KBUILD_EXTMOD + KBUILD_EXTMOD := $(shell pwd) + endif + INCL += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux) + export INCL +endif +KFLAGS := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 \ + -DIN_SUP_R0 -DVBOX -DVBOX_WITH_HGCM -DLOG_TO_BACKDOOR -DIN_MODULE \ + -DIN_GUEST_R0 +ifeq ($(BUILD_TARGET_ARCH),amd64) + KFLAGS += -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS +else + KFLAGS += -DRT_ARCH_X86 +endif +ifeq ($(BUILD_TYPE),debug) +KFLAGS += -DDEBUG +endif + +# override is required by the Debian guys +override MODULE = vboxvideo +OBJS = vboxvideo_drm.o + +ifeq ($(KERN_VERSION), 24) +# +# 2.4 +# + +CFLAGS := -O2 -DVBOX_LINUX_2_4 $(INCL) $(KFLAGS) $(KDEBUG) +MODULE_EXT := o + +# 2.4 Module linking +$(MODULE).o: $(OBJS) + $(LD) -o $@ -r $(OBJS) + +.PHONY: $(MODULE) +all: $(MODULE) +$(MODULE): $(MODULE).o + +else +# +# 2.6 and later +# + +MODULE_EXT := ko + +$(MODULE)-y := $(OBJS) + +# special hack for Fedora Core 6 2.6.18 (fc6), rhel5 2.6.18 (el5), +# ClarkConnect 4.3 (cc4) and ClarkConnect 5 (v5) +ifeq ($(KERNELRELEASE),) + KFLAGS += $(foreach inc,$(KERN_INCL),\ + $(if $(wildcard $(inc)/linux/utsrelease.h),\ + $(if $(shell grep '"2.6.18.*fc6.*"' $(inc)/linux/utsrelease.h; \ + grep '"2.6.18.*el5.*"' $(inc)/linux/utsrelease.h; \ + grep '"2.6.18.*v5.*"' $(inc)/linux/utsrelease.h; \ + grep '"2.6.18.*cc4.*"' $(inc)/linux/utsrelease.h),\ + -DKERNEL_FC6,),)) +else + KFLAGS += $(if $(shell echo "$(KERNELRELEASE)"|grep '2.6.18.*fc6.*';\ + echo "$(KERNELRELEASE)"|grep '2.6.18.*el5.*';\ + echo "$(KERNELRELEASE)"|grep '2.6.18.*v5.*';\ + echo "$(KERNELRELEASE)"|grep '2.6.18.*cc4.*'),\ + -DKERNEL_FC6,) +endif + +# build defs +EXTRA_CFLAGS += $(INCL) $(KFLAGS) $(KDEBUG) + +all: $(MODULE) + +obj-m += $(MODULE).o + +$(MODULE): + $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) modules + +endif + +install: $(MODULE) + @mkdir -p $(MODULE_DIR); \ + install -m 0664 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \ + PATH="$(PATH):/bin:/sbin" depmod -ae; + +endif # eq($(MAKECMDGOALS),clean) + +# important: Don't remove Module.symvers! DKMS does 'make clean' before building ... +clean: + for f in . linux r0drv r0drv/linux; do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done + rm -rf .vboxvideo* .tmp_ver* vboxvideo.* Modules.symvers modules.order + diff --git a/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-3.2.8-mesa-check.patch b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-3.2.8-mesa-check.patch new file mode 100644 index 000000000..6813a1744 --- /dev/null +++ b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-3.2.8-mesa-check.patch @@ -0,0 +1,36 @@ +--- configure ++++ configure +@@ -1225,10 +1225,7 @@ + XCloseDisplay(dpy); + } + EOF +- [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"` +- if test_compile "$LIBX11 $I_INCX11" Xlibs Xlibs; then +- log_success "found" +- fi ++ test_compile "$LIBX11 $I_INCX11" Xlibs Xlibs + } + + +@@ -1382,21 +1379,6 @@ + #include + extern "C" int main(void) + { +- Display *dpy; +- int major, minor; +- +- dpy = XOpenDisplay(NULL); +- if (dpy) +- { +- Bool glx_version = glXQueryVersion(dpy, &major, &minor); +- XCloseDisplay(dpy); +- if (glx_version) +- { +- printf("found version %u.%u, OK.\n", major, minor); +- return 0; +- } +- } +- printf("found (inactive), OK.\n"); + return 0; + } + EOF diff --git a/x11-drivers/xf86-video-virtualbox/xf86-video-virtualbox-3.2.12.ebuild b/x11-drivers/xf86-video-virtualbox/xf86-video-virtualbox-3.2.12.ebuild new file mode 100644 index 000000000..0ce427408 --- /dev/null +++ b/x11-drivers/xf86-video-virtualbox/xf86-video-virtualbox-3.2.12.ebuild @@ -0,0 +1,154 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/xf86-video-virtualbox/xf86-video-virtualbox-3.2.12.ebuild,v 1.3 2011/01/07 18:50:20 polynomial-c Exp $ + +EAPI=2 + +inherit eutils linux-mod multilib versionator + +MY_P=VirtualBox-${PV}-OSE +DESCRIPTION="VirtualBox video driver" +HOMEPAGE="http://www.virtualbox.org/" +SRC_URI="http://download.virtualbox.org/virtualbox/${PV}/${MY_P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 ~x86" +IUSE="dri" + +RDEPEND="x11-base/xorg-server[-minimal]" +DEPEND="${RDEPEND} + >=dev-util/kbuild-0.1.5-r1 + >=dev-lang/yasm-0.6.2 + sys-devel/dev86 + sys-power/iasl + x11-proto/fontsproto + x11-proto/randrproto + x11-proto/renderproto + x11-proto/xextproto + x11-proto/xineramaproto + x11-proto/xproto + x11-libs/libXdmcp + x11-libs/libXcomposite + x11-libs/libXau + x11-libs/libX11 + x11-libs/libXfixes + x11-libs/libXext + dri? ( x11-proto/xf86driproto + >=x11-libs/libdrm-2.4.5 )" + +BUILD_TARGETS="all" +BUILD_TARGET_ARCH="${ARCH}" +MODULE_NAMES="vboxvideo(misc:${WORKDIR}/vboxvideo_drm:${WORKDIR}/vboxvideo_drm)" + +S=${WORKDIR}/${MY_P/-OSE/_OSE} + +QA_TEXTRELS_x86="usr/lib/VBoxOGL.so" + +pkg_setup() { + linux-mod_pkg_setup + BUILD_PARAMS="KERN_DIR=${KV_DIR} KERNOUT=${KV_OUT_DIR}" +} + +src_prepare() { + # Prepare the vboxvideo_drm sources and Makefile in ${WORKDIR} + cp -a "${WORKDIR}/${MY_P/-OSE/_OSE}"/src/VBox/Additions/linux/drm \ + "${WORKDIR}/vboxvideo_drm" || die "cannot copy vboxvideo_drm directory" + cp "${FILESDIR}/${PN}-3-vboxvideo_drm.makefile" \ + "${WORKDIR}/vboxvideo_drm/Makefile" || die "cannot copy vboxvideo_drm Makefile" + + # stupid new header references... + for vboxheader in {product,version}-generated.h ; do + ln -sf "${S}"/out/linux.${ARCH}/release/${vboxheader} \ + "${WORKDIR}/vboxvideo_drm/${vboxheader}" + done + + # Remove shipped binaries (kBuild,yasm), see bug #232775 + rm -rf kBuild/bin tools + + # Disable things unused or splitted into separate ebuilds + cp "${FILESDIR}/${PN}-3-localconfig" LocalConfig.kmk + + # Ugly hack to build the opengl part of the video driver + epatch "${FILESDIR}/${PN}-2.2.0-enable-opengl.patch" + + # unset useless/problematic mesa checks in configure + epatch "${FILESDIR}/${PN}-3.2.8-mesa-check.patch" +} + +src_configure() { + # build the user-space tools, warnings are harmless + gcc-specs-pie && append-flags "-nopie" + ./configure --nofatal \ + --disable-xpcom \ + --disable-sdl-ttf \ + --disable-pulse \ + --disable-alsa \ + --build-headless || die "configure failed" + source ./env.sh +} + +src_compile() { + for each in /src/VBox/{Runtime,Additions/common/VBoxGuestLib} \ + /src/VBox/{GuestHost/OpenGL,Additions/x11/x11stubs,Additions/common/crOpenGL} \ + /src/VBox/Additions/x11/vboxvideo ; do + cd "${S}"${each} + MAKE="kmk" emake TOOL_YASM_AS=yasm \ + KBUILD_PATH="${S}/kBuild" \ + || die "kmk failed" + done + + if use dri; then + # Now creating the kernel modules. We must do this _after_ + # we compiled the user-space tools as we need two of the + # automatically generated header files. (>=3.2.0) + linux-mod_src_compile + fi +} + +src_install() { + if use dri; then + linux-mod_src_install + fi + + cd "${S}/out/linux.${ARCH}/release/bin/additions" + insinto /usr/$(get_libdir)/xorg/modules/drivers + + # xorg-server-1.9.x + if has_version ">=x11-base/xorg-server-1.9" ; then + newins vboxvideo_drv_19.so vboxvideo_drv.so + # xorg-server-1.8.x + elif has_version ">=x11-base/xorg-server-1.8" ; then + newins vboxvideo_drv_18.so vboxvideo_drv.so + # xorg-server-1.7.x + else + newins vboxvideo_drv_17.so vboxvideo_drv.so + fi + + # Guest OpenGL driver + insinto /usr/$(get_libdir) + doins -r VBoxOGL* || die + + if use dri ; then + dosym /usr/$(get_libdir)/VBoxOGL.so /usr/$(get_libdir)/dri/vboxvideo_dri.so + fi +} + +pkg_postinst() { + elog "You need to edit the file /etc/X11/xorg.conf and set:" + elog "" + elog " Driver \"vboxvideo\"" + elog "" + elog "in the Graphics device section (Section \"Device\")" + elog "" + if use dri; then + elog "To use the kernel drm video driver, please add:" + elog "\"vboxvideo\" to:" + if has_version sys-apps/openrc; then + elog "/etc/conf.d/modules" + else + elog "/etc/modules.autoload.d/kernel-${KV_MAJOR}.${KV_MINOR}" + fi + elog "" + fi +}