blob: f83d4156101ac00179923f1cdc7de23442e43caa [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 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 +000044APPTEMPLATE=$(srcdir)/Mac/OSXResources/app
Jack Jansen82f1d2c2003-03-11 23:07:08 +000045APPSUBDIRS=MacOS Resources Resources/English.lproj \
46 Resources/English.lproj/Documentation \
47 Resources/English.lproj/Documentation/doc \
48 Resources/English.lproj/Documentation/macpython_ide_tutorial
49DOCDIR=$(srcdir)/Mac/OSXResources/app/Resources/English.lproj/Documentation
50DOCINDEX=$(DOCDIR)/"Documentation idx"
Jack Jansen45c8e922002-08-09 14:15:46 +000051CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py
Jack Jansen7d996a22002-11-11 00:05:00 +000052compileall=$(srcdir)/Lib/compileall.py
Jack Jansend7800362003-02-12 15:42:49 +000053bundlebuilder=$(srcdir)/Lib/plat-mac/bundlebuilder.py
Jack Jansencce7e342002-07-31 14:46:04 +000054
Jack Jansen4ccf3e12003-02-18 23:33:39 +000055installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE \
56 install_IDLE install_PackageManager
Jack Jansencce7e342002-07-31 14:46:04 +000057
58install_PythonLauncher:
Jack Jansenbe3e1f72002-08-01 21:14:06 +000059 cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \
Jack Jansen1ebcc442002-11-20 14:06:16 +000060 pbxbuild -target PythonLauncher -buildstyle Deployment \
61 DSTROOT=$(dstroot) INSTALL_PATH=$(PYTHONAPPSPATH) install
Jack Jansencce7e342002-07-31 14:46:04 +000062
Jack Jansen04087b52003-02-25 12:41:10 +000063install_Python:
Jack Jansen82f1d2c2003-03-11 23:07:08 +000064 @if test ! -f $(DOCINDEX); then \
65 echo WARNING: you should run Apple Help Indexing Tool on $(DOCDIR); \
66 fi
Jack Jansencce7e342002-07-31 14:46:04 +000067 @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \
Jack Jansen638e5e32001-09-06 16:33:57 +000068 if test ! -d $$i; then \
69 echo "Creating directory $$i"; \
70 $(INSTALL) -d -m $(DIRMODE) $$i; \
71 fi;\
72 done
73 @for i in $(APPSUBDIRS); do \
74 if test ! -d $(APPINSTALLDIR)/Contents/$$i; then \
75 echo "Creating directory $(APPINSTALLDIR)/Contents/$$i"; \
76 $(INSTALL) -d -m $(DIRMODE) $(APPINSTALLDIR)/Contents/$$i; \
77 else true; \
78 fi; \
79 done
80 @for d in . $(APPSUBDIRS); \
81 do \
82 a=$(APPTEMPLATE)/$$d; \
83 if test ! -d $$a; then continue; else true; fi; \
84 b=$(APPINSTALLDIR)/Contents/$$d; \
85 for i in $$a/*; \
86 do \
Jack Jansen638e5e32001-09-06 16:33:57 +000087 case $$i in \
88 *CVS) ;; \
89 *.py[co]) ;; \
90 *.orig) ;; \
91 *~) ;; \
Jack Jansen82f1d2c2003-03-11 23:07:08 +000092 *idx) \
93 echo $(CPMAC) "$$i" $$b; \
94 $(CPMAC) "$$i" $$b; \
95 ;; \
Jack Jansen638e5e32001-09-06 16:33:57 +000096 *) \
97 if test -d $$i; then continue; fi; \
98 if test -x $$i; then \
99 echo $(INSTALL_SCRIPT) $$i $$b; \
100 $(INSTALL_SCRIPT) $$i $$b; \
101 else \
102 echo $(INSTALL_DATA) $$i $$b; \
103 $(INSTALL_DATA) $$i $$b; \
104 fi;; \
105 esac; \
106 done; \
107 done
Jack Jansen82f1d2c2003-03-11 23:07:08 +0000108 $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) $(APPINSTALLDIR)/Contents/MacOS/python
Jack Jansencce7e342002-07-31 14:46:04 +0000109
110install_IDE: $(INSTALLED_PYTHONW)
Jack Jansen7d996a22002-11-11 00:05:00 +0000111 @if ! $(INSTALLED_PYTHONW) -c "import waste"; then \
Jack Jansenf80798b2002-08-02 21:04:46 +0000112 echo PythonIDE needs the \"waste\" extension module; \
113 echo See Mac/OSX/README for details; \
Jack Jansen7d996a22002-11-11 00:05:00 +0000114 else \
Jack Jansen4ccf3e12003-02-18 23:33:39 +0000115 echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
116 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
117 $(srcdir)/Mac/Tools/IDE/PythonIDE.py ; \
118 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
119 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
120 $(srcdir)/Mac/Tools/IDE/PythonIDE.py; \
Jack Jansend7800362003-02-12 15:42:49 +0000121 fi
122
123install_PackageManager: $(INSTALLED_PYTHONW)
124 @if ! $(INSTALLED_PYTHONW) -c "import waste"; then \
125 echo PackageManager needs the \"waste\" extension module; \
126 echo See Mac/OSX/README for details; \
127 else \
128 echo $(INSTALLED_PYTHONW) $(bundlebuilder) \
129 --builddir $(PYTHONAPPSDIR)/ \
130 --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \
131 --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \
132 --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \
133 --creator Pimp build; \
134 $(INSTALLED_PYTHONW) $(bundlebuilder) \
135 --builddir $(PYTHONAPPSDIR)/ \
136 --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \
137 --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \
138 --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \
139 --creator Pimp build; \
Jack Jansenf80798b2002-08-02 21:04:46 +0000140 fi
Jack Jansen76a6ab62002-09-12 22:19:23 +0000141
142install_IDLE: $(INSTALLED_PYTHONW)
143 @if ! $(INSTALLED_PYTHONW) -c "import _tkinter"; then \
144 echo IDLE needs the \"Tkinter\" extension module; \
145 echo See Mac/OSX/README for details; \
146 else \
147 echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
148 --output $(PYTHONAPPSDIR)/IDLE.app \
149 --extra $(srcdir)/Tools/idle \
150 $(srcdir)/Tools/idle/idle ; \
151 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
152 --output $(PYTHONAPPSDIR)/IDLE.app \
Jack Jansenec43f642003-02-24 16:30:24 +0000153 --extra $(srcdir)/Tools/idle:Contents/Resources/idlelib \
Jack Jansen76a6ab62002-09-12 22:19:23 +0000154 $(srcdir)/Tools/idle/idle ; \
Jack Jansen76a6ab62002-09-12 22:19:23 +0000155 fi
156
Jack Jansen638e5e32001-09-06 16:33:57 +0000157
Jack Jansen940e9702002-08-02 15:32:12 +0000158install_BuildApplet: $(INSTALLED_PYTHONW)
159 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
160 --output $(PYTHONAPPSDIR)/BuildApplet.app \
161 $(srcdir)/Mac/scripts/BuildApplet.py
162
Jack Jansen83f898c2002-12-30 22:23:40 +0000163MACLIBDEST=$(LIBDEST)/plat-mac
Jack Jansen45c8e922002-08-09 14:15:46 +0000164MACTOOLSDEST=$(prefix)/Mac/Tools
165MACTOOLSSRC=$(srcdir)/Mac/Tools
166MACTOOLSSUBDIRS=IDE
Jack Jansen94fab762002-09-02 12:29:11 +0000167installmacsubtree:
Jack Jansen83f898c2002-12-30 22:23:40 +0000168 @for i in $(MACTOOLSDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000169 do \
170 if test ! -d $$i; then \
171 echo "Creating directory $$i"; \
172 $(INSTALL) -d -m $(DIRMODE) $$i; \
173 else true; \
174 fi; \
175 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000176 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000177 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000178 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000179 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000180 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000181 if test ! -d $$b; then \
182 echo "Creating directory $$b"; \
183 $(INSTALL) -d -m $(DIRMODE) $$b; \
184 else true; \
185 fi; \
186 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000187 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000188 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000189 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000190 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000191 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000192 for i in $$a/*; \
193 do \
194 case $$i in \
195 *CVS) ;; \
196 *.py[co]) ;; \
197 *.orig) ;; \
198 *~) ;; \
Jack Jansen81204152002-08-15 21:31:18 +0000199 *.rsrc) \
200 echo $(CPMAC) $$i $$b ; \
201 $(CPMAC) $$i $$b ; \
202 ;; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000203 *) \
204 if test -d $$i; then continue; fi; \
205 if test -x $$i; then \
206 echo $(INSTALL_SCRIPT) $$i $$b; \
207 $(INSTALL_SCRIPT) $$i $$b; \
208 else \
209 echo $(INSTALL_DATA) $$i $$b; \
210 $(INSTALL_DATA) $$i $$b; \
211 fi;; \
212 esac; \
213 done; \
214 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000215
Jack Jansen45c8e922002-08-09 14:15:46 +0000216
Jack Jansen04087b52003-02-25 12:41:10 +0000217 $(BUILDPYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST)
218 $(BUILDPYTHON) -Wi -tt $(compileall) -x badsyntax $(MACTOOLSDEST)
219 $(BUILDPYTHON) -O -Wi -tt $(compileall) -x badsyntax $(MACTOOLSDEST)
Jack Jansen45c8e922002-08-09 14:15:46 +0000220
Jack Jansen7d996a22002-11-11 00:05:00 +0000221#
222# We use the full name here in stead of $(INSTALLED_PYTHONW), because
223# the latter may be overridden by Makefile.jaguar when building for a pre-installed
224# /usr/bin/python
225$(APPINSTALLDIR)/Contents/MacOS/python: install_Python
Jack Jansencce7e342002-07-31 14:46:04 +0000226
Jack Jansencb4321e2002-08-09 00:18:21 +0000227# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
228# At least this rule will give an error if it doesn't exist.
229
Jack Jansen94fab762002-09-02 12:29:11 +0000230installunixtools: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW)
Jack Jansencb4321e2002-08-09 00:18:21 +0000231 $(INSTALL) -d $(bindir)
Jack Jansen50abec82003-01-28 21:45:44 +0000232 $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(bindir)/python$(VERSION)
233 $(INSTALL_SYMLINK) python$(VERSION) $(bindir)/python
Jack Jansen94fab762002-09-02 12:29:11 +0000234 echo "#!/bin/sh" > pythonw.sh
235 echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh
Jack Jansen50abec82003-01-28 21:45:44 +0000236 $(INSTALL) pythonw.sh $(bindir)/pythonw$(VERSION)
237 $(INSTALL_SYMLINK) pythonw$(VERSION) $(bindir)/pythonw