- Get _environ through the NSEnviron call in a MacOSX framework. This allows

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).
This commit is contained in:
Jack Jansen 2002-08-01 21:57:49 +00:00
parent be3e1f7a95
commit ea0c3828c0
4 changed files with 39 additions and 53 deletions

View File

@ -346,11 +346,30 @@ libpython$(VERSION).so: $(LIBRARY_OBJS)
libpython$(VERSION).sl: $(LIBRARY_OBJS) libpython$(VERSION).sl: $(LIBRARY_OBJS)
$(LDSHARED) -o $@ $(LIBRARY_OBJS) $(LIBC) $(LIBM) $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(LIBC) $(LIBM)
# This rule is here for OPENSTEP/Rhapsody/MacOSX # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): $(LIBRARY) $(PYTHONFRAMEWORKDIR) # 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) $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \ libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
-framework System @LIBTOOL_CRUFT@ -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 # This rule builds the Cygwin Python DLL
libpython$(VERSION).dll.a: $(LIBRARY_OBJS) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
@ -743,32 +762,6 @@ sharedinstall:
--install-scripts=$(BINDIR) \ --install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) --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 # On install, we re-make the framework
# structure in the install location, /Library/Frameworks/ or the argument to # structure in the install location, /Library/Frameworks/ or the argument to
# --enable-framework. If --enable-framework has been specified then we have # --enable-framework. If --enable-framework has been specified then we have

View File

@ -276,8 +276,13 @@ extern int lstat(const char *, struct stat *);
#endif #endif
/* Return a dictionary corresponding to the POSIX environment table */ /* Return a dictionary corresponding to the POSIX environment table */
#ifdef WITH_NEXT_FRAMEWORK
#if !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) ) /* 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; extern char **environ;
#endif /* !_MSC_VER */ #endif /* !_MSC_VER */
@ -289,6 +294,10 @@ convertenviron(void)
d = PyDict_New(); d = PyDict_New();
if (d == NULL) if (d == NULL)
return NULL; return NULL;
#ifdef WITH_NEXT_FRAMEWORK
if (environ == NULL)
environ = *_NSGetEnviron();
#endif
if (environ == NULL) if (environ == NULL)
return d; return d;
/* This part ignores errors */ /* This part ignores errors */

16
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# From configure.in Revision: 1.337 . # From configure.in Revision: 1.338 .
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.53. # 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 case $ac_sys_system/$ac_sys_release in
Darwin/1.3*) Darwin/1.3*)
ns_undef_sym='_environ' LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym"
LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks" LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Darwin/*) Darwin/*)
ns_undef_sym='_environ' LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -flat_namespace -U $ns_undef_sym"
LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks" LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; 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" if test "$enable_framework"
then then
OPT="$OPT -fno-common -dynamic" 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 # -F. is needed to allow linking to the framework while
# in the build location. # in the build location.
LDFLAGS="$LDFLAGS -Wl,-F."
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
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
#define WITH_NEXT_FRAMEWORK 1 #define WITH_NEXT_FRAMEWORK 1

View File

@ -820,14 +820,12 @@ AC_MSG_RESULT($enable_toolbox_glue)
AC_SUBST(LIBTOOL_CRUFT) AC_SUBST(LIBTOOL_CRUFT)
case $ac_sys_system/$ac_sys_release in case $ac_sys_system/$ac_sys_release in
Darwin/1.3*) Darwin/1.3*)
ns_undef_sym='_environ' LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym"
LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks" LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Darwin/*) Darwin/*)
ns_undef_sym='_environ' LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -flat_namespace -U $ns_undef_sym"
LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks" LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
@ -837,15 +835,9 @@ AC_MSG_CHECKING(for --enable-framework)
if test "$enable_framework" if test "$enable_framework"
then then
OPT="$OPT -fno-common -dynamic" 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 # -F. is needed to allow linking to the framework while
# in the build location. # in the build location.
LDFLAGS="$LDFLAGS -Wl,-F."
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
AC_DEFINE(WITH_NEXT_FRAMEWORK, 1, AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
[Define if you want to produce an OpenStep/Rhapsody framework [Define if you want to produce an OpenStep/Rhapsody framework
(shared library plus accessory files).]) (shared library plus accessory files).])