blob: 6411fb324e7c6324b0f267d070e336982e77f435 [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 +00008LIBDEST=$(prefix)/lib/python$(VERSION)
Jack Jansenbe3e1f72002-08-01 21:14:06 +00009prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION)
Jack Jansencb4321e2002-08-09 00:18:21 +000010dstroot=/.
11
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 Jansen0cd0e652002-03-29 14:18:18 +000024INSTALL_SYMLINK=/usr/bin/install -l as
Jack Jansen638e5e32001-09-06 16:33:57 +000025INSTALL_PROGRAM=${INSTALL}
26INSTALL_SCRIPT= ${INSTALL_PROGRAM}
27INSTALL_DATA= ${INSTALL} -m 644
Jack Jansen0cd0e652002-03-29 14:18:18 +000028STRIPFLAG=-s
Jack Jansen2cce33f2002-03-29 21:17:14 +000029OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \
30 -fno-common -dynamic
Jack Jansenbe3e1f72002-08-01 21:14:06 +000031INCLUDES=-I$(builddir) -I$(srcdir)/Include -I$(srcdir)/Mac/Include
Jack Jansencb4321e2002-08-09 00:18:21 +000032DEFINES=
Jack Jansen75ed1672001-09-05 22:09:50 +000033
34CFLAGS=$(OPT) $(DEFINES) $(INCLUDES)
Jack Jansenbe3e1f72002-08-01 21:14:06 +000035LDFLAGS=-F$(builddir) -framework System -framework Python -framework Carbon \
Jack Jansen75ed1672001-09-05 22:09:50 +000036 -framework Foundation
37CC=cc
38LD=cc
Jack Jansenfea15532002-01-27 20:05:20 +000039REZ=/Developer/Tools/Rez
40DEREZ=/Developer/Tools/DeRez
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 Jansenbe3e1f72002-08-01 21:14:06 +000045RESOURCEDIR=$(srcdir)/Mac/Resources
Jack Jansenc432cba2001-09-09 00:36:52 +000046RESOURCEFILE=python.rsrc
Jack Jansenbe3e1f72002-08-01 21:14:06 +000047RFCONVERTER=$(srcdir)/Mac/Lib/applesingle.py
Jack Jansen45c8e922002-08-09 14:15:46 +000048CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py
Jack Jansencce7e342002-07-31 14:46:04 +000049
Jack Jansencb4321e2002-08-09 00:18:21 +000050installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE
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 Jansencb4321e2002-08-09 00:18:21 +000054 pbxbuild -target PythonLauncher -buildstyle Deployment DSTROOT=$(dstroot) install
Jack Jansencce7e342002-07-31 14:46:04 +000055
Jack Jansen21ed16a2002-08-02 14:11:24 +000056install_Python: $(PYTHON)
Jack Jansencce7e342002-07-31 14:46:04 +000057 @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \
Jack Jansen638e5e32001-09-06 16:33:57 +000058 if test ! -d $$i; then \
59 echo "Creating directory $$i"; \
60 $(INSTALL) -d -m $(DIRMODE) $$i; \
61 fi;\
62 done
63 @for i in $(APPSUBDIRS); do \
64 if test ! -d $(APPINSTALLDIR)/Contents/$$i; then \
65 echo "Creating directory $(APPINSTALLDIR)/Contents/$$i"; \
66 $(INSTALL) -d -m $(DIRMODE) $(APPINSTALLDIR)/Contents/$$i; \
67 else true; \
68 fi; \
69 done
70 @for d in . $(APPSUBDIRS); \
71 do \
72 a=$(APPTEMPLATE)/$$d; \
73 if test ! -d $$a; then continue; else true; fi; \
74 b=$(APPINSTALLDIR)/Contents/$$d; \
75 for i in $$a/*; \
76 do \
Jack Jansen638e5e32001-09-06 16:33:57 +000077 case $$i in \
78 *CVS) ;; \
79 *.py[co]) ;; \
80 *.orig) ;; \
81 *~) ;; \
82 *) \
83 if test -d $$i; then continue; fi; \
84 if test -x $$i; then \
85 echo $(INSTALL_SCRIPT) $$i $$b; \
86 $(INSTALL_SCRIPT) $$i $$b; \
87 else \
88 echo $(INSTALL_DATA) $$i $$b; \
89 $(INSTALL_DATA) $$i $$b; \
90 fi;; \
91 esac; \
92 done; \
93 done
Jack Jansen21ed16a2002-08-02 14:11:24 +000094 $(INSTALL_PROGRAM) $(STRIPFLAG) $(PYTHON) $(APPINSTALLDIR)/Contents/MacOS/python
Jack Jansenc432cba2001-09-09 00:36:52 +000095 # Create a temporary version of the resources here
Jack Jansenfdc8d752002-01-15 23:20:40 +000096 $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/dialogs.rsrc dialogs.rsrc
97 $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/errors.rsrc errors.rsrc
Jack Jansenfea15532002-01-27 20:05:20 +000098 $(DEREZ) -useDF -skip ckid dialogs.rsrc > dialogs.r
99 $(DEREZ) -useDF -skip ckid errors.rsrc > errors.r
100 $(REZ) -useDF -o $(RESOURCEFILE) dialogs.r errors.r
Jack Jansenc432cba2001-09-09 00:36:52 +0000101 $(INSTALL_DATA) $(RESOURCEFILE) $(APPINSTALLDIR)/Contents/Resources/$(RESOURCEFILE)
Jack Jansencce7e342002-07-31 14:46:04 +0000102
103install_IDE: $(INSTALLED_PYTHONW)
Jack Jansenf80798b2002-08-02 21:04:46 +0000104 @if $(INSTALLED_PYTHONW) -c "import waste"; then ; else \
105 echo PythonIDE needs the \"waste\" extension module; \
106 echo See Mac/OSX/README for details; \
107 exit 1; \
108 fi
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000109 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
Jack Jansencce7e342002-07-31 14:46:04 +0000110 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000111 $(srcdir)/Mac/Tools/IDE/PythonIDE.py
Jack Jansen638e5e32001-09-06 16:33:57 +0000112
Jack Jansen940e9702002-08-02 15:32:12 +0000113install_BuildApplet: $(INSTALLED_PYTHONW)
114 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
115 --output $(PYTHONAPPSDIR)/BuildApplet.app \
116 $(srcdir)/Mac/scripts/BuildApplet.py
117
Jack Jansen45c8e922002-08-09 14:15:46 +0000118MACLIBDEST=$(prefix)/Mac/Lib
119MACLIBSRC=$(srcdir)/Mac/Lib
120MACLIBSUBDIRS= \
Jack Jansendc745682002-05-23 22:18:13 +0000121 Carbon \
122 lib-scriptpackages \
123 lib-scriptpackages/_builtinSuites \
124 lib-scriptpackages/CodeWarrior \
125 lib-scriptpackages/Explorer \
126 lib-scriptpackages/Finder \
127 lib-scriptpackages/Netscape \
128 lib-scriptpackages/StdSuites \
129 lib-scriptpackages/Terminal \
130 mkcwproject \
131 mkcwproject/template \
132 mkcwproject/template-carbon \
133 mkcwproject/template-ppc
Jack Jansen45c8e922002-08-09 14:15:46 +0000134MACTOOLSDEST=$(prefix)/Mac/Tools
135MACTOOLSSRC=$(srcdir)/Mac/Tools
136MACTOOLSSUBDIRS=IDE
137installmacsubtree: $(INSTALLED_PYTHON)
138 @for i in $(MACLIBDEST) $(MACTOOLSDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000139 do \
140 if test ! -d $$i; then \
141 echo "Creating directory $$i"; \
142 $(INSTALL) -d -m $(DIRMODE) $$i; \
143 else true; \
144 fi; \
145 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000146 @for d in $(MACLIBSUBDIRS); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000147 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000148 a=$(MACLIBSRC)/$$d; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000149 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000150 b=$(MACLIBDEST)/$$d; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000151 if test ! -d $$b; then \
152 echo "Creating directory $$b"; \
153 $(INSTALL) -d -m $(DIRMODE) $$b; \
154 else true; \
155 fi; \
156 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000157 @for i in $(MACLIBSRC)/*.py $(MACLIBSRC)/*.rsrc; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000158 do \
159 if test -x $$i; then \
Jack Jansen45c8e922002-08-09 14:15:46 +0000160 $(INSTALL_SCRIPT) $$i $(MACLIBDEST); \
161 echo $(INSTALL_SCRIPT) $$i $(MACLIBDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000162 else \
Jack Jansen45c8e922002-08-09 14:15:46 +0000163 $(INSTALL_DATA) $$i $(MACLIBDEST); \
164 echo $(INSTALL_DATA) $$i $(MACLIBDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000165 fi; \
166 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000167 @for d in $(MACLIBSUBDIRS); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000168 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000169 a=$(MACLIBSRC)/$$d; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000170 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000171 b=$(MACLIBDEST)/$$d; \
Jack Jansen638e5e32001-09-06 16:33:57 +0000172 for i in $$a/*; \
173 do \
174 case $$i in \
175 *CVS) ;; \
176 *.py[co]) ;; \
177 *.orig) ;; \
178 *~) ;; \
179 *) \
180 if test -d $$i; then continue; fi; \
181 if test -x $$i; then \
182 echo $(INSTALL_SCRIPT) $$i $$b; \
183 $(INSTALL_SCRIPT) $$i $$b; \
184 else \
185 echo $(INSTALL_DATA) $$i $$b; \
186 $(INSTALL_DATA) $$i $$b; \
187 fi;; \
188 esac; \
189 done; \
190 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000191 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000192 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000193 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000194 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000195 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000196 if test ! -d $$b; then \
197 echo "Creating directory $$b"; \
198 $(INSTALL) -d -m $(DIRMODE) $$b; \
199 else true; \
200 fi; \
201 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000202 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000203 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000204 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000205 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000206 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000207 for i in $$a/*; \
208 do \
209 case $$i in \
210 *CVS) ;; \
211 *.py[co]) ;; \
212 *.orig) ;; \
213 *~) ;; \
214 *) \
215 if test -d $$i; then continue; fi; \
216 if test -x $$i; then \
217 echo $(INSTALL_SCRIPT) $$i $$b; \
218 $(INSTALL_SCRIPT) $$i $$b; \
219 else \
220 echo $(INSTALL_DATA) $$i $$b; \
221 $(INSTALL_DATA) $$i $$b; \
222 fi;; \
223 esac; \
224 done; \
225 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000226
Jack Jansencb4321e2002-08-09 00:18:21 +0000227 $(INSTALL_DATA) $(srcdir)/Mac/OSX/Mac.pth $(LIBDEST)/site-packages/
Jack Jansen45c8e922002-08-09 14:15:46 +0000228
229 $(PYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST)
230 $(INSTALLED_PYTHON) $(srcdir)/Lib/compileall.py $(MACLIBDEST) $(MACTOOLSDEST)
231 $(INSTALLED_PYTHON) -O $(srcdir)/Lib/compileall.py $(MACLIBDEST) $(MACTOOLSDEST)
232
Jack Jansen109f0942002-01-18 16:12:27 +0000233
Jack Jansen0cd0e652002-03-29 14:18:18 +0000234# Put symlinks "python" and "pythonw" in the standard place
Jack Jansencce7e342002-07-31 14:46:04 +0000235$(INSTALLED_PYTHONW): install_Python
Jack Jansencce7e342002-07-31 14:46:04 +0000236
Jack Jansencb4321e2002-08-09 00:18:21 +0000237# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
238# At least this rule will give an error if it doesn't exist.
239
240installunixtools: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW) $(srcdir)/Mac/OSX/pythonw.sh
241 $(INSTALL) -d $(bindir)
242 $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(bindir)/python
243 $(INSTALL) $(srcdir)/Mac/OSX/pythonw.sh $(bindir)/pythonw
Jack Jansen0cd0e652002-03-29 14:18:18 +0000244
Jack Jansenc361f942002-07-08 13:34:23 +0000245# This is for development purposes: create a Mac.pth that refers to the source
246# directories
247dontinstallmacsubtree:
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000248 l=`cd $(srcdir)/Mac/Lib; pwd`; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000249 echo $$l > $(MACLIBDEST)/site-packages/Mac.pth ; \
250 echo $$l/lib-scriptpackages >> $(MACLIBDEST)/site-packages/Mac.pth