DATADIR = "/usr/share/swftools/"
+def update_dirs(list1, list2):
+ for v in list2:
+ if v not in list1 and os.path.isdir(v):
+ list1.append(v)
+
def update_list(list1, list2):
for v in list2:
if v not in list1:
'-DSWFTOOLS_DATADIR="'+DATADIR+'"']
INCLUDE=['lib/lame/', 'lib/pdf/xpdf', 'lib/pdf']
-if 'SWFTOOLS_SYSTEM_PREFIX' in os.environ:
- # Allow overriding the prefix location. This is useful if your
- # python is compiled in a custom location.
- PREFIX = os.environ.get('SWFTOOLS_SYSTEM_PREFIX').strip()
- if not os.path.exists(PREFIX):
- print 'The SWFTOOLS_SYSTEM_PREFIX location does not exist'
- sys.exit(1)
- print 'Using %s as prefix for header files' % PREFIX
+if 'library_dirs' in os.environ:
+ update_dirs(cc.library_dirs, [path.strip() for path in os.environ.get('library_dirs').strip().split(":")])
else:
- # Default to the prefix used for the python interpreter
- PREFIX = sys.prefix
-
-update_list(cc.include_dirs, [os.path.join(PREFIX, 'include'),
- os.path.join(PREFIX, 'include/freetype2'),
- os.path.join(PREFIX, 'include/fontconfig')])
+ update_dirs(cc.library_dirs, [os.path.join(sys.prefix, 'lib'),
+ os.path.join(sys.prefix, 'local/lib')])
+ if sys.platform == "darwin":
+ update_list(cc.library_dirs, ["/sw/lib", "/opt/local/lib"])
-update_list(cc.library_dirs, ["/usr/lib", "/usr/local/lib"])
+if 'include_dirs' in os.environ:
+ update_dirs(cc.include_dirs, [path.strip() for path in os.environ.get('include_dirs').strip().split(":")])
+else:
+ update_dirs(cc.include_dirs, [os.path.join(sys.prefix, 'include'),
+ os.path.join(sys.prefix, 'include/freetype2'),
+ os.path.join(sys.prefix, 'include/fontconfig')])
+ if sys.platform == "darwin":
+ update_dirs(cc.include_dirs, ["/sw/include/freetype2", "/sw/lib/freetype2/include", "/sw/include", "/opt/local/include"])
-if sys.platform == "darwin":
- update_list(cc.include_dirs, ["/sw/include/freetype2",
- "/sw/lib/freetype2/include",
- "/sw/include",
- "/opt/local/include"])
- update_list(cc.library_dirs, ["/sw/lib", "/opt/local/lib"])
class ConfigScript:
def __init__(self):
return "int"
elif name.startswith("SIZEOF_"):
t = name[7:].lower().replace("_", " ")
+ if t == "voidp":
+ t = "void*"
for i in [1,2,4,8]:
- if self.test_code("", "static int test_array [%d+1-sizeof(%s)];\ntest_array [0] = 0;" % (i,t)):
+ s = "static int test_array [%d+1-sizeof(%s)*2];\ntest_array [0] = 0;" % (i*2,t)
+ if self.test_code("", s):
return i
return None
elif name.startswith("USE_FREEETYPE"):
sys.exit(1)
base_sources = [
-"lib/q.c", "lib/utf8.c", "lib/png.c", "lib/wav.c", "lib/mp3.c", "lib/os.c", "lib/bitio.c", "lib/log.c", "lib/mem.c",
+"lib/q.c", "lib/utf8.c", "lib/png.c", "lib/jpeg.c", "lib/wav.c", "lib/mp3.c", "lib/os.c", "lib/bitio.c", "lib/log.c", "lib/mem.c",
]
rfxswf_sources = [
-"lib/modules/swfabc.c", "lib/modules/swfaction.c", "lib/modules/swfbits.c", "lib/modules/swfbutton.c",
+"lib/modules/swfaction.c", "lib/modules/swfbits.c", "lib/modules/swfbutton.c",
"lib/modules/swfcgi.c", "lib/modules/swfdraw.c", "lib/modules/swfdump.c", "lib/modules/swffilter.c",
"lib/modules/swffont.c", "lib/modules/swfobject.c", "lib/modules/swfrender.c", "lib/modules/swfshape.c",
"lib/modules/swfsound.c", "lib/modules/swftext.c", "lib/modules/swftools.c",
"lib/rfxswf.c", "lib/drawer.c", "lib/MD5.c", "lib/h.263/dct.c", "lib/h.263/h263tables.c",
"lib/h.263/swfvideo.c", "lib/action/assembler.c", "lib/action/compile.c",
"lib/action/lex.swf4.c", "lib/action/lex.swf5.c", "lib/action/libming.c",
-"lib/action/swf4compiler.tab.c", "lib/action/swf5compiler.tab.c", "lib/action/actioncompiler.c"
+"lib/action/swf4compiler.tab.c",
+"lib/as3/abc.c", "lib/as3/code.c", "lib/as3/pool.c", "lib/as3/files.c", "lib/as3/opcodes.c",
+"lib/action/swf5compiler.tab.c", "lib/action/actioncompiler.c"
]
libpdf_sources = [
"lib/pdf/GFXOutputDev.cc", "lib/pdf/InfoOutputDev.cc", "lib/pdf/BitmapOutputDev.cc",
"lib/art/art_svp_render_aa.c", "lib/art/art_svp_vpath.c", "lib/art/art_svp_vpath_stroke.c",
"lib/art/art_svp_wind.c", "lib/art/art_uta.c", "lib/art/art_uta_ops.c", "lib/art/art_uta_rect.c",
"lib/art/art_uta_svp.c", "lib/art/art_uta_vpath.c", "lib/art/art_vpath.c", "lib/art/art_vpath_bpath.c",
-"lib/art/art_vpath_dash.c", "lib/art/art_vpath_svp.c",
+"lib/art/art_vpath_dash.c", "lib/art/art_vpath_svp.c", "lib/gocr/box.c",
+"lib/gocr/database.c", "lib/gocr/detect.c", "lib/gocr/job.c", "lib/gocr/lines.c", "lib/gocr/list.c",
+"lib/gocr/ocr0.c", "lib/gocr/ocr0n.c", "lib/gocr/ocr1.c", "lib/gocr/otsu.c", "lib/gocr/output.c",
+"lib/gocr/pgm2asc.c", "lib/gocr/pixel.c", "lib/gocr/progress.c", "lib/gocr/remove.c", "lib/gocr/unicode.c",
+"lib/devices/ocr.c",
]
-gfxswf_sources = ["lib/devices/swf.c"]
+gfxswf_sources = ["lib/devices/swf.c", "lib/readers/swf.c", "lib/readers/image.c"]
swf_module = Extension(
name='SWF',