blob: 6d2ad164c69994b997e30949fb9b4b0d6c74fa81 [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@
Ronald Oussorenf29b6b42009-03-30 20:00:00 +000017PYTHONFRAMEWORKIDENTIFIER=@PYTHONFRAMEWORKIDENTIFIER@
Ronald Oussoren6f6c5622009-12-24 14:03:19 +000018LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
Ronald Oussoren755740f2010-02-07 19:56:39 +000019CC=@CC@
Ronald Oussoren712979d2010-04-20 19:51:33 +000020MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
21export MACOSX_DEPLOYMENT_TARGET
22
Christian Heimes81ee3ef2008-05-04 22:42:01 +000023
Thomas Wouters477c8d52006-05-27 19:21:47 +000024
25# These are normally glimpsed from the previous set
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000026bindir=$(prefix)/bin
Ronald Oussoren86b33c82010-04-30 11:41:56 +000027PYTHONAPPSDIR=@FRAMEWORKINSTALLAPPSPREFIX@/$(PYTHONFRAMEWORK) $(VERSION)
Thomas Wouters477c8d52006-05-27 19:21:47 +000028APPINSTALLDIR=$(prefix)/Resources/Python.app
29
30# Variables for installing the "normal" unix binaries
Christian Heimes81ee3ef2008-05-04 22:42:01 +000031INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)
Thomas Wouters477c8d52006-05-27 19:21:47 +000032
33# Items more-or-less copied from the main Makefile
34DIRMODE=755
35FILEMODE=644
36INSTALL=@INSTALL@
37INSTALL_SYMLINK=ln -fsn
38INSTALL_PROGRAM=@INSTALL_PROGRAM@
39INSTALL_SCRIPT= @INSTALL_SCRIPT@
40INSTALL_DATA=@INSTALL_DATA@
41LN=@LN@
42STRIPFLAG=-s
43CPMAC=/Developer/Tools/CpMac
44
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000045APPTEMPLATE=$(srcdir)/Resources/app
Ronald Oussorenf84d7e92009-05-19 11:27:25 +000046APPSUBDIRS=MacOS Resources
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000047compileall=$(srcdir)/../Lib/compileall.py
Thomas Wouters477c8d52006-05-27 19:21:47 +000048
Ronald Oussoren6f6c5622009-12-24 14:03:19 +000049installapps: install_Python install_pythonw install_PythonLauncher install_IDLE \
Ned Deily9a1383e2011-01-10 22:14:25 +000050 checkapplepython
Georg Brandlfcaf9102008-07-16 02:17:56 +000051
Thomas Wouters477c8d52006-05-27 19:21:47 +000052install_pythonw: pythonw
53 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
54 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
Ronald Oussoren38e2d8e2009-05-17 10:45:53 +000055 ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python3"
56 ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw3"
Ronald Oussoren6f6c5622009-12-24 14:03:19 +000057ifneq ($(LIPO_32BIT_FLAGS),)
58 lipo $(LIPO_32BIT_FLAGS) -output $(DESTDIR)$(prefix)/bin/python$(VERSION)-32 pythonw
59 lipo $(LIPO_32BIT_FLAGS) -output $(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-32 pythonw
Ronald Oussoren01d05ad2010-05-05 13:20:31 +000060 ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw3-32"
61 ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python3-32"
Ronald Oussoren6f6c5622009-12-24 14:03:19 +000062endif
Georg Brandlfcaf9102008-07-16 02:17:56 +000063
Thomas Wouters477c8d52006-05-27 19:21:47 +000064#
65# Install unix tools in /usr/local/bin. These are just aliases for the
66# actual installation inside the framework.
67#
68installunixtools:
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000069 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
70 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +000071 fi
Ronald Oussoren38e2d8e2009-05-17 10:45:53 +000072 for fn in python3 pythonw3 idle3 pydoc3 python3-config \
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000073 python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
Ronald Oussorenafbca492009-05-26 21:18:59 +000074 pydoc$(VERSION) python$(VERSION)-config 2to3 \
Vinay Sajip7ded1f02012-05-26 03:45:29 +010075 2to3-$(VERSION) pyvenv pyvenv-$(VERSION) ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +000076 do \
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000077 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +000078 done
Ned Deily6e5fd042011-05-28 05:59:55 -070079ifneq ($(LIPO_32BIT_FLAGS),)
80 for fn in python3-32 pythonw3-32 \
81 python$(VERSION)-32 pythonw$(VERSION)-32 ;\
82 do \
83 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
84 done
85endif
Thomas Wouters477c8d52006-05-27 19:21:47 +000086
Georg Brandlfcaf9102008-07-16 02:17:56 +000087
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000088#
89# Like installunixtools, but only install links to the versioned binaries.
90#
91altinstallunixtools:
92 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
93 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
94 fi
95 for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
Vinay Sajip7ded1f02012-05-26 03:45:29 +010096 pydoc$(VERSION) python$(VERSION)-config 2to3-$(VERSION) pyvenv-$(VERSION) ;\
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000097 do \
98 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
99 done
Ned Deily6e5fd042011-05-28 05:59:55 -0700100ifneq ($(LIPO_32BIT_FLAGS),)
101 for fn in python$(VERSION)-32 pythonw$(VERSION)-32 ;\
102 do \
103 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
104 done
105endif
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000106
Thomas Wouters89f507f2006-12-13 04:49:30 +0000107pythonw: $(srcdir)/Tools/pythonw.c Makefile
Ronald Oussorenb366cda2010-03-07 09:14:06 +0000108 $(CC) $(LDFLAGS) -DPYTHONFRAMEWORK='"$(PYTHONFRAMEWORK)"' -o $@ $(srcdir)/Tools/pythonw.c -I.. -I$(srcdir)/../Include ../$(PYTHONFRAMEWORK).framework/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
Thomas Wouters477c8d52006-05-27 19:21:47 +0000109
110install_PythonLauncher:
111 cd PythonLauncher && make install DESTDIR=$(DESTDIR)
112
113install_Python:
Thomas Wouters477c8d52006-05-27 19:21:47 +0000114 @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \
115 if test ! -d "$(DESTDIR)$$i"; then \
116 echo "Creating directory $(DESTDIR)$$i"; \
117 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \
118 fi;\
119 done
120 @for i in $(APPSUBDIRS); do \
121 if test ! -d "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; then \
122 echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
123 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
124 else true; \
125 fi; \
126 done
127 @for d in . $(APPSUBDIRS); \
128 do \
129 a=$(APPTEMPLATE)/$$d; \
130 if test ! -d $$a; then continue; else true; fi; \
131 b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \
132 for i in $$a/*; \
133 do \
134 case $$i in \
135 *CVS) ;; \
136 *.svn) ;; \
137 *.py[co]) ;; \
138 *.orig) ;; \
139 *~) ;; \
140 *idx) \
141 echo $(CPMAC) "$$i" $$b; \
142 $(CPMAC) "$$i" "$$b"; \
143 ;; \
144 *) \
145 if test -d $$i; then continue; fi; \
146 if test -x $$i; then \
147 echo $(INSTALL_SCRIPT) "$$i" "$$b"; \
148 $(INSTALL_SCRIPT) "$$i" "$$b"; \
149 else \
150 echo $(INSTALL_DATA) "$$i" "$$b"; \
151 $(INSTALL_DATA) "$$i" "$$b"; \
152 fi;; \
153 esac; \
154 done; \
155 done
Christian Heimes81ee3ef2008-05-04 22:42:01 +0000156 $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
Ronald Oussorenf29b6b42009-03-30 20:00:00 +0000157 sed -e "s!%bundleid%!$(PYTHONFRAMEWORKIDENTIFIER)!g" \
158 -e "s!%version%!`$(RUNSHARED) $(BUILDPYTHON) \
159 -c 'import platform; print(platform.python_version())'`!g" \
160 < "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in" \
161 > "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist"
162 rm "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000163
Georg Brandlfcaf9102008-07-16 02:17:56 +0000164
Thomas Wouters477c8d52006-05-27 19:21:47 +0000165install_IDLE:
Benjamin Petersonde9c8692008-07-01 18:23:09 +0000166 test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)"
Ronald Oussoren827822e2009-02-12 15:01:44 +0000167 -test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -rf "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
Ronald Oussorenaf118602009-01-02 11:48:29 +0000168 /bin/cp -PR "$(srcdir)/IDLE/IDLE.app" "$(DESTDIR)$(PYTHONAPPSDIR)"
Ronald Oussoren672f62a2009-02-12 15:18:15 +0000169 ln -sf "$(INSTALLED_PYTHONAPP)" "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python"
Ronald Oussorenaf118602009-01-02 11:48:29 +0000170 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 +0000171 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 +0000172 if [ -f "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" ]; then \
173 /bin/cp -p "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" \
174 "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" ; \
175 sed -e 's!name= IDLE Classic Windows!name= IDLE Classic OSX!g' \
176 < "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" \
177 > "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" ; \
178 rm "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" ; \
179 fi
180 if [ -f "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" ]; then \
181 /bin/cp -p "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" \
182 "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" ; \
183 sed -e 's!zoom-height=<Alt-Key-2>!zoom-height=<Option-Key-0>!g' \
184 -e 's!<Alt-Key-!<Option-Key-!g' \
185 < "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" \
186 > "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" ; \
187 rm "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" ; \
188 fi
Benjamin Petersonde9c8692008-07-01 18:23:09 +0000189 touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000190
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000191$(INSTALLED_PYTHONAPP): install_Python
Thomas Wouters477c8d52006-05-27 19:21:47 +0000192
Ned Deilyeb698da2011-02-07 16:44:19 +0000193installextras: $(srcdir)/Extras.install.py
194 $(INSTALL) -d "$(DESTDIR)$(prefix)/share/doc/python$(VERSION)/examples"
Ned Deily916f2a82011-01-15 05:05:53 +0000195 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Tools \
Ned Deilyeb698da2011-02-07 16:44:19 +0000196 "$(DESTDIR)$(prefix)/share/doc/python$(VERSION)/examples/Tools" ; \
197 chmod -R ugo+rX,go-w "$(DESTDIR)$(prefix)/share/doc/python$(VERSION)/examples/Tools"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000198
199
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000200checkapplepython: $(srcdir)/Tools/fixapplepython23.py
201 @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000202 echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000203 echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000204 fi
205
206
207clean:
208 rm pythonw
209 cd PythonLauncher && make clean
Thomas Wouters89f507f2006-12-13 04:49:30 +0000210
211Makefile: $(srcdir)/Makefile.in ../config.status
212 cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status