blob: 9a76fb682489b440fdd9d6670bfe0d06d7be0252 [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
14PYTHONAPPSDIR=$(dstroot)/Applications/Python
Jack Jansenbe3e1f72002-08-01 21:14:06 +000015APPINSTALLDIR=$(prefix)/Resources/Python.app
Jack Jansen7d996a22002-11-11 00:05:00 +000016PTHFILE=$(srcdir)/Mac/OSX/Mac.pth
Jack Jansen75ed1672001-09-05 22:09:50 +000017
Jack Jansen0cd0e652002-03-29 14:18:18 +000018# Variables for installing the "normal" unix binaries
Jack Jansenbe3e1f72002-08-01 21:14:06 +000019INSTALLED_PYTHON=$(prefix)/bin/python
Jack Jansen0cd0e652002-03-29 14:18:18 +000020INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/python
21
Jack Jansen638e5e32001-09-06 16:33:57 +000022# Items more-or-less copied from the main Makefile
23DIRMODE=755
24INSTALL=/usr/bin/install -c
Jack Jansenbdbff732002-08-30 15:14:02 +000025INSTALL_SYMLINK=ln -fs
Jack Jansen638e5e32001-09-06 16:33:57 +000026INSTALL_PROGRAM=${INSTALL}
27INSTALL_SCRIPT= ${INSTALL_PROGRAM}
28INSTALL_DATA= ${INSTALL} -m 644
Jack Jansen4684a092002-08-28 21:27:02 +000029LN=ln
Jack Jansen0cd0e652002-03-29 14:18:18 +000030STRIPFLAG=-s
Jack Jansen7d996a22002-11-11 00:05:00 +000031##OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \
32## -fno-common -dynamic
33##INCLUDES=-I$(builddir) -I$(srcdir)/Include -I$(srcdir)/Mac/Include
34##DEFINES=
35##
36##CFLAGS=$(OPT) $(DEFINES) $(INCLUDES)
37##LDFLAGS=-F$(builddir) -framework System -framework Python -framework Carbon \
38## -framework Foundation
39##CC=cc
40##LD=cc
Jack Jansen81204152002-08-15 21:31:18 +000041CPMAC=/Developer/Tools/CpMac
Jack Jansen75ed1672001-09-05 22:09:50 +000042
Jack Jansenbe3e1f72002-08-01 21:14:06 +000043PYTHON=$(builddir)/python.exe
44APPTEMPLATE=$(srcdir)/Mac/OSXResources/app
Jack Jansen638e5e32001-09-06 16:33:57 +000045APPSUBDIRS=MacOS Resources Resources/English.lproj
Jack Jansen45c8e922002-08-09 14:15:46 +000046CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py
Jack Jansen7d996a22002-11-11 00:05:00 +000047compileall=$(srcdir)/Lib/compileall.py
Jack Jansencce7e342002-07-31 14:46:04 +000048
Jack Jansen76a6ab62002-09-12 22:19:23 +000049installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE install_IDLE
Jack Jansencce7e342002-07-31 14:46:04 +000050
51install_PythonLauncher:
Jack Jansenbe3e1f72002-08-01 21:14:06 +000052 cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \
Jack Jansencb4321e2002-08-09 00:18:21 +000053 pbxbuild -target PythonLauncher -buildstyle Deployment DSTROOT=$(dstroot) install
Jack Jansencce7e342002-07-31 14:46:04 +000054
Jack Jansen21ed16a2002-08-02 14:11:24 +000055install_Python: $(PYTHON)
Jack Jansencce7e342002-07-31 14:46:04 +000056 @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \
Jack Jansen638e5e32001-09-06 16:33:57 +000057 if test ! -d $$i; then \
58 echo "Creating directory $$i"; \
59 $(INSTALL) -d -m $(DIRMODE) $$i; \
60 fi;\
61 done
62 @for i in $(APPSUBDIRS); do \
63 if test ! -d $(APPINSTALLDIR)/Contents/$$i; then \
64 echo "Creating directory $(APPINSTALLDIR)/Contents/$$i"; \
65 $(INSTALL) -d -m $(DIRMODE) $(APPINSTALLDIR)/Contents/$$i; \
66 else true; \
67 fi; \
68 done
69 @for d in . $(APPSUBDIRS); \
70 do \
71 a=$(APPTEMPLATE)/$$d; \
72 if test ! -d $$a; then continue; else true; fi; \
73 b=$(APPINSTALLDIR)/Contents/$$d; \
74 for i in $$a/*; \
75 do \
Jack Jansen638e5e32001-09-06 16:33:57 +000076 case $$i in \
77 *CVS) ;; \
78 *.py[co]) ;; \
79 *.orig) ;; \
80 *~) ;; \
81 *) \
82 if test -d $$i; then continue; fi; \
83 if test -x $$i; then \
84 echo $(INSTALL_SCRIPT) $$i $$b; \
85 $(INSTALL_SCRIPT) $$i $$b; \
86 else \
87 echo $(INSTALL_DATA) $$i $$b; \
88 $(INSTALL_DATA) $$i $$b; \
89 fi;; \
90 esac; \
91 done; \
92 done
Jack Jansen21ed16a2002-08-02 14:11:24 +000093 $(INSTALL_PROGRAM) $(STRIPFLAG) $(PYTHON) $(APPINSTALLDIR)/Contents/MacOS/python
Jack Jansen4684a092002-08-28 21:27:02 +000094# Finally create the documentation symlink
95 $(LN) -fsn ../../../../English.lproj/Documentation $(APPINSTALLDIR)/Contents/Resources/English.lproj/Documentation
96
Jack Jansencce7e342002-07-31 14:46:04 +000097
98install_IDE: $(INSTALLED_PYTHONW)
Jack Jansen7d996a22002-11-11 00:05:00 +000099 @if ! $(INSTALLED_PYTHONW) -c "import waste"; then \
Jack Jansenf80798b2002-08-02 21:04:46 +0000100 echo PythonIDE needs the \"waste\" extension module; \
101 echo See Mac/OSX/README for details; \
Jack Jansen7d996a22002-11-11 00:05:00 +0000102 else \
103 echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
104 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
105 $(srcdir)/Mac/Tools/IDE/PythonIDE.py ; \
106 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
107 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
108 $(srcdir)/Mac/Tools/IDE/PythonIDE.py; \
Jack Jansenf80798b2002-08-02 21:04:46 +0000109 fi
Jack Jansen76a6ab62002-09-12 22:19:23 +0000110
111install_IDLE: $(INSTALLED_PYTHONW)
112 @if ! $(INSTALLED_PYTHONW) -c "import _tkinter"; then \
113 echo IDLE needs the \"Tkinter\" extension module; \
114 echo See Mac/OSX/README for details; \
115 else \
116 echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
117 --output $(PYTHONAPPSDIR)/IDLE.app \
118 --extra $(srcdir)/Tools/idle \
119 $(srcdir)/Tools/idle/idle ; \
120 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
121 --output $(PYTHONAPPSDIR)/IDLE.app \
122 --extra $(srcdir)/Tools/idle \
123 $(srcdir)/Tools/idle/idle ; \
124 echo mv $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idle \
125 $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idlelib; \
126 mv $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idle \
127 $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idlelib; \
128 fi
129
Jack Jansen638e5e32001-09-06 16:33:57 +0000130
Jack Jansen940e9702002-08-02 15:32:12 +0000131install_BuildApplet: $(INSTALLED_PYTHONW)
132 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
133 --output $(PYTHONAPPSDIR)/BuildApplet.app \
134 $(srcdir)/Mac/scripts/BuildApplet.py
135
Jack Jansen45c8e922002-08-09 14:15:46 +0000136MACLIBDEST=$(prefix)/Mac/Lib
137MACLIBSRC=$(srcdir)/Mac/Lib
138MACLIBSUBDIRS= \
Jack Jansendc745682002-05-23 22:18:13 +0000139 Carbon \
140 lib-scriptpackages \
141 lib-scriptpackages/_builtinSuites \
142 lib-scriptpackages/CodeWarrior \
143 lib-scriptpackages/Explorer \
144 lib-scriptpackages/Finder \
145 lib-scriptpackages/Netscape \
146 lib-scriptpackages/StdSuites \
147 lib-scriptpackages/Terminal \
148 mkcwproject \
149 mkcwproject/template \
150 mkcwproject/template-carbon \
151 mkcwproject/template-ppc
Jack Jansen45c8e922002-08-09 14:15:46 +0000152MACTOOLSDEST=$(prefix)/Mac/Tools
153MACTOOLSSRC=$(srcdir)/Mac/Tools
154MACTOOLSSUBDIRS=IDE
Jack Jansen94fab762002-09-02 12:29:11 +0000155installmacsubtree:
Jack Jansen45c8e922002-08-09 14:15:46 +0000156 @for i in $(MACLIBDEST) $(MACTOOLSDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000157 do \
158 if test ! -d $$i; then \
159 echo "Creating directory $$i"; \
160 $(INSTALL) -d -m $(DIRMODE) $$i; \
161 else true; \
162 fi; \
163 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000164 @for d in $(MACLIBSUBDIRS); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000165 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000166 a=$(MACLIBSRC)/$$d; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000167 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000168 b=$(MACLIBDEST)/$$d; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000169 if test ! -d $$b; then \
170 echo "Creating directory $$b"; \
171 $(INSTALL) -d -m $(DIRMODE) $$b; \
172 else true; \
173 fi; \
174 done
Jack Jansen81204152002-08-15 21:31:18 +0000175 @for i in $(MACLIBSRC)/*.py; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000176 do \
177 if test -x $$i; then \
Jack Jansen45c8e922002-08-09 14:15:46 +0000178 $(INSTALL_SCRIPT) $$i $(MACLIBDEST); \
179 echo $(INSTALL_SCRIPT) $$i $(MACLIBDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000180 else \
Jack Jansen45c8e922002-08-09 14:15:46 +0000181 $(INSTALL_DATA) $$i $(MACLIBDEST); \
182 echo $(INSTALL_DATA) $$i $(MACLIBDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000183 fi; \
184 done
Jack Jansendde800e2002-11-07 23:07:05 +0000185 @for i in $(MACLIBSRC)/*.rsrc; \
186 do \
187 echo $(CPMAC) $$i $(MACLIBDEST) ; \
188 $(CPMAC) $$i $(MACLIBDEST) ; \
189 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000190 @for d in $(MACLIBSUBDIRS); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000191 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000192 a=$(MACLIBSRC)/$$d; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000193 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000194 b=$(MACLIBDEST)/$$d; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000195 for i in $$a/*; \
196 do \
197 case $$i in \
198 *CVS) ;; \
199 *.py[co]) ;; \
200 *.orig) ;; \
201 *~) ;; \
Jack Jansen81204152002-08-15 21:31:18 +0000202 *.rsrc) \
203 echo $(CPMAC) $$i $$b ; \
204 $(CPMAC) $$i $$b ; \
205 ;; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000206 *) \
207 if test -d $$i; then continue; fi; \
208 if test -x $$i; then \
209 echo $(INSTALL_SCRIPT) $$i $$b; \
210 $(INSTALL_SCRIPT) $$i $$b; \
211 else \
212 echo $(INSTALL_DATA) $$i $$b; \
213 $(INSTALL_DATA) $$i $$b; \
214 fi;; \
215 esac; \
216 done; \
217 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000218 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000219 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000220 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000221 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000222 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000223 if test ! -d $$b; then \
224 echo "Creating directory $$b"; \
225 $(INSTALL) -d -m $(DIRMODE) $$b; \
226 else true; \
227 fi; \
228 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000229 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000230 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000231 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000232 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000233 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000234 for i in $$a/*; \
235 do \
236 case $$i in \
237 *CVS) ;; \
238 *.py[co]) ;; \
239 *.orig) ;; \
240 *~) ;; \
Jack Jansen81204152002-08-15 21:31:18 +0000241 *.rsrc) \
242 echo $(CPMAC) $$i $$b ; \
243 $(CPMAC) $$i $$b ; \
244 ;; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000245 *) \
246 if test -d $$i; then continue; fi; \
247 if test -x $$i; then \
248 echo $(INSTALL_SCRIPT) $$i $$b; \
249 $(INSTALL_SCRIPT) $$i $$b; \
250 else \
251 echo $(INSTALL_DATA) $$i $$b; \
252 $(INSTALL_DATA) $$i $$b; \
253 fi;; \
254 esac; \
255 done; \
256 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000257
Jack Jansen7d996a22002-11-11 00:05:00 +0000258 $(INSTALL_DATA) $(PTHFILE) $(LIBDEST)/site-packages/
Jack Jansen45c8e922002-08-09 14:15:46 +0000259
260 $(PYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST)
Jack Jansen7d996a22002-11-11 00:05:00 +0000261 $(PYTHON) -Wi -tt $(compileall) -x badsyntax $(MACLIBDEST) $(MACTOOLSDEST)
262 $(PYTHON) -O -Wi -tt $(compileall) -x badsyntax $(MACLIBDEST) $(MACTOOLSDEST)
Jack Jansen45c8e922002-08-09 14:15:46 +0000263
Jack Jansen7d996a22002-11-11 00:05:00 +0000264#
265# We use the full name here in stead of $(INSTALLED_PYTHONW), because
266# the latter may be overridden by Makefile.jaguar when building for a pre-installed
267# /usr/bin/python
268$(APPINSTALLDIR)/Contents/MacOS/python: install_Python
Jack Jansencce7e342002-07-31 14:46:04 +0000269
Jack Jansencb4321e2002-08-09 00:18:21 +0000270# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
271# At least this rule will give an error if it doesn't exist.
272
Jack Jansen94fab762002-09-02 12:29:11 +0000273installunixtools: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW)
Jack Jansencb4321e2002-08-09 00:18:21 +0000274 $(INSTALL) -d $(bindir)
275 $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(bindir)/python
Jack Jansen94fab762002-09-02 12:29:11 +0000276 echo "#!/bin/sh" > pythonw.sh
277 echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh
278 $(INSTALL) pythonw.sh $(bindir)/pythonw
Jack Jansen0cd0e652002-03-29 14:18:18 +0000279
Jack Jansenc361f942002-07-08 13:34:23 +0000280# This is for development purposes: create a Mac.pth that refers to the source
281# directories
282dontinstallmacsubtree:
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000283 l=`cd $(srcdir)/Mac/Lib; pwd`; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000284 echo $$l > $(MACLIBDEST)/site-packages/Mac.pth ; \
285 echo $$l/lib-scriptpackages >> $(MACLIBDEST)/site-packages/Mac.pth