Browse Source

os x changes.

Dave Schuyler 22 years ago
parent
commit
27f14fc2e3

+ 21 - 7
dtool/Config.pp

@@ -1,5 +1,5 @@
 //
-// Config.pp
+// dtool/Config.pp
 //
 // This file defines certain configuration variables that are written
 // into the various make scripts.  It is processed by ppremake (along
@@ -43,13 +43,13 @@
 // store only the variable references themselves, and expand them when
 // the variable is later referenced.  It is very similar to the
 // relationship between := and = in GNU Make.
-//
+// dtool/Config.pp
+
 // In general, #defer is used in this file, to allow the user to
 // redefine critical variables in his or her own Config.pp file.
 
 
 
-
 // What kind of build scripts are we generating?  This selects a
 // suitable template file from the ppremake system files.  The
 // allowable choices, at present, are:
@@ -69,6 +69,8 @@
   #define BUILD_TYPE gmsvc
 #elif $[eq $[PLATFORM], Cygwin]
   #define BUILD_TYPE gmsvc
+#elif $[eq $[PLATFORM], osx]
+  #define BUILD_TYPE osx
 #else
   #define BUILD_TYPE unix
 #endif
@@ -461,6 +463,8 @@
   #define USE_COMPILER MIPS
 #elif $[eq $[PLATFORM], Linux]
   #define USE_COMPILER GCC
+#elif $[eq $[PLATFORM], osx]
+  #define USE_COMPILER GCC
 #endif
 
 
@@ -572,8 +576,13 @@
 // How to generate a static C or C++ library.  $[target] is the
 // name of the library to generate, and $[sources] is the list of .o
 // files that will go into the library.
-#defer STATIC_LIB_C ar cru $[target] $[sources]
-#defer STATIC_LIB_C++ ar cru $[target] $[sources]
+#if $[eq $[PLATFORM], osx]
+  #defer STATIC_LIB_C libtool -static -o $[target] $[sources]
+  #defer STATIC_LIB_C++ libtool -static -o $[target] $[sources]
+#else
+  #defer STATIC_LIB_C ar cru $[target] $[sources]
+  #defer STATIC_LIB_C++ ar cru $[target] $[sources]
+#endif
 
 // How to run ranlib, if necessary, after generating a static library.
 // $[target] is the name of the library.  Set this to the empty string
@@ -584,8 +593,13 @@
 // as above, and $[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 SHARED_LIB_C $[CC] -shared -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]
-#defer SHARED_LIB_C++ $[CXX] -shared -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]
+#if $[eq $[PLATFORM], osx]
+  #defer SHARED_LIB_C $[CC] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]
+  #defer SHARED_LIB_C++ $[CXX] -dynamic -dynamiclib -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]
+#else
+  #defer SHARED_LIB_C $[CC] -shared -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]
+  #defer SHARED_LIB_C++ $[CXX] -shared -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]
+#endif
 
 // How to install a data file or executable file.  $[local] is the
 // local name of the file to install, and $[dest] is the name of the

+ 3 - 0
dtool/LocalSetup.pp

@@ -148,6 +148,9 @@ $[cdefine HAVE_NAMESPACE]
 /* Define if fstream::open() accepts a third parameter for umask. */
 $[cdefine HAVE_OPEN_MASK]
 
+/* Define if the some header file defines wchar_t. */
+$[cdefine HAVE_WCHAR_T]
+
 /* Define if the <string> header file defines wstring. */
 $[cdefine HAVE_WSTRING]
 

+ 4 - 1
dtool/Package.pp

@@ -55,8 +55,11 @@
 // True if we are building on some flavor of Windows.
 #define WINDOWS_PLATFORM $[or $[eq $[PLATFORM],Win32],$[eq $[PLATFORM],Cygwin]]
 
+// True if we are building on some flavor of OS X.
+#define OSX_PLATFORM $[or $[eq $[PLATFORM],Darwin],$[eq $[PLATFORM],osx]]
+
 // True if we are building on some flavor of Unix.
-#define UNIX_PLATFORM $[not $[WINDOWS_PLATFORM]]
+#define UNIX_PLATFORM $[and $[not $[WINDOWS_PLATFORM]],$[not $[OSX_PLATFORM]]]
 
 
 

