blob: d12adccbdb117ccca733dd0c8dd9ca2d986090cc [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@
Thomas Wouters73e5a5b2006-06-08 15:35:45 +00006builddir = ..
7srcdir=@srcdir@
Thomas Wouters0e3f5912006-08-11 14:57:12 +00008prefix=@prefix@
Thomas Wouters477c8d52006-05-27 19:21:47 +00009LIBDEST=$(prefix)/lib/python$(VERSION)
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000010RUNSHARED=@RUNSHARED@
11BUILDEXE=@BUILDEXEEXT@
12BUILDPYTHON=$(builddir)/python$(BUILDEXE)
Thomas Wouters477c8d52006-05-27 19:21:47 +000013DESTDIR=
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000014LDFLAGS=@LDFLAGS@
15FRAMEWORKUNIXTOOLSPREFIX=@FRAMEWORKUNIXTOOLSPREFIX@
Christian Heimes81ee3ef2008-05-04 22:42:01 +000016PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
17
Thomas Wouters477c8d52006-05-27 19:21:47 +000018
19# These are normally glimpsed from the previous set
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000020bindir=$(prefix)/bin
Christian Heimes81ee3ef2008-05-04 22:42:01 +000021PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION)
Thomas Wouters477c8d52006-05-27 19:21:47 +000022APPINSTALLDIR=$(prefix)/Resources/Python.app
23
24# Variables for installing the "normal" unix binaries
Christian Heimes81ee3ef2008-05-04 22:42:01 +000025INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)
Thomas Wouters477c8d52006-05-27 19:21:47 +000026
27# Items more-or-less copied from the main Makefile
28DIRMODE=755
29FILEMODE=644
30INSTALL=@INSTALL@
31INSTALL_SYMLINK=ln -fsn
32INSTALL_PROGRAM=@INSTALL_PROGRAM@
33INSTALL_SCRIPT= @INSTALL_SCRIPT@
34INSTALL_DATA=@INSTALL_DATA@
35LN=@LN@
36STRIPFLAG=-s
37CPMAC=/Developer/Tools/CpMac
38
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000039APPTEMPLATE=$(srcdir)/Resources/app
Thomas Wouters477c8d52006-05-27 19:21:47 +000040APPSUBDIRS=MacOS Resources Resources/English.lproj \
41 Resources/English.lproj/Documentation \
42 Resources/English.lproj/Documentation/doc \
43 Resources/English.lproj/Documentation/ide
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000044DOCDIR=$(srcdir)/Resources/app/Resources/English.lproj/Documentation
Thomas Wouters477c8d52006-05-27 19:21:47 +000045DOCINDEX=$(DOCDIR)/"Documentation idx"
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000046compileall=$(srcdir)/../Lib/compileall.py
Thomas Wouters477c8d52006-05-27 19:21:47 +000047
Benjamin Petersonde9c8692008-07-01 18:23:09 +000048installapps: install_PythonLauncher install_IDLE checkapplepython install_pythonw \
49 install_versionedtools
Thomas Wouters477c8d52006-05-27 19:21:47 +000050
Georg Brandlfcaf9102008-07-16 02:17:56 +000051installapps4way: install_Python4way install_BuildApplet install_PythonLauncher install_IDLE install_pythonw4way install_versionedtools
52
53
Thomas Wouters477c8d52006-05-27 19:21:47 +000054install_pythonw: pythonw
55 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
56 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
57 ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python"
58 ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw"
59
Georg Brandlfcaf9102008-07-16 02:17:56 +000060
61# Install 3 variants of python/pythonw:
62# - 32-bit (i386 and ppc)
63# - 64-bit (x86_64 and ppc64)
64# - all (all four architectures)
65# - Make 'python' and 'pythonw' aliases for the 32-bit variant
66install_pythonw4way: pythonw-32 pythonw-64 pythonw
67 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-64 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-64"
68 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-64 "$(DESTDIR)$(prefix)/bin/python$(VERSION)-64"
69 ln -sf python$(VERSION)-64 "$(DESTDIR)$(prefix)/bin/python-64"
70 ln -sf pythonw$(VERSION)-64 "$(DESTDIR)$(prefix)/bin/pythonw-64"
71
72 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-32 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-32"
73 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-32 "$(DESTDIR)$(prefix)/bin/python$(VERSION)-32"
74 ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python-32"
75 ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw-32"
76
77 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-all"
78 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)-all"
79 ln -sf python$(VERSION)-all "$(DESTDIR)$(prefix)/bin/python-all"
80 ln -sf pythonw$(VERSION)-all "$(DESTDIR)$(prefix)/bin/pythonw-all"
81
82 ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
83 ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
84 ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw"
85 ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python"
86
Thomas Wouters477c8d52006-05-27 19:21:47 +000087#
88# Install unix tools in /usr/local/bin. These are just aliases for the
89# actual installation inside the framework.
90#
91installunixtools:
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000092 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
93 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +000094 fi
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000095 for fn in python pythonw idle pydoc python-config smtpd.py \
96 python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
Georg Brandlfcaf9102008-07-16 02:17:56 +000097 pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +000098 do \
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000099 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +0000100 done
101
Georg Brandlfcaf9102008-07-16 02:17:56 +0000102
103# TODO: install symlinks for -32, -64 and -all as well
104installunixtools4way: installunixtools
105
106
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000107#
108# Like installunixtools, but only install links to the versioned binaries.
109#
110altinstallunixtools:
111 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
112 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
113 fi
114 for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
Georg Brandlfcaf9102008-07-16 02:17:56 +0000115 pydoc$(VERSION) python$(VERSION)-config) smtpd$(VERSION).py ;\
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000116 do \
117 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
118 done
119
Georg Brandlfcaf9102008-07-16 02:17:56 +0000120# TODO: -32, -64 and -all variants
121altinstallunixtools4way: altinstallunixtools
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000122
Thomas Wouters477c8d52006-05-27 19:21:47 +0000123# By default most tools are installed without a version in their basename, to
124# make it easier to install (and use) several python versions side-by-side move
125# the tools to a version-specific name and add the non-versioned name as an
126# alias.
127install_versionedtools:
Georg Brandlfcaf9102008-07-16 02:17:56 +0000128 for fn in idle pydoc ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +0000129 do \
130 if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \
131 continue ;\
132 fi ;\
133 mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\
134 ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\
135 done
Georg Brandlfcaf9102008-07-16 02:17:56 +0000136 if [ ! -h "$(DESTDIR)$(prefix)/bin/python-config" ]; then \
137 mv "$(DESTDIR)$(prefix)/bin/python-config" "$(DESTDIR)$(prefix)/bin/python$(VERSION)-config" ;\
138 ln -sf "python$(VERSION)-config" "$(DESTDIR)$(prefix)/bin/python-config" ; \
139 fi
Thomas Wouters477c8d52006-05-27 19:21:47 +0000140 if [ ! -h "$(DESTDIR)$(prefix)/bin/smtpd.py" ]; then \
141 mv "$(DESTDIR)$(prefix)/bin/smtpd.py" "$(DESTDIR)$(prefix)/bin/smtpd$(VERSION).py" ;\
142 ln -sf "smtpd$(VERSION).py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\
143 fi
144
145
Thomas Wouters89f507f2006-12-13 04:49:30 +0000146pythonw: $(srcdir)/Tools/pythonw.c Makefile
Thomas Wouters477c8d52006-05-27 19:21:47 +0000147 $(CC) $(LDFLAGS) -o $@ $(srcdir)/Tools/pythonw.c \
Christian Heimes81ee3ef2008-05-04 22:42:01 +0000148 -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"'
Thomas Wouters477c8d52006-05-27 19:21:47 +0000149
Georg Brandlfcaf9102008-07-16 02:17:56 +0000150pythonw-32: $(srcdir)/Tools/pythonw.c Makefile
151 $(CC) $(LDFLAGS) -o $@ -arch i386 -arch ppc $(srcdir)/Tools/pythonw.c \
152 -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32"'
153
154pythonw-64: $(srcdir)/Tools/pythonw.c Makefile
155 $(CC) $(LDFLAGS) -o $@ -arch x86_64 -arch ppc64 $(srcdir)/Tools/pythonw.c \
156 -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64"'
Thomas Wouters477c8d52006-05-27 19:21:47 +0000157
158install_PythonLauncher:
159 cd PythonLauncher && make install DESTDIR=$(DESTDIR)
160
161install_Python:
162 @if test ! -f $(DOCINDEX); then \
163 echo WARNING: you should run Apple Help Indexing Tool on $(DOCDIR); \
164 fi
165 @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \
166 if test ! -d "$(DESTDIR)$$i"; then \
167 echo "Creating directory $(DESTDIR)$$i"; \
168 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \
169 fi;\
170 done
171 @for i in $(APPSUBDIRS); do \
172 if test ! -d "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; then \
173 echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
174 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
175 else true; \
176 fi; \
177 done
178 @for d in . $(APPSUBDIRS); \
179 do \
180 a=$(APPTEMPLATE)/$$d; \
181 if test ! -d $$a; then continue; else true; fi; \
182 b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \
183 for i in $$a/*; \
184 do \
185 case $$i in \
186 *CVS) ;; \
187 *.svn) ;; \
188 *.py[co]) ;; \
189 *.orig) ;; \
190 *~) ;; \
191 *idx) \
192 echo $(CPMAC) "$$i" $$b; \
193 $(CPMAC) "$$i" "$$b"; \
194 ;; \
195 *) \
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
Christian Heimes81ee3ef2008-05-04 22:42:01 +0000207 $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000208
Georg Brandlfcaf9102008-07-16 02:17:56 +0000209install_Python4way: install_Python
210 lipo -extract i386 -extract ppc7400 -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
211 lipo -extract x86_64 -extract ppc64 -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
212
213
214
Thomas Wouters477c8d52006-05-27 19:21:47 +0000215install_IDLE:
Benjamin Petersonde9c8692008-07-01 18:23:09 +0000216 test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)"
217 -test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -r "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
218 cp -PR IDLE/IDLE.app "$(DESTDIR)$(PYTHONAPPSDIR)"
Benjamin Petersonbbea7972008-07-05 22:51:21 +0000219 ln -sf $(INSTALLED_PYTHONAPP) "$(DESDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python"
Benjamin Petersonde9c8692008-07-01 18:23:09 +0000220 touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000221
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000222$(INSTALLED_PYTHONAPP): install_Python
Thomas Wouters477c8d52006-05-27 19:21:47 +0000223
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000224installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py
Thomas Wouters477c8d52006-05-27 19:21:47 +0000225 $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras"
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000226 $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
227 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000228 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo"
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000229 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/Demo \
230 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000231
232
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000233checkapplepython: $(srcdir)/Tools/fixapplepython23.py
234 @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000235 echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000236 echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000237 fi
238
239
240clean:
241 rm pythonw
242 cd PythonLauncher && make clean
Thomas Wouters89f507f2006-12-13 04:49:30 +0000243
244Makefile: $(srcdir)/Makefile.in ../config.status
245 cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status