blob: 0b32673323a0dc35f600f13b61760069d393a1f5 [file] [log] [blame]
Serhiy Storchaka45ec3282015-04-03 19:42:32 +03001# This file can be invoked from the various frameworkinstall... targets in the
2# main Makefile. The next couple of variables are overridden on the
Thomas Wouters477c8d52006-05-27 19:21:47 +00003# commandline in that case.
4
5VERSION=@VERSION@
Ned Deilyb8f944f2013-11-21 22:42:25 -08006ABIFLAGS=@ABIFLAGS@
7LDVERSION=@LDVERSION@
Ned Deily322f5ba2013-11-21 23:01:59 -08008ENSUREPIP=@ENSUREPIP@
Thomas Wouters73e5a5b2006-06-08 15:35:45 +00009builddir = ..
10srcdir=@srcdir@
Thomas Wouters0e3f5912006-08-11 14:57:12 +000011prefix=@prefix@
Ned Deilyb8f944f2013-11-21 22:42:25 -080012exec_prefix=@exec_prefix@
Thomas Wouters477c8d52006-05-27 19:21:47 +000013LIBDEST=$(prefix)/lib/python$(VERSION)
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000014RUNSHARED=@RUNSHARED@
15BUILDEXE=@BUILDEXEEXT@
16BUILDPYTHON=$(builddir)/python$(BUILDEXE)
Thomas Wouters477c8d52006-05-27 19:21:47 +000017DESTDIR=
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000018LDFLAGS=@LDFLAGS@
19FRAMEWORKUNIXTOOLSPREFIX=@FRAMEWORKUNIXTOOLSPREFIX@
Christian Heimes81ee3ef2008-05-04 22:42:01 +000020PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
Ronald Oussorenf29b6b42009-03-30 20:00:00 +000021PYTHONFRAMEWORKIDENTIFIER=@PYTHONFRAMEWORKIDENTIFIER@
Ronald Oussoren6f6c5622009-12-24 14:03:19 +000022LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
Ronald Oussoren755740f2010-02-07 19:56:39 +000023CC=@CC@
Ronald Oussoren712979d2010-04-20 19:51:33 +000024MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
25export MACOSX_DEPLOYMENT_TARGET
26
Christian Heimes81ee3ef2008-05-04 22:42:01 +000027
Thomas Wouters477c8d52006-05-27 19:21:47 +000028
29# These are normally glimpsed from the previous set
Ned Deilyb8f944f2013-11-21 22:42:25 -080030BINDIR= @bindir@
Ronald Oussoren86b33c82010-04-30 11:41:56 +000031PYTHONAPPSDIR=@FRAMEWORKINSTALLAPPSPREFIX@/$(PYTHONFRAMEWORK) $(VERSION)
Thomas Wouters477c8d52006-05-27 19:21:47 +000032APPINSTALLDIR=$(prefix)/Resources/Python.app
33
34# Variables for installing the "normal" unix binaries
Christian Heimes81ee3ef2008-05-04 22:42:01 +000035INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)
Thomas Wouters477c8d52006-05-27 19:21:47 +000036
37# Items more-or-less copied from the main Makefile
38DIRMODE=755
39FILEMODE=644
40INSTALL=@INSTALL@
41INSTALL_SYMLINK=ln -fsn
42INSTALL_PROGRAM=@INSTALL_PROGRAM@
43INSTALL_SCRIPT= @INSTALL_SCRIPT@
44INSTALL_DATA=@INSTALL_DATA@
45LN=@LN@
46STRIPFLAG=-s
Ned Deilydfca8c92012-08-06 06:34:00 -070047CPMAC=CpMac
Thomas Wouters477c8d52006-05-27 19:21:47 +000048
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000049APPTEMPLATE=$(srcdir)/Resources/app
Ned Deily430d7a32012-06-24 00:19:31 -070050APPSUBDIRS=MacOS Resources
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000051compileall=$(srcdir)/../Lib/compileall.py
Thomas Wouters477c8d52006-05-27 19:21:47 +000052
Ned Deilyb8f944f2013-11-21 22:42:25 -080053installapps: install_Python install_PythonLauncher install_IDLE
Georg Brandlfcaf9102008-07-16 02:17:56 +000054
Thomas Wouters477c8d52006-05-27 19:21:47 +000055#
Serhiy Storchaka45ec3282015-04-03 19:42:32 +030056# Install unix tools in /usr/local/bin. These are just aliases for the
Thomas Wouters477c8d52006-05-27 19:21:47 +000057# actual installation inside the framework.
58#
59installunixtools:
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000060 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
61 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +000062 fi
Ned Deilyb8f944f2013-11-21 22:42:25 -080063 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
64 for fn in \
65 2to3 \
66 idle3 \
67 pydoc3 \
68 python3 \
69 python3-config \
Ned Deilyb8f944f2013-11-21 22:42:25 -080070 ; \
Thomas Wouters477c8d52006-05-27 19:21:47 +000071 do \
Ned Deilyb8f944f2013-11-21 22:42:25 -080072 rm -f $${fn} ; \
73 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +000074 done
Ned Deilyb8f944f2013-11-21 22:42:25 -080075 -if test "x$(VERSION)" != "x$(LDVERSION)"; then \
76 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
77 for fn in \
78 python$(VERSION)-config \
79 ; \
80 do \
81 rm -f $${fn} ;\
82 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\
83 done ;\
84 fi
85 -if test "x$(LIPO_32BIT_FLAGS)" != "x"; then \
86 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
87 for fn in \
88 python3-32 \
89 ; \
90 do \
91 rm -f $${fn} ;\
92 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\
93 done ;\
94 fi
Ned Deily322f5ba2013-11-21 23:01:59 -080095 -if test "x$(ENSUREPIP)" != "xno" ; then \
96 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
97 for fn in \
98 pip3 \
99 ; \
100 do \
101 rm -f $${fn} ;\
102 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\
103 done ;\
104 fi
Georg Brandlfcaf9102008-07-16 02:17:56 +0000105
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000106#
107# Like installunixtools, but only install links to the versioned binaries.
108#
109altinstallunixtools:
110 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
111 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
112 fi
Ned Deilyb8f944f2013-11-21 22:42:25 -0800113 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
114 for fn in \
115 2to3-$(VERSION) \
116 idle$(VERSION) \
117 pydoc$(VERSION) \
118 python$(VERSION) \
119 python$(LDVERSION)-config \
Ned Deilyb8f944f2013-11-21 22:42:25 -0800120 ; \
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000121 do \
Ned Deilyb8f944f2013-11-21 22:42:25 -0800122 rm -f $${fn} ;\
123 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000124 done
Ned Deilyb8f944f2013-11-21 22:42:25 -0800125 -if test "x$(VERSION)" != "x$(LDVERSION)"; then \
126 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
127 for fn in \
128 python$(LDVERSION) \
129 ; \
130 do \
131 rm -f $${fn} ;\
132 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\
133 done ;\
134 fi
135 -if test "x$(LIPO_32BIT_FLAGS)" != "x"; then \
136 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
137 for fn in \
138 python$(VERSION)-32 \
139 ; \
140 do \
141 rm -f $${fn} ;\
142 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\
143 done ;\
144 fi
Ned Deily322f5ba2013-11-21 23:01:59 -0800145 -if test "x$(ENSUREPIP)" != "xno" ; then \
146 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
147 for fn in \
148 easy_install-$(VERSION) \
149 pip$(VERSION) \
150 ; \
151 do \
152 rm -f $${fn} ;\
153 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\
154 done ;\
155 fi
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000156
Thomas Wouters89f507f2006-12-13 04:49:30 +0000157pythonw: $(srcdir)/Tools/pythonw.c Makefile
Ned Deilyb8f944f2013-11-21 22:42:25 -0800158 $(CC) $(LDFLAGS) -DPYTHONFRAMEWORK='"$(PYTHONFRAMEWORK)"' -o $@ \
159 $(srcdir)/Tools/pythonw.c -I.. -I$(srcdir)/../Include \
160 ../$(PYTHONFRAMEWORK).framework/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
Thomas Wouters477c8d52006-05-27 19:21:47 +0000161
162install_PythonLauncher:
163 cd PythonLauncher && make install DESTDIR=$(DESTDIR)
164
165install_Python:
Thomas Wouters477c8d52006-05-27 19:21:47 +0000166 @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)"
Ronald Oussorenf29b6b42009-03-30 20:00:00 +0000209 sed -e "s!%bundleid%!$(PYTHONFRAMEWORKIDENTIFIER)!g" \
210 -e "s!%version%!`$(RUNSHARED) $(BUILDPYTHON) \
211 -c 'import platform; print(platform.python_version())'`!g" \
212 < "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in" \
213 > "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist"
214 rm "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000215
Georg Brandlfcaf9102008-07-16 02:17:56 +0000216
Thomas Wouters477c8d52006-05-27 19:21:47 +0000217install_IDLE:
Benjamin Petersonde9c8692008-07-01 18:23:09 +0000218 test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)"
Ronald Oussoren827822e2009-02-12 15:01:44 +0000219 -test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -rf "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
Ronald Oussorenaf118602009-01-02 11:48:29 +0000220 /bin/cp -PR "$(srcdir)/IDLE/IDLE.app" "$(DESTDIR)$(PYTHONAPPSDIR)"
Ronald Oussoren672f62a2009-02-12 15:18:15 +0000221 ln -sf "$(INSTALLED_PYTHONAPP)" "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python"
Ronald Oussorenaf118602009-01-02 11:48:29 +0000222 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 +0000223 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"
Ronald Oussoren711b5782009-02-12 15:12:03 +0000224 if [ -f "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" ]; then \
225 /bin/cp -p "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" \
226 "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" ; \
227 sed -e 's!name= IDLE Classic Windows!name= IDLE Classic OSX!g' \
228 < "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" \
229 > "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" ; \
230 rm "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" ; \
231 fi
232 if [ -f "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" ]; then \
233 /bin/cp -p "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" \
234 "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" ; \
235 sed -e 's!zoom-height=<Alt-Key-2>!zoom-height=<Option-Key-0>!g' \
236 -e 's!<Alt-Key-!<Option-Key-!g' \
237 < "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" \
238 > "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" ; \
239 rm "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" ; \
240 fi
Benjamin Petersonde9c8692008-07-01 18:23:09 +0000241 touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000242
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000243$(INSTALLED_PYTHONAPP): install_Python
Thomas Wouters477c8d52006-05-27 19:21:47 +0000244
Ned Deilyeb698da2011-02-07 16:44:19 +0000245installextras: $(srcdir)/Extras.install.py
246 $(INSTALL) -d "$(DESTDIR)$(prefix)/share/doc/python$(VERSION)/examples"
Ned Deily916f2a82011-01-15 05:05:53 +0000247 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Tools \
Ned Deilyeb698da2011-02-07 16:44:19 +0000248 "$(DESTDIR)$(prefix)/share/doc/python$(VERSION)/examples/Tools" ; \
249 chmod -R ugo+rX,go-w "$(DESTDIR)$(prefix)/share/doc/python$(VERSION)/examples/Tools"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000250
Thomas Wouters477c8d52006-05-27 19:21:47 +0000251clean:
252 rm pythonw
253 cd PythonLauncher && make clean
Thomas Wouters89f507f2006-12-13 04:49:30 +0000254
255Makefile: $(srcdir)/Makefile.in ../config.status
256 cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status