Browse Source

Lots of improvements to makepanda, too lazy to sum them all up

rdb 16 years ago
parent
commit
080484f9ee
3 changed files with 30 additions and 39 deletions
  1. 2 1
      makepanda/installpanda.py
  2. 10 25
      makepanda/makepanda.py
  3. 18 13
      makepanda/makepandacore.py

+ 2 - 1
makepanda/installpanda.py

@@ -49,7 +49,8 @@ def InstallPanda(destdir="", prefix="/usr", outputdir="built"):
     oscmd("echo '"+prefix+libdir+"/panda3d'>>   "+destdir+PPATH+"/panda3d.pth")
     oscmd("cp "+outputdir+"/bin/*               "+destdir+prefix+"/bin/")
     for base in os.listdir(outputdir+"/lib"):
-        oscmd("cp "+outputdir+"/lib/"+base+" "+destdir+prefix+libdir+"/panda3d/"+base)
+        if (not base.endswith(".a")):
+            oscmd("cp "+outputdir+"/lib/"+base+" "+destdir+prefix+libdir+"/panda3d/"+base)
     # rpmlint doesn't like it if we compile pyc.
     #for base in os.listdir(destdir+prefix+"/share/panda3d/direct"):
     #    if ((base != "extensions") and (base != "extensions_native")):

+ 10 - 25
makepanda/makepanda.py

@@ -341,9 +341,9 @@ if (COMPILER=="LINUX"):
     PkgConfigEnable("GTK2", "gtk+-2.0")
     
     if (sys.platform == "darwin"):
-        pkgs = ["VRPN", "FFTW", "FMODEX", "ARTOOLKIT", "ODE", "OPENCV", "FCOLLADA", "SQUISH", "FFMPEG", "PNG", "JPEG", "TIFF", "TINYXML"]
+        pkgs = ["VRPN", "FFTW", "FMODEX", "ARTOOLKIT", "ODE", "OPENCV", "FCOLLADA", "SQUISH", "FFMPEG", "PNG", "JPEG", "TIFF", "TINYXML", "NPAPI"]
     else:
-        pkgs = ["VRPN", "FFTW", "FMODEX", "ARTOOLKIT", "ODE", "OPENCV", "FCOLLADA", "SQUISH", "NVIDIACG", "FFMPEG", "OPENAL", "TINYXML"]
+        pkgs = ["VRPN", "FFTW", "FMODEX", "ARTOOLKIT", "ODE", "OPENCV", "FCOLLADA", "SQUISH", "NVIDIACG", "FFMPEG", "OPENAL", "TINYXML", "NPAPI"]
     for pkg in pkgs:
         if (PkgSkip(pkg)==0):
             if (os.path.isdir(THIRDPARTYLIBS + pkg.lower())):
@@ -400,6 +400,7 @@ if (COMPILER=="LINUX"):
     if (PkgSkip("OPENCV")==0):     LibName("OPENCV", "-lcvaux")
     if (PkgSkip("OPENCV")==0):     LibName("OPENCV", "-lml")
     if (PkgSkip("OPENCV")==0):     LibName("OPENCV", "-lcxcore")
+    if (PkgSkip("TINYXML")==0):    LibName("TINYXML", "-ltinyxml")
     if (sys.platform == "darwin"):
         LibName("ALWAYS", "-framework AppKit")
         if (PkgSkip("OPENCV")==0):   LibName("OPENCV", "-framework QuickTime")
@@ -684,9 +685,10 @@ def CompileLib(lib, obj, opts):
         if sys.platform == 'darwin':
             cmd = 'libtool -static -o ' + BracketNameWithQuotes(lib)
         else:
-            cmd = 'ar cru ' + lib
+            cmd = 'ar cru ' + BracketNameWithQuotes(lib)
         for x in obj: cmd=cmd + ' ' + BracketNameWithQuotes(x)
         oscmd(cmd)
+        os.system('chmod +x ' + BracketNameWithQuotes(lib))
 
 ########################################################################
 ##
@@ -741,7 +743,7 @@ def CompileLink(dll, obj, opts):
         if (GetOrigExt(dll)==".exe"): cmd = 'g++ -o ' + dll + ' -L' + GetOutputDir() + '/lib -L/usr/X11R6/lib'
         else:
             if (sys.platform == "darwin"):
