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

Skip to content

Commit 9592fe9

Browse files
committed
Fixed the DESTDIR modifications to also allow MacOSX framework builds
to be installed to a different location. This should make the OSX binary installer building a lot simpler.
1 parent 8ba0e80 commit 9592fe9

2 files changed

Lines changed: 71 additions & 63 deletions

File tree

Mac/OSX/Makefile

Lines changed: 55 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
VERSION=2.3
66
builddir = ../..
77
srcdir = ../..
8-
dstroot=/.
9-
prefix=$(dstroot)/Library/Frameworks/Python.framework/Versions/$(VERSION)
8+
prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION)
109
LIBDEST=$(prefix)/lib/python$(VERSION)
1110
BUILDPYTHON=$(builddir)/python.exe
11+
DESTDIR=
1212

1313
# These are normally glimpsed from the previous set
14-
bindir=$(dstroot)/usr/local/bin
14+
bindir=/usr/local/bin
1515
PYTHONAPPSPATH=/Applications/MacPython-$(VERSION)
16-
PYTHONAPPSDIR=$(dstroot)$(PYTHONAPPSPATH)
16+
PYTHONAPPSDIR=$(PYTHONAPPSPATH)
1717
APPINSTALLDIR=$(prefix)/Resources/Python.app
1818

1919
# Variables for installing the "normal" unix binaries
@@ -59,30 +59,30 @@ installapps: install_PythonLauncher install_Python install_BuildApplet install_I
5959
install_PythonLauncher:
6060
cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \
6161
pbxbuild -target PythonLauncher -buildstyle Deployment \
62-
DSTROOT=$(dstroot) INSTALL_PATH=$(PYTHONAPPSPATH) install
62+
DSTROOT=$(DESTDIR) INSTALL_PATH=$(PYTHONAPPSPATH) install
6363