+ 4 - 1
dtool/pptempl/Global.pp

@@ -6,7 +6,6 @@
 // different kinds of build_types.
 //
 
-
 // We start off by defining a number of map variables.  These are
 // special variables that can be used to look up a particular named
 // scope according to a key (that is, according to the value of some
@@ -389,6 +388,8 @@
 
   #if $[WINDOWS_PLATFORM]
     #set alt_libs $[alt_libs] $[WIN_SYS_LIBS] $[components $[WIN_SYS_LIBS],$[active_component_libs] $[transitive_link]]
+  #elif $[OSX_PLATFORM]
+    #set alt_libs $[alt_libs] $[OSX_SYS_LIBS] $[components $[OSX_SYS_LIBS],$[active_component_libs] $[transitive_link]]
   #else
     #set alt_libs $[alt_libs] $[UNIX_SYS_LIBS] $[components $[UNIX_SYS_LIBS],$[active_component_libs] $[transitive_link]]
   #endif
@@ -486,6 +487,8 @@
 #end get_depend_libs
 
 
+// dtool/pptempl/Global.pp
+
 // Define a few directories that will be useful.
 
 #define install_dir $[$[upcase $[PACKAGE]]_INSTALL]

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

@@ -24,7 +24,7 @@
 #ifndef DTOOLBASE_H
 #define DTOOLBASE_H
 
-#include <dtool_config.h>
+#include "dtool_config.h"
 
 #ifdef WIN32_VC
 /* These warning pragmas must appear before anything else for VC++ to

+ 5 - 0
dtool/src/dtoolbase/dtoolbase_cc.h

@@ -80,6 +80,11 @@ using namespace std;
 #define TYPENAME
 #endif
 
+#ifndef HAVE_WCHAR_T
+// Some C++ libraries (os x 3.1) don't define this.
+typedef unsigned short wchar_t;
+#endif
+
 #ifndef HAVE_WSTRING
 // Some C++ libraries (gcc 2.95) don't define this.
 typedef basic_string<wchar_t> wstring;

+ 20 - 1
dtool/src/dtoolutil/load_dso.cxx

@@ -18,7 +18,26 @@
 
 #include "load_dso.h"
 
-#if defined(PENV_PS2)
+#if 1 || defined(PENV_OSX)
+// These are not used on Macintosh OS X
+
+void *
+load_dso(const Filename &) {
+  return (void *) NULL;
+}
+
+bool
+unload_dso(void *dso_handle) {
+ return false;
+}
+
+string
+load_dso_error() {
+  const char *message="load_dso_error() unsupported on PS2";
+  return message;
+}
+
+#elif defined(PENV_PS2)
 
 // The playstation2 can't do any of this stuff, so these functions are B O G U S
 

+ 1 - 1
dtool/src/interrogate/interrogate.cxx

@@ -27,7 +27,7 @@
 // If our system getopt() doesn't come with getopt_long_only(), then use
 // the GNU flavor that we've got in tool for this purpose.
 #ifndef HAVE_GETOPT_LONG_ONLY
-#include "gnu_getopt.h"
+  #include "gnu_getopt.h"
 #else
   #ifdef HAVE_GETOPT_H
     #include <getopt.h>

+ 5 - 3
dtool/src/interrogate/parse_file.cxx

@@ -28,10 +28,12 @@
 
 #include <stdlib.h>
 
-#ifndef HAVE_GETOPT
-#include <gnu_getopt.h>
+#ifndef HAVE_GETOPT_LONG_ONLY
+  #include "gnu_getopt.h"
 #else
-#include <getopt.h>
+  #ifdef HAVE_GETOPT_H
+    #include <getopt.h>
+  #endif
 #endif
 
 CPPParser parser;

+ 5 - 3
dtool/src/test_interrogate/test_interrogate.cxx

@@ -26,10 +26,12 @@
 
 #include <stdlib.h>
 
-#ifndef HAVE_GETOPT
-#include <gnu_getopt.h>
+#ifndef HAVE_GETOPT_LONG_ONLY
+  #include "gnu_getopt.h"
 #else
-#include <getopt.h>
+  #ifdef HAVE_GETOPT_H
+    #include <getopt.h>
+  #endif
 #endif