Hi,
after talking to Dischi on IRC, here's the 3rd version, I hope it's ok
so far.
Lucian
diff -Naur --exclude=entries kaa/display/setup.py kaa_noX11/display/setup.py
--- kaa/display/setup.py 2006-02-24 20:17:01.000000000 +0100
+++ kaa_noX11/display/setup.py 2006-02-24 19:50:36.000000000 +0100
@@ -52,17 +52,17 @@
print "+ FB support enabled"
modules.append(fb)
else:
- print "+ FB support disabled"
+ print "- FB support disabled"
fb = None
-# the framebuffer so module
+# the DirectFB so module
dfb = Extension('kaa.display._DFBmodule', [ 'src/dfb.c'] )
if dfb.check_library('directfb', '0.9.20'):
print "+ DFB support enabled"
modules.append(dfb)
else:
- print "+ DFB support disabled"
+ print "- DFB support disabled"
dfb = None
# config file
diff -Naur --exclude=entries kaa/display/src/display.c kaa_noX11/display/src/display.c
--- kaa/display/src/display.c 2006-02-24 20:17:00.000000000 +0100
+++ kaa_noX11/display/src/display.c 2006-02-24 19:19:24.000000000 +0100
@@ -33,8 +33,10 @@
#include <Python.h>
#include "config.h"
#include "display.h"
+#ifdef HAVE_X11
#include "x11display.h"
#include "x11window.h"
+#endif
#include "imlib2.h"
#include "evas.h"
#include "sdl.h"
@@ -43,11 +45,13 @@
{ "image_to_surface", (PyCFunction) image_to_surface, METH_VARARGS },
{ "render_imlib2_image", (PyCFunction) render_imlib2_image, METH_VARARGS },
#ifdef USE_EVAS
+#ifdef HAVE_X11
{ "new_evas_software_x11", (PyCFunction) new_evas_software_x11, METH_VARARGS | METH_KEYWORDS },
#ifdef ENABLE_ENGINE_GL_X11
{ "new_evas_gl_x11", (PyCFunction) new_evas_gl_x11, METH_VARARGS | METH_KEYWORDS },
#endif
#endif
+#endif
{ NULL }
};
@@ -74,7 +78,7 @@
static void *display_api_ptrs[3];
m = Py_InitModule("_Display", display_methods);
-
+ #ifdef HAVE_X11
if (PyType_Ready(&X11Display_PyObject_Type) < 0)
return;
Py_INCREF(&X11Display_PyObject_Type);
@@ -85,11 +89,12 @@
Py_INCREF(&X11Window_PyObject_Type);
PyModule_AddObject(m, "X11Window", (PyObject *)&X11Window_PyObject_Type);
+
// Export display C API
display_api_ptrs[0] = (void *)X11Window_PyObject__wrap;
display_api_ptrs[1] = (void *)&X11Window_PyObject_Type;
display_api_ptrs[2] = (void *)x11window_object_decompose;
-
+ #endif
display_c_api = PyCObject_FromVoidPtr((void *)display_api_ptrs, NULL);
PyModule_AddObject(m, "_C_API", display_c_api);
@@ -114,7 +119,8 @@
#else
Evas_PyObject_Type = NULL;
#endif
-
+ #ifdef HAVE_X11
if (!XInitThreads())
PyErr_Format(PyExc_SystemError, "Unable to initialize X11 threads.");
+ #endif
}
diff -Naur --exclude=entries kaa/display/src/evas.c kaa_noX11/display/src/evas.c
--- kaa/display/src/evas.c 2006-02-24 20:16:59.000000000 +0100
+++ kaa_noX11/display/src/evas.c 2006-02-24 19:19:24.000000000 +0100
@@ -39,8 +39,10 @@
#ifdef USE_EVAS
#include "evas.h"
+#ifdef HAVE_X11
#include "x11display.h"
#include "x11window.h"
+#endif
Evas *(*evas_object_from_pyobject)(PyObject *pyevas);
diff -Naur --exclude=entries kaa/display/src/evas.h kaa_noX11/display/src/evas.h
--- kaa/display/src/evas.h 2006-02-24 20:17:00.000000000 +0100
+++ kaa_noX11/display/src/evas.h 2006-02-24 19:19:24.000000000 +0100
@@ -37,15 +37,17 @@
#define _EVAS_H_
#ifdef USE_EVAS
+#ifdef HAVE_X11
#include "x11window.h"
+#endif
#include <Evas.h>
extern Evas *(*evas_object_from_pyobject)(PyObject *pyevas);
-
+#ifdef HAVE_X11
X11Window_PyObject *new_evas_software_x11(PyObject *, PyObject *, PyObject *);
#ifdef ENABLE_ENGINE_GL_X11
X11Window_PyObject *new_evas_gl_x11(PyObject *, PyObject *, PyObject *);
#endif
-
+#endif // HAVE_X11
#endif // USE_EVAS
#endif // _EVAS_H_
diff -Naur --exclude=entries kaa/xine/setup.py kaa_noX11/xine/setup.py
--- kaa/xine/setup.py 2006-02-24 20:16:50.000000000 +0100
+++ kaa_noX11/xine/setup.py 2006-02-24 20:09:37.000000000 +0100
@@ -30,22 +30,49 @@
try:
# kaa base imports
- from kaa.base.distribution import Extension, setup
+ from kaa.base.distribution import Extension, Configfile, setup
except ImportError:
print 'kaa.base not installed'
sys.exit(1)
-
-files = ['src/xine.c', 'src/video_port.c', 'src/audio_port.c', 'src/stream.c',
- 'src/post.c', 'src/drivers/x11.c', 'src/drivers/video_out_kaa.c',
- 'src/post_out.c', 'src/post_in.c', 'src/event.c', 'src/event_queue.c',
- 'src/utils.c', 'src/vo_driver.c', 'src/drivers/kaa.c',
- 'src/drivers/yuv2rgb.c', 'src/drivers/yuv2rgb_mmx.c', 'src/drivers/dummy.c',
- 'src/drivers/video_out_dummy.c', 'src/drivers/common.c', 'src/drivers/fb.c'
-]
-xineso = Extension('kaa.xine._xinemodule', files, config='src/config.h',
+
+# config file
+config = Configfile('src/config.h')
+
+# check for X11
+x11 = Extension('kaa.display._Displaymodule',
+ [ 'src/display.c', 'src/sdl.c', 'src/x11display.c',
+ 'src/x11window.c', 'src/imlib2.c', 'src/evas.c' ],
+ libraries = ['png', 'rt'])
+
+# check if X11 is actually present
+if not x11.check_cc(['<X11/Xlib.h>'], '', '-lX11'):
+ print "System without X11 detected! Disabling all X11 dependencies..."
+ x11 = None
+else:
+ config.define('HAVE_X11')
+
+
+if x11:
+ files = ['src/xine.c', 'src/video_port.c', 'src/audio_port.c', 'src/stream.c',
+ 'src/post.c', 'src/drivers/x11.c', 'src/drivers/video_out_kaa.c',
+ 'src/post_out.c', 'src/post_in.c', 'src/event.c', 'src/event_queue.c',
+ 'src/utils.c', 'src/vo_driver.c', 'src/drivers/kaa.c',
+ 'src/drivers/yuv2rgb.c', 'src/drivers/yuv2rgb_mmx.c', 'src/drivers/dummy.c',
+ 'src/drivers/video_out_dummy.c', 'src/drivers/common.c', 'src/drivers/fb.c'
+ ]
+ xineso = Extension('kaa.xine._xinemodule', files,
libraries = ["X11"],
# FIXME: don't hardcode this path
library_dirs = ["/usr/X11R6/lib"])
+else:
+ files = ['src/xine.c', 'src/video_port.c', 'src/audio_port.c', 'src/stream.c',
+ 'src/post.c', 'src/drivers/video_out_kaa.c',
+ 'src/post_out.c', 'src/post_in.c', 'src/event.c', 'src/event_queue.c',
+ 'src/utils.c', 'src/vo_driver.c', 'src/drivers/kaa.c',
+ 'src/drivers/yuv2rgb.c', 'src/drivers/yuv2rgb_mmx.c', 'src/drivers/dummy.c',
+ 'src/drivers/video_out_dummy.c', 'src/drivers/common.c', 'src/drivers/fb.c'
+ ]
+ xineso = Extension('kaa.xine._xinemodule', files)
if not xineso.check_library('xine', '1.1.1'):
print 'xine >= 1.1.1 not found'
diff -Naur --exclude=entries kaa/xine/src/config.h kaa_noX11/xine/src/config.h
--- kaa/xine/src/config.h 1970-01-01 01:00:00.000000000 +0100
+++ kaa_noX11/xine/src/config.h 2006-02-24 20:14:32.000000000 +0100
@@ -0,0 +1 @@
+#define HAVE_X11
diff -Naur --exclude=entries kaa/xine/src/drivers/common.c kaa_noX11/xine/src/drivers/common.c
--- kaa/xine/src/drivers/common.c 2006-02-24 20:16:47.000000000 +0100
+++ kaa_noX11/xine/src/drivers/common.c 2006-02-24 19:19:24.000000000 +0100
@@ -1,5 +1,7 @@
#include "common.h"
+#ifdef HAVE_X11
#include "x11.h"
+#endif
#include "kaa.h"
#include "dummy.h"
@@ -10,8 +12,12 @@
*visual_type_return = XINE_VISUAL_TYPE_NONE;
if (!strcmp(driver, "xv") || !strcmp(driver, "xshm") || !strcmp(driver, "auto") ||
!strcmp(driver, "opengl") || !strcmp(driver, "sdl")) {
+ #ifdef HAVE_X11
*visual_type_return = XINE_VISUAL_TYPE_X11;
return x11_get_visual_info(xine, kwargs, visual_return, driver_info_return);
+ #endif
+ PyErr_Format(PyExc_ValueError, "Unsupported driver: %s", driver);
+ return 0;
} else if (!strcmp(driver, "none")) {
*driver_info_return = 0;
*visual_return = 0;
diff -Naur --exclude=entries kaa/xine/src/xine.c kaa_noX11/xine/src/xine.c
--- kaa/xine/src/xine.c 2006-02-24 20:16:48.000000000 +0100
+++ kaa_noX11/xine/src/xine.c 2006-02-24 19:19:24.000000000 +0100
@@ -13,7 +13,9 @@
#include "drivers/video_out_kaa.h"
#include "drivers/video_out_dummy.h"
#include "drivers/kaa.h"
+#ifdef HAVE_X11
#include "drivers/x11.h"
+#endif
#include "drivers/dummy.h"
#include "drivers/common.h"
@@ -740,10 +742,14 @@
PyErr_Format(xine_error, "Failed to import kaa.display");
return;
}
+ #ifdef HAVE_X11
X11Window_PyObject_Type = display_api_ptrs[1];
x11window_object_decompose = display_api_ptrs[2];
+ #endif
#else
+ #ifdef HAVE_X11
X11Window_PyObject_Type = NULL;
+ #endif
#endif
PyEval_InitThreads();