*** misc/Python-2.2.2/Makefile.pre.in Fri Aug 23 11:05:49 2002 --- misc/build/Python-2.2.2/Makefile.pre.in Thu Jul 10 09:45:54 2003 *************** *** 350,355 **** --- 350,359 ---- libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \ -framework System @LIBTOOL_CRUFT@ + libpython$(VERSION).dylib: $(LIBRARY) + libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \ + -framework System @LIBTOOL_CRUFT@ + # This rule builds the Cygwin Python DLL libpython$(VERSION).dll.a: $(LIBRARY_OBJS) dlltool --export-all --output-def $@ $^ *************** *** 560,565 **** --- 564,573 ---- $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \ else true; \ fi + if test -f libpython$(VERSION).dylib; then \ + $(INSTALL_DATA) libpython$(VERSION).dylib $(LIBDIR); \ + else true; \ + fi if test -f "$(DLLLIBRARY)"; then \ $(INSTALL_SHARED) $(DLLLIBRARY) $(BINDIR); \ else true; \ *************** *** 689,695 **** @if test -d $(LDLIBRARY); then :; else \ if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \ ! $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \ else \ echo Skip install of $(LDLIBRARY) - use make frameworkinstall; \ fi; \ --- 697,705 ---- @if test -d $(LDLIBRARY); then :; else \ if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \ ! if test "$(LDLIBRARY)" != libpython$(VERSION).dylib; then \ ! $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \ ! fi \ else \ echo Skip install of $(LDLIBRARY) - use make frameworkinstall; \ fi; \ *** misc/Python-2.2.2/Modules/posixmodule.c Fri Aug 23 11:27:40 2002 --- misc/build/Python-2.2.2/Modules/posixmodule.c Thu Jul 10 09:45:54 2003 *************** *** 271,276 **** --- 271,279 ---- # define STRUCT_STAT struct stat #endif + #ifdef __APPLE__ + #include + #endif /* Return a dictionary corresponding to the POSIX environment table */ *************** *** 281,288 **** --- 284,297 ---- static PyObject * convertenviron(void) { + #ifdef __APPLE__ + char **environ; + #endif PyObject *d; char **e; + #ifdef __APPLE__ + environ = *_NSGetEnviron(); + #endif d = PyDict_New(); if (d == NULL) return NULL; *** misc/Python-2.2.2/Python/dynload_next.c Thu Dec 6 16:58:56 2001 --- misc/build/Python-2.2.2/Python/dynload_next.c Thu Jul 10 09:45:54 2003 *************** *** 33,40 **** const struct filedescr _PyImport_DynLoadFiletab[] = { ! {".so", "rb", C_EXTENSION}, ! {"module.so", "rb", C_EXTENSION}, {0, 0} }; --- 33,40 ---- const struct filedescr _PyImport_DynLoadFiletab[] = { ! {".dylib", "rb", C_EXTENSION}, ! {"module.dylib", "rb", C_EXTENSION}, {0, 0} }; *************** *** 115,123 **** of shared library) and rld() can't be used in the same program; instead, you have to use dyld, which is mostly unimplemented. */ { ! NSObjectFileImageReturnCode rc; ! NSObjectFileImage image; ! NSModule newModule; NSSymbol theSym; const char *errString; --- 115,121 ---- of shared library) and rld() can't be used in the same program; instead, you have to use dyld, which is mostly unimplemented. */ { ! const struct mach_header *pLib = NULL; NSSymbol theSym; const char *errString; *************** *** 126,172 **** p = (dl_funcptr)NSAddressOfSymbol(theSym); return p; } ! rc = NSCreateObjectFileImageFromFile(pathname, &image); ! switch(rc) { ! default: ! case NSObjectFileImageFailure: ! case NSObjectFileImageFormat: ! /* for these a message is printed on stderr by dyld */ ! errString = "Can't create object file image"; ! break; ! case NSObjectFileImageSuccess: ! errString = NULL; ! break; ! case NSObjectFileImageInappropriateFile: ! errString = "Inappropriate file type for dynamic loading"; ! break; ! case NSObjectFileImageArch: ! errString = "Wrong CPU type in object file"; ! break; ! case NSObjectFileImageAccess: ! errString = "Can't read object file (no access)"; ! break; ! } ! if (errString == NULL) { ! newModule = NSLinkModule(image, pathname, ! NSLINKMODULE_OPTION_BINDNOW|NSLINKMODULE_OPTION_RETURN_ON_ERROR); ! if (!newModule) ! errString = "Failure linking new module"; ! } ! if (errString != NULL) { ! PyErr_SetString(PyExc_ImportError, errString); ! return NULL; ! } ! if (!NSIsSymbolNameDefined(funcname)) { ! /* UnlinkModule() isn't implemented in current versions, but calling it does no harm */ ! NSUnLinkModule(newModule, FALSE); ! PyErr_Format(PyExc_ImportError, ! "Loaded module does not contain symbol %.200s", ! funcname); ! return NULL; } ! theSym = NSLookupAndBindSymbol(funcname); ! p = (dl_funcptr)NSAddressOfSymbol(theSym); } #endif /* USE_DYLD */ --- 124,141 ---- p = (dl_funcptr)NSAddressOfSymbol(theSym); return p; } ! pLib = NSAddImage(pathname, NSADDIMAGE_OPTION_WITH_SEARCHING | ! NSADDIMAGE_OPTION_RETURN_ON_ERROR); ! if ( pLib ) ! { ! theSym = NSLookupSymbolInImage(pLib, funcname, NSLOOKUPSYMBOLINIMAGE_OPTION_BIND); ! p = (dl_funcptr)NSAddressOfSymbol(theSym); ! return p; } ! else ! errString = "Library could not be loaded"; ! ! fprintf( stderr, "error string = %s\n", errString ); } #endif /* USE_DYLD */ *** misc/Python-2.2.2/configure Thu Oct 10 10:26:41 2002 --- misc/build/Python-2.2.2/configure Thu Jul 10 10:15:32 2003 *************** *** 1454,1459 **** --- 1454,1462 ---- LDLIBRARY='libpython$(VERSION).dll.a' DLLLIBRARY='libpython$(VERSION).dll' ;; + darwin*) + LDLIBRARY='libpython$(VERSION).dylib' + ;; esac # MacOSX framework builds need more magic. LDLIBRARY is the dynamic *************** *** 1696,1702 **** esac case $ac_sys_system in Darwin*) ! OPT="$OPT -no-cpp-precomp";; esac fi --- 1699,1713 ---- esac case $ac_sys_system in Darwin*) ! OPT="$OPT -dynamic -no-cpp-precomp -fno-common -fPIC -malign-natural";; ! Linux*) ! case "`uname -m`" in ! ppc*) ! OPT="$OPT -fPIC";; ! *) ! OPT="$OPT";; ! esac ! ;; esac fi *************** *** 3100,3108 **** LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; Darwin/*) ns_undef_sym='_environ' ! LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -flat_namespace -U $ns_undef_sym" LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks" ! LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; esac --- 3111,3119 ---- LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; Darwin/*) ns_undef_sym='_environ' ! LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc " LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks" ! LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name @executable_path/$(LDLIBRARY)' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; esac *************** *** 3159,3164 **** --- 3170,3176 ---- case $ac_sys_system in hp*|HP*) SO=.sl;; CYGWIN*) SO=.dll;; + Darwin*) SO=.dylib;; *) SO=.so;; esac fi *************** *** 3201,3214 **** LDSHARED="$LDSHARED -undefined suppress" fi ;; Darwin/*) ! LDSHARED='$(CC) $(LDFLAGS) -bundle' if test "$enable_framework" ; then # Link against the framework. All externals should be defined. LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)' else # No framework, use the Python app as bundle-loader ! BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)' ! LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/$(PYTHON)' fi ;; Linux*) LDSHARED='$(CC) -shared';; dgux*) LDSHARED="ld -G";; --- 3213,3227 ---- LDSHARED="$LDSHARED -undefined suppress" fi ;; Darwin/*) ! LDSHARED='g++ -dynamiclib $(LDFLAGS) -framework System -framework CoreServices -framework Foundation -lstdc++ -lcc_dynamic -L. -lpython$(VERSION)' if test "$enable_framework" ; then # Link against the framework. All externals should be defined. LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)' else # No framework, use the Python app as bundle-loader ! #BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)' ! #LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/$(PYTHON)' ! LDSHARED="$LDSHARED" fi ;; Linux*) LDSHARED='$(CC) -shared';; dgux*) LDSHARED="ld -G";;