blob: 9b72ebb9ff92a2050f86db8a865ae4d95d5ecc78 [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 Jansen4ccf3e12003-02-18 23:33:39 +000051installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE \
52 install_IDLE install_PackageManager
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 Jansen4ccf3e12003-02-18 23:33:39 +0000107 echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
108 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
109 $(srcdir)/Mac/Tools/IDE/PythonIDE.py ; \
110 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
111 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
112 $(srcdir)/Mac/Tools/IDE/PythonIDE.py; \
Jack Jansend7800362003-02-12 15:42:49 +0000113 fi
114
115install_PackageManager: $(INSTALLED_PYTHONW)
116 @if ! $(INSTALLED_PYTHONW) -c "import waste"; then \
117 echo PackageManager needs the \"waste\" extension module; \
118 echo See Mac/OSX/README for details; \
119 else \
120 echo $(INSTALLED_PYTHONW) $(bundlebuilder) \
121 --builddir $(PYTHONAPPSDIR)/ \
122 --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \
123 --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \
124 --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \
125 --creator Pimp build; \
126 $(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; \
Jack Jansenf80798b2002-08-02 21:04:46 +0000132 fi
Jack Jansen76a6ab62002-09-12 22:19:23 +0000133
134install_IDLE: $(INSTALLED_PYTHONW)
135 @if ! $(INSTALLED_PYTHONW) -c "import _tkinter"; then \
136 echo IDLE needs the \"Tkinter\" extension module; \
137 echo See Mac/OSX/README for details; \
138 else \
139 echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
140 --output $(PYTHONAPPSDIR)/IDLE.app \
141 --extra $(srcdir)/Tools/idle \
142 $(srcdir)/Tools/idle/idle ; \
143 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
144 --output $(PYTHONAPPSDIR)/IDLE.app \
145 --extra $(srcdir)/Tools/idle \
146 $(srcdir)/Tools/idle/idle ; \
147 echo mv $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idle \
148 $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idlelib; \
149 mv $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idle \
150 $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idlelib; \
151 fi
152
Jack Jansen638e5e32001-09-06 16:33:57 +0000153
Jack Jansen940e9702002-08-02 15:32:12 +0000154install_BuildApplet: $(INSTALLED_PYTHONW)
155 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
156 --output $(PYTHONAPPSDIR)/BuildApplet.app \
157 $(srcdir)/Mac/scripts/BuildApplet.py
158
Jack Jansen83f898c2002-12-30 22:23:40 +0000159MACLIBDEST=$(LIBDEST)/plat-mac
Jack Jansen45c8e922002-08-09 14:15:46 +0000160MACTOOLSDEST=$(prefix)/Mac/Tools
161MACTOOLSSRC=$(srcdir)/Mac/Tools
162MACTOOLSSUBDIRS=IDE
Jack Jansen94fab762002-09-02 12:29:11 +0000163installmacsubtree:
Jack Jansen83f898c2002-12-30 22:23:40 +0000164 @for i in $(MACTOOLSDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000165 do \
166 if test ! -d $$i; then \
167 echo "Creating directory $$i"; \
168 $(INSTALL) -d -m $(DIRMODE) $$i; \
169 else true; \
170 fi; \
171 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000172 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000173 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000174 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000175 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000176 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000177 if test ! -d $$b; then \
178 echo "Creating directory $$b"; \
179 $(INSTALL) -d -m $(DIRMODE) $$b; \
180 else true; \
181 fi; \
182 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000183 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000184 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000185 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000186 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000187 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000188 for i in $$a/*; \
189 do \
190 case $$i in \
191 *CVS) ;; \
192 *.py[co]) ;; \
193 *.orig) ;; \
194 *~) ;; \
Jack Jansen81204152002-08-15 21:31:18 +0000195 *.rsrc) \
196 echo $(CPMAC) $$i $$b ; \
197 $(CPMAC) $$i $$b ; \
198 ;; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000199 *) \
200 if test -d $$i; then continue; fi; \
201 if test -x $$i; then \
202 echo $(INSTALL_SCRIPT) $$i $$b; \
203 $(INSTALL_SCRIPT) $$i $$b; \
204 else \
205 echo $(INSTALL_DATA) $$i $$b; \
206 $(INSTALL_DATA) $$i $$b; \
207 fi;; \
208 esac; \
209 done; \
210 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000211
Jack Jansen7d996a22002-11-11 00:05:00 +0000212 $(INSTALL_DATA) $(PTHFILE) $(LIBDEST)/site-packages/
Jack Jansen45c8e922002-08-09 14:15:46 +0000213
214 $(PYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST)
Jack Jansen83f898c2002-12-30 22:23:40 +0000215 $(PYTHON) -Wi -tt $(compileall) -x badsyntax $(MACTOOLSDEST)
216 $(PYTHON) -O -Wi -tt $(compileall) -x badsyntax $(MACTOOLSDEST)
Jack Jansen45c8e922002-08-09 14:15:46 +0000217
Jack Jansen7d996a22002-11-11 00:05:00 +0000218#
219# We use the full name here in stead of $(INSTALLED_PYTHONW), because
220# the latter may be overridden by Makefile.jaguar when building for a pre-installed
221# /usr/bin/python
222$(APPINSTALLDIR)/Contents/MacOS/python: install_Python
Jack Jansencce7e342002-07-31 14:46:04 +0000223
Jack Jansencb4321e2002-08-09 00:18:21 +0000224# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
225# At least this rule will give an error if it doesn't exist.
226
Jack Jansen94fab762002-09-02 12:29:11 +0000227installunixtools: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW)
Jack Jansencb4321e2002-08-09 00:18:21 +0000228 $(INSTALL) -d $(bindir)
Jack Jansen50abec82003-01-28 21:45:44 +0000229 $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(bindir)/python$(VERSION)
230 $(INSTALL_SYMLINK) python$(VERSION) $(bindir)/python
Jack Jansen94fab762002-09-02 12:29:11 +0000231 echo "#!/bin/sh" > pythonw.sh
232 echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh
Jack Jansen50abec82003-01-28 21:45:44 +0000233 $(INSTALL) pythonw.sh $(bindir)/pythonw$(VERSION)
234 $(INSTALL_SYMLINK) pythonw$(VERSION) $(bindir)/pythonw