]> granicus.if.org Git - python/commitdiff
- Get _environ through the NSEnviron call in a MacOSX framework. This allows
authorJack Jansen <jack.jansen@cwi.nl>
Thu, 1 Aug 2002 21:57:49 +0000 (21:57 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Thu, 1 Aug 2002 21:57:49 +0000 (21:57 +0000)
  us to completely decouple the framework from the executable, so we
  can use a two-level namespace.
- Do framework builds with a twolevel namespace.
- Reorganized the code that creates the minimal framework in the build
  directory, to make it more robust against incomplete frameworks (from
  earlier aborted builds, or builds of previous Python versions).

Makefile.pre.in
Modules/posixmodule.c
configure
configure.in

index e77a037da816171dfe537a370a6c3b29c8bcfa25..efa31c4f348d65690e528807a127fa7e0341de76 100644 (file)
@@ -346,11 +346,30 @@ libpython$(VERSION).so: $(LIBRARY_OBJS)
 libpython$(VERSION).sl: $(LIBRARY_OBJS)
        $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(LIBC) $(LIBM)
 
-# This rule is here for OPENSTEP/Rhapsody/MacOSX
-$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): $(LIBRARY) $(PYTHONFRAMEWORKDIR)
+# This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
+# minimal framework (not including the Lib directory and such) in the current
+# directory.
+RESSRCDIR=$(srcdir)/Mac/OSXResources/framework
+$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
+               $(LIBRARY) \
+               $(RESSRCDIR)/Info.plist \
+                $(RESSRCDIR)/version.plist \
+                $(RESSRCDIR)/English.lproj/InfoPlist.strings
        $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
        libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
                -framework System @LIBTOOL_CRUFT@
+       $(INSTALL) -d -m $(DIRMODE)  \
+               $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
+       $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
+               $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
+       $(INSTALL_DATA) $(RESSRCDIR)/version.plist \
+               $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist
+       $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
+               $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings
+       $(LN) -fsh $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
+       $(LN) -fsh Versions/Current/Python $(PYTHONFRAMEWORKDIR)/Python
+       $(LN) -fsh Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
+       $(LN) -fsh Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
 
 # This rule builds the Cygwin Python DLL
 libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
@@ -743,32 +762,6 @@ sharedinstall:
                --install-scripts=$(BINDIR) \
                --install-platlib=$(DESTSHARED)
 
-# Install a MacOSX framework During build (before
-# setup.py), make a minimal Python.framework directory structure in the build
-# directory. This framework is minimal, it doesn't contain the Lib directory
-# and such, but together with some magic in Modules/getpath.c it is good enough
-# to run python from the install dir.
-
-FRAMEWORKDEST=$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
-RESSRCDIR=$(srcdir)/Mac/OSXResources/framework
-$(PYTHONFRAMEWORKDIR): $(RESSRCDIR)/Info.plist \
-                $(RESSRCDIR)/version.plist \
-                $(RESSRCDIR)/English.lproj/InfoPlist.strings
-       @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
-               echo Not configured with --enable-framework; \
-               exit 1; \
-       else true; \
-       fi
-       $(INSTALL) -d -m $(DIRMODE)  $(FRAMEWORKDEST)/Resources/English.lproj
-       $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(FRAMEWORKDEST)/Resources/Info.plist
-       $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(FRAMEWORKDEST)/Resources/version.plist
-       $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
-               $(FRAMEWORKDEST)/Resources/English.lproj/InfoPlist.strings
-       $(LN) -fsh $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
-       $(LN) -fsh Versions/Current/Python $(PYTHONFRAMEWORKDIR)/Python
-       $(LN) -fsh Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
-       $(LN) -fsh Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
-
 # On install, we re-make the framework
 # structure in the install location, /Library/Frameworks/ or the argument to
 # --enable-framework. If --enable-framework has been specified then we have
