blob: 0d2e55c2effe89dc3058ddf42f822b2d7e0235d4 [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 Jansend7800362003-02-12 15:42:49 +000049bundlebuilder=$(srcdir)/Lib/plat-mac/bundlebuilder.py
Jack Jansencce7e342002-07-31 14:46:04 +000050
Jack Jansend7800362003-02-12 15:42:49 +000051installapps: install_PythonLauncher install_Python install_BuildApplet \
52 install_PackageManager install_IDE install_IDLE
Jack Jansencce7e342002-07-31 14:46:04 +000053
54install_PythonLauncher:
Jack Jansenbe3e1f72002-08-01 21:14:06 +000055 cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \
Jack Jansen1ebcc442002-11-20 14:06:16 +000056 pbxbuild -target PythonLauncher -buildstyle Deployment \
57 DSTROOT=$(dstroot) INSTALL_PATH=$(PYTHONAPPSPATH) install
Jack Jansencce7e342002-07-31 14:46:04 +000058
Jack Jansen21ed16a2002-08-02 14:11:24 +000059install_Python: $(PYTHON)
Jack Jansencce7e342002-07-31 14:46:04 +000060 @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \
Jack Jansen638e5e32001-09-06 16:33:57 +000061 if test ! -d $$i; then \
62 echo "Creating directory $$i"; \
63 $(INSTALL) -d -m $(DIRMODE) $$i; \
64 fi;\
65 done
66 @for i in $(APPSUBDIRS); do \
67 if test ! -d $(APPINSTALLDIR)/Contents/$$i; then \
68 echo "Creating directory $(APPINSTALLDIR)/Contents/$$i"; \
69 $(INSTALL) -d -m $(DIRMODE) $(APPINSTALLDIR)/Contents/$$i; \
70 else true; \
71 fi; \
72 done
73 @for d in . $(APPSUBDIRS); \
74 do \
75 a=$(APPTEMPLATE)/$$d; \
76 if test ! -d $$a; then continue; else true; fi; \
77 b=$(APPINSTALLDIR)/Contents/$$d; \
78 for i in $$a/*; \
79 do \
Jack Jansen638e5e32001-09-06 16:33:57 +000080 case $$i in \
81 *CVS) ;; \
82 *.py[co]) ;; \
83 *.orig) ;; \
84 *~) ;; \
85 *) \
86 if test -d $$i; then continue; fi; \
87 if test -x $$i; then \
88 echo $(INSTALL_SCRIPT) $$i $$b; \
89 $(INSTALL_SCRIPT) $$i $$b; \
90 else \
91 echo $(INSTALL_DATA) $$i $$b; \
92 $(INSTALL_DATA) $$i $$b; \
93 fi;; \
94 esac; \
95 done; \
96 done
Jack Jansen21ed16a2002-08-02 14:11:24 +000097 $(INSTALL_PROGRAM) $(STRIPFLAG) $(PYTHON) $(APPINSTALLDIR)/Contents/MacOS/python
Jack Jansen4684a092002-08-28 21:27:02 +000098# Finally create the documentation symlink
99 $(LN) -fsn ../../../../English.lproj/Documentation $(APPINSTALLDIR)/Contents/Resources/English.lproj/Documentation
100
Jack Jansencce7e342002-07-31 14:46:04 +0000101
102install_IDE: $(INSTALLED_PYTHONW)
Jack Jansen7d996a22002-11-11 00:05:00 +0000103 @if ! $(INSTALLED_PYTHONW) -c "import waste"; then \
Jack Jansenf80798b2002-08-02 21:04:46 +0000104 echo PythonIDE needs the \"waste\" extension module; \
105 echo See Mac/OSX/README for details; \
Jack Jansen7d996a22002-11-11 00:05:00 +0000106 else \
Jack Jansend7800362003-02-12 15:42:49 +0000107 echo $(INSTALLED_PYTHONW) $(bundlebuilder) \
108 --builddir $(PYTHONAPPSDIR)/ \
109 --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \
110 --mainprogram $(srcdir)/Mac/Tools/IDE/PythonIDE.py \
111 --iconfile $(srcdir)/Mac/Tools/IDE/PythonIDE.icns \
112 --creator Pide build; \
113 $(INSTALLED_PYTHONW) $(bundlebuilder) \
114 --builddir $(PYTHONAPPSDIR)/ \
115 --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \
116 --mainprogram $(srcdir)/Mac/Tools/IDE/PythonIDE.py \
117 --iconfile $(srcdir)/Mac/Tools/IDE/PythonIDE.icns \
118 --creator Pide build; \
119 fi
120
121install_PackageManager: $(INSTALLED_PYTHONW)
122 @if ! $(INSTALLED_PYTHONW) -c "import waste"; then \
123 echo PackageManager needs the \"waste\" extension module; \
124 echo See Mac/OSX/README for details; \
125 else \
126 echo $(INSTALLED_PYTHONW) $(bundlebuilder) \
127 --builddir $(PYTHONAPPSDIR)/ \
128 --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \
129 --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \
130 --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \
131 --creator Pimp build; \
132 $(INSTALLED_PYTHONW) $(bundlebuilder) \
133 --builddir $(PYTHONAPPSDIR)/ \
134 --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \
135 --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \
136 --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \
137 --creator Pimp build; \
Jack Jansenf80798b2002-08-02 21:04:46 +0000138 fi
Jack Jansen76a6ab62002-09-12 22:19:23 +0000139
140install_IDLE: $(INSTALLED_PYTHONW)
141 @if ! $(INSTALLED_PYTHONW) -c "import _tkinter"; then \
142 echo IDLE needs the \"Tkinter\" extension module; \
143 echo See Mac/OSX/README for details; \
144 else \
145 echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
146 --output $(PYTHONAPPSDIR)/IDLE.app \
147 --extra $(srcdir)/Tools/idle \
148 $(srcdir)/Tools/idle/idle ; \
149 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
150 --output $(PYTHONAPPSDIR)/IDLE.app \
151 --extra $(srcdir)/Tools/idle \
152 $(srcdir)/Tools/idle/idle ; \
153 echo mv $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idle \
154 $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idlelib; \
155 mv $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idle \
156 $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idlelib; \
157 fi
158
Jack Jansen638e5e32001-09-06 16:33:57 +0000159
Jack Jansen940e9702002-08-02 15:32:12 +0000160install_BuildApplet: $(INSTALLED_PYTHONW)
161 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
162 --output $(PYTHONAPPSDIR)/BuildApplet.app \
163 $(srcdir)/Mac/scripts/BuildApplet.py
164
Jack Jansen83f898c2002-12-30 22:23:40 +0000165MACLIBDEST=$(LIBDEST)/plat-mac
Jack Jansen45c8e922002-08-09 14:15:46 +0000166MACTOOLSDEST=$(prefix)/Mac/Tools
167MACTOOLSSRC=$(srcdir)/Mac/Tools
168MACTOOLSSUBDIRS=IDE
Jack Jansen94fab762002-09-02 12:29:11 +0000169installmacsubtree:
Jack Jansen83f898c2002-12-30 22:23:40 +0000170 @for i in $(MACTOOLSDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000171 do \
172 if test ! -d $$i; then \
173 echo "Creating directory $$i"; \
174 $(INSTALL) -d -m $(DIRMODE) $$i; \
175 else true; \
176 fi; \
177 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000178 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000179 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000180 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000181 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000182 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000183 if test ! -d $$b; then \
184 echo "Creating directory $$b"; \
185 $(INSTALL) -d -m $(DIRMODE) $$b; \
186 else true; \
187 fi; \
188 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000189 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000190 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000191 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000192 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000193 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000194 for i in $$a/*; \
195 do \
196 case $$i in \
197 *CVS) ;; \
198 *.py[co]) ;; \
199 *.orig) ;; \
200 *~) ;; \
Jack Jansen81204152002-08-15 21:31:18 +0000201 *.rsrc) \
202 echo $(CPMAC) $$i $$b ; \
203 $(CPMAC) $$i $$b ; \
204 ;; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000205 *) \
206 if test -d $$i; then continue; fi; \
207 if test -x $$i; then \
208 echo $(INSTALL_SCRIPT) $$i $$b; \
209 $(INSTALL_SCRIPT) $$i $$b; \
210 else \
211 echo $(INSTALL_DATA) $$i $$b; \
212 $(INSTALL_DATA) $$i $$b; \
213 fi;; \
214 esac; \
215 done; \
216 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000217
Jack Jansen7d996a22002-11-11 00:05:00 +0000218 $(INSTALL_DATA) $(PTHFILE) $(LIBDEST)/site-packages/
Jack Jansen45c8e922002-08-09 14:15:46 +0000219
220 $(PYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST)
Jack Jansen83f898c2002-12-30 22:23:40 +0000221 $(PYTHON) -Wi -tt $(compileall) -x badsyntax $(MACTOOLSDEST)
222 $(PYTHON) -O -Wi -tt $(compileall) -x badsyntax $(MACTOOLSDEST)
Jack Jansen45c8e922002-08-09 14:15:46 +0000223
Jack Jansen7d996a22002-11-11 00:05:00 +0000224#
225# We use the full name here in stead of $(INSTALLED_PYTHONW), because
226# the latter may be overridden by Makefile.jaguar when building for a pre-installed
227# /usr/bin/python
228$(APPINSTALLDIR)/Contents/MacOS/python: install_Python
Jack Jansencce7e342002-07-31 14:46:04 +0000229
Jack Jansencb4321e2002-08-09 00:18:21 +0000230# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
231# At least this rule will give an error if it doesn't exist.
232
Jack Jansen94fab762002-09-02 12:29:11 +0000233installunixtools: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW)
Jack Jansencb4321e2002-08-09 00:18:21 +0000234 $(INSTALL) -d $(bindir)
Jack Jansen50abec82003-01-28 21:45:44 +0000235 $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(bindir)/python$(VERSION)
236 $(INSTALL_SYMLINK) python$(VERSION) $(bindir)/python
Jack Jansen94fab762002-09-02 12:29:11 +0000237 echo "#!/bin/sh" > pythonw.sh
238 echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh
Jack Jansen50abec82003-01-28 21:45:44 +0000239 $(INSTALL) pythonw.sh $(bindir)/pythonw$(VERSION)
240 $(INSTALL_SYMLINK) pythonw$(VERSION) $(bindir)/pythonw