Commits

Anonymous committed c3cc646

Altered config_unix.py and the two relevant header files to look for the
relevant headers of ffmpeg in either <localbase>/<library> or
<localbase>/ffmpeg. This was tested and working on Ubuntu 9.04, 8.04.

Comments (0)

Files changed (3)

 
 #these get prefixes with '/usr' and '/usr/local' or the $LOCALBASE
 origincdirs = ['/include', '/include/SDL', '/include/SDL',
-               '/include/smpeg' ]
+               '/include/smpeg']
 origlibdirs = ['/lib','/lib64','/X11R6/lib']
 
 def confirm(message):
         else:
             print (self.name + '        '[len(self.name):] + ': not found')
 
-class DebugDependency(Dependency):
-    def __init__(self, name, checkhead, checklib, libs):
+        
+class FFMPEGDependency(Dependency):
+    def __init__(self, name, checkhead, checklib, libs, dirs):
+        self.dirs=dirs
         Dependency.__init__(self, name, checkhead, checklib, libs)
-        self.cflags="-Xcompiler -O0"
+        self.cflags=""
+        
+    def configure(self, incdirs, libdirs):
+        incname = self.checkhead
+        libnames = self.checklib, self.name.lower()
+        
+        dirs=self.dirs[:]
+        self.dirs = ["/usr"+d for d in dirs]
+        self.dirs += ["/usr/local"+d for d in dirs]
+        loc_incdirs = incdirs[:]+self.dirs
+        if incname:
+            for dir in loc_incdirs:
+                path = os.path.join(dir, incname)
+                if os.path.isfile(path):
+                    self.inc_dir = dir
 
+        for dir in libdirs:
+            for name in libnames:
+                path = os.path.join(dir, name)
+                if filter(os.path.isfile, glob(path+'*')):
+                    self.lib_dir = dir
+
+        if (incname and self.lib_dir and self.inc_dir) or (not incname and self.lib_dir):
+            print (self.name + '        '[len(self.name):] + ': found')
+            self.found = 1
+        else:
+            print (self.name + '        '[len(self.name):] + ': not found')
+        
+        
 class DependencyPython:
     def __init__(self, name, module, header):
         self.name = name
         Dependency('SCRAP', '', 'libX11', ['X11']),
         Dependency('PORTMIDI', 'portmidi.h', 'libportmidi.so', ['portmidi']),
         Dependency('PORTTIME', 'porttime.h', 'libporttime.so', ['porttime']),
-        DebugDependency('AVFORMAT', 'libavformat/avformat.h', 'libavformat.a', ['avformat']),
-        DebugDependency('SWSCALE', 'libswscale/swscale.h', 'libswscale.a', ['swscale']),
+        FFMPEGDependency('AVFORMAT', 'avformat.h', 'libavformat.a', ['avformat'], ['/include/libavformat', '/include/ffmpeg']),
+        FFMPEGDependency('SWSCALE', 'swscale.h', 'libswscale.a', ['swscale'], ['/include/libswscale', '/include/ffmpeg']),
         DependencyProg('FREETYPE', 'FREETYPE_CONFIG', 'freetype-config', '2.0', ['freetype'], '--ftversion'),
         #Dependency('GFX', 'SDL_gfxPrimitives.h', 'libSDL_gfx.so', ['SDL_gfx']),
     ]
 #include <Python.h>
 #include <SDL.h>
 #include <SDL_thread.h>
-#include <libavformat/avformat.h>
-#include <libswscale/swscale.h>
+#include <avformat.h>
+#include <swscale.h>
 
 	
 /*constant definitions */
 #include <SDL/SDL_mixer.h>
 #include <SDL.h>
 #include <SDL_thread.h>
-#include <libavformat/avformat.h>
+#include <avformat.h>
 
 
 /* Buffer Node for a simple FIFO queue of sound samples. */