Browse Source

This should fix libswscale problems for real, I think

rdb 16 years ago
parent
commit
3469e528ba
2 changed files with 23 additions and 20 deletions
  1. 5 4
      makepanda/makepanda.py
  2. 18 16
      makepanda/makepandacore.py

+ 5 - 4
makepanda/makepanda.py

@@ -359,9 +359,6 @@ if (COMPILER=="MSVC"):
     if (PkgSkip("FREETYPE")==0): LibName("FREETYPE", GetThirdpartyDir() + "freetype/lib/freetype.lib")
     if (PkgSkip("FFTW")==0):     LibName("FFTW",     GetThirdpartyDir() + "fftw/lib/rfftw.lib")        
     if (PkgSkip("FFTW")==0):     LibName("FFTW",     GetThirdpartyDir() + "fftw/lib/fftw.lib")        
-    if (PkgSkip("FFMPEG")==0):   LibName("FFMPEG",   GetThirdpartyDir() + "ffmpeg/lib/avcodec-51-panda.lib")
-    if (PkgSkip("FFMPEG")==0):   LibName("FFMPEG",   GetThirdpartyDir() + "ffmpeg/lib/avformat-50-panda.lib")
-    if (PkgSkip("FFMPEG")==0):   LibName("FFMPEG",   GetThirdpartyDir() + "ffmpeg/lib/avutil-49-panda.lib")
     if (PkgSkip("ARTOOLKIT")==0):LibName("ARTOOLKIT",GetThirdpartyDir() + "artoolkit/lib/libAR.lib")
     if (PkgSkip("ODE")==0):      LibName("ODE",      GetThirdpartyDir() + "ode/lib/ode.lib")
     if (PkgSkip("FCOLLADA")==0): LibName("FCOLLADA", GetThirdpartyDir() + "fcollada/lib/FCollada.lib")
@@ -372,6 +369,10 @@ if (COMPILER=="MSVC"):
     if (PkgSkip("OPENCV")==0):   LibName("OPENCV",   GetThirdpartyDir() + "opencv/lib/ml.lib")
     if (PkgSkip("OPENCV")==0):   LibName("OPENCV",   GetThirdpartyDir() + "opencv/lib/cxcore.lib")
     if (PkgSkip("TINYXML")==0):  LibName("TINYXML",  GetThirdpartyDir() + "tinyxml/lib/tinyxml.lib")
+    if (PkgSkip("FFMPEG")==0):   LibName("FFMPEG",   GetThirdpartyDir() + "ffmpeg/lib/avcodec-51-panda.lib")
+    if (PkgSkip("FFMPEG")==0):   LibName("FFMPEG",   GetThirdpartyDir() + "ffmpeg/lib/avformat-50-panda.lib")
+    if (PkgSkip("FFMPEG")==0):   LibName("FFMPEG",   GetThirdpartyDir() + "ffmpeg/lib/avutil-49-panda.lib")
+    if (PkgSkip("SWSCALE")==0):  PkgDisable("SWSCALE")
     if (PkgSkip("WX")==0):
         LibName("WX",       GetThirdpartyDir() + "wx/lib/wxbase28u.lib")
         LibName("WX",       GetThirdpartyDir() + "wx/lib/wxmsw28u_core.lib")
@@ -421,7 +422,7 @@ if (COMPILER=="LINUX"):
         SmartPkgEnable("ARTOOLKIT", "",          ("AR"), "AR/ar.h")
         SmartPkgEnable("FCOLLADA",  "",          ChooseLib(*fcollada_libs), ("FCollada", "FCollada.h"))
         SmartPkgEnable("FFMPEG",    ffmpeg_libs, ffmpeg_libs, ffmpeg_libs)
-        SmartPkgEnable("SWSCALE",   "libswscale", "libswscale", ("libswscale", "libswscale/swscale.h"))
+        SmartPkgEnable("SWSCALE",   "libswscale", "libswscale", ("libswscale", "libswscale/swscale.h"), target_pkg = "FFMPEG")
         SmartPkgEnable("FFTW",      "",          ("fftw", "rfftw"), ("fftw.h", "rfftw.h"))
         SmartPkgEnable("FMODEX",    "",          ("fmodex"), ("fmodex", "fmodex/fmod.h"))
         SmartPkgEnable("FREETYPE",  "freetype2", ("freetype"), ("freetype2", "freetype2/freetype/freetype.h"))

+ 18 - 16
makepanda/makepandacore.py

@@ -1040,10 +1040,12 @@ def ChooseLib(*libs):
     if (len(libs) > 0):
         return libs[0]
 
-def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None, framework = None, tool = "pkg-config"):
+def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None, framework = None, target_pkg = None, tool = "pkg-config"):
     global PKG_LIST_ALL
     if (pkg in PkgListGet() and PkgSkip(pkg)):
         return
