blob: 2c1c488c7cb584079defb353c2e65859bf3b16c4 [file] [log] [blame]
Jack Jansencb4321e2002-08-09 00:18:21 +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
Jack Jansen0b06be72002-06-21 14:48:38 +00003# commandline in that case.
4
Jack Jansencb4321e2002-08-09 00:18:21 +00005VERSION=2.3
Jack Jansenbe3e1f72002-08-01 21:14:06 +00006builddir = ../..
7srcdir = ../..
Jack Jansencb4321e2002-08-09 00:18:21 +00008dstroot=/.
Jack Jansene3d9f402002-09-02 12:16:00 +00009prefix=$(dstroot)/Library/Frameworks/Python.framework/Versions/$(VERSION)
10LIBDEST=$(prefix)/lib/python$(VERSION)
Jack Jansencb4321e2002-08-09 00:18:21 +000011
12# These are normally glimpsed from the previous set
13bindir=$(dstroot)/usr/local/bin
Jack Jansencfe28362002-12-25 22:31:28 +000014PYTHONAPPSPATH=/Applications/MacPython-$(VERSION)
Jack Jansen1ebcc442002-11-20 14:06:16 +000015PYTHONAPPSDIR=$(dstroot)$(PYTHONAPPSPATH)
Jack Jansenbe3e1f72002-08-01 21:14:06 +000016APPINSTALLDIR=$(prefix)/Resources/Python.app
Jack Jansen7d996a22002-11-11 00:05:00 +000017PTHFILE=$(srcdir)/Mac/OSX/Mac.pth
Jack Jansen75ed1672001-09-05 22:09:50 +000018
Jack Jansen0cd0e652002-03-29 14:18:18 +000019# Variables for installing the "normal" unix binaries
Jack Jansenbe3e1f72002-08-01 21:14:06 +000020INSTALLED_PYTHON=$(prefix)/bin/python
Jack Jansen0cd0e652002-03-29 14:18:18 +000021INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/python
22
Jack Jansen638e5e32001-09-06 16:33:57 +000023# Items more-or-less copied from the main Makefile
24DIRMODE=755
25INSTALL=/usr/bin/install -c
Jack Jansenbdbff732002-08-30 15:14:02 +000026INSTALL_SYMLINK=ln -fs
Jack Jansen638e5e32001-09-06 16:33:57 +000027INSTALL_PROGRAM=${INSTALL}
28INSTALL_SCRIPT= ${INSTALL_PROGRAM}
29INSTALL_DATA= ${INSTALL} -m 644
Jack Jansen4684a092002-08-28 21:27:02 +000030LN=ln
Jack Jansen0cd0e652002-03-29 14:18:18 +000031STRIPFLAG=-s
Jack Jansen7d996a22002-11-11 00:05:00 +000032##OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \
33## -fno-common -dynamic
34##INCLUDES=-I$(builddir) -I$(srcdir)/Include -I$(srcdir)/Mac/Include
35##DEFINES=
36##
37##CFLAGS=$(OPT) $(DEFINES) $(INCLUDES)
38##LDFLAGS=-F$(builddir) -framework System -framework Python -framework Carbon \
39## -framework Foundation
40##CC=cc
41##LD=cc
Jack Jansen81204152002-08-15 21:31:18 +000042CPMAC=/Developer/Tools/CpMac
Jack Jansen75ed1672001-09-05 22:09:50 +000043
Jack Jansenbe3e1f72002-08-01 21:14:06 +000044PYTHON=$(builddir)/python.exe
45APPTEMPLATE=$(srcdir)/Mac/OSXResources/app
Jack Jansen638e5e32001-09-06 16:33:57 +000046APPSUBDIRS=MacOS Resources Resources/English.lproj
Jack Jansen45c8e922002-08-09 14:15:46 +000047CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py
Jack Jansen7d996a22002-11-11 00:05:00 +000048compileall=$(srcdir)/Lib/compileall.py
Jack Jansencce7e342002-07-31 14:46:04 +000049
Jack Jansen76a6ab62002-09-12 22:19:23 +000050installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE install_IDLE
Jack Jansencce7e342002-07-31 14:46:04 +000051
52install_PythonLauncher:
Jack Jansenbe3e1f72002-08-01 21:14:06 +000053 cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \
Jack Jansen1ebcc442002-11-20 14:06:16 +000054 pbxbuild -target PythonLauncher -buildstyle Deployment \
55 DSTROOT=$(dstroot) INSTALL_PATH=$(PYTHONAPPSPATH) install
Jack Jansencce7e342002-07-31 14:46:04 +000056
Jack Jansen21ed16a2002-08-02 14:11:24 +000057install_Python: $(PYTHON)
Jack Jansencce7e342002-07-31 14:46:04 +000058 @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \
Jack Jansen638e5e32001-09-06 16:33:57 +000059 if test ! -d $$i; then \
60 echo "Creating directory $$i"; \
61 $(INSTALL) -d -m $(DIRMODE) $$i; \
62 fi;\
63 done
64 @for i in $(APPSUBDIRS); do \
65 if test ! -d $(APPINSTALLDIR)/Contents/$$i; then \
66 echo "Creating directory $(APPINSTALLDIR)/Contents/$$i"; \
67 $(INSTALL) -d -m $(DIRMODE) $(APPINSTALLDIR)/Contents/$$i; \
68 else true; \
69 fi; \
70 done
71 @for d in . $(APPSUBDIRS); \
72 do \
73 a=$(APPTEMPLATE)/$$d; \
74 if test ! -d $$a; then continue; else true; fi; \
75 b=$(APPINSTALLDIR)/Contents/$$d; \
76 for i in $$a/*; \
77 do \
Jack Jansen638e5e32001-09-06 16:33:57 +000078 case $$i in \
79 *CVS) ;; \
80 *.py[co]) ;; \
81 *.orig) ;; \
82 *~) ;; \
83 *) \
84 if test -d $$i; then continue; fi; \
85 if test -x $$i; then \
86 echo $(INSTALL_SCRIPT) $$i $$b; \
87 $(INSTALL_SCRIPT) $$i $$b; \
88 else \
89 echo $(INSTALL_DATA) $$i $$b; \
90 $(INSTALL_DATA) $$i $$b; \
91 fi;; \
92 esac; \
93 done; \
94 done
Jack Jansen21ed16a2002-08-02 14:11:24 +000095 $(INSTALL_PROGRAM) $(STRIPFLAG) $(PYTHON) $(APPINSTALLDIR)/Contents/MacOS/python
Jack Jansen4684a092002-08-28 21:27:02 +000096# Finally create the documentation symlink
97 $(LN) -fsn ../../../../English.lproj/Documentation $(APPINSTALLDIR)/Contents/Resources/English.lproj/Documentation
98
Jack Jansencce7e342002-07-31 14:46:04 +000099
100install_IDE: $(INSTALLED_PYTHONW)
Jack Jansen7d996a22002-11-11 00:05:00 +0000101 @if ! $(INSTALLED_PYTHONW) -c "import waste"; then \
Jack Jansenf80798b2002-08-02 21:04:46 +0000102 echo PythonIDE needs the \"waste\" extension module; \
103 echo See Mac/OSX/README for details; \
Jack Jansen7d996a22002-11-11 00:05:00 +0000104 else \
105 echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
106 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
107 $(srcdir)/Mac/Tools/IDE/PythonIDE.py ; \
108 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
109 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
110 $(srcdir)/Mac/Tools/IDE/PythonIDE.py; \
Jack Jansenf80798b2002-08-02 21:04:46 +0000111 fi
Jack Jansen76a6ab62002-09-12 22:19:23 +0000112
113install_IDLE: $(INSTALLED_PYTHONW)
114 @if ! $(INSTALLED_PYTHONW) -c "import _tkinter"; then \
115 echo IDLE needs the \"Tkinter\" extension module; \
116 echo See Mac/OSX/README for details; \
117 else \
118 echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
119 --output $(PYTHONAPPSDIR)/IDLE.app \
120 --extra $(srcdir)/Tools/idle \
121 $(srcdir)/Tools/idle/idle ; \
122 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
123 --output $(PYTHONAPPSDIR)/IDLE.app \
124 --extra $(srcdir)/Tools/idle \
125 $(srcdir)/Tools/idle/idle ; \
126 echo mv $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idle \
127 $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idlelib; \
128 mv $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idle \
129 $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idlelib; \
130 fi
131
Jack Jansen638e5e32001-09-06 16:33:57 +0000132
Jack Jansen940e9702002-08-02 15:32:12 +0000133install_BuildApplet: $(INSTALLED_PYTHONW)
134 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
135 --output $(PYTHONAPPSDIR)/BuildApplet.app \
136 $(srcdir)/Mac/scripts/BuildApplet.py
137
Jack Jansen45c8e922002-08-09 14:15:46 +0000138MACLIBDEST=$(prefix)/Mac/Lib
139MACLIBSRC=$(srcdir)/Mac/Lib
140MACLIBSUBDIRS= \
Jack Jansendc745682002-05-23 22:18:13 +0000141 Carbon \
142 lib-scriptpackages \
143 lib-scriptpackages/_builtinSuites \
144 lib-scriptpackages/CodeWarrior \
145 lib-scriptpackages/Explorer \
146 lib-scriptpackages/Finder \
147 lib-scriptpackages/Netscape \
148 lib-scriptpackages/StdSuites \
149 lib-scriptpackages/Terminal \
150 mkcwproject \
151 mkcwproject/template \
152 mkcwproject/template-carbon \
153 mkcwproject/template-ppc
Jack Jansen45c8e922002-08-09 14:15:46 +0000154MACTOOLSDEST=$(prefix)/Mac/Tools
155MACTOOLSSRC=$(srcdir)/Mac/Tools
156MACTOOLSSUBDIRS=IDE
Jack Jansen94fab762002-09-02 12:29:11 +0000157installmacsubtree:
Jack Jansen45c8e922002-08-09 14:15:46 +0000158 @for i in $(MACLIBDEST) $(MACTOOLSDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000159 do \
160 if test ! -d $$i; then \
161 echo "Creating directory $$i"; \
162 $(INSTALL) -d -m $(DIRMODE) $$i; \
163 else true; \
164 fi; \
165 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000166 @for d in $(MACLIBSUBDIRS); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000167 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000168 a=$(MACLIBSRC)/$$d; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000169 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000170 b=$(MACLIBDEST)/$$d; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000171 if test ! -d $$b; then \
172 echo "Creating directory $$b"; \
173 $(INSTALL) -d -m $(DIRMODE) $$b; \
174 else true; \
175 fi; \
176 done
Jack Jansen81204152002-08-15 21:31:18 +0000177 @for i in $(MACLIBSRC)/*.py; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000178 do \
179 if test -x $$i; then \
Jack Jansen45c8e922002-08-09 14:15:46 +0000180 $(INSTALL_SCRIPT) $$i $(MACLIBDEST); \
181 echo $(INSTALL_SCRIPT) $$i $(MACLIBDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000182 else \
Jack Jansen45c8e922002-08-09 14:15:46 +0000183 $(INSTALL_DATA) $$i $(MACLIBDEST); \
184 echo $(INSTALL_DATA) $$i $(MACLIBDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000185 fi; \
186 done
Jack Jansendde800e2002-11-07 23:07:05 +0000187 @for i in $(MACLIBSRC)/*.rsrc; \
188 do \
189 echo $(CPMAC) $$i $(MACLIBDEST) ; \
190 $(CPMAC) $$i $(MACLIBDEST) ; \
191 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000192 @for d in $(MACLIBSUBDIRS); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000193 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000194 a=$(MACLIBSRC)/$$d; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000195 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000196 b=$(MACLIBDEST)/$$d; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000197 for i in $$a/*; \
198 do \
199 case $$i in \
200 *CVS) ;; \
201 *.py[co]) ;; \
202 *.orig) ;; \
203 *~) ;; \
Jack Jansen81204152002-08-15 21:31:18 +0000204 *.rsrc) \
205 echo $(CPMAC) $$i $$b ; \
206 $(CPMAC) $$i $$b ; \
207 ;; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000208 *) \
209 if test -d $$i; then continue; fi; \
210 if test -x $$i; then \
211 echo $(INSTALL_SCRIPT) $$i $$b; \
212 $(INSTALL_SCRIPT) $$i $$b; \
213 else \
214 echo $(INSTALL_DATA) $$i $$b; \
215 $(INSTALL_DATA) $$i $$b; \
216 fi;; \
217 esac; \
218 done; \
219 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000220 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000221 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000222 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000223 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000224 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000225 if test ! -d $$b; then \
226 echo "Creating directory $$b"; \
227 $(INSTALL) -d -m $(DIRMODE) $$b; \
228 else true; \
229 fi; \
230 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000231 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000232 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000233 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000234 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000235 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000236 for i in $$a/*; \
237 do \
238 case $$i in \
239 *CVS) ;; \
240 *.py[co]) ;; \
241 *.orig) ;; \
242 *~) ;; \
Jack Jansen81204152002-08-15 21:31:18 +0000243 *.rsrc) \
244 echo $(CPMAC) $$i $$b ; \
245 $(CPMAC) $$i $$b ; \
246 ;; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000247 *) \
248 if test -d $$i; then continue; fi; \
249 if test -x $$i; then \
250 echo $(INSTALL_SCRIPT) $$i $$b; \
251 $(INSTALL_SCRIPT) $$i $$b; \
252 else \
253 echo $(INSTALL_DATA) $$i $$b; \
254 $(INSTALL_DATA) $$i $$b; \
255 fi;; \
256 esac; \
257 done; \
258 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000259
Jack Jansen7d996a22002-11-11 00:05:00 +0000260 $(INSTALL_DATA) $(PTHFILE) $(LIBDEST)/site-packages/
Jack Jansen45c8e922002-08-09 14:15:46 +0000261
262 $(PYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST)
Jack Jansen7d996a22002-11-11 00:05:00 +0000263 $(PYTHON) -Wi -tt $(compileall) -x badsyntax $(MACLIBDEST) $(MACTOOLSDEST)
264 $(PYTHON) -O -Wi -tt $(compileall) -x badsyntax $(MACLIBDEST) $(MACTOOLSDEST)
Jack Jansen45c8e922002-08-09 14:15:46 +0000265
Jack Jansen7d996a22002-11-11 00:05:00 +0000266#
267# We use the full name here in stead of $(INSTALLED_PYTHONW), because
268# the latter may be overridden by Makefile.jaguar when building for a pre-installed
269# /usr/bin/python
270$(APPINSTALLDIR)/Contents/MacOS/python: install_Python
Jack Jansencce7e342002-07-31 14:46:04 +0000271
Jack Jansencb4321e2002-08-09 00:18:21 +0000272# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
273# At least this rule will give an error if it doesn't exist.
274
Jack Jansen94fab762002-09-02 12:29:11 +0000275installunixtools: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW)
Jack Jansencb4321e2002-08-09 00:18:21 +0000276 $(INSTALL) -d $(bindir)
277 $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(bindir)/python
Jack Jansen94fab762002-09-02 12:29:11 +0000278 echo "#!/bin/sh" > pythonw.sh
279 echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh
280 $(INSTALL) pythonw.sh $(bindir)/pythonw
Jack Jansen0cd0e652002-03-29 14:18:18 +0000281
Jack Jansenc361f942002-07-08 13:34:23 +0000282# This is for development purposes: create a Mac.pth that refers to the source
283# directories
284dontinstallmacsubtree:
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000285 l=`cd $(srcdir)/Mac/Lib; pwd`; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000286 echo $$l > $(MACLIBDEST)/site-packages/Mac.pth ; \
287 echo $$l/lib-scriptpackages >> $(MACLIBDEST)/site-packages/Mac.pth