blob: c8d584090e52faaa9cd83d5768156996cb97a28c [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 Jansen75ed1672001-09-05 22:09:50 +000016
Jack Jansen0cd0e652002-03-29 14:18:18 +000017# Variables for installing the "normal" unix binaries
Jack Jansenbe3e1f72002-08-01 21:14:06 +000018INSTALLED_PYTHON=$(prefix)/bin/python
Jack Jansen0cd0e652002-03-29 14:18:18 +000019INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/python
20
Jack Jansen638e5e32001-09-06 16:33:57 +000021# Items more-or-less copied from the main Makefile
22DIRMODE=755
23INSTALL=/usr/bin/install -c
Jack Jansenbdbff732002-08-30 15:14:02 +000024INSTALL_SYMLINK=ln -fs
Jack Jansen638e5e32001-09-06 16:33:57 +000025INSTALL_PROGRAM=${INSTALL}
26INSTALL_SCRIPT= ${INSTALL_PROGRAM}
27INSTALL_DATA= ${INSTALL} -m 644
Jack Jansen4684a092002-08-28 21:27:02 +000028LN=ln
Jack Jansen0cd0e652002-03-29 14:18:18 +000029STRIPFLAG=-s
Jack Jansen2cce33f2002-03-29 21:17:14 +000030OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \
31 -fno-common -dynamic
Jack Jansenbe3e1f72002-08-01 21:14:06 +000032INCLUDES=-I$(builddir) -I$(srcdir)/Include -I$(srcdir)/Mac/Include
Jack Jansencb4321e2002-08-09 00:18:21 +000033DEFINES=
Jack Jansen75ed1672001-09-05 22:09:50 +000034
35CFLAGS=$(OPT) $(DEFINES) $(INCLUDES)
Jack Jansenbe3e1f72002-08-01 21:14:06 +000036LDFLAGS=-F$(builddir) -framework System -framework Python -framework Carbon \
Jack Jansen75ed1672001-09-05 22:09:50 +000037 -framework Foundation
38CC=cc
39LD=cc
Jack Jansen81204152002-08-15 21:31:18 +000040CPMAC=/Developer/Tools/CpMac
Jack Jansen75ed1672001-09-05 22:09:50 +000041
Jack Jansenbe3e1f72002-08-01 21:14:06 +000042PYTHON=$(builddir)/python.exe
43APPTEMPLATE=$(srcdir)/Mac/OSXResources/app
Jack Jansen638e5e32001-09-06 16:33:57 +000044APPSUBDIRS=MacOS Resources Resources/English.lproj
Jack Jansen45c8e922002-08-09 14:15:46 +000045CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py
Jack Jansencce7e342002-07-31 14:46:04 +000046
Jack Jansen76a6ab62002-09-12 22:19:23 +000047installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE install_IDLE
Jack Jansencce7e342002-07-31 14:46:04 +000048
49install_PythonLauncher:
Jack Jansenbe3e1f72002-08-01 21:14:06 +000050 cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \
Jack Jansencb4321e2002-08-09 00:18:21 +000051 pbxbuild -target PythonLauncher -buildstyle Deployment DSTROOT=$(dstroot) install
Jack Jansencce7e342002-07-31 14:46:04 +000052
Jack Jansen21ed16a2002-08-02 14:11:24 +000053install_Python: $(PYTHON)
Jack Jansencce7e342002-07-31 14:46:04 +000054 @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \
Jack Jansen638e5e32001-09-06 16:33:57 +000055 if test ! -d $$i; then \
56 echo "Creating directory $$i"; \
57 $(INSTALL) -d -m $(DIRMODE) $$i; \
58 fi;\
59 done
60 @for i in $(APPSUBDIRS); do \
61 if test ! -d $(APPINSTALLDIR)/Contents/$$i; then \
62 echo "Creating directory $(APPINSTALLDIR)/Contents/$$i"; \
63 $(INSTALL) -d -m $(DIRMODE) $(APPINSTALLDIR)/Contents/$$i; \
64 else true; \
65 fi; \
66 done
67 @for d in . $(APPSUBDIRS); \
68 do \
69 a=$(APPTEMPLATE)/$$d; \
70 if test ! -d $$a; then continue; else true; fi; \
71 b=$(APPINSTALLDIR)/Contents/$$d; \
72 for i in $$a/*; \
73 do \
Jack Jansen638e5e32001-09-06 16:33:57 +000074 case $$i in \
75 *CVS) ;; \
76 *.py[co]) ;; \
77 *.orig) ;; \
78 *~) ;; \
79 *) \
80 if test -d $$i; then continue; fi; \
81 if test -x $$i; then \
82 echo $(INSTALL_SCRIPT) $$i $$b; \
83 $(INSTALL_SCRIPT) $$i $$b; \
84 else \
85 echo $(INSTALL_DATA) $$i $$b; \
86 $(INSTALL_DATA) $$i $$b; \
87 fi;; \
88 esac; \
89 done; \
90 done
Jack Jansen21ed16a2002-08-02 14:11:24 +000091 $(INSTALL_PROGRAM) $(STRIPFLAG) $(PYTHON) $(APPINSTALLDIR)/Contents/MacOS/python
Jack Jansen4684a092002-08-28 21:27:02 +000092# Finally create the documentation symlink
93 $(LN) -fsn ../../../../English.lproj/Documentation $(APPINSTALLDIR)/Contents/Resources/English.lproj/Documentation
94
Jack Jansencce7e342002-07-31 14:46:04 +000095
96install_IDE: $(INSTALLED_PYTHONW)
Jack Jansenbdbff732002-08-30 15:14:02 +000097 @if $(INSTALLED_PYTHONW) -c "import waste"; then : ; else \
Jack Jansenf80798b2002-08-02 21:04:46 +000098 echo PythonIDE needs the \"waste\" extension module; \
99 echo See Mac/OSX/README for details; \
100 exit 1; \
101 fi
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000102 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
Jack Jansencce7e342002-07-31 14:46:04 +0000103 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000104 $(srcdir)/Mac/Tools/IDE/PythonIDE.py
Jack Jansen76a6ab62002-09-12 22:19:23 +0000105
106install_IDLE: $(INSTALLED_PYTHONW)
107 @if ! $(INSTALLED_PYTHONW) -c "import _tkinter"; then \
108 echo IDLE needs the \"Tkinter\" extension module; \
109 echo See Mac/OSX/README for details; \
110 else \
111 echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
112 --output $(PYTHONAPPSDIR)/IDLE.app \
113 --extra $(srcdir)/Tools/idle \
114 $(srcdir)/Tools/idle/idle ; \
115 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
116 --output $(PYTHONAPPSDIR)/IDLE.app \
117 --extra $(srcdir)/Tools/idle \
118 $(srcdir)/Tools/idle/idle ; \
119 echo mv $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idle \
120 $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idlelib; \
121 mv $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idle \
122 $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idlelib; \
123 fi
124
Jack Jansen638e5e32001-09-06 16:33:57 +0000125
Jack Jansen940e9702002-08-02 15:32:12 +0000126install_BuildApplet: $(INSTALLED_PYTHONW)
127 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
128 --output $(PYTHONAPPSDIR)/BuildApplet.app \
129 $(srcdir)/Mac/scripts/BuildApplet.py
130
Jack Jansen45c8e922002-08-09 14:15:46 +0000131MACLIBDEST=$(prefix)/Mac/Lib
132MACLIBSRC=$(srcdir)/Mac/Lib
133MACLIBSUBDIRS= \
Jack Jansendc745682002-05-23 22:18:13 +0000134 Carbon \
135 lib-scriptpackages \
136 lib-scriptpackages/_builtinSuites \
137 lib-scriptpackages/CodeWarrior \
138 lib-scriptpackages/Explorer \
139 lib-scriptpackages/Finder \
140 lib-scriptpackages/Netscape \
141 lib-scriptpackages/StdSuites \
142 lib-scriptpackages/Terminal \
143 mkcwproject \
144 mkcwproject/template \
145 mkcwproject/template-carbon \
146 mkcwproject/template-ppc
Jack Jansen45c8e922002-08-09 14:15:46 +0000147MACTOOLSDEST=$(prefix)/Mac/Tools
148MACTOOLSSRC=$(srcdir)/Mac/Tools
149MACTOOLSSUBDIRS=IDE
Jack Jansen94fab762002-09-02 12:29:11 +0000150installmacsubtree:
Jack Jansen45c8e922002-08-09 14:15:46 +0000151 @for i in $(MACLIBDEST) $(MACTOOLSDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000152 do \
153 if test ! -d $$i; then \
154 echo "Creating directory $$i"; \
155 $(INSTALL) -d -m $(DIRMODE) $$i; \
156 else true; \
157 fi; \
158 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000159 @for d in $(MACLIBSUBDIRS); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000160 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000161 a=$(MACLIBSRC)/$$d; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000162 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000163 b=$(MACLIBDEST)/$$d; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000164 if test ! -d $$b; then \
165 echo "Creating directory $$b"; \
166 $(INSTALL) -d -m $(DIRMODE) $$b; \
167 else true; \
168 fi; \
169 done
Jack Jansen81204152002-08-15 21:31:18 +0000170 @for i in $(MACLIBSRC)/*.py; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000171 do \
172 if test -x $$i; then \
Jack Jansen45c8e922002-08-09 14:15:46 +0000173 $(INSTALL_SCRIPT) $$i $(MACLIBDEST); \
174 echo $(INSTALL_SCRIPT) $$i $(MACLIBDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000175 else \
Jack Jansen45c8e922002-08-09 14:15:46 +0000176 $(INSTALL_DATA) $$i $(MACLIBDEST); \
177 echo $(INSTALL_DATA) $$i $(MACLIBDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000178 fi; \
179 done
Jack Jansendde800e2002-11-07 23:07:05 +0000180 @for i in $(MACLIBSRC)/*.rsrc; \
181 do \
182 echo $(CPMAC) $$i $(MACLIBDEST) ; \
183 $(CPMAC) $$i $(MACLIBDEST) ; \
184 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000185 @for d in $(MACLIBSUBDIRS); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000186 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000187 a=$(MACLIBSRC)/$$d; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000188 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000189 b=$(MACLIBDEST)/$$d; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000190 for i in $$a/*; \
191 do \
192 case $$i in \
193 *CVS) ;; \
194 *.py[co]) ;; \
195 *.orig) ;; \
196 *~) ;; \
Jack Jansen81204152002-08-15 21:31:18 +0000197 *.rsrc) \
198 echo $(CPMAC) $$i $$b ; \
199 $(CPMAC) $$i $$b ; \
200 ;; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000201 *) \
202 if test -d $$i; then continue; fi; \
203 if test -x $$i; then \
204 echo $(INSTALL_SCRIPT) $$i $$b; \
205 $(INSTALL_SCRIPT) $$i $$b; \
206 else \
207 echo $(INSTALL_DATA) $$i $$b; \
208 $(INSTALL_DATA) $$i $$b; \
209 fi;; \
210 esac; \
211 done; \
212 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000213 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000214 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000215 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000216 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000217 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000218 if test ! -d $$b; then \
219 echo "Creating directory $$b"; \
220 $(INSTALL) -d -m $(DIRMODE) $$b; \
221 else true; \
222 fi; \
223 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000224 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000225 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000226 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000227 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000228 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000229 for i in $$a/*; \
230 do \
231 case $$i in \
232 *CVS) ;; \
233 *.py[co]) ;; \
234 *.orig) ;; \
235 *~) ;; \
Jack Jansen81204152002-08-15 21:31:18 +0000236 *.rsrc) \
237 echo $(CPMAC) $$i $$b ; \
238 $(CPMAC) $$i $$b ; \
239 ;; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000240 *) \
241 if test -d $$i; then continue; fi; \
242 if test -x $$i; then \
243 echo $(INSTALL_SCRIPT) $$i $$b; \
244 $(INSTALL_SCRIPT) $$i $$b; \
245 else \
246 echo $(INSTALL_DATA) $$i $$b; \
247 $(INSTALL_DATA) $$i $$b; \
248 fi;; \
249 esac; \
250 done; \
251 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000252
Jack Jansencb4321e2002-08-09 00:18:21 +0000253 $(INSTALL_DATA) $(srcdir)/Mac/OSX/Mac.pth $(LIBDEST)/site-packages/
Jack Jansen45c8e922002-08-09 14:15:46 +0000254
255 $(PYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST)
Jack Jansen94fab762002-09-02 12:29:11 +0000256 $(PYTHON) -Wi -tt $(srcdir)/Lib/compileall.py -x badsyntax $(MACLIBDEST) $(MACTOOLSDEST)
257 $(PYTHON) -O -Wi -tt $(srcdir)/Lib/compileall.py -x badsyntax $(MACLIBDEST) $(MACTOOLSDEST)
Jack Jansen45c8e922002-08-09 14:15:46 +0000258
Jack Jansen109f0942002-01-18 16:12:27 +0000259
Jack Jansen0cd0e652002-03-29 14:18:18 +0000260# Put symlinks "python" and "pythonw" in the standard place
Jack Jansencce7e342002-07-31 14:46:04 +0000261$(INSTALLED_PYTHONW): install_Python
Jack Jansencce7e342002-07-31 14:46:04 +0000262
Jack Jansencb4321e2002-08-09 00:18:21 +0000263# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
264# At least this rule will give an error if it doesn't exist.
265
Jack Jansen94fab762002-09-02 12:29:11 +0000266installunixtools: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW)
Jack Jansencb4321e2002-08-09 00:18:21 +0000267 $(INSTALL) -d $(bindir)
268 $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(bindir)/python
Jack Jansen94fab762002-09-02 12:29:11 +0000269 echo "#!/bin/sh" > pythonw.sh
270 echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh
271 $(INSTALL) pythonw.sh $(bindir)/pythonw
Jack Jansen0cd0e652002-03-29 14:18:18 +0000272
Jack Jansenc361f942002-07-08 13:34:23 +0000273# This is for development purposes: create a Mac.pth that refers to the source
274# directories
275dontinstallmacsubtree:
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000276 l=`cd $(srcdir)/Mac/Lib; pwd`; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000277 echo $$l > $(MACLIBDEST)/site-packages/Mac.pth ; \
278 echo $$l/lib-scriptpackages >> $(MACLIBDEST)/site-packages/Mac.pth