-                cmd = 'g++ -undefined dynamic_lookup -dynamic -dynamiclib -o ' + dll + ' -install_name ' + GetOutputDir() + '/lib/' + os.path.basename(dll) + ' -L' + GetOutputDir() + '/lib -L/usr/X11R6/lib'
+                cmd = 'g++ -undefined dynamic_lookup -dynamic -dynamiclib -o ' + dll + ' -install_name ' + os.path.basename(dll) + ' -L' + GetOutputDir() + '/lib -L/usr/X11R6/lib'
             else:
                 cmd = 'g++ -shared -o ' + dll + ' -L' + GetOutputDir() + '/lib -L/usr/X11R6/lib'
         for x in obj:
@@ -760,6 +762,7 @@ def CompileLink(dll, obj, opts):
             cmd = cmd + " -isysroot " + SDK["MACOSX"] + " -Wl,-syslibroot," + SDK["MACOSX"] + " -arch ppc -arch i386"
         
         oscmd(cmd)
+        os.system("chmod +x " + BracketNameWithQuotes(dll))
 
 ##########################################################################################
 #
@@ -3976,27 +3979,9 @@ def MakeInstallerOSX():
       if os.path.isdir(GetOutputDir()+"/Pmw"):     oscmd("cp -R %s/Pmw Panda3D-tpl-rw/Panda3D/%s/lib/Pmw" % (GetOutputDir(), VERSION))
       if os.path.isdir(GetOutputDir()+"/plugins"): oscmd("cp -R %s/plugins Panda3D-tpl-rw/Panda3D/%s/plugins" % (GetOutputDir(), VERSION))
       for base in os.listdir(GetOutputDir()+"/lib"):
-          oscmd("cp "+GetOutputDir()+"/lib/"+base+" Panda3D-tpl-rw/Panda3D/"+VERSION+"/lib/"+base)
-      # Loop through the binaries and libraries and execute install_name_tool on them
-      bindir = "Panda3D-tpl-rw/Panda3D/%s/bin/" % VERSION
-      libdir = "Panda3D-tpl-rw/Panda3D/%s/lib/" % VERSION
-      for fn in os.listdir(bindir):
-          if os.path.isfile(bindir + fn):
-              oscmd("otool -L %s%s | grep %s/lib/ > %s/tmp/otool-libs.txt" % (bindir, fn, GetOutputDir(), GetOutputDir()), True)
-              for line in open(GetOutputDir()+"/tmp/otool-libs.txt", "r"):
-                  if len(line.strip()) > 0:
-                      libname = line.strip().split(GetOutputDir()+"/lib/")[1].split(" ")[0]
-                      oscmd("install_name_tool -change %s/lib/%s %s %s%s" % (GetOutputDir(), libname, libname, bindir, fn), True)
-              oscmd("chmod +x %s%s" % (bindir, fn), True)
-      for fn in os.listdir(libdir):
-          if os.path.isfile(libdir + fn):
-              oscmd("install_name_tool -id %s %s%s" % (fn, libdir, fn), True)
-              oscmd("otool -L %s%s | grep %s/lib/ > %s/tmp/otool-libs.txt" % (libdir, fn, GetOutputDir(), GetOutputDir()), True)
-              for line in open(GetOutputDir()+"/tmp/otool-libs.txt", "r"):
-                  if len(line.strip()) > 0:
-                      libname = line.strip().split(GetOutputDir()+"/lib/")[1].split(" ")[0]
-                      oscmd("install_name_tool -change %s/lib/%s %s %s%s" % (GetOutputDir(), libname, libname, libdir, fn), True)
-              oscmd("chmod +x %s%s" % (libdir, fn), True)
+          if (not base.endswith(".a")):
+              oscmd("cp "+GetOutputDir()+"/lib/"+base+" Panda3D-tpl-rw/Panda3D/"+VERSION+"/lib/"+base)
+      
       # Compile the python files
       for base in os.listdir("Panda3D-tpl-rw/Panda3D/"+VERSION+"/lib/direct"):
           if ((base != "extensions") and (base != "extensions_native")):

