blob: e847ba90882608288bab2b81a99f5ed70b703144 [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
Georg Brandl59f8d832008-07-19 09:58:13 +000048installapps: install_Python install_PythonLauncher install_IDLE \
49 checkapplepython install_pythonw install_versionedtools
Thomas Wouters477c8d52006-05-27 19:21:47 +000050
Georg Brandl59f8d832008-07-19 09:58:13 +000051installapps4way: install_Python4way install_PythonLauncher \
52 install_IDLE install_pythonw4way install_versionedtools
Georg Brandlfcaf9102008-07-16 02:17:56 +000053
54
Thomas Wouters477c8d52006-05-27 19:21:47 +000055install_pythonw: pythonw
56 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
57 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
58 ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python"
59 ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw"
60
Georg Brandlfcaf9102008-07-16 02:17:56 +000061
62# Install 3 variants of python/pythonw:
63# - 32-bit (i386 and ppc)
64# - 64-bit (x86_64 and ppc64)
65# - all (all four architectures)
66# - Make 'python' and 'pythonw' aliases for the 32-bit variant
67install_pythonw4way: pythonw-32 pythonw-64 pythonw
68 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-64 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-64"
69 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-64 "$(DESTDIR)$(prefix)/bin/python$(VERSION)-64"
70 ln -sf python$(VERSION)-64 "$(DESTDIR)$(prefix)/bin/python-64"
71 ln -sf pythonw$(VERSION)-64 "$(DESTDIR)$(prefix)/bin/pythonw-64"
72
73 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-32 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-32"
74 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-32 "$(DESTDIR)$(prefix)/bin/python$(VERSION)-32"
75 ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python-32"
76 ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw-32"
77
78 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-all"
79 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)-all"
80 ln -sf python$(VERSION)-all "$(DESTDIR)$(prefix)/bin/python-all"
81 ln -sf pythonw$(VERSION)-all "$(DESTDIR)$(prefix)/bin/pythonw-all"
82
83 ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
84 ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
85 ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw"
86 ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python"
87
Thomas Wouters477c8d52006-05-27 19:21:47 +000088#
89# Install unix tools in /usr/local/bin. These are just aliases for the
90# actual installation inside the framework.
91#
92installunixtools:
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000093 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
94 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +000095 fi
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000096 for fn in python pythonw idle pydoc python-config smtpd.py \
97 python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
Georg Brandlfcaf9102008-07-16 02:17:56 +000098 pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +000099 do \
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000100 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +0000101 done
102
Georg Brandlfcaf9102008-07-16 02:17:56 +0000103
104# TODO: install symlinks for -32, -64 and -all as well
105installunixtools4way: installunixtools
106
107
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000108#
109# Like installunixtools, but only install links to the versioned binaries.
110#
111altinstallunixtools:
112 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
113 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
114 fi
115 for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
Georg Brandl3ccb7872008-07-16 03:00:45 +0000116 pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py ;\
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000117 do \
118 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
119 done
120
Georg Brandlfcaf9102008-07-16 02:17:56 +0000121# TODO: -32, -64 and -all variants
122altinstallunixtools4way: altinstallunixtools
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000123
Thomas Wouters477c8d52006-05-27 19:21:47 +0000124# By default most tools are installed without a version in their basename, to
125# make it easier to install (and use) several python versions side-by-side move
126# the tools to a version-specific name and add the non-versioned name as an
127# alias.
128install_versionedtools:
Georg Brandlfcaf9102008-07-16 02:17:56 +0000129 for fn in idle pydoc ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +0000130 do \
131 if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \
132 continue ;\
133 fi ;\
134 mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\
135 ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\
136 done
Georg Brandlfcaf9102008-07-16 02:17:56 +0000137 if [ ! -h "$(DESTDIR)$(prefix)/bin/python-config" ]; then \
138 mv "$(DESTDIR)$(prefix)/bin/python-config" "$(DESTDIR)$(prefix)/bin/python$(VERSION)-config" ;\
139 ln -sf "python$(VERSION)-config" "$(DESTDIR)$(prefix)/bin/python-config" ; \
140 fi
Thomas Wouters477c8d52006-05-27 19:21:47 +0000141 if [ ! -h "$(DESTDIR)$(prefix)/bin/smtpd.py" ]; then \
142 mv "$(DESTDIR)$(prefix)/bin/smtpd.py" "$(DESTDIR)$(prefix)/bin/smtpd$(VERSION).py" ;\
143 ln -sf "smtpd$(VERSION).py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\
144 fi
145
146
Thomas Wouters89f507f2006-12-13 04:49:30 +0000147pythonw: $(srcdir)/Tools/pythonw.c Makefile
Thomas Wouters477c8d52006-05-27 19:21:47 +0000148 $(CC) $(LDFLAGS) -o $@ $(srcdir)/Tools/pythonw.c \
Christian Heimes81ee3ef2008-05-04 22:42:01 +0000149 -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"'
Thomas Wouters477c8d52006-05-27 19:21:47 +0000150
Georg Brandlfcaf9102008-07-16 02:17:56 +0000151pythonw-32: $(srcdir)/Tools/pythonw.c Makefile
152 $(CC) $(LDFLAGS) -o $@ -arch i386 -arch ppc $(srcdir)/Tools/pythonw.c \
153 -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32"'
154
155pythonw-64: $(srcdir)/Tools/pythonw.c Makefile
156 $(CC) $(LDFLAGS) -o $@ -arch x86_64 -arch ppc64 $(srcdir)/Tools/pythonw.c \
157 -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64"'
Thomas Wouters477c8d52006-05-27 19:21:47 +0000158
159install_PythonLauncher:
160 cd PythonLauncher && make install DESTDIR=$(DESTDIR)
161
162install_Python:
163 @if test ! -f $(DOCINDEX); then \
164 echo WARNING: you should run Apple Help Indexing Tool on $(DOCDIR); \
165 fi
166 @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \
167 if test ! -d "$(DESTDIR)$$i"; then \
168 echo "Creating directory $(DESTDIR)$$i"; \
169 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \
170 fi;\
171 done
172 @for i in $(APPSUBDIRS); do \
173 if test ! -d "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; then \
174 echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
175 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
176 else true; \
177 fi; \
178 done
179 @for d in . $(APPSUBDIRS); \
180 do \
181 a=$(APPTEMPLATE)/$$d; \
182 if test ! -d $$a; then continue; else true; fi; \
183 b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \
184 for i in $$a/*; \
185 do \
186 case $$i in \
187 *CVS) ;; \
188 *.svn) ;; \
189 *.py[co]) ;; \
190 *.orig) ;; \
191 *~) ;; \
192 *idx) \
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
Christian Heimes81ee3ef2008-05-04 22:42:01 +0000208 $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000209
Georg Brandlfcaf9102008-07-16 02:17:56 +0000210install_Python4way: install_Python
211 lipo -extract i386 -extract ppc7400 -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
212 lipo -extract x86_64 -extract ppc64 -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
213
214
215
Thomas Wouters477c8d52006-05-27 19:21:47 +0000216install_IDLE:
Benjamin Petersonde9c8692008-07-01 18:23:09 +0000217 test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)"
Ronald Oussoren827822e2009-02-12 15:01:44 +0000218 -test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -rf "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
Ronald Oussorenaf118602009-01-02 11:48:29 +0000219 /bin/cp -PR "$(srcdir)/IDLE/IDLE.app" "$(DESTDIR)$(PYTHONAPPSDIR)"
Benjamin Petersonaed4bd42008-07-19 02:56:43 +0000220 ln -sf $(INSTALLED_PYTHONAPP) "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python"
Ronald Oussorenaf118602009-01-02 11:48:29 +0000221 sed -e "s!%prefix%!$(prefix)!g" -e 's!%exe%!$(PYTHONFRAMEWORK)!g' < "$(srcdir)/IDLE/IDLE.app/Contents/MacOS/IDLE" > "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/IDLE"
Ronald Oussoren21600152008-12-30 12:59:02 +0000222 sed "s!%version%!`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`!g" < "$(srcdir)/IDLE/IDLE.app/Contents/Info.plist" > "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/Info.plist"
Benjamin Petersonde9c8692008-07-01 18:23:09 +0000223 touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000224
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000225$(INSTALLED_PYTHONAPP): install_Python
Thomas Wouters477c8d52006-05-27 19:21:47 +0000226
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000227installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py
Thomas Wouters477c8d52006-05-27 19:21:47 +0000228 $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras"
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000229 $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
230 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000231 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo"
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000232 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/Demo \
233 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000234
235
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000236checkapplepython: $(srcdir)/Tools/fixapplepython23.py
237 @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000238 echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000239 echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000240 fi
241
242
243clean:
244 rm pythonw
245 cd PythonLauncher && make clean
Thomas Wouters89f507f2006-12-13 04:49:30 +0000246
247Makefile: $(srcdir)/Makefile.in ../config.status
248 cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status