Browse Source

osx tweaks

David Rose 19 years ago
parent
commit
5d2466c72a

+ 1 - 1
direct/src/dcparser/Sources.pp

@@ -1,6 +1,6 @@
 #define OTHER_LIBS \
     express:c pandaexpress:m \
-    pstatclient:c panda:m \
+    pstatclient:c pipeline:c panda:m \
     interrogatedb:c dconfig:c dtoolconfig:m \
     dtoolutil:c dtoolbase:c dtool:m prc:c pandabase:c \
     linmath:c putil:c

+ 3 - 3
direct/src/ffi/genPyCode.pp

@@ -42,7 +42,7 @@ $[python] -u $[osfilename $[install_bin_dir]/genPyCode.py] %1 %2 %3 %4 %5 %6 %7
 #### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]].
 ################################# DO NOT EDIT ###########################
 
-#if $[and $[CTPROJS],$[not $[OSX_PLATFORM]]]
+#if $[CTPROJS]
 # This script was generated while the user was using the ctattach
 # tools.  That had better still be the case.
 #if $[WINDOWS_PLATFORM]
@@ -66,7 +66,7 @@ import os
 import sys
 import glob
 
-#if $[and $[CTPROJS],$[not $[OSX_PLATFORM]]]
+#if $[CTPROJS]
 # This script was generated while the user was using the ctattach
 # tools.  That had better still be the case.
 
@@ -128,7 +128,7 @@ DoGenPyCode.interrogateLib = r'libdtoolconfig'
 DoGenPyCode.codeLibs = r'$[GENPYCODE_LIBS]'.split()
 DoGenPyCode.native = $[if $[PYTHON_NATIVE],1,0]
 
-#if $[not $[and $[CTPROJS],$[not $[OSX_PLATFORM]]]]
+#if $[not $[CTPROJS]]
 // Since the user is not using ctattach, bake these variables in too.
 DoGenPyCode.directDir = r'$[osfilename $[TOPDIR]]'
 DoGenPyCode.outputCodeDir = r'$[osfilename $[install_lib_dir]/pandac]'

+ 6 - 1
direct/src/heapq/Sources.pp

@@ -14,11 +14,16 @@
 #define OTHER_LIBS \
   pandaexpress:m \
   dconfig:c dtoolconfig:m \
-  dtoolutil:c dtoolbase:c dtool:m
+  dtoolutil:c dtoolbase:c prc:c dtool:m
 
 #begin metalib_target
   #define TARGET heapq
 
+  // Tell ppremake to treat this file as if it had been generated via
+  // interrogate.  On OSX, this will move it into the .so, instead of
+  // the .dylib, so that it can be imported into Python.
+  #define PYTHON_MODULE_ONLY 1
+
   #define SOURCES heapq.cxx
 #end metalib_target
 

+ 2 - 1
direct/src/interval/IntervalGlobal.py

@@ -15,5 +15,6 @@ from SoundInterval import *
 from ProjectileInterval import *
 from MetaInterval import *
 from IntervalManager import *
-from TestInterval import *
+if __debug__:
+    from TestInterval import *
 from pandac.PandaModules import WaitInterval

+ 7 - 2
direct/src/showbase/EventManager.py

@@ -7,7 +7,11 @@ from MessengerGlobal import *
 from direct.task.TaskManagerGlobal import taskMgr
 from direct.directnotify.DirectNotifyGlobal import *
 from direct.task.Task import Task
-from pandac.PandaModules import *
+
+# This module may not import pandac.PandaModules, since it is imported
+# by the Toontown Launcher before the complete PandaModules have been
+# downloaded.
+#from pandac.PandaModules import *
 
 class EventManager:
 
@@ -56,7 +60,8 @@ class EventManager:
             # Must be some user defined type, return the ptr
             # which will be downcast to that type
             ptr = eventParameter.getPtr()
-            
+
+            from pandac.PandaModules import EventStorePandaNode
             if isinstance(ptr, EventStorePandaNode):
                 # Actually, it's a kludgey wrapper around a PandaNode
                 # pointer.  Return the node.

+ 4 - 4
dtool/Config.osxintel.pp

@@ -36,9 +36,9 @@
 //#define ZLIB_LPATH /usr/lib/
 //#define ZLIB_LIBS  libz.dylib 
 
-#define HAVE_ZLIB 1
-#define HAVE_JPEG 1
-#define HAVE_FREETYPE 1
+//#define HAVE_ZLIB 1
+//#define HAVE_JPEG 1
+//#define HAVE_FREETYPE 1
 #print   Before Configure Miles 
 #define HAVE_RAD_MSS 1
 #define RAD_MSS_IPATH  /Users/roger/m/include
