blob: a44191d055e895fe5013ae3f26d390e310059dff [file] [log] [blame]
Thomas Wouters477c8d52006-05-27 19:21:47 +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
3# commandline in that case.
4
5VERSION=@VERSION@
6builddir = ../..
7srcdir = @srcdir@
8prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION)
9LIBDEST=$(prefix)/lib/python$(VERSION)
10BUILDPYTHON=$(builddir)/python.exe
11DESTDIR=
12
13# These are normally glimpsed from the previous set
14bindir=@exec_prefix@/bin
15PYTHONAPPSDIR=/Applications/MacPython $(VERSION)
16APPINSTALLDIR=$(prefix)/Resources/Python.app
17
18# Variables for installing the "normal" unix binaries
19INSTALLED_PYDOC=$(prefix)/bin/pydoc
20INSTALLED_IDLE=$(prefix)/bin/idle
21INSTALLED_PYTHON=$(prefix)/bin/python
22INSTALLED_PYTHONW=$(prefix)/bin/pythonw
23INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/Python
24
25# Items more-or-less copied from the main Makefile
26DIRMODE=755
27FILEMODE=644
28INSTALL=@INSTALL@
29INSTALL_SYMLINK=ln -fsn
30INSTALL_PROGRAM=@INSTALL_PROGRAM@
31INSTALL_SCRIPT= @INSTALL_SCRIPT@
32INSTALL_DATA=@INSTALL_DATA@
33LN=@LN@
34STRIPFLAG=-s
35CPMAC=/Developer/Tools/CpMac
36
37APPTEMPLATE=$(srcdir)/../OSXResources/app
38APPSUBDIRS=MacOS Resources Resources/English.lproj \
39 Resources/English.lproj/Documentation \
40 Resources/English.lproj/Documentation/doc \
41 Resources/English.lproj/Documentation/ide
42DOCDIR=$(srcdir)/../OSXResources/app/Resources/English.lproj/Documentation
43DOCINDEX=$(DOCDIR)/"Documentation idx"
44CACHERSRC=$(srcdir)/../scripts/cachersrc.py
45compileall=$(srcdir)/../../Lib/compileall.py
46
47installapps: install_Python install_BuildApplet install_PythonLauncher \
48 install_IDLE checkapplepython install_pythonw install_versionedtools
49
50install_pythonw: pythonw
51 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
52 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
53 ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python"
54 ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw"
55
56#
57# Install unix tools in /usr/local/bin. These are just aliases for the
58# actual installation inside the framework.
59#
60installunixtools:
61 if [ ! -d "$(DESTDIR)/usr/local/bin" ]; then \
62 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)/usr/local/bin" ;\
63 fi
64 for fn in `ls "$(DESTDIR)$(prefix)/bin/"` ; \
65 do \
66 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)/usr/local/bin/$${fn}" ;\
67 done
68
69# By default most tools are installed without a version in their basename, to
70# make it easier to install (and use) several python versions side-by-side move
71# the tools to a version-specific name and add the non-versioned name as an
72# alias.
73install_versionedtools:
74 for fn in idle pydoc python-config ;\
75 do \
76 if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \
77 continue ;\
78 fi ;\
79 mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\
80 ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\
81 done
82 if [ ! -h "$(DESTDIR)$(prefix)/bin/smtpd.py" ]; then \
83 mv "$(DESTDIR)$(prefix)/bin/smtpd.py" "$(DESTDIR)$(prefix)/bin/smtpd$(VERSION).py" ;\
84 ln -sf "smtpd$(VERSION).py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\
85 fi
86
87
88pythonw: $(srcdir)/Tools/pythonw.c
89 $(CC) $(LDFLAGS) -o $@ $(srcdir)/Tools/pythonw.c \
90 -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/Python"'
91
92
93install_PythonLauncher:
94 cd PythonLauncher && make install DESTDIR=$(DESTDIR)
95
96install_Python:
97 @if test ! -f $(DOCINDEX); then \
98 echo WARNING: you should run Apple Help Indexing Tool on $(DOCDIR); \
99 fi
100 @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \
101 if test ! -d "$(DESTDIR)$$i"; then \
102 echo "Creating directory $(DESTDIR)$$i"; \
103 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \
104 fi;\
105 done
106 @for i in $(APPSUBDIRS); do \
107 if test ! -d "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; then \
108 echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
109 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
110 else true; \
111 fi; \
112 done
113 @for d in . $(APPSUBDIRS); \
114 do \
115 a=$(APPTEMPLATE)/$$d; \
116 if test ! -d $$a; then continue; else true; fi; \
117 b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \
118 for i in $$a/*; \
119 do \
120 case $$i in \
121 *CVS) ;; \
122 *.svn) ;; \
123 *.py[co]) ;; \
124 *.orig) ;; \
125 *~) ;; \
126 *idx) \
127 echo $(CPMAC) "$$i" $$b; \
128 $(CPMAC) "$$i" "$$b"; \
129 ;; \
130 *) \
131 if test -d $$i; then continue; fi; \
132 if test -x $$i; then \
133 echo $(INSTALL_SCRIPT) "$$i" "$$b"; \
134 $(INSTALL_SCRIPT) "$$i" "$$b"; \
135 else \
136 echo $(INSTALL_DATA) "$$i" "$$b"; \
137 $(INSTALL_DATA) "$$i" "$$b"; \
138 fi;; \
139 esac; \
140 done; \
141 done
142 $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/Python"
143
144install_IDLE:
145 cd IDLE && make install
146
147install_BuildApplet:
148 $(BUILDPYTHON) $(srcdir)/../scripts/BuildApplet.py \
149 --destroot "$(DESTDIR)" \
150 --python $(INSTALLED_PYTHONAPP) \
151 --output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \
152 $(srcdir)/../scripts/BuildApplet.py
153
154MACLIBDEST=$(LIBDEST)/plat-mac
155MACTOOLSDEST=$(prefix)/Mac/Tools
156MACTOOLSSRC=$(srcdir)/Mac/Tools
157MACTOOLSSUBDIRS=IDE
158
159installmacsubtree:
160 @for i in $(MACTOOLSDEST); \
161 do \
162 if test ! -d $(DESTDIR)$$i; then \
163 echo "Creating directory $(DESTDIR)$$i"; \
164 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
165 else true; \
166 fi; \
167 done
168 @for d in $(MACTOOLSSUBDIRS); \
169 do \
170 a=$(MACTOOLSSRC)/$$d; \
171 if test ! -d $$a; then continue; else true; fi; \
172 b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
173 if test ! -d $$b; then \
174 echo "Creating directory $$b"; \
175 $(INSTALL) -d -m $(DIRMODE) $$b; \
176 else true; \
177 fi; \
178 done
179 @for d in $(MACTOOLSSUBDIRS); \
180 do \
181 a=$(MACTOOLSSRC)/$$d; \
182 if test ! -d $$a; then continue; else true; fi; \
183 b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
184 for i in $$a/*; \
185 do \
186 case $$i in \
187 *CVS) ;; \
188 *.svn) ;; \
189 *.py[co]) ;; \
190 *.orig) ;; \
191 *~) ;; \
192 *.rsrc) \
193 echo $(CPMAC) $$i $$b ; \
194 $(CPMAC) $$i $$b ; \
195 ;; \
196 *) \
197 if test -d $$i; then continue; fi; \
198 if test -x $$i; then \
199 echo $(INSTALL_SCRIPT) $$i $$b; \
200 $(INSTALL_SCRIPT) $$i $$b; \
201 else \
202 echo $(INSTALL_DATA) $$i $$b; \
203 $(INSTALL_DATA) $$i $$b; \
204 fi;; \
205 esac; \
206 done; \
207 done
208
209
210 $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST)
211 $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
212 $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
213
214#
215# We use the full name here in stead of $(INSTALLED_PYTHONAPP), because
216# the latter may be overridden by Makefile.jaguar when building for a pre-installed
217$(INSTALLED_PYTHONAPP)/Contents/MacOS/Python: install_Python
218
219# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
220# At least this rule will give an error if it doesn't exist.
221
222installextras:
223 $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras"
224 $(INSTALL) $(srcdir)/Mac/OSX/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
225 $(BUILDPYTHON) $(srcdir)/Mac/OSX/Extras.install.py $(srcdir)/Demo \
226 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo"
227
228
229checkapplepython:
230 @if ! $(BUILDPYTHON) $(srcdir)/fixapplepython23.py -n; then \
231 echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \
232 echo "* WARNING: Run $(srcdir)/fixapplepython23.py with \"sudo\" to fix this."; \
233 fi
234
235
236clean:
237 rm pythonw
238 cd PythonLauncher && make clean
239 cd IDLE && make clean
240
241