aboutsummaryrefslogtreecommitdiff
path: root/emulators
diff options
context:
space:
mode:
authorBernhard Froehlich <decke@FreeBSD.org>2013-05-15 21:22:21 +0000
committerBernhard Froehlich <decke@FreeBSD.org>2013-05-15 21:22:21 +0000
commit2931f65e37596cae6de663dfbe1c15c68c8cf3c4 (patch)
tree199cdec14ebbcd7da90f2d745d08e5ff6f139181 /emulators
parent07722cdcee696ddeb4fd160619e752f2e2781678 (diff)
downloadports-2931f65e37596cae6de663dfbe1c15c68c8cf3c4.tar.gz
ports-2931f65e37596cae6de663dfbe1c15c68c8cf3c4.zip
Notes
Diffstat (limited to 'emulators')
-rw-r--r--emulators/virtualbox-ose-additions/Makefile24
-rw-r--r--emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-common-crOpenGL-Makefile.kmk40
-rw-r--r--emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-common-crOpenGL-fakedri_drv.c120
-rw-r--r--emulators/virtualbox-ose-additions/files/vboxguest.in16
-rw-r--r--emulators/virtualbox-ose-additions/pkg-plist10
5 files changed, 208 insertions, 2 deletions
diff --git a/emulators/virtualbox-ose-additions/Makefile b/emulators/virtualbox-ose-additions/Makefile
index 13ab74856076..21bd86e0bf86 100644
--- a/emulators/virtualbox-ose-additions/Makefile
+++ b/emulators/virtualbox-ose-additions/Makefile
@@ -3,6 +3,7 @@
PORTNAME= virtualbox-ose
DISTVERSION= 4.2.12
+PORTREVISION= 1
CATEGORIES= emulators kld
MASTER_SITES= http://download.virtualbox.org/virtualbox/${DISTVERSION}/ \
http://tmp.chruetertee.ch/ \
@@ -31,8 +32,7 @@ MAKE_JOBS_UNSAFE= yes
HAS_CONFIGURE= yes
CONFIGURE_ARGS+=--with-gcc="${CC}" --with-g++="${CXX}" --nofatal \
--disable-xpcom --disable-sdl-ttf --disable-pulse \
- --disable-alsa --disable-dbus --disable-python \
- --build-headless
+ --disable-alsa --disable-dbus --disable-python
CONFLICTS= bcc-[0-9]*
CONFLICTS_INSTALL= virtualbox-ose-additions-devel-[3,4]* virtualbox-ose-[3,4]* virtualbox-ose-devel-[3,4]* virtualbox-ose-legacy-[3,4]*
@@ -70,9 +70,12 @@ PLIST_SUB+= X11="@comment "
.endif
.if ${PORT_OPTIONS:MOPENGL}
+USE_XORG+= xcomposite xdamage xext xfixes
USE_GL= gl
+PLIST_SUB+= OPENGL=""
.else
CONFIGURE_ARGS+=--disable-opengl
+PLIST_SUB+= OPENGL="@comment "
.endif
.if ${ARCH} == i386
@@ -122,6 +125,9 @@ do-build:
do-install:
${MKDIR} ${KMODDIR}
${INSTALL_KLD} ${VBOX_BIN}/src/vboxguest/vboxguest.ko ${KMODDIR}
+.if ${PORT_OPTIONS:MX11}
+ ${INSTALL_KLD} ${VBOX_BIN}/vboxvideo.ko ${KMODDIR}
+.endif
@/usr/sbin/kldxref ${KMODDIR}
${MKDIR} ${PREFIX}/etc/rc.d/
@@ -154,6 +160,20 @@ do-install:
${INSTALL_DATA} ${VBOX_BIN}/vboxmouse_drv_${XSERVER_ABI}.so ${INPUTDIR}/vboxmouse_drv.so
.endif
+.if ${PORT_OPTIONS:MOPENGL}
+ ${MKDIR} ${PREFIX}/lib
+ ${INSTALL_DATA} ${VBOX_BIN}/VBoxOGL.so ${PREFIX}/lib/
+ ${INSTALL_DATA} ${VBOX_BIN}/VBoxOGLarrayspu.so ${PREFIX}/lib/
+ ${INSTALL_DATA} ${VBOX_BIN}/VBoxOGLcrutil.so ${PREFIX}/lib/
+ ${INSTALL_DATA} ${VBOX_BIN}/VBoxOGLerrorspu.so ${PREFIX}/lib/
+ ${INSTALL_DATA} ${VBOX_BIN}/VBoxOGLfeedbackspu.so ${PREFIX}/lib/
+ ${INSTALL_DATA} ${VBOX_BIN}/VBoxOGLpackspu.so ${PREFIX}/lib/
+ ${INSTALL_DATA} ${VBOX_BIN}/VBoxOGLpassthroughspu.so ${PREFIX}/lib/
+
+ ${MKDIR} ${PREFIX}/lib/dri
+ ${LN} -sf ${PREFIX}/lib/VBoxOGL.so ${PREFIX}/lib/dri/vboxvideo_dri.so
+.endif
+
post-install:
@${CAT} ${PKGMESSAGE}
diff --git a/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-common-crOpenGL-Makefile.kmk b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-common-crOpenGL-Makefile.kmk
new file mode 100644
index 000000000000..59962fd217b3
--- /dev/null
+++ b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-common-crOpenGL-Makefile.kmk
@@ -0,0 +1,40 @@
+--- src/VBox/Additions/common/crOpenGL/Makefile.kmk.orig 2013-04-12 12:35:06.000000000 +0200
++++ src/VBox/Additions/common/crOpenGL/Makefile.kmk 2013-05-02 23:33:26.523212251 +0200
+@@ -42,7 +42,7 @@
+
+ if1of ($(KBUILD_TARGET), linux solaris freebsd)
+ #VBoxOGL_DRI = 1
+- ifn1of ($(KBUILD_TARGET),solaris freebsd) # No DRI on Solaris yet
++ ifn1of ($(KBUILD_TARGET),solaris) # No DRI on Solaris yet
+ VBoxOGL_FAKEDRI = 1
+ endif
+
+@@ -209,8 +209,13 @@
+ $(PATH_STAGE_LIB)/libXfixes.so \
+ $(PATH_STAGE_LIB)/libXext.so
+ ifdef VBoxOGL_FAKEDRI
+- VBoxOGL_LIBS += \
++ ifeq ($(KBUILD_TARGET), freebsd)
++ VBoxOGL_LIBS += \
++ elf
++ else
++ VBoxOGL_LIBS += \
+ dl
++ endif
+ endif
+ endif
+ ifdef VBOX_WITH_CRHGSMI
+@@ -368,6 +373,13 @@
+ | $$(dir $$@)
+ $(call MSG_GENERATE,python,$@,$<)
+ $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI)
++ else ifeq ($(KBUILD_TARGET),freebsd)
++$(VBOX_PATH_CROGL_GENFILES)/freebsd_exports.c: \
++ $(PATH_SUB_CURRENT)/FreeBSD_exports.py \
++ $(VBOX_CROGL_API_FILES) $(PATH_SUB_CURRENT)/entrypoints.py \
++ | $$(dir $$@)
++ $(call MSG_GENERATE,python,$@,$<)
++ $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI)
+ else
+ $(VBOX_PATH_CROGL_GENFILES)/linux_exports.c: \
+ $(PATH_SUB_CURRENT)/Linux_exports.py \
diff --git a/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-common-crOpenGL-fakedri_drv.c b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-common-crOpenGL-fakedri_drv.c
new file mode 100644
index 000000000000..30e49b85c315
--- /dev/null
+++ b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-common-crOpenGL-fakedri_drv.c
@@ -0,0 +1,120 @@
+--- src/VBox/Additions/common/crOpenGL/fakedri_drv.c.orig 2012-12-19 13:25:04.000000000 -0500
++++ src/VBox/Additions/common/crOpenGL/fakedri_drv.c 2013-01-27 17:57:04.000000000 -0500
+@@ -29,6 +29,15 @@
+ #include <dlfcn.h>
+ #include <elf.h>
+ #include <unistd.h>
++
++#include <sys/param.h>
++#if defined(BSD)
++#include <fcntl.h>
++#include <gelf.h>
++#include <libelf.h>
++#include <string.h>
++#endif
++
+ /** X server message type definitions. */
+ typedef enum {
+ X_PROBED, /* Value was probed */
+@@ -50,11 +59,11 @@
+
+ //@todo this could be different...
+ #ifdef RT_ARCH_AMD64
+-# define DRI_DEFAULT_DRIVER_DIR "/usr/lib64/dri:/usr/lib/dri:/usr/lib/x86_64-linux-gnu/dri"
+-# define DRI_XORG_DRV_DIR "/usr/lib/xorg/modules/drivers/"
++# define DRI_DEFAULT_DRIVER_DIR "/usr/local/lib/dri"
++# define DRI_XORG_DRV_DIR "/usr/local/lib/xorg/modules/drivers/"
+ #else
+-# define DRI_DEFAULT_DRIVER_DIR "/usr/lib/dri:/usr/lib/i386-linux-gnu/dri"
+-# define DRI_XORG_DRV_DIR "/usr/lib/xorg/modules/drivers/"
++# define DRI_DEFAULT_DRIVER_DIR "/usr/local/lib/dri"
++# define DRI_XORG_DRV_DIR "/usr/local/lib/xorg/modules/drivers/"
+ #endif
+
+ #ifdef DEBUG_DRI_CALLS
+@@ -209,6 +218,85 @@
+
+ #define FAKEDRI_JMP64_PATCH_SIZE 13
+
++#if defined(BSD)
++/* Provide basic dladdr1 flags */
++enum {
++ RTLD_DL_SYMENT = 1
++};
++
++/* Provide a minimal local version of dladdr1 */
++static int
++dladdr1(const void *address, Dl_info *dlip, void **info, int flags)
++{
++ static DRI_ELFSYM desym;
++ GElf_Sym sym;
++ GElf_Shdr shdr;
++ Elf *elf;
++ Elf_Scn *scn;
++ Elf_Data *data;
++ int ret, fd, count, i;
++
++ /* Initialize variables */
++ fd = -1;
++ elf = NULL;
++
++ /* Call dladdr first */
++ ret = dladdr(address, dlip);
++ if (ret == 0) goto err_exit;
++
++ /* Check for supported flags */
++ if (flags != RTLD_DL_SYMENT) return 1;
++
++ /* Open shared library's ELF file */
++ if (elf_version(EV_CURRENT) == EV_NONE) goto err_exit;
++ fd = open(dlip->dli_fname, O_RDONLY);
++ if (fd < 0) goto err_exit;
++ elf = elf_begin(fd, ELF_C_READ, NULL);
++ if (elf == NULL) goto err_exit;
++
++ /* Find the '.dynsym' section */
++ scn = elf_nextscn(elf, NULL);
++ while (scn != NULL) {
++ if (gelf_getshdr(scn, &shdr) == NULL) goto err_exit;
++ if (shdr.sh_type == SHT_DYNSYM) break;
++ scn = elf_nextscn(elf, scn);
++ }
++ if (scn == NULL) goto err_exit;
++
++ /* Search for the requested symbol by name and offset */
++ data = elf_getdata(scn, NULL);
++ count = shdr.sh_size / shdr.sh_entsize;
++ for (i = 0; i < count; i++) {
++ gelf_getsym(data, i, &sym);
++ if ((strcmp(dlip->dli_sname,
++ elf_strptr(elf, shdr.sh_link, sym.st_name)) == 0) &&
++ (sym.st_value == (dlip->dli_saddr - dlip->dli_fbase))) {
++ break;
++ }
++ }
++
++ /* Close ELF file */
++ elf_end(elf);
++ close(fd);
++
++ /* Return symbol entry in native format */
++ desym.st_name = sym.st_name;
++ desym.st_info = sym.st_info;
++ desym.st_other = sym.st_other;
++ desym.st_shndx = sym.st_shndx;
++ desym.st_value = sym.st_value;
++ desym.st_size = sym.st_size;
++ *info = &desym;
++ return 1;
++
++ /* Error handler */
++err_exit:
++ if (elf != NULL) elf_end(elf);
++ if (fd >= 0) close(fd);
++ return 0;
++}
++#endif
++
+ static void
+ vboxPatchMesaExport(const char* psFuncName, const void *pStart, const void *pEnd)
+ {
diff --git a/emulators/virtualbox-ose-additions/files/vboxguest.in b/emulators/virtualbox-ose-additions/files/vboxguest.in
index f542b22ef472..ade179f1e22f 100644
--- a/emulators/virtualbox-ose-additions/files/vboxguest.in
+++ b/emulators/virtualbox-ose-additions/files/vboxguest.in
@@ -32,10 +32,26 @@ vboxguest_start()
return 1
fi
fi
+ if ! kldstat -q -m vgapci/vboxvideo;
+ then
+ if ! kldload vboxvideo > /dev/null 2>&1;
+ then
+ warn "Can't load vboxvideo module."
+ return 1
+ fi
+ fi
}
vboxguest_stop()
{
+ if kldstat -q -m vgapci/vboxvideo;
+ then
+ if ! kldunload vboxvideo > /dev/null 2>&1;
+ then
+ warn "Can't unload vboxvideo module."
+ return 1
+ fi
+ fi
if kldstat -q -m pci/vboxguest;
then
if ! kldunload vboxguest > /dev/null 2>&1;
diff --git a/emulators/virtualbox-ose-additions/pkg-plist b/emulators/virtualbox-ose-additions/pkg-plist
index e196271aeeda..de7dec99b2fb 100644
--- a/emulators/virtualbox-ose-additions/pkg-plist
+++ b/emulators/virtualbox-ose-additions/pkg-plist
@@ -4,6 +4,14 @@
%%X11%%etc/xdg/autostart/vboxclient.desktop
sbin/VBoxControl
sbin/VBoxService
+%%OPENGL%%lib/VBoxOGL.so
+%%OPENGL%%lib/VBoxOGLarrayspu.so
+%%OPENGL%%lib/VBoxOGLcrutil.so
+%%OPENGL%%lib/VBoxOGLerrorspu.so
+%%OPENGL%%lib/VBoxOGLfeedbackspu.so
+%%OPENGL%%lib/VBoxOGLpackspu.so
+%%OPENGL%%lib/VBoxOGLpassthroughspu.so
+%%OPENGL%%lib/dri/vboxvideo_dri.so
%%X11%%share/autostart/vboxclient.desktop
%%X11%%lib/xorg/modules/drivers/vboxvideo_drv.so
%%X11%%lib/xorg/modules/input/vboxmouse_drv.so
@@ -12,8 +20,10 @@ sbin/VBoxService
%%X11%%@dirrmtry lib/xorg/modules/input
%%X11%%@dirrmtry lib/xorg/modules
%%X11%%@dirrmtry lib/xorg
+%%OPENGL%%@dirrmtry lib/dri
%%X11%%@dirrmtry lib
@cwd /
%%KMODDIR%%/vboxguest.ko
+%%KMODDIR%%/vboxvideo.ko
@exec /usr/sbin/kldxref /%%KMODDIR%%
@unexec /usr/sbin/kldxref /%%KMODDIR%%