blob: e079ba78fce2efe0b35392e798ff723c2e26fe5f [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 Jansen82f1d2c2003-03-11 23:07:08 +000046APPSUBDIRS=MacOS Resources Resources/English.lproj \
47 Resources/English.lproj/Documentation \
48 Resources/English.lproj/Documentation/doc \
49 Resources/English.lproj/Documentation/macpython_ide_tutorial
50DOCDIR=$(srcdir)/Mac/OSXResources/app/Resources/English.lproj/Documentation
51DOCINDEX=$(DOCDIR)/"Documentation idx"
Jack Jansen45c8e922002-08-09 14:15:46 +000052CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py
Jack Jansen7d996a22002-11-11 00:05:00 +000053compileall=$(srcdir)/Lib/compileall.py
Jack Jansend7800362003-02-12 15:42:49 +000054bundlebuilder=$(srcdir)/Lib/plat-mac/bundlebuilder.py
Jack Jansencce7e342002-07-31 14:46:04 +000055
Jack Jansen4ccf3e12003-02-18 23:33:39 +000056installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE \
57 install_IDLE install_PackageManager
Jack Jansencce7e342002-07-31 14:46:04 +000058
59install_PythonLauncher:
Jack Jansenbe3e1f72002-08-01 21:14:06 +000060 cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \
Jack Jansen1ebcc442002-11-20 14:06:16 +000061 pbxbuild -target PythonLauncher -buildstyle Deployment \
62 DSTROOT=$(dstroot) INSTALL_PATH=$(PYTHONAPPSPATH) install
Jack Jansencce7e342002-07-31 14:46:04 +000063
Jack Jansen04087b52003-02-25 12:41:10 +000064install_Python:
Jack Jansen82f1d2c2003-03-11 23:07:08 +000065 @if test ! -f $(DOCINDEX); then \
66 echo WARNING: you should run Apple Help Indexing Tool on $(DOCDIR); \
67 fi
Jack Jansencce7e342002-07-31 14:46:04 +000068 @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \
Jack Jansen638e5e32001-09-06 16:33:57 +000069 if test ! -d $$i; then \
70 echo "Creating directory $$i"; \
71 $(INSTALL) -d -m $(DIRMODE) $$i; \
72 fi;\
73 done
74 @for i in $(APPSUBDIRS); do \
75 if test ! -d $(APPINSTALLDIR)/Contents/$$i; then \
76 echo "Creating directory $(APPINSTALLDIR)/Contents/$$i"; \
77 $(INSTALL) -d -m $(DIRMODE) $(APPINSTALLDIR)/Contents/$$i; \
78 else true; \
79 fi; \
80 done
81 @for d in . $(APPSUBDIRS); \
82 do \
83 a=$(APPTEMPLATE)/$$d; \
84 if test ! -d $$a; then continue; else true; fi; \
85 b=$(APPINSTALLDIR)/Contents/$$d; \
86 for i in $$a/*; \
87 do \
Jack Jansen638e5e32001-09-06 16:33:57 +000088 case $$i in \
89 *CVS) ;; \
90 *.py[co]) ;; \
91 *.orig) ;; \
92 *~) ;; \
Jack Jansen82f1d2c2003-03-11 23:07:08 +000093 *idx) \
94 echo $(CPMAC) "$$i" $$b; \
95 $(CPMAC) "$$i" $$b; \
96 ;; \
Jack Jansen638e5e32001-09-06 16:33:57 +000097 *) \
98 if test -d $$i; then continue; fi; \
99 if test -x $$i; then \
100 echo $(INSTALL_SCRIPT) $$i $$b; \
101 $(INSTALL_SCRIPT) $$i $$b; \
102 else \
103 echo $(INSTALL_DATA) $$i $$b; \
104 $(INSTALL_DATA) $$i $$b; \
105 fi;; \
106 esac; \
107 done; \
108 done
Jack Jansen82f1d2c2003-03-11 23:07:08 +0000109 $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) $(APPINSTALLDIR)/Contents/MacOS/python
Jack Jansencce7e342002-07-31 14:46:04 +0000110
111install_IDE: $(INSTALLED_PYTHONW)
Jack Jansen7d996a22002-11-11 00:05:00 +0000112 @if ! $(INSTALLED_PYTHONW) -c "import waste"; then \
Jack Jansenf80798b2002-08-02 21:04:46 +0000113 echo PythonIDE needs the \"waste\" extension module; \
114 echo See Mac/OSX/README for details; \
Jack Jansen7d996a22002-11-11 00:05:00 +0000115 else \
Jack Jansen4ccf3e12003-02-18 23:33:39 +0000116 echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
117 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
118 $(srcdir)/Mac/Tools/IDE/PythonIDE.py ; \
119 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
120 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
121 $(srcdir)/Mac/Tools/IDE/PythonIDE.py; \
Jack Jansend7800362003-02-12 15:42:49 +0000122 fi
123
124install_PackageManager: $(INSTALLED_PYTHONW)
125 @if ! $(INSTALLED_PYTHONW) -c "import waste"; then \
126 echo PackageManager needs the \"waste\" extension module; \
127 echo See Mac/OSX/README for details; \
128 else \
129 echo $(INSTALLED_PYTHONW) $(bundlebuilder) \
130 --builddir $(PYTHONAPPSDIR)/ \
131 --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \
132 --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \
133 --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \
134 --creator Pimp build; \
135 $(INSTALLED_PYTHONW) $(bundlebuilder) \
136 --builddir $(PYTHONAPPSDIR)/ \
137 --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \
138 --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \
139 --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \
140 --creator Pimp build; \
Jack Jansenf80798b2002-08-02 21:04:46 +0000141 fi
Jack Jansen76a6ab62002-09-12 22:19:23 +0000142
143install_IDLE: $(INSTALLED_PYTHONW)
144 @if ! $(INSTALLED_PYTHONW) -c "import _tkinter"; then \
145 echo IDLE needs the \"Tkinter\" extension module; \
146 echo See Mac/OSX/README for details; \
147 else \
148 echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
149 --output $(PYTHONAPPSDIR)/IDLE.app \
150 --extra $(srcdir)/Tools/idle \
151 $(srcdir)/Tools/idle/idle ; \
152 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
153 --output $(PYTHONAPPSDIR)/IDLE.app \
Jack Jansenec43f642003-02-24 16:30:24 +0000154 --extra $(srcdir)/Tools/idle:Contents/Resources/idlelib \
Jack Jansen76a6ab62002-09-12 22:19:23 +0000155 $(srcdir)/Tools/idle/idle ; \
Jack Jansen76a6ab62002-09-12 22:19:23 +0000156 fi
157
Jack Jansen638e5e32001-09-06 16:33:57 +0000158
Jack Jansen940e9702002-08-02 15:32:12 +0000159install_BuildApplet: $(INSTALLED_PYTHONW)
160 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
161 --output $(PYTHONAPPSDIR)/BuildApplet.app \
162 $(srcdir)/Mac/scripts/BuildApplet.py
163
Jack Jansen83f898c2002-12-30 22:23:40 +0000164MACLIBDEST=$(LIBDEST)/plat-mac
Jack Jansen45c8e922002-08-09 14:15:46 +0000165MACTOOLSDEST=$(prefix)/Mac/Tools
166MACTOOLSSRC=$(srcdir)/Mac/Tools
167MACTOOLSSUBDIRS=IDE
Jack Jansen94fab762002-09-02 12:29:11 +0000168installmacsubtree:
Jack Jansen83f898c2002-12-30 22:23:40 +0000169 @for i in $(MACTOOLSDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000170 do \
171 if test ! -d $$i; then \
172 echo "Creating directory $$i"; \
173 $(INSTALL) -d -m $(DIRMODE) $$i; \
174 else true; \
175 fi; \
176 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000177 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000178 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000179 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000180 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000181 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000182 if test ! -d $$b; then \
183 echo "Creating directory $$b"; \
184 $(INSTALL) -d -m $(DIRMODE) $$b; \
185 else true; \
186 fi; \
187 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000188 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000189 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000190 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000191 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000192 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000193 for i in $$a/*; \
194 do \
195 case $$i in \
196 *CVS) ;; \
197 *.py[co]) ;; \
198 *.orig) ;; \
199 *~) ;; \
Jack Jansen81204152002-08-15 21:31:18 +0000200 *.rsrc) \
201 echo $(CPMAC) $$i $$b ; \
202 $(CPMAC) $$i $$b ; \
203 ;; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000204 *) \
205 if test -d $$i; then continue; fi; \
206 if test -x $$i; then \
207 echo $(INSTALL_SCRIPT) $$i $$b; \
208 $(INSTALL_SCRIPT) $$i $$b; \
209 else \
210 echo $(INSTALL_DATA) $$i $$b; \
211 $(INSTALL_DATA) $$i $$b; \
212 fi;; \
213 esac; \
214 done; \
215 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000216
Jack Jansen7d996a22002-11-11 00:05:00 +0000217 $(INSTALL_DATA) $(PTHFILE) $(LIBDEST)/site-packages/
Jack Jansen45c8e922002-08-09 14:15:46 +0000218
Jack Jansen04087b52003-02-25 12:41:10 +0000219 $(BUILDPYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST)
220 $(BUILDPYTHON) -Wi -tt $(compileall) -x badsyntax $(MACTOOLSDEST)
221 $(BUILDPYTHON) -O -Wi -tt $(compileall) -x badsyntax $(MACTOOLSDEST)
Jack Jansen45c8e922002-08-09 14:15:46 +0000222
Jack Jansen7d996a22002-11-11 00:05:00 +0000223#
224# We use the full name here in stead of $(INSTALLED_PYTHONW), because
225# the latter may be overridden by Makefile.jaguar when building for a pre-installed
226# /usr/bin/python
227$(APPINSTALLDIR)/Contents/MacOS/python: install_Python
Jack Jansencce7e342002-07-31 14:46:04 +0000228
Jack Jansencb4321e2002-08-09 00:18:21 +0000229# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
230# At least this rule will give an error if it doesn't exist.
231
Jack Jansen94fab762002-09-02 12:29:11 +0000232installunixtools: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW)
Jack Jansencb4321e2002-08-09 00:18:21 +0000233 $(INSTALL) -d $(bindir)
Jack Jansen50abec82003-01-28 21:45:44 +0000234 $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(bindir)/python$(VERSION)
235 $(INSTALL_SYMLINK) python$(VERSION) $(bindir)/python
Jack Jansen94fab762002-09-02 12:29:11 +0000236 echo "#!/bin/sh" > pythonw.sh
237 echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh
Jack Jansen50abec82003-01-28 21:45:44 +0000238 $(INSTALL) pythonw.sh $(bindir)/pythonw$(VERSION)
239 $(INSTALL_SYMLINK) pythonw$(VERSION) $(bindir)/pythonw