blob: bc0c90d9686cb785f5c78e3e15d2234e5fb5ab9b [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 \
75 2to3-$(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
79
Georg Brandlfcaf9102008-07-16 02:17:56 +000080
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000081#
82# Like installunixtools, but only install links to the versioned binaries.
83#
84altinstallunixtools:
85 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
86 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
87 fi
88 for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
Ronald Oussorenafbca492009-05-26 21:18:59 +000089 pydoc$(VERSION) python$(VERSION)-config 2to3-$(VERSION);\
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000090 do \
91 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
92 done
93
Thomas Wouters89f507f2006-12-13 04:49:30 +000094pythonw: $(srcdir)/Tools/pythonw.c Makefile
Ronald Oussorenb366cda2010-03-07 09:14:06 +000095 $(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 +000096
97install_PythonLauncher:
98 cd PythonLauncher && make install DESTDIR=$(DESTDIR)
99
100install_Python:
Thomas Wouters477c8d52006-05-27 19:21:47 +0000101 @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \
102 if test ! -d "$(DESTDIR)$$i"; then \
103 echo "Creating directory $(DESTDIR)$$i"; \
104 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \
105 fi;\
106 done
107 @for i in $(APPSUBDIRS); do \
108 if test ! -d "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; then \
109 echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
110 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
111 else true; \
112 fi; \
113 done
114 @for d in . $(APPSUBDIRS); \
115 do \
116 a=$(APPTEMPLATE)/$$d; \
117 if test ! -d $$a; then continue; else true; fi; \
118 b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \
119 for i in $$a/*; \
120 do \
121 case $$i in \
122 *CVS) ;; \
123 *.svn) ;; \
124 *.py[co]) ;; \
125 *.orig) ;; \
126 *~) ;; \
127 *idx) \
128 echo $(CPMAC) "$$i" $$b; \
129 $(CPMAC) "$$i" "$$b"; \
130 ;; \
131 *) \
132 if test -d $$i; then continue; fi; \
133 if test -x $$i; then \
134 echo $(INSTALL_SCRIPT) "$$i" "$$b"; \
135 $(INSTALL_SCRIPT) "$$i" "$$b"; \
136 else \
137 echo $(INSTALL_DATA) "$$i" "$$b"; \
138 $(INSTALL_DATA) "$$i" "$$b"; \
139 fi;; \
140 esac; \
141 done; \
142 done
Christian Heimes81ee3ef2008-05-04 22:42:01 +0000143 $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
Ronald Oussorenf29b6b42009-03-30 20:00:00 +0000144 sed -e "s!%bundleid%!$(PYTHONFRAMEWORKIDENTIFIER)!g" \
145 -e "s!%version%!`$(RUNSHARED) $(BUILDPYTHON) \
146 -c 'import platform; print(platform.python_version())'`!g" \
147 < "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in" \
148 > "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist"
149 rm "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000150
Georg Brandlfcaf9102008-07-16 02:17:56 +0000151
Thomas Wouters477c8d52006-05-27 19:21:47 +0000152install_IDLE:
Benjamin Petersonde9c8692008-07-01 18:23:09 +0000153 test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)"
Ronald Oussoren827822e2009-02-12 15:01:44 +0000154 -test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -rf "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
Ronald Oussorenaf118602009-01-02 11:48:29 +0000155 /bin/cp -PR "$(srcdir)/IDLE/IDLE.app" "$(DESTDIR)$(PYTHONAPPSDIR)"
Ronald Oussoren672f62a2009-02-12 15:18:15 +0000156 ln -sf "$(INSTALLED_PYTHONAPP)" "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python"
Ronald Oussorenaf118602009-01-02 11:48:29 +0000157 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 +0000158 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 +0000159 if [ -f "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" ]; then \
160 /bin/cp -p "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" \
161 "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" ; \
162 sed -e 's!name= IDLE Classic Windows!name= IDLE Classic OSX!g' \
163 < "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" \
164 > "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" ; \
165 rm "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" ; \
166 fi
167 if [ -f "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" ]; then \
168 /bin/cp -p "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" \
169 "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" ; \
170 sed -e 's!zoom-height=<Alt-Key-2>!zoom-height=<Option-Key-0>!g' \
171 -e 's!<Alt-Key-!<Option-Key-!g' \
172 < "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" \
173 > "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" ; \
174 rm "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" ; \
175 fi
Benjamin Petersonde9c8692008-07-01 18:23:09 +0000176 touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000177
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000178$(INSTALLED_PYTHONAPP): install_Python
Thomas Wouters477c8d52006-05-27 19:21:47 +0000179
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000180installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py
Thomas Wouters477c8d52006-05-27 19:21:47 +0000181 $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras"
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000182 $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
Ned Deily916f2a82011-01-15 05:05:53 +0000183 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Tools \
184 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Tools"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000185
186
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000187checkapplepython: $(srcdir)/Tools/fixapplepython23.py
188 @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000189 echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000190 echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000191 fi
192
193
194clean:
195 rm pythonw
196 cd PythonLauncher && make clean
Thomas Wouters89f507f2006-12-13 04:49:30 +0000197
198Makefile: $(srcdir)/Makefile.in ../config.status
199 cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status