Author: dmeyer
Date: Fri Feb 24 18:14:06 2006
New Revision: 1221
Modified:
trunk/display/setup.py
Log:
support systems without X11 (in setup.py)
Modified: trunk/display/setup.py
==============================================================================
--- trunk/display/setup.py (original)
+++ trunk/display/setup.py Fri Feb 24 18:14:06 2006
@@ -37,16 +37,20 @@
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)
+# a list of all modules
+modules = []
+
# the framebuffer so module
fb = Extension('kaa.display._FBmodule', [ 'src/fb.c'] )
if fb.check_library('imlib2', '1.1.1'):
print "+ FB support enabled"
+ modules.append(fb)
else:
print "+ FB support disabled"
fb = None
@@ -56,52 +60,66 @@
if dfb.check_library('directfb', '0.9.20'):
print "+ DFB support enabled"
+ modules.append(dfb)
else:
print "+ DFB support disabled"
dfb = None
-# the display so module
-display = 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'],
- config='src/config.h')
+# config file
+config = Configfile('src/config.h')
+# the display so module
+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:
+ modules.append(x11)
+ config.define('HAVE_X11')
-if display.check_library('imlib2', '1.1.1'):
- display.config('#define USE_IMLIB2')
- if 'X11' in display.libraries:
- display.config('#define USE_IMLIB2_DISPLAY')
- print "+ Imlib2 support enabled"
+ if x11.check_library('imlib2', '1.1.1'):
+ config.define('USE_IMLIB2')
+ if 'X11' in x11.libraries:
+ config.define('USE_IMLIB2_DISPLAY')
+ print "+ Imlib2 support enabled"
+ else:
+ print '- Imlib2 compiled without X11, not building imlib2 display'
else:
- print '- Imlib2 compiled without X11, not building imlib2 display'
-else:
print "- Imlib2 support disabled."
-try:
- # test for pygame support
try:
- import pygame
- except ImportError, e:
- print 'pygame module not found'
- raise e
- inc = re.sub("/(lib|lib64)/", "/include/",
- pygame.__path__[0]).replace("site-packages/", "")
- if not os.path.isdir(inc):
- print 'pygame header file not found. Install pygame-devel.'
- raise ImportError
- if not display.check_library('sdl', '1.2.5'):
- print 'SDL not found'
- raise ImportError
- display.include_dirs.append(inc)
- display.config('#define USE_PYGAME\n')
- print "+ pygame support enabled"
-except ImportError:
- print '- pygame support disabled'
+ # test for pygame support
+ try:
+ import pygame
+ except ImportError, e:
+ print 'pygame module not found'
+ raise e
+ inc = re.sub("/(lib|lib64)/", "/include/",
+ pygame.__path__[0]).replace("site-packages/", "")
+ if not os.path.isdir(inc):
+ print 'pygame header file not found. Install pygame-devel.'
+ raise ImportError
+ if not x11.check_library('sdl', '1.2.5'):
+ print 'SDL not found'
+ raise ImportError
+ x11.include_dirs.append(inc)
+ config.define('USE_PYGAME\n')
+ print "+ pygame support enabled"
+ except ImportError:
+ print '- pygame support disabled'
+
# Test for evas and supported engines
evas_engines = ""
-if display.check_library('evas', '0.9.9.010'):
+for display in modules:
+ if not display.check_library('evas', '0.9.9.010'):
+ break
+else:
indent = re.compile("^", re.M)
out = "/tmp/a.out.%s" % os.getpid()
cmd = "cc -x c - `evas-config --libs --cflags` -o %s" % out
@@ -129,41 +147,29 @@
for line in output.splitlines():
engine = line.strip()
- if engine == "software_x11":
- display.config("#define ENABLE_ENGINE_SOFTWARE_X11\n")
+ if engine == "software_x11" and x11:
+ config.define("ENABLE_ENGINE_SOFTWARE_X11")
evas_engines += " software_x11"
- elif engine == "gl_x11":
- display.config("#define ENABLE_ENGINE_GL_X11\n")
+ elif engine == "gl_x11" and x11:
+ config.define("ENABLE_ENGINE_GL_X11")
evas_engines += " gl_x11"
- elif engine == 'fb':
- display.config("#define ENABLE_ENGINE_FB\n")
+ elif engine == 'fb' and fb:
+ config.define("ENABLE_ENGINE_FB")
evas_engines += " fb"
- # FIXME: This is ugly. Find a better way to add
- # the evas libs to the fb module
- fb.libraries += display.libraries
- fb.library_dirs += display.library_dirs
elif engine == 'directfb' and dfb:
- display.config("#define ENABLE_ENGINE_DFB\n")
+ config.define("ENABLE_ENGINE_DFB")
evas_engines += " dfb"
- # FIXME: This is ugly. Find a better way to add
- # the evas libs to the fb module
- dfb.libraries += display.libraries
- dfb.library_dirs += display.library_dirs
os.unlink(out)
if evas_engines == "":
print "- evas support disabled"
else:
print "+ evas support enabled for engines:" + evas_engines
- display.config("#define USE_EVAS\n")
+ config.define("USE_EVAS")
-ext_modules = [ display ]
-if fb:
- ext_modules.append(fb)
-if dfb:
- ext_modules.append(dfb)
-
setup(module = 'display',
version = '0.1',
- ext_modules = ext_modules
+ ext_modules = modules
)
+
+config.unlink()
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog