diff --git a/direct/src/plugin/Sources.pp b/direct/src/plugin/Sources.pp index 3b094f6c50..92b907bdb4 100644 --- a/direct/src/plugin/Sources.pp +++ b/direct/src/plugin/Sources.pp @@ -100,7 +100,7 @@ interrogatedb:c dconfig:c dtoolconfig:m \ express:c pandaexpress:m \ prc:c pstatclient:c pandabase:c linmath:c putil:c \ - pipeline:c event:c nativenet:c panda:m + pipeline:c event:c nativenet:c net:c panda:m #define SOURCES \ binaryXml.cxx binaryXml.h \ diff --git a/direct/src/plugin_npapi/Sources.pp b/direct/src/plugin_npapi/Sources.pp index 645a7a09db..ce800e6936 100644 --- a/direct/src/plugin_npapi/Sources.pp +++ b/direct/src/plugin_npapi/Sources.pp @@ -46,6 +46,7 @@ // Mac-specific options. #if $[OSX_PLATFORM] #define LINK_AS_BUNDLE 1 + #define BUNDLE_EXT #endif #define INSTALL_HEADERS diff --git a/direct/src/plugin_npapi/make_osx_bundle.py b/direct/src/plugin_npapi/make_osx_bundle.py index e57dc4792f..c686558369 100755 --- a/direct/src/plugin_npapi/make_osx_bundle.py +++ b/direct/src/plugin_npapi/make_osx_bundle.py @@ -110,7 +110,7 @@ def makeBundle(startDir): f.write(ResourceFile) f.close() - os.system('/Developer/usr/bin/Rez -useDF -o %s %s' % ( + os.system('/Developer/Tools/Rez -useDF -o %s %s' % ( resourceFilename.toOsSpecific(), tfile.toOsSpecific())) tfile.unlink() diff --git a/direct/src/plugin_npapi/ppInstance.cxx b/direct/src/plugin_npapi/ppInstance.cxx index 6a45403b59..381464865b 100644 --- a/direct/src/plugin_npapi/ppInstance.cxx +++ b/direct/src/plugin_npapi/ppInstance.cxx @@ -337,54 +337,61 @@ stream_as_file(NPStream *stream, const char *fname) { // "Macintosh HD:blah:blah:blah" instead of the new-style form // "/blah/blah/blah". How annoying. - // TODO: Is "Macintosh HD:" the only possible prefix? - if (filename.substr(0, 13) == "Macintosh HD:") { - string fname2; - for (size_t p = 12; p < filename.size(); ++p) { + size_t colon = filename.find(':'); + size_t slash = filename.find('/'); + if (colon < slash) { + // This might be such a filename. + + string fname2 = "/Volumes/"; + for (size_t p = 0; p < filename.size(); ++p) { if (filename[p] == ':') { fname2 += '/'; } else { fname2 += filename[p]; } } - filename = fname2; - // Here's another temporary hack. In addition to the weird - // filename format, the file that Safari tells us about appears to - // be a temporary file that Safari's about to delete. In order to - // protect ourselves from this, we need to temporarily copy the - // file somewhere else. - char *name = tempnam(NULL, "p3d_"); + if (access(fname2.c_str(), R_OK) == 0) { + // Looks like we've converted it successfully. + filename = fname2; - // We prefer just making a hard link; it's quick and easy. - if (link(filename.c_str(), name) == 0) { - logfile << "linked " << filename << " to " << name << "\n"; - } else { - // But sometimes the hard link might fail, particularly if these - // are two different file systems. In this case we have to open - // the files and copy the data by hand. - ifstream in(filename.c_str(), ios::in | ios::binary); - ofstream out(name, ios::out | ios::binary); + // Here's another temporary hack. In addition to the weird + // filename format, the file that Safari tells us about appears + // to be a temporary file that Safari's about to delete. In + // order to protect ourselves from this, we need to temporarily + // copy the file somewhere else. + char *name = tempnam(NULL, "p3d_"); - static const size_t buffer_size = 4096; - char buffer[buffer_size]; - - in.read(buffer, buffer_size); - size_t count = in.gcount(); - while (count != 0) { - out.write(buffer, count); + // We prefer just making a hard link; it's quick and easy. + if (link(filename.c_str(), name) == 0) { + logfile << "linked " << filename << " to " << name << "\n"; + } else { + // But sometimes the hard link might fail, particularly if these + // are two different file systems. In this case we have to open + // the files and copy the data by hand. + ifstream in(filename.c_str(), ios::in | ios::binary); + ofstream out(name, ios::out | ios::binary); + + static const size_t buffer_size = 4096; + char buffer[buffer_size]; + in.read(buffer, buffer_size); - count = in.gcount(); + size_t count = in.gcount(); + while (count != 0) { + out.write(buffer, count); + in.read(buffer, buffer_size); + count = in.gcount(); + } + logfile << "copied " << filename << " to " << name << "\n"; } - logfile << "copied " << filename << " to " << name << "\n"; + + filename = name; + free(name); + + // TODO: remove this temporary file when we're done with it. } - - filename = name; - free(name); - - // TODO: remove this temporary file when we're done with it. } - + #endif // __APPLE__ PPDownloadRequest *req = (PPDownloadRequest *)(stream->notifyData); diff --git a/direct/src/showutil/FreezeTool.py b/direct/src/showutil/FreezeTool.py index d359687521..142af0e1e9 100644 --- a/direct/src/showutil/FreezeTool.py +++ b/direct/src/showutil/FreezeTool.py @@ -55,12 +55,13 @@ if sys.platform == 'win32': elif sys.platform == 'darwin': # OSX - - PythonIPath = '/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5' - - compileObj = "gcc -fPIC -c -o %(basename)s.o -O2 -arch i386 -arch ppc -I %(pythonIPath)s %(filename)s" + compileObj = "gcc -fPIC -c -o %(basename)s.o -O2 -I%(pythonIPath)s %(filename)s" linkExe = "gcc -o %(basename)s %(basename)s.o -framework Python" - linkDll = "gcc -dynamiclib -o %(basename)s.so %(basename)s.o -framework Python" + linkDll = "gcc -undefined dynamic_lookup -bundle -o %(basename)s.so %(basename)s.o -framework Python" + #PythonLPath = '/Users/drose/player/osxtools/built/lib' + #PythonVersion = '2.4_panda' + #linkExe = "gcc -o %(basename)s %(basename)s.o -lpython%(pythonVersion)s -L%(pythonLPath)s" + #linkDll = "gcc -undefined dynamic_lookup -bundle -o %(basename)s.so %(basename)s.o -lpython%(pythonVersion)s -L%(pythonLPath)s" else: # Linux