6464
install_Python:
6565
@if test ! -f $(DOCINDEX); then \
6666
echo WARNING: you should run Apple Help Indexing Tool on $(DOCDIR); \
6767
fi
6868
@for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \
69-
if test ! -d $$i; then \
70-
echo "Creating directory $$i"; \
71-
$(INSTALL) -d -m $(DIRMODE) $$i; \
69+
if test ! -d $(DESTDIR)$$i; then \
70+
echo "Creating directory $(DESTDIR)$$i"; \
71+
$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
7272
fi;\
7373
done
7474
@for i in $(APPSUBDIRS); do \
75-
if test ! -d $(APPINSTALLDIR)/Contents/$$i; then \
76-
echo "Creating directory $(APPINSTALLDIR)/Contents/$$i"; \
77-
$(INSTALL) -d -m $(DIRMODE) $(APPINSTALLDIR)/Contents/$$i; \
75+
if test ! -d $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i; then \
76+
echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
77+
$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i; \
7878
else true; \
7979
fi; \
8080
done
8181
@for d in . $(APPSUBDIRS); \
8282
do \
8383
a=$(APPTEMPLATE)/$$d; \
8484
if test ! -d $$a; then continue; else true; fi; \
85-
b=$(APPINSTALLDIR)/Contents/$$d; \
85+
b=$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d; \
8686
for i in $$a/*; \
8787
do \
8888
case $$i in \
@@ -106,59 +106,66 @@ install_Python:
106106
esac; \
107107
done; \
108108
done
109-
$(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) $(APPINSTALLDIR)/Contents/MacOS/python
109+
$(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) $(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/python
110110

111-
install_IDE: $(INSTALLED_PYTHONW)
112-
@if ! $(INSTALLED_PYTHONW) -c "import waste"; then \
111+
install_IDE:
112+
@if ! $(BUILDPYTHON) -c "import waste"; then \
113113
echo PythonIDE needs the \"waste\" extension module; \
114114
echo See Mac/OSX/README for details; \
115115
else \
116-
echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
117-
--output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
116+
echo $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
117+
--python $(INSTALLED_PYTHONW) \
118+
--output $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app --noargv \
118119
$(srcdir)/Mac/Tools/IDE/PythonIDE.py ; \
119-
$(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
120-
--output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
120+
$(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
121+
--python $(INSTALLED_PYTHONW) \
122+
--output $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app --noargv \
121123
$(srcdir)/Mac/Tools/IDE/PythonIDE.py; \
122124
fi
123125

124-
install_PackageManager: $(INSTALLED_PYTHONW)
125-
@if ! $(INSTALLED_PYTHONW) -c "import waste"; then \
126+
install_PackageManager:
127+
@if ! $(BUILDPYTHON) -c "import waste"; then \
126128
echo PackageManager needs the \"waste\" extension module; \
127129
echo See Mac/OSX/README for details; \
128130
else \
129-
echo $(INSTALLED_PYTHONW) $(bundlebuilder) \
130-
--builddir $(PYTHONAPPSDIR)/ \
131+
echo $(BUILDPYTHON) $(bundlebuilder) \
132+
--builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \
133+
--python $(INSTALLED_PYTHONW) \
131134
--resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \
132135
--mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \
133136
--iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \
134137
--creator Pimp build; \
135-
$(INSTALLED_PYTHONW) $(bundlebuilder) \
136-
--builddir $(PYTHONAPPSDIR)/ \
138+
$(BUILDPYTHON) $(bundlebuilder) \
139+
--builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \
140+
--python $(INSTALLED_PYTHONW) \
137141
--resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \
138142
--mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \
139143
--iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \
140144
--creator Pimp build; \
141145
fi
142146

143-
install_IDLE: $(INSTALLED_PYTHONW)
144-
@if ! $(INSTALLED_PYTHONW) -c "import _tkinter"; then \
147+
install_IDLE:
148+
@if ! $(BUILDPYTHON) -c "import _tkinter"; then \
145149
echo IDLE needs the \"Tkinter\" extension module; \
146150
echo See Mac/OSX/README for details; \
147151
else \
148-
echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
149-
--output $(PYTHONAPPSDIR)/IDLE.app \
152+
echo $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
153+
--python $(INSTALLED_PYTHONW) \
154+
--output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \
150155
--extra $(srcdir)/Tools/idle \
151156
$(srcdir)/Tools/idle/idle ; \
152-
$(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
153-
--output $(PYTHONAPPSDIR)/IDLE.app \
157+
$(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
158+
--python $(INSTALLED_PYTHONW) \
159+
--output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \
154160
--extra $(srcdir)/Tools/idle:Contents/Resources/idlelib \
155161
$(srcdir)/Tools/idle/idle ; \
156162
fi
157163

158164

159-
install_BuildApplet: $(INSTALLED_PYTHONW)
160-
$(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
161-
--output $(PYTHONAPPSDIR)/BuildApplet.app \
165+
install_BuildApplet:
166+
$(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
167+
--python $(INSTALLED_PYTHONW) \
168+
--output $(DESTDIR)$(PYTHONAPPSDIR)/BuildApplet.app \
162169
$(srcdir)/Mac/scripts/BuildApplet.py
163170

164171
MACLIBDEST=$(LIBDEST)/plat-mac
@@ -168,17 +175,17 @@ MACTOOLSSUBDIRS=IDE
168175
installmacsubtree:
169176
@for i in $(MACTOOLSDEST); \
170177
do \
171-
if test ! -d $$i; then \
172-
echo "Creating directory $$i"; \
173-
$(INSTALL) -d -m $(DIRMODE) $$i; \
178+
if test ! -d $(DESTDIR)$$i; then \
179+
echo "Creating directory $(DESTDIR)$$i"; \
180+
$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
174181
else true; \
175182
fi; \
176183
done
177184
@for d in $(MACTOOLSSUBDIRS); \
178185
do \
179186
a=$(MACTOOLSSRC)/$$d; \
180187
if test ! -d $$a; then continue; else true; fi; \
181-
b=$(MACTOOLSDEST)/$$d; \
188+
b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
182189
if test ! -d $$b; then \
183190
echo "Creating directory $$b"; \
184191
$(INSTALL) -d -m $(DIRMODE) $$b; \
@@ -189,7 +196,7 @@ installmacsubtree:
189196
do \
190197
a=$(MACTOOLSSRC)/$$d; \
191198
if test ! -d $$a; then continue; else true; fi; \
192-
b=$(MACTOOLSDEST)/$$d; \
199+
b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
193200
for i in $$a/*; \
194201
do \
195202
case $$i in \
@@ -215,9 +222,9 @@ installmacsubtree:
215222
done
216223

217224

218-
$(BUILDPYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST)
219-
$(BUILDPYTHON) -Wi -tt $(compileall) -x badsyntax $(MACTOOLSDEST)
220-
$(BUILDPYTHON) -O -Wi -tt $(compileall) -x badsyntax $(MACTOOLSDEST)
225+
$(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST)
226+
$(BUILDPYTHON) -Wi -tt $(compileall) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
227+
$(BUILDPYTHON) -O -Wi -tt $(compileall) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
221228

222229
#
223230
# We use the full name here in stead of $(INSTALLED_PYTHONW), because
@@ -228,11 +235,11 @@ $(APPINSTALLDIR)/Contents/MacOS/python: install_Python
228235
# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
229236
# At least this rule will give an error if it doesn't exist.
230237

231-
installunixtools: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW)
232-
$(INSTALL) -d $(bindir)
233-
$(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(bindir)/python$(VERSION)
234-
$(INSTALL_SYMLINK) python$(VERSION) $(bindir)/python
238+
installunixtools:
239+
$(INSTALL) -d $(DESTDIR)$(bindir)
240+
$(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(DESTDIR)$(bindir)/python$(VERSION)
241+
$(INSTALL_SYMLINK) python$(VERSION) $(DESTDIR)$(bindir)/python
235242
echo "#!/bin/sh" > pythonw.sh
236243
echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh
237-
$(INSTALL) pythonw.sh $(bindir)/pythonw$(VERSION)
238-
$(INSTALL_SYMLINK) pythonw$(VERSION) $(bindir)/pythonw
244+
$(INSTALL) pythonw.sh $(DESTDIR)$(bindir)/pythonw$(VERSION)
245+
$(INSTALL_SYMLINK) pythonw$(VERSION) $(DESTDIR)$(bindir)/pythonw

Makefile.pre.in

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ bininstall: altbininstall
590590
# This goes into $(exec_prefix)
591591
altbininstall: $(BUILDPYTHON)
592592
@if test "$(PYTHONFRAMEWORKDIR)" != no-framework; then \
593-
if test ! -f $(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current/Resources/Info.plist; then \
593+
if test ! -f $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current/Resources/Info.plist; then \
594594
echo 'Framework build: use "make frameworkinstall" in stead of "make install"'; \
595595
exit 1; \
596596
fi; \
@@ -835,39 +835,40 @@ frameworkinstallstructure: $(LDLIBRARY)
835835
fi
836836
@for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
837837
if test ! -d $(DESTDIR)$$i; then \
838-
echo "Creating directory $$i"; \
839-
$(INSTALL) -d -m $(DIRMODE) $$i; \
838+
echo "Creating directory $(DESTDIR)$$i"; \
839+
$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
840840
else true; \
841841
fi; \
842842
done
843-
$(LN) -fsn include/python$(VERSION) $(prefix)/Headers
844-
$(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(prefix)/Resources/Info.plist
845-
$(INSTALL_DATA) $(RESSRCDIR)/version.plist $(prefix)/Resources/version.plist
843+
$(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
844+
$(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(DESTDIR)$(prefix)/Resources/Info.plist
845+
$(INSTALL_DATA) $(RESSRCDIR)/version.plist $(DESTDIR)$(prefix)/Resources/version.plist
846846
$(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
847-
$(prefix)/Resources/English.lproj/InfoPlist.strings
848-
$(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
849-
$(LN) -fsn Versions/Current/Python $(PYTHONFRAMEWORKINSTALLDIR)/Python
850-
$(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKINSTALLDIR)/Headers
851-
$(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKINSTALLDIR)/Resources
852-
$(INSTALL_DATA) $(LDLIBRARY) $(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
847+
$(DESTDIR)$(prefix)/Resources/English.lproj/InfoPlist.strings
848+
$(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
849+
$(LN) -fsn Versions/Current/Python $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Python
850+
$(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
851+
$(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
852+
$(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
853853

854854
# This installs Mac/Lib into the framework
855855
frameworkinstallmaclib:
856856
$(MAKE) -f $(srcdir)/Mac/OSX/Makefile installmacsubtree \
857857
BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \
858-
srcdir=$(srcdir) builddir=. prefix=$(prefix) LIBDEST=$(LIBDEST)
858+
srcdir=$(srcdir) builddir=. prefix=$(prefix) LIBDEST=$(LIBDEST) \
859+
DESTDIR=$(DESTDIR)
859860

860861
# This installs the IDE, the Launcher and other apps into /Applications
861862
frameworkinstallapps:
862863
$(MAKE) -f $(srcdir)/Mac/OSX/Makefile installapps \
863864
BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \
864-
srcdir=$(srcdir) builddir=. dstroot=$(PYTHONFRAMEWORKPREFIX)/../..
865+
srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR)
865866

866867
# This install the unix python and pythonw tools in /usr/local/bin
867868
frameworkinstallunixtools:
868869
$(MAKE) -f $(srcdir)/Mac/OSX/Makefile installunixtools \
869870
DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \
870-
srcdir=$(srcdir) builddir=. dstroot=$(PYTHONFRAMEWORKPREFIX)/../..
871+
srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR)
871872

872873
# This installs IDLE
873874
idleinstall:

0 commit comments

Comments
 (0)