@@ -71,7 +71,7 @@
 // Is libfftw installed, and where?
 #define FFTW_IPATH /opt/local/include
 #define FFTW_LPATH /opt/local/lib
-#define FFTW_LIBS drfftw dfftw
+#define FFTW_LIBS rfftw fftw
 //#define HAVE_FFTW 1
 
 

+ 20 - 7
dtool/Config.pp

@@ -144,6 +144,12 @@
 //
 #define OPTIMIZE 3
 
+// On OSX, you may or may not want to compile universal binaries.
+// Leaving this option on allows your compiled version of Panda to run
+// on any version of OSX (PPC or Intel-based), but it will also
+// increase the compilation time, as well as the resulting binary
+// size.  This option has no effect on non-OSX platforms.
+#define UNIVERSAL_BINARIES 1
 
 // Panda uses prc files for runtime configuration.  There are many
 // compiled-in options to customize the behavior of the prc config
@@ -870,13 +876,20 @@
   #define CXX CC
 #endif
 
+#if $[and $[OSX_PLATFORM],$[UNIVERSAL_BINARIES]]
+  // Configure for universal binaries on OSX.
+  #define ARCH_FLAGS -arch i386 -arch ppc
+#else
+  #define ARCH_FLAGS
+#endif
+
 // How to compile a C or C++ file into a .o file.  $[target] is the
 // name of the .o file, $[source] is the name of the source file,
 // $[ipath] is a space-separated list of directories to search for
 // include files, and $[flags] is a list of additional flags to pass
 // to the compiler.
-#defer COMPILE_C $[CC] $[CFLAGS_GEN] -c -o $[target] $[ipath:%=-I%] $[flags] $[source]
-#defer COMPILE_C++ $[CXX] $[C++FLAGS_GEN] -c -o $[target] $[ipath:%=-I%] $[flags] $[source]
+#defer COMPILE_C $[CC] $[CFLAGS_GEN] $[ARCH_FLAGS] -c -o $[target] $[ipath:%=-I%] $[flags] $[source]
+#defer COMPILE_C++ $[CXX] $[C++FLAGS_GEN] $[ARCH_FLAGS] -c -o $[target] $[ipath:%=-I%] $[flags] $[source]
 
 // What flags should be passed to both C and C++ compilers to enable
 // compiler optimizations?  This will be supplied when OPTIMIZE
@@ -913,9 +926,9 @@
 // $[sources] is the list of .o files.  $[libs] is a space-separated
 // list of dependent libraries, and $[lpath] is a space-separated list
 // of directories in which those libraries can be found.
-#defer LINK_BIN_C $[cc_ld] -o $[target] $[sources] $[flags] $[lpath:%=-L%] $[libs:%=-l%]\
+#defer LINK_BIN_C $[cc_ld] $[ARCH_FLAGS] -o $[target] $[sources] $[flags] $[lpath:%=-L%] $[libs:%=-l%]\
  $[fpath:%=-Wl,-F%] $[patsubst %,-framework %, $[bin_frameworks]]
-#defer LINK_BIN_C++ $[cxx_ld]\
+#defer LINK_BIN_C++ $[cxx_ld] $[ARCH_FLAGS] \
  -o $[target] $[sources]\
  $[flags]\
  $[lpath:%=-L%] $[libs:%=-l%]\
@@ -950,9 +963,9 @@
 // libraries, and $[lpath] is a space-separated list of directories in
 // which those libraries can be found.
 #if $[OSX_PLATFORM]
-  #defer SHARED_LIB_C $[cc_ld] -o $[target] -install_name $[notdir $[target]] $[sources] $[lpath:%=-L%] $[libs:%=-l%] $[patsubst %,-framework %, $[frameworks]]
-  #defer SHARED_LIB_C++ $[cxx_ld] -undefined dynamic_lookup -dynamic -dynamiclib -o $[target] -install_name $[notdir $[target]] $[sources] $[lpath:%=-L%] $[libs:%=-l%] $[patsubst %,-framework %, $[frameworks]]
-  #defer BUNDLE_LIB_C++ $[cxx_ld] -undefined dynamic_lookup -bundle -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] $[patsubst %,-framework %, $[frameworks]]
+  #defer SHARED_LIB_C $[cc_ld] $[ARCH_FLAGS] -o $[target] -install_name $[notdir $[target]] $[sources] $[lpath:%=-L%] $[libs:%=-l%] $[patsubst %,-framework %, $[frameworks]]
+  #defer SHARED_LIB_C++ $[cxx_ld] $[ARCH_FLAGS] -undefined dynamic_lookup -dynamic -dynamiclib -o $[target] -install_name $[notdir $[target]] $[sources] $[lpath:%=-L%] $[libs:%=-l%] $[patsubst %,-framework %, $[frameworks]]
+  #defer BUNDLE_LIB_C++ $[cxx_ld] $[ARCH_FLAGS] -undefined dynamic_lookup -bundle -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] $[patsubst %,-framework %, $[frameworks]]
 #else
   #defer SHARED_LIB_C $[cc_ld] -shared $[LFLAGS] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]
   #defer SHARED_LIB_C++ $[cxx_ld] -shared $[LFLAGS] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]

