Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b6e9cad

Browse files
committed
Lots of changes in the framework support:
- Made framework builds work for MacOSX. The configure arg is now "--enable-framework". - Added an install target frameworkinstall which installs the framework. - Ripped out Next/OpenStep support, which was broken anyway. - Made the MacOSX toolbox glue dependant on a --enable-toolbox-glue configure arg. This should make naked darwin build work again (untested). A few targets have been added to Makefile.pre.in, and on inspection they look harmless to non-MacOSX machines, but it is worth checking. Closes bug #420601 and patch #450350.
1 parent e925faf commit b6e9cad

File tree

2 files changed

+197
-103
lines changed

2 files changed

+197
-103
lines changed

Makefile.pre.in

Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ DESTSHARED= $(BINLIBDEST)/lib-dynload
101101
# Executable suffix (.exe on Windows and Mac OS X)
102102
EXE= @EXEEXT@
103103

104+
# Short name and location for Mac OS X Python framework
105+
PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
106+
PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
107+
PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
108+
PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
109+
104110
# Modes for directories, executables and data files created by the
105111
# install process. Default to user-only-writable for all file types.
106112
DIRMODE= 755
@@ -126,7 +132,9 @@ DIST= $(DISTFILES) $(DISTDIRS)
126132

127133
LIBRARY= @LIBRARY@
128134
LDLIBRARY= @LDLIBRARY@
135+
BLDLIBRARY= @BLDLIBRARY@
129136
DLLLIBRARY= @DLLLIBRARY@
137+
LDLIBRARYDIR= @LDLIBRARYDIR@
130138

131139

132140
LIBS= @LIBS@
@@ -280,7 +288,7 @@ all: $(PYTHON) oldsharedmods sharedmods
280288
$(PYTHON): Modules/$(MAINOBJ) $(LDLIBRARY)
281289
$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
282290
Modules/$(MAINOBJ) \
283-
$(LDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
291+
$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
284292

285293
platform: $(PYTHON)
286294
./$(PYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
@@ -329,7 +337,7 @@ libpython$(VERSION).so: $(LIBRARY)
329337
esac
330338

331339
# This rule is here for OPENSTEP/Rhapsody/MacOSX
332-
libpython$(VERSION).dylib: $(LIBRARY)
340+
$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): $(LIBRARY) $(PYTHONFRAMEWORKDIR)
333341
libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
334342
-framework System @LIBTOOL_CRUFT@
335343

@@ -631,6 +639,7 @@ $(srcdir)/Lib/$(PLATDIR):
631639
cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
632640
export PATH; PATH="`pwd`:$$PATH"; \
633641
export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
642+
export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
634643
export EXE; EXE="$(EXE)"; \
635644
cd $(srcdir)/Lib/$(PLATDIR); ./regen
636645

@@ -665,8 +674,12 @@ libainstall: all
665674
fi; \
666675
done
667676
@if test -d $(LDLIBRARY); then :; else \
668-
$(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
669-
$(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
677+
if test -z "$(PYTHONFRAMEWORKDIR)"; then \
678+
$(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
679+
$(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
680+
else \
681+
echo Skip install of $(LDLIBRARY) - use make frameworkinstall; \
682+
fi; \
670683
fi
671684
$(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
672685
$(INSTALL_DATA) Modules/$(MAINOBJ) $(LIBPL)/$(MAINOBJ)
@@ -711,6 +724,64 @@ sharedinstall:
711724
./$(PYTHON) -E $(srcdir)/setup.py install \
712725
--install-platlib=$(DESTSHARED)
713726

727+
# Install a MacOSX framework During build (before
728+
# setup.py), make a minimal Python.framework directory structure in the build
729+
# directory. This framework is minimal, it doesn't contain the Lib directory
730+
# and such, but together with some magic in Modules/getpath.c it is good enough
731+
# to run python from the install dir.
732+
733+
FRAMEWORKDEST=$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
734+
RESSRCDIR=$(srcdir)/Mac/OSXResources/framework
735+
$(PYTHONFRAMEWORKDIR): $(RESSRCDIR)/Info.plist \
736+
$(RESSRCDIR)/version.plist \
737+
$(RESSRCDIR)/English.lproj/InfoPlist.strings
738+
@if test -z "$(PYTHONFRAMEWORKDIR)"; then \
739+
echo Not configured with --enable-framework; \
740+
exit; \
741+
else true; \
742+
fi
743+
$(INSTALL) -d -m $(DIRMODE) $(FRAMEWORKDEST)/Resources/English.lproj
744+
$(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(FRAMEWORKDEST)/Resources/Info.plist
745+
$(INSTALL_DATA) $(RESSRCDIR)/version.plist $(FRAMEWORKDEST)/Resources/version.plist
746+
$(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
747+
$(FRAMEWORKDEST)/Resources/English.lproj/InfoPlist.strings
748+
$(LN) -fs $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
749+
$(LN) -fs Versions/Current/Python $(PYTHONFRAMEWORKDIR)/Python
750+
$(LN) -fs Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
751+
$(LN) -fs Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
752+
753+
# On install, we re-make the framework
754+
# structure in the install location, /Library/Frameworks/ or the argument to
755+
# --enable-framework. If --enable-framework has been specified then we have
756+
# automatically set prefix to the location deep down in the framework, so we
757+
# only have to cater for the structural bits of the framework.
758+
759+
frameworkinstall: install frameworkinfrastructureinstall
760+
FRAMEWORKFINALDEST=$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)
761+
frameworkinfrastructureinstall: $(LDLIBRARY)
762+
@if test -z "$(PYTHONFRAMEWORKDIR)"; then \
763+
echo Not configured with --enable-framework; \
764+
exit; \
765+
else true; \
766+
fi
767+
@for i in $(FRAMEWORKFINALDEST)/Resources/English.lproj $(FRAMEWORKFINALDEST)/lib; do\
768+
if test ! -d $$i; then \
769+
echo "Creating directory $$i"; \
770+
$(INSTALL) -d -m $(DIRMODE) $$i; \
771+
else true; \
772+
fi; \
773+
done
774+
$(LN) -sf $(FRAMEWORKFINALDEST)/Headers $(INCLUDEPY)
775+
$(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(FRAMEWORKFINALDEST)/Resources/Info.plist
776+
$(INSTALL_DATA) $(RESSRCDIR)/version.plist $(FRAMEWORKFINALDEST)/Resources/version.plist
777+
$(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
778+
$(FRAMEWORKFINALDEST)/Resources/English.lproj/InfoPlist.strings
779+
$(LN) -fs $(VERSION) $(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
780+
$(LN) -fs Versions/Current/Python $(PYTHONFRAMEWORKINSTALLDIR)/Python
781+
$(LN) -fs Versions/Current/Headers $(PYTHONFRAMEWORKINSTALLDIR)/Headers
782+
$(LN) -fs Versions/Current/Resources $(PYTHONFRAMEWORKINSTALLDIR)/Resources
783+
$(INSTALL_DATA) $(LDLIBRARY) $(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
784+
714785
# Build the toplevel Makefile
715786
Makefile.pre: Makefile.pre.in config.status
716787
CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status

0 commit comments

Comments
 (0)