Browse Source

Tweaks for building with static thirdparty libs on Linux

Sneak in a function used by makewheel
rdb 9 years ago
parent
commit
601b6b8678
2 changed files with 23 additions and 3 deletions
  1. 11 3
      makepanda/makepanda.py
  2. 12 0
      makepanda/makepandacore.py

+ 11 - 3
makepanda/makepanda.py

@@ -561,6 +561,10 @@ if (COMPILER == "MSVC"):
                 LibName(pkg, 'dxerrVNUM.lib'.replace("VNUM", vnum))
                 LibName(pkg, 'dxerrVNUM.lib'.replace("VNUM", vnum))
             #LibName(pkg, 'ddraw.lib')
             #LibName(pkg, 'ddraw.lib')
             LibName(pkg, 'dxguid.lib')
             LibName(pkg, 'dxguid.lib')
+
+    if not PkgSkip("FREETYPE") and os.path.isdir(GetThirdpartyDir() + "freetype/include/freetype2"):
+        IncDirectory("FREETYPE", GetThirdpartyDir() + "freetype/include/freetype2")
+
     IncDirectory("ALWAYS", GetThirdpartyDir() + "extras/include")
     IncDirectory("ALWAYS", GetThirdpartyDir() + "extras/include")
     LibName("WINSOCK", "wsock32.lib")
     LibName("WINSOCK", "wsock32.lib")
     LibName("WINSOCK2", "wsock32.lib")
     LibName("WINSOCK2", "wsock32.lib")
@@ -766,9 +770,13 @@ if (COMPILER=="GCC"):
         SmartPkgEnable("JPEG",      "",          ("jpeg"), "jpeglib.h")
         SmartPkgEnable("JPEG",      "",          ("jpeg"), "jpeglib.h")
         SmartPkgEnable("PNG",       "libpng",    ("png"), "png.h", tool = "libpng-config")
         SmartPkgEnable("PNG",       "libpng",    ("png"), "png.h", tool = "libpng-config")
 
 
-        if GetTarget() == "darwin" and not PkgSkip("FFMPEG"):
-            LibName("FFMPEG", "-Wl,-read_only_relocs,suppress")
-            LibName("FFMPEG", "-framework VideoDecodeAcceleration")
+        if not PkgSkip("FFMPEG"):
+            if GetTarget() == "darwin":
+                LibName("FFMPEG", "-Wl,-read_only_relocs,suppress")
+                LibName("FFMPEG", "-framework VideoDecodeAcceleration")
+            elif os.path.isfile(GetThirdpartyDir() + "ffmpeg/lib/libavcodec.a"):
+                # Needed when linking ffmpeg statically on Linux.
+                LibName("FFMPEG", "-Wl,-Bsymbolic")
 
 
         cv_lib = ChooseLib(("opencv_core", "cv"), "OPENCV")
         cv_lib = ChooseLib(("opencv_core", "cv"), "OPENCV")
         if cv_lib == "opencv_core":
         if cv_lib == "opencv_core":

+ 12 - 0
makepanda/makepandacore.py

@@ -1491,6 +1491,11 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
         if os.path.isdir(os.path.join(pkg_dir, "include")):
         if os.path.isdir(os.path.join(pkg_dir, "include")):
             IncDirectory(target_pkg, os.path.join(pkg_dir, "include"))
             IncDirectory(target_pkg, os.path.join(pkg_dir, "include"))
 
 
+            # Handle cases like freetype2 where the include dir is a subdir under "include"
+            for i in incs:
+                if os.path.isdir(os.path.join(pkg_dir, "include", i)):
+                    IncDirectory(target_pkg, os.path.join(pkg_dir, "include", i))
+
         if os.path.isdir(os.path.join(pkg_dir, "lib")):
         if os.path.isdir(os.path.join(pkg_dir, "lib")):
             LibDirectory(target_pkg, os.path.join(pkg_dir, "lib"))
             LibDirectory(target_pkg, os.path.join(pkg_dir, "lib"))
 
 
@@ -2749,6 +2754,13 @@ def GetOrigExt(x):
 def SetOrigExt(x, v):
 def SetOrigExt(x, v):
     ORIG_EXT[x] = v
     ORIG_EXT[x] = v
 
 
+def GetExtensionSuffix():
+    target = GetTarget()
+    if target == 'windows':
+        return '.pyd'
+    else:
+        return '.so'
+
 def CalcLocation(fn, ipath):
 def CalcLocation(fn, ipath):
     if (fn.count("/")): return fn
     if (fn.count("/")): return fn
     dllext = ""
     dllext = ""