blob: a3e00b22f91cd210f07a18af73bf77e6448a798f [file] [log] [blame]
Ronald Oussoren836b0392006-05-14 19:56:34 +00001# This file can be invoked from the various frameworkinstall... targets in the
2# main Makefile. The next couple of variables are overridden on the
3# commandline in that case.
4
5VERSION=@VERSION@
Ronald Oussoren32f5d8f2006-06-07 19:02:03 +00006builddir = ..
7srcdir=@srcdir@
Ronald Oussoren4fbb0802006-06-11 20:23:29 +00008prefix=@prefix@
Ronald Oussoren836b0392006-05-14 19:56:34 +00009LIBDEST=$(prefix)/lib/python$(VERSION)
Ronald Oussoren32f5d8f2006-06-07 19:02:03 +000010RUNSHARED=@RUNSHARED@
11BUILDEXE=@BUILDEXEEXT@
12BUILDPYTHON=$(builddir)/python$(BUILDEXE)
Ronald Oussoren836b0392006-05-14 19:56:34 +000013DESTDIR=
Ronald Oussoren32f5d8f2006-06-07 19:02:03 +000014LDFLAGS=@LDFLAGS@
Ronald Oussoren5b787322006-06-06 19:50:24 +000015FRAMEWORKUNIXTOOLSPREFIX=@FRAMEWORKUNIXTOOLSPREFIX@
Ronald Oussoren580c7fe2008-05-02 19:45:11 +000016PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
Ronald Oussoren354bb5c2009-03-30 19:56:25 +000017PYTHONFRAMEWORKIDENTIFIER=@PYTHONFRAMEWORKIDENTIFIER@
Ronald Oussoren92919a62009-12-24 13:30:58 +000018LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
Ronald Oussorena55af9a2010-01-17 16:25:57 +000019CC=@CC@
Ronald Oussoren1bf02022010-04-20 08:53:12 +000020MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
21export MACOSX_DEPLOYMENT_TARGET
Ronald Oussoren836b0392006-05-14 19:56:34 +000022
23# These are normally glimpsed from the previous set
Ronald Oussoren32f5d8f2006-06-07 19:02:03 +000024bindir=$(prefix)/bin
Ronald Oussoren01d149f2010-04-30 11:20:14 +000025PYTHONAPPSDIR=@FRAMEWORKINSTALLAPPSPREFIX@/$(PYTHONFRAMEWORK) $(VERSION)
Ronald Oussoren836b0392006-05-14 19:56:34 +000026APPINSTALLDIR=$(prefix)/Resources/Python.app
27
28# Variables for installing the "normal" unix binaries
Ronald Oussoren580c7fe2008-05-02 19:45:11 +000029INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)
Ronald Oussoren836b0392006-05-14 19:56:34 +000030
31# Items more-or-less copied from the main Makefile
32DIRMODE=755
33FILEMODE=644
34INSTALL=@INSTALL@
35INSTALL_SYMLINK=ln -fsn
36INSTALL_PROGRAM=@INSTALL_PROGRAM@
37INSTALL_SCRIPT= @INSTALL_SCRIPT@
38INSTALL_DATA=@INSTALL_DATA@
39LN=@LN@
40STRIPFLAG=-s
Ned Deilye1c9794952013-01-29 00:07:46 -080041CPMAC=CpMac
Ronald Oussoren836b0392006-05-14 19:56:34 +000042
Ronald Oussoren32f5d8f2006-06-07 19:02:03 +000043APPTEMPLATE=$(srcdir)/Resources/app
Ned Deilye1c9794952013-01-29 00:07:46 -080044APPSUBDIRS=MacOS Resources
Ronald Oussoren32f5d8f2006-06-07 19:02:03 +000045CACHERSRC=$(srcdir)/scripts/cachersrc.py
46compileall=$(srcdir)/../Lib/compileall.py
Ronald Oussoren836b0392006-05-14 19:56:34 +000047
Ronald Oussoren92919a62009-12-24 13:30:58 +000048installapps: install_Python install_pythonw install_BuildApplet install_PythonLauncher \
49 install_IDLE checkapplepython install_versionedtools
Ronald Oussoren5640ce22008-06-05 12:58:24 +000050
51
Ronald Oussoren836b0392006-05-14 19:56:34 +000052install_pythonw: pythonw
53 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
54 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
Ned Deilyc5df5632012-02-19 02:19:12 +010055 ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python2"
56 ln -sf python2 "$(DESTDIR)$(prefix)/bin/python"
57 ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw2"
58 ln -sf pythonw2 "$(DESTDIR)$(prefix)/bin/pythonw"
Ronald Oussoren92919a62009-12-24 13:30:58 +000059ifneq ($(LIPO_32BIT_FLAGS),)
60 lipo $(LIPO_32BIT_FLAGS) -output $(DESTDIR)$(prefix)/bin/python$(VERSION)-32 pythonw
61 lipo $(LIPO_32BIT_FLAGS) -output $(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-32 pythonw
Ned Deilyc5df5632012-02-19 02:19:12 +010062 ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python2-32"
63 ln -sf python2-32 "$(DESTDIR)$(prefix)/bin/python-32"
64 ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw2-32"
65 ln -sf pythonw2-32 "$(DESTDIR)$(prefix)/bin/pythonw-32"
Ronald Oussoren92919a62009-12-24 13:30:58 +000066endif
Ronald Oussoren5640ce22008-06-05 12:58:24 +000067
Ronald Oussoren5640ce22008-06-05 12:58:24 +000068
Ronald Oussoren836b0392006-05-14 19:56:34 +000069#
70# Install unix tools in /usr/local/bin. These are just aliases for the
71# actual installation inside the framework.
72#
73installunixtools:
Ronald Oussoren5b787322006-06-06 19:50:24 +000074 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
75 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
Ronald Oussoren836b0392006-05-14 19:56:34 +000076 fi
Ronald Oussoren0969c672010-07-29 13:18:19 +000077 for fn in python pythonw idle pydoc python-config smtpd.py 2to3 \
Ned Deilyc5df5632012-02-19 02:19:12 +010078 python2 pythonw2 idle2 \
79 pydoc2 python2-config smtpd2.py \
80 2to3-2 \
Ronald Oussoren5b787322006-06-06 19:50:24 +000081 python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
Ronald Oussoren0969c672010-07-29 13:18:19 +000082 pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py \
83 2to3-$(VERSION) ;\
Ronald Oussoren836b0392006-05-14 19:56:34 +000084 do \
Ronald Oussoren5b787322006-06-06 19:50:24 +000085 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
Ronald Oussoren836b0392006-05-14 19:56:34 +000086 done
Ned Deily22f63b52011-05-28 05:56:14 -070087ifneq ($(LIPO_32BIT_FLAGS),)
88 for fn in python-32 pythonw-32 \
Ned Deilyc5df5632012-02-19 02:19:12 +010089 python2-32 pythonw2-32 \
Ned Deily22f63b52011-05-28 05:56:14 -070090 python$(VERSION)-32 pythonw$(VERSION)-32 ;\
91 do \
92 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
93 done
94endif
Ronald Oussoren836b0392006-05-14 19:56:34 +000095
Ronald Oussoren5640ce22008-06-05 12:58:24 +000096
Ronald Oussoren5b787322006-06-06 19:50:24 +000097#
98# Like installunixtools, but only install links to the versioned binaries.
99#
100altinstallunixtools:
101 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
102 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
103 fi
104 for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
Mark Dickinson1b6c4c82008-06-25 15:29:32 +0000105 pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py ;\
Ronald Oussoren5b787322006-06-06 19:50:24 +0000106 do \
107 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
108 done
Ned Deily22f63b52011-05-28 05:56:14 -0700109ifneq ($(LIPO_32BIT_FLAGS),)
110 for fn in python$(VERSION)-32 pythonw$(VERSION)-32 ;\
111 do \
112 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
113 done
114endif
Ronald Oussoren0969c672010-07-29 13:18:19 +0000115 ln -fs "$(prefix)/bin/2to3-$(VERSION)" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/2to3-$(VERSION)" ;\
Ronald Oussoren5b787322006-06-06 19:50:24 +0000116
Ronald Oussoren836b0392006-05-14 19:56:34 +0000117# By default most tools are installed without a version in their basename, to
118# make it easier to install (and use) several python versions side-by-side move
119# the tools to a version-specific name and add the non-versioned name as an
120# alias.
121install_versionedtools:
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000122 for fn in idle pydoc ;\
Ronald Oussoren836b0392006-05-14 19:56:34 +0000123 do \
Ronald Oussorenda89b992006-05-23 11:04:24 +0000124 if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \
125 continue ;\
126 fi ;\
Ronald Oussoren836b0392006-05-14 19:56:34 +0000127 mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\
Ned Deilyc5df5632012-02-19 02:19:12 +0100128 ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}2" ;\
129 ln -sf "$${fn}2" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\
Ronald Oussoren836b0392006-05-14 19:56:34 +0000130 done
Ronald Oussorenda89b992006-05-23 11:04:24 +0000131 if [ ! -h "$(DESTDIR)$(prefix)/bin/smtpd.py" ]; then \
132 mv "$(DESTDIR)$(prefix)/bin/smtpd.py" "$(DESTDIR)$(prefix)/bin/smtpd$(VERSION).py" ;\
Ned Deilyc5df5632012-02-19 02:19:12 +0100133 ln -sf "smtpd$(VERSION).py" "$(DESTDIR)$(prefix)/bin/smtpd2.py" ;\
134 ln -sf "smtpd2.py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\
Ronald Oussorenda89b992006-05-23 11:04:24 +0000135 fi
Ronald Oussoren0969c672010-07-29 13:18:19 +0000136 if [ ! -h "$(DESTDIR)$(prefix)/bin/2to3" ]; then \
137 mv "$(DESTDIR)$(prefix)/bin/2to3" "$(DESTDIR)$(prefix)/bin/2to3-$(VERSION)" ;\
Ned Deilyc5df5632012-02-19 02:19:12 +0100138 ln -sf "2to3-$(VERSION)" "$(DESTDIR)$(prefix)/bin/2to3-2" ;\
139 ln -sf "2to3-2" "$(DESTDIR)$(prefix)/bin/2to3" ;\
Ronald Oussoren0969c672010-07-29 13:18:19 +0000140 fi
Ronald Oussoren836b0392006-05-14 19:56:34 +0000141
142
Ronald Oussorena6790f12006-09-17 19:23:27 +0000143pythonw: $(srcdir)/Tools/pythonw.c Makefile
Ronald Oussoren2a4ab812010-03-07 09:04:06 +0000144 $(CC) $(LDFLAGS) -DPYTHONFRAMEWORK='"$(PYTHONFRAMEWORK)"' -o $@ $(srcdir)/Tools/pythonw.c -I.. -I$(srcdir)/../Include ../$(PYTHONFRAMEWORK).framework/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
Ronald Oussoren836b0392006-05-14 19:56:34 +0000145
146install_PythonLauncher:
147 cd PythonLauncher && make install DESTDIR=$(DESTDIR)
148
149install_Python:
Ronald Oussoren836b0392006-05-14 19:56:34 +0000150 @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \
151 if test ! -d "$(DESTDIR)$$i"; then \
152 echo "Creating directory $(DESTDIR)$$i"; \
153 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \
154 fi;\
155 done
156 @for i in $(APPSUBDIRS); do \
157 if test ! -d "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; then \
158 echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
159 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
160 else true; \
161 fi; \
162 done
163 @for d in . $(APPSUBDIRS); \
164 do \
165 a=$(APPTEMPLATE)/$$d; \
166 if test ! -d $$a; then continue; else true; fi; \
167 b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \
168 for i in $$a/*; \
169 do \
170 case $$i in \
171 *CVS) ;; \
172 *.svn) ;; \
173 *.py[co]) ;; \
174 *.orig) ;; \
175 *~) ;; \
176 *idx) \
177 echo $(CPMAC) "$$i" $$b; \
178 $(CPMAC) "$$i" "$$b"; \
179 ;; \
180 *) \
181 if test -d $$i; then continue; fi; \
182 if test -x $$i; then \
183 echo $(INSTALL_SCRIPT) "$$i" "$$b"; \
184 $(INSTALL_SCRIPT) "$$i" "$$b"; \
185 else \
186 echo $(INSTALL_DATA) "$$i" "$$b"; \
187 $(INSTALL_DATA) "$$i" "$$b"; \
188 fi;; \
189 esac; \
190 done; \
191 done
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000192 $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
Ronald Oussoren354bb5c2009-03-30 19:56:25 +0000193 sed -e "s!%bundleid%!$(PYTHONFRAMEWORKIDENTIFIER)!g" \
194 -e "s!%version%!`$(RUNSHARED) $(BUILDPYTHON) \
195 -c 'import platform; print(platform.python_version())'`!g" \
196 < "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in" \
197 > "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist"
198 rm "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in"
Ronald Oussoren836b0392006-05-14 19:56:34 +0000199
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000200
Ronald Oussoren836b0392006-05-14 19:56:34 +0000201install_IDLE:
202 cd IDLE && make install
203
204install_BuildApplet:
Ned Deily8e60f6e2013-05-30 00:14:29 -0700205 if ! $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) \
206 -c 'import EasyDialogs' 2>/dev/null ; then \
207 echo "EasyDialogs not available in this Python - skipping Build Applet.app" ; \
208 else \
209 $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \
210 --destroot "$(DESTDIR)" \
211 --python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \
212 --output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \
213 $(srcdir)/scripts/BuildApplet.py && \
214 if [ -n "$(LIPO_32BIT_FLAGS)" ] ; then \
215 rm "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app/Contents/MacOS/Python" && \
216 lipo $(LIPO_32BIT_FLAGS) \
217 -output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app/Contents/MacOS/Python" \
218 $(BUILDPYTHON) ; \
219 fi \
220 fi
Ronald Oussoren836b0392006-05-14 19:56:34 +0000221
222MACLIBDEST=$(LIBDEST)/plat-mac
223MACTOOLSDEST=$(prefix)/Mac/Tools
224MACTOOLSSRC=$(srcdir)/Mac/Tools
225MACTOOLSSUBDIRS=IDE
226
227installmacsubtree:
228 @for i in $(MACTOOLSDEST); \
229 do \
230 if test ! -d $(DESTDIR)$$i; then \
231 echo "Creating directory $(DESTDIR)$$i"; \
232 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
233 else true; \
234 fi; \
235 done
236 @for d in $(MACTOOLSSUBDIRS); \
237 do \
238 a=$(MACTOOLSSRC)/$$d; \
239 if test ! -d $$a; then continue; else true; fi; \
240 b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
241 if test ! -d $$b; then \
242 echo "Creating directory $$b"; \
243 $(INSTALL) -d -m $(DIRMODE) $$b; \
244 else true; \
245 fi; \
246 done
247 @for d in $(MACTOOLSSUBDIRS); \
248 do \
249 a=$(MACTOOLSSRC)/$$d; \
250 if test ! -d $$a; then continue; else true; fi; \
251 b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
252 for i in $$a/*; \
253 do \
254 case $$i in \
255 *CVS) ;; \
256 *.svn) ;; \
257 *.py[co]) ;; \
258 *.orig) ;; \
259 *~) ;; \
260 *.rsrc) \
261 echo $(CPMAC) $$i $$b ; \
262 $(CPMAC) $$i $$b ; \
263 ;; \
264 *) \
265 if test -d $$i; then continue; fi; \
266 if test -x $$i; then \
267 echo $(INSTALL_SCRIPT) $$i $$b; \
268 $(INSTALL_SCRIPT) $$i $$b; \
269 else \
270 echo $(INSTALL_DATA) $$i $$b; \
271 $(INSTALL_DATA) $$i $$b; \
272 fi;; \
273 esac; \
274 done; \
275 done
276
277
Ronald Oussoren5aa0b4d2008-07-22 07:06:33 +0000278 $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST)
Ronald Oussoren32f5d8f2006-06-07 19:02:03 +0000279 $(RUNSHARED) $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
280 $(RUNSHARED) $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
Ronald Oussoren836b0392006-05-14 19:56:34 +0000281
Ronald Oussoren32f5d8f2006-06-07 19:02:03 +0000282$(INSTALLED_PYTHONAPP): install_Python
Ronald Oussoren836b0392006-05-14 19:56:34 +0000283
Ronald Oussoren32f5d8f2006-06-07 19:02:03 +0000284installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py
Ronald Oussoren836b0392006-05-14 19:56:34 +0000285 $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras"
Ronald Oussoren32f5d8f2006-06-07 19:02:03 +0000286 $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
287 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \
Ronald Oussoren836b0392006-05-14 19:56:34 +0000288 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo"
Ronald Oussoren32f5d8f2006-06-07 19:02:03 +0000289 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/Demo \
290 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac"
Ronald Oussoren836b0392006-05-14 19:56:34 +0000291
292
Ronald Oussoren32f5d8f2006-06-07 19:02:03 +0000293checkapplepython: $(srcdir)/Tools/fixapplepython23.py
294 @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \
Ronald Oussoren836b0392006-05-14 19:56:34 +0000295 echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \
Ronald Oussoren32f5d8f2006-06-07 19:02:03 +0000296 echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \
Ronald Oussoren836b0392006-05-14 19:56:34 +0000297 fi
298
299
300clean:
301 rm pythonw
302 cd PythonLauncher && make clean
303 cd IDLE && make clean
Ronald Oussorena6790f12006-09-17 19:23:27 +0000304
305Makefile: $(srcdir)/Makefile.in ../config.status
306 cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status