Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 1 | # 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 | |
| 5 | VERSION=@VERSION@ |
Thomas Wouters | 73e5a5b | 2006-06-08 15:35:45 +0000 | [diff] [blame] | 6 | builddir = .. |
| 7 | srcdir=@srcdir@ |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 8 | prefix=@prefix@ |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 9 | LIBDEST=$(prefix)/lib/python$(VERSION) |
Thomas Wouters | 73e5a5b | 2006-06-08 15:35:45 +0000 | [diff] [blame] | 10 | RUNSHARED=@RUNSHARED@ |
| 11 | BUILDEXE=@BUILDEXEEXT@ |
| 12 | BUILDPYTHON=$(builddir)/python$(BUILDEXE) |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 13 | DESTDIR= |
Thomas Wouters | 73e5a5b | 2006-06-08 15:35:45 +0000 | [diff] [blame] | 14 | LDFLAGS=@LDFLAGS@ |
| 15 | FRAMEWORKUNIXTOOLSPREFIX=@FRAMEWORKUNIXTOOLSPREFIX@ |
Christian Heimes | 81ee3ef | 2008-05-04 22:42:01 +0000 | [diff] [blame] | 16 | PYTHONFRAMEWORK=@PYTHONFRAMEWORK@ |
Ronald Oussoren | f29b6b4 | 2009-03-30 20:00:00 +0000 | [diff] [blame] | 17 | PYTHONFRAMEWORKIDENTIFIER=@PYTHONFRAMEWORKIDENTIFIER@ |
Ronald Oussoren | 6f6c562 | 2009-12-24 14:03:19 +0000 | [diff] [blame] | 18 | LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@ |
Ronald Oussoren | 755740f | 2010-02-07 19:56:39 +0000 | [diff] [blame] | 19 | CC=@CC@ |
Ronald Oussoren | 712979d | 2010-04-20 19:51:33 +0000 | [diff] [blame] | 20 | MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ |
| 21 | export MACOSX_DEPLOYMENT_TARGET |
| 22 | |
Christian Heimes | 81ee3ef | 2008-05-04 22:42:01 +0000 | [diff] [blame] | 23 | |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 24 | |
| 25 | # These are normally glimpsed from the previous set |
Thomas Wouters | 73e5a5b | 2006-06-08 15:35:45 +0000 | [diff] [blame] | 26 | bindir=$(prefix)/bin |
Ronald Oussoren | 86b33c8 | 2010-04-30 11:41:56 +0000 | [diff] [blame] | 27 | PYTHONAPPSDIR=@FRAMEWORKINSTALLAPPSPREFIX@/$(PYTHONFRAMEWORK) $(VERSION) |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 28 | APPINSTALLDIR=$(prefix)/Resources/Python.app |
| 29 | |
| 30 | # Variables for installing the "normal" unix binaries |
Christian Heimes | 81ee3ef | 2008-05-04 22:42:01 +0000 | [diff] [blame] | 31 | INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK) |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 32 | |
| 33 | # Items more-or-less copied from the main Makefile |
| 34 | DIRMODE=755 |
| 35 | FILEMODE=644 |
| 36 | INSTALL=@INSTALL@ |
| 37 | INSTALL_SYMLINK=ln -fsn |
| 38 | INSTALL_PROGRAM=@INSTALL_PROGRAM@ |
| 39 | INSTALL_SCRIPT= @INSTALL_SCRIPT@ |
| 40 | INSTALL_DATA=@INSTALL_DATA@ |
| 41 | LN=@LN@ |
| 42 | STRIPFLAG=-s |
| 43 | CPMAC=/Developer/Tools/CpMac |
| 44 | |
Thomas Wouters | 73e5a5b | 2006-06-08 15:35:45 +0000 | [diff] [blame] | 45 | APPTEMPLATE=$(srcdir)/Resources/app |
Ronald Oussoren | f84d7e9 | 2009-05-19 11:27:25 +0000 | [diff] [blame] | 46 | APPSUBDIRS=MacOS Resources |
Thomas Wouters | 73e5a5b | 2006-06-08 15:35:45 +0000 | [diff] [blame] | 47 | compileall=$(srcdir)/../Lib/compileall.py |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 48 | |
Ronald Oussoren | 6f6c562 | 2009-12-24 14:03:19 +0000 | [diff] [blame] | 49 | installapps: install_Python install_pythonw install_PythonLauncher install_IDLE \ |
Ned Deily | 9a1383e | 2011-01-10 22:14:25 +0000 | [diff] [blame] | 50 | checkapplepython |
Georg Brandl | fcaf910 | 2008-07-16 02:17:56 +0000 | [diff] [blame] | 51 | |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 52 | install_pythonw: pythonw |
| 53 | $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)" |
| 54 | $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)" |
Ronald Oussoren | 38e2d8e | 2009-05-17 10:45:53 +0000 | [diff] [blame] | 55 | ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python3" |
| 56 | ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw3" |
Ronald Oussoren | 6f6c562 | 2009-12-24 14:03:19 +0000 | [diff] [blame] | 57 | ifneq ($(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 Oussoren | 01d05ad | 2010-05-05 13:20:31 +0000 | [diff] [blame] | 60 | ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw3-32" |
| 61 | ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python3-32" |
Ronald Oussoren | 6f6c562 | 2009-12-24 14:03:19 +0000 | [diff] [blame] | 62 | endif |
Georg Brandl | fcaf910 | 2008-07-16 02:17:56 +0000 | [diff] [blame] | 63 | |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 64 | # |
| 65 | # Install unix tools in /usr/local/bin. These are just aliases for the |
| 66 | # actual installation inside the framework. |
| 67 | # |
| 68 | installunixtools: |
Thomas Wouters | 73e5a5b | 2006-06-08 15:35:45 +0000 | [diff] [blame] | 69 | if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \ |
| 70 | $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\ |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 71 | fi |
Ronald Oussoren | 38e2d8e | 2009-05-17 10:45:53 +0000 | [diff] [blame] | 72 | for fn in python3 pythonw3 idle3 pydoc3 python3-config \ |
Thomas Wouters | 73e5a5b | 2006-06-08 15:35:45 +0000 | [diff] [blame] | 73 | python$(VERSION) pythonw$(VERSION) idle$(VERSION) \ |
Ronald Oussoren | afbca49 | 2009-05-26 21:18:59 +0000 | [diff] [blame] | 74 | pydoc$(VERSION) python$(VERSION)-config 2to3 \ |
Vinay Sajip | 7ded1f0 | 2012-05-26 03:45:29 +0100 | [diff] [blame] | 75 | 2to3-$(VERSION) pyvenv pyvenv-$(VERSION) ;\ |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 76 | do \ |
Thomas Wouters | 73e5a5b | 2006-06-08 15:35:45 +0000 | [diff] [blame] | 77 | ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\ |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 78 | done |
Ned Deily | 6e5fd04 | 2011-05-28 05:59:55 -0700 | [diff] [blame] | 79 | ifneq ($(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 |
| 85 | endif |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 86 | |
Georg Brandl | fcaf910 | 2008-07-16 02:17:56 +0000 | [diff] [blame] | 87 | |
Thomas Wouters | 73e5a5b | 2006-06-08 15:35:45 +0000 | [diff] [blame] | 88 | # |
| 89 | # Like installunixtools, but only install links to the versioned binaries. |
| 90 | # |
| 91 | altinstallunixtools: |
| 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 Sajip | 7ded1f0 | 2012-05-26 03:45:29 +0100 | [diff] [blame] | 96 | pydoc$(VERSION) python$(VERSION)-config 2to3-$(VERSION) pyvenv-$(VERSION) ;\ |
Thomas Wouters | 73e5a5b | 2006-06-08 15:35:45 +0000 | [diff] [blame] | 97 | do \ |
| 98 | ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\ |
| 99 | done |
Ned Deily | 6e5fd04 | 2011-05-28 05:59:55 -0700 | [diff] [blame] | 100 | ifneq ($(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 |
| 105 | endif |
Thomas Wouters | 73e5a5b | 2006-06-08 15:35:45 +0000 | [diff] [blame] | 106 | |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 107 | pythonw: $(srcdir)/Tools/pythonw.c Makefile |
Ronald Oussoren | b366cda | 2010-03-07 09:14:06 +0000 | [diff] [blame] | 108 | $(CC) $(LDFLAGS) -DPYTHONFRAMEWORK='"$(PYTHONFRAMEWORK)"' -o $@ $(srcdir)/Tools/pythonw.c -I.. -I$(srcdir)/../Include ../$(PYTHONFRAMEWORK).framework/Versions/$(VERSION)/$(PYTHONFRAMEWORK) |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 109 | |
| 110 | install_PythonLauncher: |
| 111 | cd PythonLauncher && make install DESTDIR=$(DESTDIR) |
| 112 | |
| 113 | install_Python: |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 114 | @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 Heimes | 81ee3ef | 2008-05-04 22:42:01 +0000 | [diff] [blame] | 156 | $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)" |
Ronald Oussoren | f29b6b4 | 2009-03-30 20:00:00 +0000 | [diff] [blame] | 157 | 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 Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 163 | |
Georg Brandl | fcaf910 | 2008-07-16 02:17:56 +0000 | [diff] [blame] | 164 | |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 165 | install_IDLE: |
Benjamin Peterson | de9c869 | 2008-07-01 18:23:09 +0000 | [diff] [blame] | 166 | test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)" |
Ronald Oussoren | 827822e | 2009-02-12 15:01:44 +0000 | [diff] [blame] | 167 | -test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -rf "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" |
Ronald Oussoren | af11860 | 2009-01-02 11:48:29 +0000 | [diff] [blame] | 168 | /bin/cp -PR "$(srcdir)/IDLE/IDLE.app" "$(DESTDIR)$(PYTHONAPPSDIR)" |
Ronald Oussoren | 672f62a | 2009-02-12 15:18:15 +0000 | [diff] [blame] | 169 | ln -sf "$(INSTALLED_PYTHONAPP)" "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python" |
Ronald Oussoren | af11860 | 2009-01-02 11:48:29 +0000 | [diff] [blame] | 170 | 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 Oussoren | 2160015 | 2008-12-30 12:59:02 +0000 | [diff] [blame] | 171 | 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 Oussoren | 711b578 | 2009-02-12 15:12:03 +0000 | [diff] [blame] | 172 | 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 Peterson | de9c869 | 2008-07-01 18:23:09 +0000 | [diff] [blame] | 189 | touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 190 | |
Thomas Wouters | 73e5a5b | 2006-06-08 15:35:45 +0000 | [diff] [blame] | 191 | $(INSTALLED_PYTHONAPP): install_Python |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 192 | |
Ned Deily | eb698da | 2011-02-07 16:44:19 +0000 | [diff] [blame] | 193 | installextras: $(srcdir)/Extras.install.py |
| 194 | $(INSTALL) -d "$(DESTDIR)$(prefix)/share/doc/python$(VERSION)/examples" |
Ned Deily | 916f2a8 | 2011-01-15 05:05:53 +0000 | [diff] [blame] | 195 | $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Tools \ |
Ned Deily | eb698da | 2011-02-07 16:44:19 +0000 | [diff] [blame] | 196 | "$(DESTDIR)$(prefix)/share/doc/python$(VERSION)/examples/Tools" ; \ |
| 197 | chmod -R ugo+rX,go-w "$(DESTDIR)$(prefix)/share/doc/python$(VERSION)/examples/Tools" |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 198 | |
| 199 | |
Thomas Wouters | 73e5a5b | 2006-06-08 15:35:45 +0000 | [diff] [blame] | 200 | checkapplepython: $(srcdir)/Tools/fixapplepython23.py |
| 201 | @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \ |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 202 | echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \ |
Thomas Wouters | 73e5a5b | 2006-06-08 15:35:45 +0000 | [diff] [blame] | 203 | echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \ |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 204 | fi |
| 205 | |
| 206 | |
| 207 | clean: |
| 208 | rm pythonw |
| 209 | cd PythonLauncher && make clean |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 210 | |
| 211 | Makefile: $(srcdir)/Makefile.in ../config.status |
| 212 | cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status |