Browse Source

fixes for osx build

David Rose 19 years ago
parent
commit
601dbd02ca

+ 1 - 1
dtool/Config.osxintel.pp

@@ -168,7 +168,7 @@
 #define HAVE_IO_H
 
 // Do we have <malloc.h>?
-#define HAVE_MALLOC_H 1
+#define HAVE_MALLOC_H
 
 // Do we have <alloca.h>?
 #define HAVE_ALLOCA_H 1

+ 26 - 8
dtool/pptempl/Depends.pp

@@ -27,10 +27,14 @@
 
   // We define $[c_sources], $[cxx_sources], $[yxx_sources], and
   // $[lxx_sources] within each target, which lists original files as
-  // well as synthetic composite files.  There's also
-  // $[compile_sources], which is the union of all the others: any
-  // source files that are actually compiled and result in a generated
-  // .o (or .obj) file.
+  // well as synthetic composite files.  We also now add
+  // $[cxx_interrogate_sources], which are the C++ files generated by
+  // interrogate.  Under OSX, we want to compile these files
+  // separately.
+
+  // Finally, there's $[compile_sources], which is the union of all
+  // the others: any source files that are actually compiled and
+  // result in a generated .o (or .obj) file.
 
   // Finally, we build up $[composite_list] out here to list all of
   // the composite files generated for all targets.
@@ -78,11 +82,17 @@
     // Now compute the source files.
     #define c_sources $[filter %.c,$[get_sources]]
     #define cxx_sources $[filter-out %_src.cxx,$[filter %.cxx %.cpp,$[get_sources]]]
+    #define cxx_interrogate_sources
+    #if $[PYTHON_MODULE_ONLY]
+      #set cxx_interrogate_sources $[cxx_sources]
+      #set cxx_sources
+    #endif
+
     #define yxx_sources $[filter %.yxx,$[get_sources]]
     #define lxx_sources $[filter %.lxx,$[get_sources]]
 
     // Define what the object files are.
-    #foreach file $[c_sources] $[cxx_sources] $[yxx_sources] $[lxx_sources]
+    #foreach file $[c_sources] $[cxx_sources] $[cxx_interrogate_sources] $[yxx_sources] $[lxx_sources]
       #define $[file]_obj $[patsubst %.c %.cxx %.cpp %.yxx %.lxx,$[ODIR]/$[obj_prefix]%$[OBJ],$[notdir $[file]]]
       #push 1 $[file]_obj
     #end file
@@ -97,7 +107,11 @@
         #define $[composite_file]_obj $[ODIR]/$[TARGET]_composite$[OBJ]
         #push 1 $[composite_file]_sources
         #push 1 $[composite_file]_obj
-        #set cxx_sources $[composite_file]
+        #if $[PYTHON_MODULE_ONLY]
+          #set cxx_interrogate_sources $[composite_file]
+        #else
+          #set cxx_sources $[composite_file]
+        #endif
       #endif
       #if $[> $[words $[c_sources]], 1]
         // If we have multiple C files, put them together into one
@@ -128,6 +142,10 @@
       #define $[generated_file]_obj $[get_igateoutput:%.cxx=%$[OBJ]]
       #define $[generated_file]_sources $[get_igatescan]
       #push 1 $[generated_file]_obj
+     // We add this to cxx_sources instead of cxx_interrogate_sources,
+     // even though it's an interrogate-generated file, because it's
+     // not a module file--we really only accumulate module files into
+     // cxx_interrogate_sources.
       #set cxx_sources $[cxx_sources] $[generated_file]
     #endif
     #if $[get_igatemout]
@@ -135,10 +153,10 @@
       #define $[generated_file]_obj $[get_igatemout:%.cxx=%$[OBJ]]
       #define $[generated_file]_sources none
       #push 1 $[generated_file]_obj
-      #set cxx_sources $[cxx_sources] $[generated_file]
+      #set cxx_interrogate_sources $[cxx_interrogate_sources] $[generated_file]
     #endif
 
-    #define compile_sources $[c_sources] $[cxx_sources]
+    #define compile_sources $[c_sources] $[cxx_sources] $[cxx_interrogate_sources]
 
   #end metalib_target lib_target noinst_lib_target test_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target
 

