blob: e5ad5c458792fb8d4c1a02fa6aa2fe8c1a5ab0bc [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 Jansencce7e342002-07-31 14:46:04 +000049
Jack Jansen76a6ab62002-09-12 22:19:23 +000050installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE install_IDLE
Jack Jansencce7e342002-07-31 14:46:04 +000051
52install_PythonLauncher:
Jack Jansenbe3e1f72002-08-01 21:14:06 +000053 cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \
Jack Jansen1ebcc442002-11-20 14:06:16 +000054 pbxbuild -target PythonLauncher -buildstyle Deployment \
55 DSTROOT=$(dstroot) INSTALL_PATH=$(PYTHONAPPSPATH) install
Jack Jansencce7e342002-07-31 14:46:04 +000056
Jack Jansen21ed16a2002-08-02 14:11:24 +000057install_Python: $(PYTHON)
Jack Jansencce7e342002-07-31 14:46:04 +000058 @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \
Jack Jansen638e5e32001-09-06 16:33:57 +000059 if test ! -d $$i; then \
60 echo "Creating directory $$i"; \
61 $(INSTALL) -d -m $(DIRMODE) $$i; \
62 fi;\
63 done
64 @for i in $(APPSUBDIRS); do \
65 if test ! -d $(APPINSTALLDIR)/Contents/$$i; then \
66 echo "Creating directory $(APPINSTALLDIR)/Contents/$$i"; \
67 $(INSTALL) -d -m $(DIRMODE) $(APPINSTALLDIR)/Contents/$$i; \
68 else true; \
69 fi; \
70 done
71 @for d in . $(APPSUBDIRS); \
72 do \
73 a=$(APPTEMPLATE)/$$d; \
74 if test ! -d $$a; then continue; else true; fi; \
75 b=$(APPINSTALLDIR)/Contents/$$d; \
76 for i in $$a/*; \
77 do \
Jack Jansen638e5e32001-09-06 16:33:57 +000078 case $$i in \
79 *CVS) ;; \
80 *.py[co]) ;; \
81 *.orig) ;; \
82 *~) ;; \
83 *) \
84 if test -d $$i; then continue; fi; \
85 if test -x $$i; then \
86 echo $(INSTALL_SCRIPT) $$i $$b; \
87 $(INSTALL_SCRIPT) $$i $$b; \
88 else \
89 echo $(INSTALL_DATA) $$i $$b; \
90 $(INSTALL_DATA) $$i $$b; \
91 fi;; \
92 esac; \
93 done; \
94 done
Jack Jansen21ed16a2002-08-02 14:11:24 +000095 $(INSTALL_PROGRAM) $(STRIPFLAG) $(PYTHON) $(APPINSTALLDIR)/Contents/MacOS/python
Jack Jansen4684a092002-08-28 21:27:02 +000096# Finally create the documentation symlink
97 $(LN) -fsn ../../../../English.lproj/Documentation $(APPINSTALLDIR)/Contents/Resources/English.lproj/Documentation
98
Jack Jansencce7e342002-07-31 14:46:04 +000099
100install_IDE: $(INSTALLED_PYTHONW)
Jack Jansen7d996a22002-11-11 00:05:00 +0000101 @if ! $(INSTALLED_PYTHONW) -c "import waste"; then \
Jack Jansenf80798b2002-08-02 21:04:46 +0000102 echo PythonIDE needs the \"waste\" extension module; \
103 echo See Mac/OSX/README for details; \
Jack Jansen7d996a22002-11-11 00:05:00 +0000104 else \
105 echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
106 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
107 $(srcdir)/Mac/Tools/IDE/PythonIDE.py ; \
108 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
109 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
110 $(srcdir)/Mac/Tools/IDE/PythonIDE.py; \
Jack Jansenf80798b2002-08-02 21:04:46 +0000111 fi
Jack Jansen76a6ab62002-09-12 22:19:23 +0000112
113install_IDLE: $(INSTALLED_PYTHONW)
114 @if ! $(INSTALLED_PYTHONW) -c "import _tkinter"; then \
115 echo IDLE needs the \"Tkinter\" extension module; \
116 echo See Mac/OSX/README for details; \
117 else \
118 echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
119 --output $(PYTHONAPPSDIR)/IDLE.app \
120 --extra $(srcdir)/Tools/idle \
121 $(srcdir)/Tools/idle/idle ; \
122 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
123 --output $(PYTHONAPPSDIR)/IDLE.app \
124 --extra $(srcdir)/Tools/idle \
125 $(srcdir)/Tools/idle/idle ; \
126 echo mv $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idle \
127 $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idlelib; \
128 mv $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idle \
129 $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idlelib; \
130 fi
131
Jack Jansen638e5e32001-09-06 16:33:57 +0000132
Jack Jansen940e9702002-08-02 15:32:12 +0000133install_BuildApplet: $(INSTALLED_PYTHONW)
134 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
135 --output $(PYTHONAPPSDIR)/BuildApplet.app \
136 $(srcdir)/Mac/scripts/BuildApplet.py
137
Jack Jansen83f898c2002-12-30 22:23:40 +0000138MACLIBDEST=$(LIBDEST)/plat-mac
Jack Jansen45c8e922002-08-09 14:15:46 +0000139MACTOOLSDEST=$(prefix)/Mac/Tools
140MACTOOLSSRC=$(srcdir)/Mac/Tools
141MACTOOLSSUBDIRS=IDE
Jack Jansen94fab762002-09-02 12:29:11 +0000142installmacsubtree:
Jack Jansen83f898c2002-12-30 22:23:40 +0000143 @for i in $(MACTOOLSDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000144 do \
145 if test ! -d $$i; then \
146 echo "Creating directory $$i"; \
147 $(INSTALL) -d -m $(DIRMODE) $$i; \
148 else true; \
149 fi; \
150 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000151 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000152 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000153 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000154 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000155 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000156 if test ! -d $$b; then \
157 echo "Creating directory $$b"; \
158 $(INSTALL) -d -m $(DIRMODE) $$b; \
159 else true; \
160 fi; \
161 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000162 @for d in $(MACTOOLSSUBDIRS); \
Jack Jansenc71efe02002-01-21 22:51:55 +0000163 do \
Jack Jansen45c8e922002-08-09 14:15:46 +0000164 a=$(MACTOOLSSRC)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000165 if test ! -d $$a; then continue; else true; fi; \
Jack Jansen45c8e922002-08-09 14:15:46 +0000166 b=$(MACTOOLSDEST)/$$d; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000167 for i in $$a/*; \
168 do \
169 case $$i in \
170 *CVS) ;; \
171 *.py[co]) ;; \
172 *.orig) ;; \
173 *~) ;; \
Jack Jansen81204152002-08-15 21:31:18 +0000174 *.rsrc) \
175 echo $(CPMAC) $$i $$b ; \
176 $(CPMAC) $$i $$b ; \
177 ;; \
Jack Jansenc71efe02002-01-21 22:51:55 +0000178 *) \
179 if test -d $$i; then continue; fi; \
180 if test -x $$i; then \
181 echo $(INSTALL_SCRIPT) $$i $$b; \
182 $(INSTALL_SCRIPT) $$i $$b; \
183 else \
184 echo $(INSTALL_DATA) $$i $$b; \
185 $(INSTALL_DATA) $$i $$b; \
186 fi;; \
187 esac; \
188 done; \
189 done
Jack Jansen45c8e922002-08-09 14:15:46 +0000190
Jack Jansen7d996a22002-11-11 00:05:00 +0000191 $(INSTALL_DATA) $(PTHFILE) $(LIBDEST)/site-packages/
Jack Jansen45c8e922002-08-09 14:15:46 +0000192
193 $(PYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST)
Jack Jansen83f898c2002-12-30 22:23:40 +0000194 $(PYTHON) -Wi -tt $(compileall) -x badsyntax $(MACTOOLSDEST)
195 $(PYTHON) -O -Wi -tt $(compileall) -x badsyntax $(MACTOOLSDEST)
Jack Jansen45c8e922002-08-09 14:15:46 +0000196
Jack Jansen7d996a22002-11-11 00:05:00 +0000197#
198# We use the full name here in stead of $(INSTALLED_PYTHONW), because
199# the latter may be overridden by Makefile.jaguar when building for a pre-installed
200# /usr/bin/python
201$(APPINSTALLDIR)/Contents/MacOS/python: install_Python
Jack Jansencce7e342002-07-31 14:46:04 +0000202
Jack Jansencb4321e2002-08-09 00:18:21 +0000203# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
204# At least this rule will give an error if it doesn't exist.
205
Jack Jansen94fab762002-09-02 12:29:11 +0000206installunixtools: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW)
Jack Jansencb4321e2002-08-09 00:18:21 +0000207 $(INSTALL) -d $(bindir)
Jack Jansen50abec82003-01-28 21:45:44 +0000208 $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(bindir)/python$(VERSION)
209 $(INSTALL_SYMLINK) python$(VERSION) $(bindir)/python
Jack Jansen94fab762002-09-02 12:29:11 +0000210 echo "#!/bin/sh" > pythonw.sh
211 echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh
Jack Jansen50abec82003-01-28 21:45:44 +0000212 $(INSTALL) pythonw.sh $(bindir)/pythonw$(VERSION)
213 $(INSTALL_SYMLINK) pythonw$(VERSION) $(bindir)/pythonw