+ 18 - 13
makepanda/makepandacore.py

@@ -941,11 +941,9 @@ def SdkAutoDisableDirectX():
     for ver in ["DX8","DX9","DIRECTCAM"]:
         if (PkgSkip(ver)==0):
             if (SDK.has_key(ver)==0):
-                if (sys.platform == "win32"):
+                if (sys.platform.startswith("win")):
                     WARNINGS.append("I cannot locate SDK for "+ver)
-                else:
-                    WARNINGS.append(ver+" only supported on windows yet")
-                WARNINGS.append("I have automatically added this command-line option: --no-"+ver.lower())
+                    WARNINGS.append("I have automatically added this command-line option: --no-"+ver.lower())
                 PkgDisable(ver)
             else:
                 WARNINGS.append("Using "+ver+" sdk: "+SDK[ver])
@@ -963,14 +961,12 @@ def SdkAutoDisableMaya():
 def SdkAutoDisableMax():
     for version,key1,key2,subdir in MAXVERSIONINFO:
         if (PkgSkip(version)==0) and ((SDK.has_key(version)==0) or (SDK.has_key(version+"CS")==0)): 
-            if (sys.platform == "win32"):
+            if (sys.platform.startswith("win")):
                 if (SDK.has_key(version)):
                     WARNINGS.append("Your copy of "+version+" does not include the character studio SDK")
                 else: 
                     WARNINGS.append("The registry does not appear to contain a pointer to "+version)
-            else:
-                WARNINGS.append(version+" only supported on windows yet")
-            WARNINGS.append("I have automatically added this command-line option: --no-"+version.lower())
+                WARNINGS.append("I have automatically added this command-line option: --no-"+version.lower())
             PkgDisable(version)
 
 ########################################################################
@@ -1041,32 +1037,41 @@ def DefSymbol(opt, sym, val):
 
 ########################################################################
 #
-# On Linux, to run panda, the dynamic linker needs to know how to find
-# the shared libraries.  This subroutine verifies that the dynamic
+# On Linux/OSX, to run panda, the dynamic linker needs to know how to
+# find the shared libraries.  This subroutine verifies that the dynamic
 # linker is properly configured.  If not, it sets it up on a temporary
 # basis and issues a warning.
 #
 ########################################################################
 
-
 def CheckLinkerLibraryPath():
     if (sys.platform == "win32"): return
     builtlib = os.path.abspath(os.path.join(OUTPUTDIR,"lib"))
+    dyldpath = []
     try:
         ldpath = []
         f = file("/etc/ld.so.conf","r")
         for line in f: ldpath.append(line.rstrip())
         f.close()
     except: ldpath = []
+    
+    # Get the current 
     if (os.environ.has_key("LD_LIBRARY_PATH")):
         ldpath = ldpath + os.environ["LD_LIBRARY_PATH"].split(":")
+    if (sys.platform == "darwin" and os.environ.has_key("DYLD_LIBRARY_PATH")):
+        dyldpath = os.environ["DYLD_LIBRARY_PATH"].split(":")
+
+    # Add built/lib/ to (DY)LD_LIBRARY_PATH if it's not already there
     if (ldpath.count(builtlib)==0):
-        #WARNINGS.append("Caution: the "+os.path.join(OUTPUTDIR,"lib")+" directory is not in LD_LIBRARY_PATH")
-        #WARNINGS.append("or /etc/ld.so.conf.  You must add it before using panda.")
         if (os.environ.has_key("LD_LIBRARY_PATH")):
             os.environ["LD_LIBRARY_PATH"] = builtlib + ":" + os.environ["LD_LIBRARY_PATH"]
         else:
             os.environ["LD_LIBRARY_PATH"] = builtlib
+    if (sys.platform == "darwin" and dyldpath.count(builtlib)==0):
+        if (os.environ.has_key("DYLD_LIBRARY_PATH")):
+            os.environ["DYLD_LIBRARY_PATH"] = builtlib + ":" + os.environ["DYLD_LIBRARY_PATH"]
+        else:
+            os.environ["DYLD_LIBRARY_PATH"] = builtlib
 
 ########################################################################
 ##