+ 1 - 1
dtool/pptempl/Template.gmsvc.pp

@@ -856,7 +856,7 @@ $[TAB] $[COMPILE_C]
 
 // Rules to compile C++ files.
 
-#foreach file $[sort $[cxx_sources]]
+#foreach file $[sort $[cxx_sources] $[cxx_interrogate_sources]]
 #define target $[$[file]_obj]
 #define source $[file]
 #define ipath $[target_ipath]

+ 1 - 1
dtool/pptempl/Template.nmake.pp

@@ -868,7 +868,7 @@ $[TAB] $[COMPILE_C]
 
 // Rules to compile C++ files.
 
-#foreach file $[sort $[cxx_sources]]
+#foreach file $[sort $[cxx_sources] $[cxx_interrogate_sources]]
 #define target $[$[file]_obj]
 #define source $[file]
 #define ipath $[target_ipath]

+ 7 - 5
dtool/pptempl/Template.unix.pp

@@ -347,12 +347,14 @@ igate : $[get_igatedb(metalib_target lib_target ss_lib_target)]
   // various .obj files.
 
   #define sources \
-   $[patsubst %,$[%_obj],$[compile_sources]]
+   $[patsubst %,$[%_obj],$[c_sources] $[cxx_sources]]
+  #define interrogate_sources \
+   $[patsubst %,$[%_obj],$[cxx_interrogate_sources]]
   #define cc_ld $[or $[get_ld],$[CC]]
   #define cxx_ld $[or $[get_ld],$[CXX]]
 
   #define varname $[subst -,_,lib$[TARGET]_so]
-$[varname] = $[sources]
+$[varname] = $[sources] $[if $[not $[BUNDLE_EXT]],$[interrogate_sources]]
   #define target $[ODIR]/lib$[TARGET]$[DYNAMIC_LIB_EXT]
   #define sources $($[varname])
 
@@ -366,7 +368,7 @@ $[TAB] $[shared_lib_c]
   #if $[BUNDLE_EXT]
     // Also generate the bundles (on OSX only).
     #define target $[ODIR]/lib$[TARGET]$[BUNDLE_EXT]
-    #define sources $[ODIR]/lib$[TARGET]$[DYNAMIC_LIB_EXT]
+    #define sources $[interrogate_sources] $[ODIR]/lib$[TARGET]$[DYNAMIC_LIB_EXT]
 $[target] : $[sources] $[static_lib_dependencies] 
 $[TAB] $[BUNDLE_LIB_C++]
   #endif  // BUNDLE_EXT
@@ -700,7 +702,7 @@ $[TAB] $[compile_c]
 
 // Rules to compile C++ files (static objects).
 
-#foreach file $[sort $[cxx_sources]]
+#foreach file $[sort $[cxx_sources] $[cxx_interrogate_sources]]
 #define target $[$[file]_obj]
 #define source $[file]
 #define ipath $[target_ipath]
@@ -741,7 +743,7 @@ $[TAB] $[compile_c]
 
 // Rules to compile C++ files (shared objects).
 
-#foreach file $[sort $[cxx_sources]]
+#foreach file $[sort $[cxx_sources] $[cxx_interrogate_sources]]
 #define target $[$[file]_obj]
 #define source $[file]
 #define ipath $[target_ipath]

+ 1 - 0
dtool/src/attach/ctattach.drv