+    if (target_pkg == "" or target_pkg == None):
+        target_pkg = pkg
     if (pkgconfig == ""):
         pkgconfig = None
     if (framework == ""):
@@ -1068,19 +1070,19 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
     
     if (pkg.lower() == "swscale" and os.path.isfile(GetThirdpartyDir() + "ffmpeg/include/libswscale/swscale.h")):
         # Let it be handled by the ffmpeg package
-        LibName(pkg, "-lswscale")
+        LibName(target_pkg, "-lswscale")
         return
     
     if (os.path.isdir(GetThirdpartyDir() + pkg.lower())):
-        IncDirectory(pkg, GetThirdpartyDir() + pkg.lower() + "/include")
-        LibDirectory(pkg, GetThirdpartyDir() + pkg.lower() + "/lib")
+        IncDirectory(target_pkg, GetThirdpartyDir() + pkg.lower() + "/include")
+        LibDirectory(target_pkg, GetThirdpartyDir() + pkg.lower() + "/lib")
         # TODO: check for a .pc file in the lib/pkg-config/ dir
         if (tool != None and os.path.isfile(GetThirdpartyDir() + pkg.lower() + "/bin/" + tool)):
             tool = GetThirdpartyDir() + pkg.lower() + "/bin/" + tool
-            for i in PkgConfigGetLibs(pkg.lower(), tool):
-                LibName(pkg, i)
-            for i, j in PkgConfigGetDefSymbols(pkg.lower(), tool).items():
-                DefSymbol(pkg, i, j)
+            for i in PkgConfigGetLibs(None, tool):
+                LibName(target_pkg, i)
+            for i, j in PkgConfigGetDefSymbols(None, tool).items():
+                DefSymbol(target_pkg, i, j)
             return
         for l in libs:
             libname = l
@@ -1090,18 +1092,18 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
             if (len(glob.glob(GetThirdpartyDir() + pkg.lower() + "/lib/libpanda%s.*" % libname)) > 0 and
                 len(glob.glob(GetThirdpartyDir() + pkg.lower() + "/lib/lib%s.*" % libname)) == 0):
                 libname = "panda" + libname
-            LibName(pkg, "-l" + libname)
+            LibName(target_pkg, "-l" + libname)
         for d, v in defs.values():
-            DefSymbol(pkg, d, v)
+            DefSymbol(target_pkg, d, v)
         return
     elif (sys.platform == "darwin" and framework != None):
         if (os.path.isdir("/Library/Frameworks/%s.framework" % framework) or
             os.path.isdir("/System/Library/Frameworks/%s.framework" % framework) or
             os.path.isdir("/Developer/Library/Frameworks/%s.framework" % framework) or
             os.path.isdir("/Users/%s/System/Library/Frameworks/%s.framework" % (getpass.getuser(), framework))):
-            LibName(pkg, "-framework " + framework)
+            LibName(target_pkg, "-framework " + framework)
             for d, v in defs.values():
-                DefSymbol(pkg, d, v)
+                DefSymbol(target_pkg, d, v)
         elif (pkg in PkgListGet()):
             print "%sWARNING:%s Could not locate framework %s, excluding from build" % (GetColor("red"), GetColor(), framework)
             PkgDisable(pkg)
@@ -1112,12 +1114,12 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
     elif (LocateBinary(tool) != None and (tool != "pkg-config" or pkgconfig != None)):
         if (isinstance(pkgconfig, str) or tool != "pkg-config"):
             if (PkgConfigHavePkg(pkgconfig, tool)):
-                return PkgConfigEnable(pkg, pkgconfig, tool)
+                return PkgConfigEnable(target_pkg, pkgconfig, tool)
         else:
             have_all_pkgs = True
             for pc in pkgconfig:
                 if (PkgConfigHavePkg(pc, tool)):
-                    PkgConfigEnable(pkg, pc, tool)
+                    PkgConfigEnable(target_pkg, pc, tool)
                 else:
                     have_all_pkgs = False
             if (have_all_pkgs):
@@ -1138,7 +1140,7 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
             if (l.startswith("lib")):
                 libname = l[3:]
             if (libname in GetLibCache()):
-                LibName(pkg, "-l" + libname)
+                LibName(target_pkg, "-l" + libname)
             else:
                 if (VERBOSE):
                     print GetColor("cyan") + "Couldn't find library lib" + libname + GetColor()
@@ -1164,7 +1166,7 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
             
             # Note: It's possible to specify a file instead of a dir, for the sake of checking if it exists.
             if (incdir != None and os.path.isdir(incdir)):
-                IncDirectory(pkg, incdir)
+                IncDirectory(target_pkg, incdir)
         
         if (not have_pkg):
             if (pkg in PkgListGet()):