index 6f18da874e014bbac5c1d1eda16b4696e17b35d8..bf178f87fccc48be40c53799506a6e8d7a9dfaf6 100644 (file)
@@ -276,8 +276,13 @@ extern int lstat(const char *, struct stat *);
 #endif
 
 /* Return a dictionary corresponding to the POSIX environment table */
-
-#if !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
+#ifdef WITH_NEXT_FRAMEWORK
+/* On Darwin/MacOSX a shared library or framework has no access to
+** environ directly, we must obtain it with _NSGetEnviron().
+*/
+#include <crt_externs.h>
+static char **environ;
+#elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
 extern char **environ;
 #endif /* !_MSC_VER */
 
@@ -289,6 +294,10 @@ convertenviron(void)
        d = PyDict_New();
        if (d == NULL)
                return NULL;
+#ifdef WITH_NEXT_FRAMEWORK
+       if (environ == NULL)
+               environ = *_NSGetEnviron();
+#endif
        if (environ == NULL)
                return d;
        /* This part ignores errors */
index 4478ede2df2e2850e6623728c74e94c6d53f7bec..fa14838d10368d927f4953a8fa44b8a7d96ce2d0 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 1.337 .
+# From configure.in Revision: 1.338 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.53.
 #
@@ -8759,14 +8759,12 @@ echo "${ECHO_T}$enable_toolbox_glue" >&6
 
 case $ac_sys_system/$ac_sys_release in
   Darwin/1.3*)
-    ns_undef_sym='_environ'
-    LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym"
+    LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
        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)';;
   Darwin/*)
-    ns_undef_sym='_environ'
-    LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -flat_namespace -U $ns_undef_sym"
+    LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
       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)';;
@@ -8777,15 +8775,9 @@ echo $ECHO_N "checking for --enable-framework... $ECHO_C" >&6
 if test "$enable_framework"
 then
        OPT="$OPT -fno-common -dynamic"
-       # -U __environ is needed since bundles don't have access
-       # to crt0 when built but will always be linked against it
        # -F. is needed to allow linking to the framework while
        # in the build location.
-
-       case $ac_sys_system/$ac_sys_release in
-           Darwin/1.3*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-U,$ns_undef_sym";;
-           Darwin/*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-flat_namespace,-U,$ns_undef_sym";;
-       esac
+       LDFLAGS="$LDFLAGS -Wl,-F."
 
 cat >>confdefs.h <<\_ACEOF
 #define WITH_NEXT_FRAMEWORK 1
index 5ea8c3ece5c519fae224dc84e2022fcbda1d2a27..f2f47e2cda2109040b54567417f153200c00ea97 100644 (file)
@@ -820,14 +820,12 @@ AC_MSG_RESULT($enable_toolbox_glue)
 AC_SUBST(LIBTOOL_CRUFT)
 case $ac_sys_system/$ac_sys_release in
   Darwin/1.3*)
-    ns_undef_sym='_environ'
-    LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym"
+    LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
        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)';;
   Darwin/*)
-    ns_undef_sym='_environ'
-    LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -flat_namespace -U $ns_undef_sym"
+    LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
       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)';;
@@ -837,15 +835,9 @@ AC_MSG_CHECKING(for --enable-framework)
 if test "$enable_framework"
 then
        OPT="$OPT -fno-common -dynamic"
-       # -U __environ is needed since bundles don't have access
-       # to crt0 when built but will always be linked against it
        # -F. is needed to allow linking to the framework while 
        # in the build location.
-       
-       case $ac_sys_system/$ac_sys_release in
-           Darwin/1.3*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-U,$ns_undef_sym";;
-           Darwin/*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-flat_namespace,-U,$ns_undef_sym";;
-       esac
+       LDFLAGS="$LDFLAGS -Wl,-F."
        AC_DEFINE(WITH_NEXT_FRAMEWORK, 1, 
          [Define if you want to produce an OpenStep/Rhapsody framework
          (shared library plus accessory files).])