@@ -130,6 +130,7 @@ if (( $proj eq "-" ) || ( $flav eq "-" )) {
    if (( $curflav eq "" ) || ( $noflav == 0 )) {
       $envsep{"PATH"} = ":" ;
       $envsep{"LD_LIBRARY_PATH"} = ":" ;
+      $envsep{"DYLD_LIBRARY_PATH"} = ":" ;
       $envsep{"PFPATH"} = ":" ;
       $envsep{"SSPATH"} = ":" ;
       $envsep{"STKPATH"} = ":" ;

+ 1 - 0
dtool/src/attach/ctattch.pl

@@ -374,6 +374,7 @@ sub CTAttachCompute {
           #if ( -e $item ) {
           &CTAttachMod( "PATH", $item, $root, $proj ) ;
       &CTAttachMod( "LD_LIBRARY_PATH", $item, $root, $proj ) ;
+      &CTAttachMod( "DYLD_LIBRARY_PATH", $item, $root, $proj ) ;
           #}
 
           $item = $root . "/built/include" ;

+ 1 - 0
dtool/src/attach/ctattch.pl.rnd

@@ -565,6 +565,7 @@ sub CTAttachCompute {
 
       &CTAttachAddToMod( "PATH", $root . "/bin" ) ;
       &CTAttachAddToMod( "LD_LIBRARY_PATH", $root . "/lib" ) ;
+      &CTAttachAddToMod( "DYLD_LIBRARY_PATH", $root . "/lib" ) ;
       #&CTAttachAddToMod( "CDPATH", $root . "/src/all" ) ;
       &CTAttachAddToMod( "CT_INCLUDE_PATH", $root . "/include" ) ;
       &CTAttachAddToMod( "DC_PATH", $root . "/etc" ) ;

+ 1 - 0
dtool/src/attach/ctunattach.drv

@@ -29,6 +29,7 @@ foreach $proj ( @ARGV ) {
    if ( $curflav ne "" ) {
       $envsep{"PATH"} = ":" ;
       $envsep{"LD_LIBRARY_PATH"} = ":" ;
+      $envsep{"DYLD_LIBRARY_PATH"} = ":" ;
       $envsep{"PFPATH"} = ":" ;
       $envsep{"SSPATH"} = ":" ;
       $envsep{"STKPATH"} = ":" ;

+ 1 - 0
dtool/src/attach/ctunattach.pl

@@ -92,6 +92,7 @@ sub CTUnattachCompute {
 	  &CTUnattachMod( "PATH", $item ) ;
       }
       &CTUnattachMod( "LD_LIBRARY_PATH", $item ) ;
+      &CTUnattachMod( "DYLD_LIBRARY_PATH", $item ) ;
       #$item = $root . "/src/all" ;
       #&CTUnattachMod( "CDPATH", $item ) ;
       $item = $root . "/built/include" ;

+ 1 - 0
dtool/src/attach/dtool.cshrc

@@ -4,6 +4,7 @@ setenv OS `uname`
 
 # careful, security exploit here
 setenv LD_LIBRARY_PATH "."
+setenv DYLD_LIBRARY_PATH "."
 
 setenv CTEMACS_FOREHIGHLIGHT white
 setenv CTEMACS_BACKHIGHLIGHT blue

+ 2 - 0
dtool/src/attach/dtool.sh

@@ -28,6 +28,8 @@ fi
 
 LD_LIBRARY_PATH="."
 export LD_LIBRARY_PATH
+DYLD_LIBRARY_PATH="."
+export DYLD_LIBRARY_PATH
 CT_INCLUDE_PATH="."
 export CT_INCLUDE_PATH
 #cdpath=.

+ 2 - 1
panda/src/event/asyncTask.I

@@ -98,7 +98,8 @@ get_python_object() const {
     Py_XINCREF(_python_object);
     return _python_object;
   }
-  Py_RETURN_NONE;
+  Py_INCREF(Py_None);
+  return Py_None;
 }
 #endif  // HAVE_PYTHON
 

+ 2 - 1
panda/src/pgraph/nodePath.I

@@ -2239,7 +2239,8 @@ get_python_tag(const string &key) const {
   // An empty NodePath quietly returns no tags.  This makes
   // get_net_python_tag() easier to implement.
   if (is_empty()) {
-    Py_RETURN_NONE;
+    Py_INCREF(Py_None);
+    return Py_None;
   }
   return node()->get_python_tag(key);
 }

+ 2 - 1
panda/src/pgraph/pandaNode.cxx

@@ -1339,7 +1339,8 @@ get_python_tag(const string &key) const {
     Py_XINCREF(result);
     return result;
   }
-  Py_RETURN_NONE;
+  Py_INCREF(Py_None);
+  return Py_None;
 }
 #endif  // HAVE_PYTHON