+ 19 - 1
dtool/src/dtoolbase/dtoolbase.h

@@ -242,7 +242,25 @@
 #define TAU_GLOBAL_TIMER_START(timer)
 #define TAU_GLOBAL_TIMER_STOP()
 
-#endif  // USE_TAU
+#endif  /* USE_TAU */
+
+/* Try to infer the endianness of the host based on compiler
+   predefined macros.  For systems on which the compiler does not
+   define these macros, we rely on ppremake to define WORDS_BIGENDIAN
+   correctly.  For systems on which the compiler *does* define these
+   macros, we ignore what ppremake said and define WORDS_BIGENDIAN
+   correctly here.  (This is essential on OSX, which requires
+   compiling each file twice in different modes, for universal binary
+   support.) */
+
+#if defined(__LITTLE_ENDIAN__) || defined(__i386__)
+#undef WORDS_BIGENDIAN
+
+#elif defined(__BIG_ENDIAN__) || defined(__ppc__)
+#undef WORDS_BIGENDIAN
+#define WORDS_BIGENDIAN 1
+
+#endif
 
 /*
  We define the macros BEGIN_PUBLISH and END_PUBLISH to bracket

+ 1 - 1
panda/src/distort/Sources.pp

@@ -1,6 +1,6 @@
 #define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
                    dtoolutil:c dtoolbase:c dtool:m prc:c
-#define OSX_SYS_LIBS mx
+//#define OSX_SYS_LIBS mx
 
 #begin lib_target
   #define TARGET distort

+ 12 - 12
panda/src/downloadertools/multify.cxx

@@ -35,7 +35,7 @@ bool update = false;           // -u
 bool tlist = false;             // -t
 bool extract = false;          // -x
 bool verbose = false;          // -v
-bool compress = false;         // -z
+bool compress_flag = false;         // -z
 int default_compression_level = 6;
 Filename multifile_name;       // -f
 bool got_multifile_name = false;
@@ -198,7 +198,7 @@ is_named(const string &subfile_name, int argc, char *argv[]) {
 int
 get_compression_level(const Filename &subfile_name) {
   // Returns the appropriate compression level for the named file.
-  if (!compress) {
+  if (!compress_flag) {
     // Don't compress anything.
     return 0;
   }
@@ -544,43 +544,43 @@ main(int argc, char *argv[]) {
       verbose = true;
       break;
     case 'z':
-      compress = true;
+      compress_flag = true;
       break;
     case '1':
       default_compression_level = 1;
-      compress = true;
+      compress_flag = true;
       break;
     case '2':
       default_compression_level = 2;
-      compress = true;
+      compress_flag = true;
       break;
     case '3':
       default_compression_level = 3;
-      compress = true;
+      compress_flag = true;
       break;
     case '4':
       default_compression_level = 4;
-      compress = true;
+      compress_flag = true;
       break;
     case '5':
       default_compression_level = 5;
-      compress = true;
+      compress_flag = true;
       break;
     case '6':
       default_compression_level = 6;
-      compress = true;
+      compress_flag = true;
       break;
     case '7':
       default_compression_level = 7;
-      compress = true;
+      compress_flag = true;
       break;
     case '8':
       default_compression_level = 8;
-      compress = true;
+      compress_flag = true;
       break;
     case '9':
       default_compression_level = 9;
-      compress = true;
+      compress_flag = true;
       break;
     case 'Z':
       dont_compress_str = optarg;

+ 1 - 1
panda/src/gobj/Sources.pp

@@ -1,6 +1,6 @@
 #define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
                    dtoolutil:c dtoolbase:c dtool:m prc:c
-#define OSX_SYS_LIBS mx
+//#define OSX_SYS_LIBS mx
 #define USE_PACKAGES zlib
 
 #begin lib_target

+ 1 - 1
panda/src/testbed/Sources.pp

@@ -1,7 +1,7 @@
 #define OTHER_LIBS interrogatedb:c prc:c dconfig:c dtoolconfig:m \
                    dtoolutil:c dtoolbase:c dtool:m pystub
 
-#define USE_PACKAGES fftw cg
+#define USE_PACKAGES cg freetype
 
 #define LOCAL_LIBS \
     framework putil collide pgraph chan text \