blob: 5f8d6279789dbc5aaaff477313ce17fc6a3df15e [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 Jansen04087b52003-02-25 12:41:10 +000011BUILDPYTHON=$(builddir)/python.exe
Jack Jansencb4321e2002-08-09 00:18:21 +000012
13# These are normally glimpsed from the previous set
14bindir=$(dstroot)/usr/local/bin
Jack Jansencfe28362002-12-25 22:31:28 +000015PYTHONAPPSPATH=/Applications/MacPython-$(VERSION)
Jack Jansen1ebcc442002-11-20 14:06:16 +000016PYTHONAPPSDIR=$(dstroot)$(PYTHONAPPSPATH)
Jack Jansenbe3e1f72002-08-01 21:14:06 +000017APPINSTALLDIR=$(prefix)/Resources/Python.app
Jack Jansen7d996a22002-11-11 00:05:00 +000018PTHFILE=$(srcdir)/Mac/OSX/Mac.pth
Jack Jansen75ed1672001-09-05 22:09:50 +000019
Jack Jansen0cd0e652002-03-29 14:18:18 +000020# Variables for installing the "normal" unix binaries
Jack Jansenbe3e1f72002-08-01 21:14:06 +000021INSTALLED_PYTHON=$(prefix)/bin/python
Jack Jansen0cd0e652002-03-29 14:18:18 +000022INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/python
23
Jack Jansen638e5e32001-09-06 16:33:57 +000024# Items more-or-less copied from the main Makefile
25DIRMODE=755
26INSTALL=/usr/bin/install -c
Jack Jansenbdbff732002-08-30 15:14:02 +000027INSTALL_SYMLINK=ln -fs
Jack Jansen638e5e32001-09-06 16:33:57 +000028INSTALL_PROGRAM=${INSTALL}
29INSTALL_SCRIPT= ${INSTALL_PROGRAM}
30INSTALL_DATA= ${INSTALL} -m 644
Jack Jansen4684a092002-08-28 21:27:02 +000031LN=ln
Jack Jansen0cd0e652002-03-29 14:18:18 +000032STRIPFLAG=-s
Jack Jansen7d996a22002-11-11 00:05:00 +000033##OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \
34## -fno-common -dynamic
35##INCLUDES=-I$(builddir) -I$(srcdir)/Include -I$(srcdir)/Mac/Include
36##DEFINES=
37##
38##CFLAGS=$(OPT) $(DEFINES) $(INCLUDES)
39##LDFLAGS=-F$(builddir) -framework System -framework Python -framework Carbon \
40## -framework Foundation
41##CC=cc
42##LD=cc
Jack Jansen81204152002-08-15 21:31:18 +000043CPMAC=/Developer/Tools/CpMac
Jack Jansen75ed1672001-09-05 22:09:50 +000044
Jack Jansenbe3e1f72002-08-01 21:14:06 +000045APPTEMPLATE=$(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 Jansen04087b52003-02-25 12:41:10 +000059install_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 Jansen04087b52003-02-25 12:41:10 +000097 $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) $(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 \
Jack Jansenec43f642003-02-24 16:30:24 +0000145 --extra $(srcdir)/Tools/idle:Contents/Resources/idlelib \
Jack Jansen76a6ab62002-09-12 22:19:23 +0000146 $(srcdir)/Tools/idle/idle ; \
Jack Jansen76a6ab62002-09-12 22:19:23 +0000147 fi
148
Jack Jansen638e5e32001-09-06 16:33:57 +0000149
Jack Jansen940e9702002-08-02 15:32:12 +0000150install_BuildApplet: $(INSTALLED_PYTHONW)
151 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
152 --output $(PYTHONAPPSDIR)/BuildApplet.app \
153 $(srcdir)/Mac/scripts/BuildApplet.py
154
Jack Jansen83f898c2002-12-30 22:23:40 +0000155MACLIBDEST=$(LIBDEST)/plat-mac
Jack Jansen45c8e922002-08-09 14:15:46 +0000156MACTOOLSDEST=$(prefix)/Mac/Tools
157MACTOOLSSRC=$(srcdir)/Mac/Tools
158MACTOOLSSUBDIRS=IDE
Jack Jansen94fab762002-09-02 12:29:11 +0000159installmacsubtree:
Jack Jansen83f898c2002-12-30 22:23:40 +0000160 @for i in $(MACTOOLSDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000161 do \
162 if test ! -d $$i; then \
163 echo "Creating directory $$i"; \
164 $(INSTALL) -d -m $(DIRMODE) $$i; \
165 else true; \
166 fi; \
167 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000168 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000169 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000170 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000171 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000172 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000173 if test ! -d $$b; then \
174 echo "Creating directory $$b"; \
175 $(INSTALL) -d -m $(DIRMODE) $$b; \
176 else true; \
177 fi; \
178 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000179 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000180 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000181 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000182 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000183 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000184 for i in $$a/*; \
185 do \
186 case $$i in \
187 *CVS) ;; \
188 *.py[co]) ;; \
189 *.orig) ;; \
190 *~) ;; \
Jack Jansen81204152002-08-15 21:31:18 +0000191 *.rsrc) \
192 echo $(CPMAC) $$i $$b ; \
193 $(CPMAC) $$i $$b ; \
194 ;; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000195 *) \
196 if test -d $$i; then continue; fi; \
197 if test -x $$i; then \
198 echo $(INSTALL_SCRIPT) $$i $$b; \
199 $(INSTALL_SCRIPT) $$i $$b; \
200 else \
201 echo $(INSTALL_DATA) $$i $$b; \
202 $(INSTALL_DATA) $$i $$b; \
203 fi;; \
204 esac; \
205 done; \
206 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000207
Jack Jansen7d996a22002-11-11 00:05:00 +0000208 $(INSTALL_DATA) $(PTHFILE) $(LIBDEST)/site-packages/
Jack Jansen45c8e922002-08-09 14:15:46 +0000209
Jack Jansen04087b52003-02-25 12:41:10 +0000210 $(BUILDPYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST)
211 $(BUILDPYTHON) -Wi -tt $(compileall) -x badsyntax $(MACTOOLSDEST)
212 $(BUILDPYTHON) -O -Wi -tt $(compileall) -x badsyntax $(MACTOOLSDEST)
Jack Jansen45c8e922002-08-09 14:15:46 +0000213
Jack Jansen7d996a22002-11-11 00:05:00 +0000214#
215# We use the full name here in stead of $(INSTALLED_PYTHONW), because
216# the latter may be overridden by Makefile.jaguar when building for a pre-installed
217# /usr/bin/python
218$(APPINSTALLDIR)/Contents/MacOS/python: install_Python
Jack Jansencce7e342002-07-31 14:46:04 +0000219
Jack Jansencb4321e2002-08-09 00:18:21 +0000220# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
221# At least this rule will give an error if it doesn't exist.
222
Jack Jansen94fab762002-09-02 12:29:11 +0000223installunixtools: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW)
Jack Jansencb4321e2002-08-09 00:18:21 +0000224 $(INSTALL) -d $(bindir)
Jack Jansen50abec82003-01-28 21:45:44 +0000225 $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(bindir)/python$(VERSION)
226 $(INSTALL_SYMLINK) python$(VERSION) $(bindir)/python
Jack Jansen94fab762002-09-02 12:29:11 +0000227 echo "#!/bin/sh" > pythonw.sh
228 echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh
Jack Jansen50abec82003-01-28 21:45:44 +0000229 $(INSTALL) pythonw.sh $(bindir)/pythonw$(VERSION)
230 $(INSTALL_SYMLINK) pythonw$(VERSION) $(bindir)/pythonw