| 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@
|
|---|
| 6 | builddir = ..
|
|---|
| 7 | srcdir=@srcdir@
|
|---|
| 8 | prefix=@prefix@
|
|---|
| 9 | LIBDEST=$(prefix)/lib/python$(VERSION)
|
|---|
| 10 | RUNSHARED=@RUNSHARED@
|
|---|
| 11 | BUILDEXE=@BUILDEXEEXT@
|
|---|
| 12 | BUILDPYTHON=$(builddir)/python$(BUILDEXE)
|
|---|
| 13 | DESTDIR=
|
|---|
| 14 | LDFLAGS=@LDFLAGS@
|
|---|
| 15 | FRAMEWORKUNIXTOOLSPREFIX=@FRAMEWORKUNIXTOOLSPREFIX@
|
|---|
| 16 | PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
|
|---|
| 17 | PYTHONFRAMEWORKIDENTIFIER=@PYTHONFRAMEWORKIDENTIFIER@
|
|---|
| 18 | LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
|
|---|
| 19 | CC=@CC@
|
|---|
| 20 | MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
|
|---|
| 21 | export MACOSX_DEPLOYMENT_TARGET
|
|---|
| 22 |
|
|---|
| 23 | # These are normally glimpsed from the previous set
|
|---|
| 24 | bindir=$(prefix)/bin
|
|---|
| 25 | PYTHONAPPSDIR=@FRAMEWORKINSTALLAPPSPREFIX@/$(PYTHONFRAMEWORK) $(VERSION)
|
|---|
| 26 | APPINSTALLDIR=$(prefix)/Resources/Python.app
|
|---|
| 27 |
|
|---|
| 28 | # Variables for installing the "normal" unix binaries
|
|---|
| 29 | INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)
|
|---|
| 30 |
|
|---|
| 31 | # Items more-or-less copied from the main Makefile
|
|---|
| 32 | DIRMODE=755
|
|---|
| 33 | FILEMODE=644
|
|---|
| 34 | INSTALL=@INSTALL@
|
|---|
| 35 | INSTALL_SYMLINK=ln -fsn
|
|---|
| 36 | INSTALL_PROGRAM=@INSTALL_PROGRAM@
|
|---|
| 37 | INSTALL_SCRIPT= @INSTALL_SCRIPT@
|
|---|
| 38 | INSTALL_DATA=@INSTALL_DATA@
|
|---|
| 39 | LN=@LN@
|
|---|
| 40 | STRIPFLAG=-s
|
|---|
| 41 | CPMAC=CpMac
|
|---|
| 42 |
|
|---|
| 43 | APPTEMPLATE=$(srcdir)/Resources/app
|
|---|
| 44 | APPSUBDIRS=MacOS Resources
|
|---|
| 45 | CACHERSRC=$(srcdir)/scripts/cachersrc.py
|
|---|
| 46 | compileall=$(srcdir)/../Lib/compileall.py
|
|---|
| 47 |
|
|---|
| 48 | installapps: install_Python install_pythonw install_BuildApplet install_PythonLauncher \
|
|---|
| 49 | install_IDLE checkapplepython install_versionedtools
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 | install_pythonw: pythonw
|
|---|
| 53 | $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
|
|---|
| 54 | $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
|
|---|
| 55 | ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python2"
|
|---|
| 56 | ln -sf python2 "$(DESTDIR)$(prefix)/bin/python"
|
|---|
| 57 | ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw2"
|
|---|
| 58 | ln -sf pythonw2 "$(DESTDIR)$(prefix)/bin/pythonw"
|
|---|
| 59 | ifneq ($(LIPO_32BIT_FLAGS),)
|
|---|
| 60 | lipo $(LIPO_32BIT_FLAGS) -output $(DESTDIR)$(prefix)/bin/python$(VERSION)-32 pythonw
|
|---|
| 61 | lipo $(LIPO_32BIT_FLAGS) -output $(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-32 pythonw
|
|---|
| 62 | ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python2-32"
|
|---|
| 63 | ln -sf python2-32 "$(DESTDIR)$(prefix)/bin/python-32"
|
|---|
| 64 | ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw2-32"
|
|---|
| 65 | ln -sf pythonw2-32 "$(DESTDIR)$(prefix)/bin/pythonw-32"
|
|---|
| 66 | endif
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 | #
|
|---|
| 70 | # Install unix tools in /usr/local/bin. These are just aliases for the
|
|---|
| 71 | # actual installation inside the framework.
|
|---|
| 72 | #
|
|---|
| 73 | installunixtools:
|
|---|
| 74 | if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
|
|---|
| 75 | $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
|
|---|
| 76 | fi
|
|---|
| 77 | for fn in python pythonw idle pydoc python-config smtpd.py 2to3 \
|
|---|
| 78 | python2 pythonw2 idle2 \
|
|---|
| 79 | pydoc2 python2-config smtpd2.py \
|
|---|
| 80 | 2to3-2 \
|
|---|
| 81 | python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
|
|---|
| 82 | pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py \
|
|---|
| 83 | 2to3-$(VERSION) ;\
|
|---|
| 84 | do \
|
|---|
| 85 | ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
|
|---|
| 86 | done
|
|---|
| 87 | ifneq ($(LIPO_32BIT_FLAGS),)
|
|---|
| 88 | for fn in python-32 pythonw-32 \
|
|---|
| 89 | python2-32 pythonw2-32 \
|
|---|
| 90 | python$(VERSION)-32 pythonw$(VERSION)-32 ;\
|
|---|
| 91 | do \
|
|---|
| 92 | ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
|
|---|
| 93 | done
|
|---|
| 94 | endif
|
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 | #
|
|---|
| 98 | # Like installunixtools, but only install links to the versioned binaries.
|
|---|
| 99 | #
|
|---|
| 100 | altinstallunixtools:
|
|---|
| 101 | if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
|
|---|
| 102 | $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
|
|---|
| 103 | fi
|
|---|
| 104 | for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
|
|---|
| 105 | pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py ;\
|
|---|
| 106 | do \
|
|---|
| 107 | ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
|
|---|
| 108 | done
|
|---|
| 109 | ifneq ($(LIPO_32BIT_FLAGS),)
|
|---|
| 110 | for fn in python$(VERSION)-32 pythonw$(VERSION)-32 ;\
|
|---|
| 111 | do \
|
|---|
| 112 | ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
|
|---|
| 113 | done
|
|---|
| 114 | endif
|
|---|
| 115 | ln -fs "$(prefix)/bin/2to3-$(VERSION)" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/2to3-$(VERSION)" ;\
|
|---|
| 116 |
|
|---|
| 117 | # By default most tools are installed without a version in their basename, to
|
|---|
| 118 | # make it easier to install (and use) several python versions side-by-side move
|
|---|
| 119 | # the tools to a version-specific name and add the non-versioned name as an
|
|---|
| 120 | # alias.
|
|---|
| 121 | install_versionedtools:
|
|---|
| 122 | for fn in idle pydoc ;\
|
|---|
| 123 | do \
|
|---|
| 124 | if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \
|
|---|
| 125 | continue ;\
|
|---|
| 126 | fi ;\
|
|---|
| 127 | mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\
|
|---|
| 128 | ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}2" ;\
|
|---|
| 129 | ln -sf "$${fn}2" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\
|
|---|
| 130 | done
|
|---|
| 131 | if [ ! -h "$(DESTDIR)$(prefix)/bin/smtpd.py" ]; then \
|
|---|
| 132 | mv "$(DESTDIR)$(prefix)/bin/smtpd.py" "$(DESTDIR)$(prefix)/bin/smtpd$(VERSION).py" ;\
|
|---|
| 133 | ln -sf "smtpd$(VERSION).py" "$(DESTDIR)$(prefix)/bin/smtpd2.py" ;\
|
|---|
| 134 | ln -sf "smtpd2.py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\
|
|---|
| 135 | fi
|
|---|
| 136 | if [ ! -h "$(DESTDIR)$(prefix)/bin/2to3" ]; then \
|
|---|
| 137 | mv "$(DESTDIR)$(prefix)/bin/2to3" "$(DESTDIR)$(prefix)/bin/2to3-$(VERSION)" ;\
|
|---|
| 138 | ln -sf "2to3-$(VERSION)" "$(DESTDIR)$(prefix)/bin/2to3-2" ;\
|
|---|
| 139 | ln -sf "2to3-2" "$(DESTDIR)$(prefix)/bin/2to3" ;\
|
|---|
| 140 | fi
|
|---|
| 141 |
|
|---|
| 142 |
|
|---|
| 143 | pythonw: $(srcdir)/Tools/pythonw.c Makefile
|
|---|
| 144 | $(CC) $(LDFLAGS) -DPYTHONFRAMEWORK='"$(PYTHONFRAMEWORK)"' -o $@ $(srcdir)/Tools/pythonw.c -I.. -I$(srcdir)/../Include ../$(PYTHONFRAMEWORK).framework/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
|
|---|
| 145 |
|
|---|
| 146 | install_PythonLauncher:
|
|---|
| 147 | cd PythonLauncher && make install DESTDIR=$(DESTDIR)
|
|---|
| 148 |
|
|---|
| 149 | install_Python:
|
|---|
| 150 | @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \
|
|---|
| 151 | if test ! -d "$(DESTDIR)$$i"; then \
|
|---|
| 152 | echo "Creating directory $(DESTDIR)$$i"; \
|
|---|
| 153 | $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \
|
|---|
| 154 | fi;\
|
|---|
| 155 | done
|
|---|
| 156 | @for i in $(APPSUBDIRS); do \
|
|---|
| 157 | if test ! -d "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; then \
|
|---|
| 158 | echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
|
|---|
| 159 | $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
|
|---|
| 160 | else true; \
|
|---|
| 161 | fi; \
|
|---|
| 162 | done
|
|---|
| 163 | @for d in . $(APPSUBDIRS); \
|
|---|
| 164 | do \
|
|---|
| 165 | a=$(APPTEMPLATE)/$$d; \
|
|---|
| 166 | if test ! -d $$a; then continue; else true; fi; \
|
|---|
| 167 | b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \
|
|---|
| 168 | for i in $$a/*; \
|
|---|
| 169 | do \
|
|---|
| 170 | case $$i in \
|
|---|
| 171 | *CVS) ;; \
|
|---|
| 172 | *.svn) ;; \
|
|---|
| 173 | *.py[co]) ;; \
|
|---|
| 174 | *.orig) ;; \
|
|---|
| 175 | *~) ;; \
|
|---|
| 176 | *idx) \
|
|---|
| 177 | echo $(CPMAC) "$$i" $$b; \
|
|---|
| 178 | $(CPMAC) "$$i" "$$b"; \
|
|---|
| 179 | ;; \
|
|---|
| 180 | *) \
|
|---|
| 181 | if test -d $$i; then continue; fi; \
|
|---|
| 182 | if test -x $$i; then \
|
|---|
| 183 | echo $(INSTALL_SCRIPT) "$$i" "$$b"; \
|
|---|
| 184 | $(INSTALL_SCRIPT) "$$i" "$$b"; \
|
|---|
| 185 | else \
|
|---|
| 186 | echo $(INSTALL_DATA) "$$i" "$$b"; \
|
|---|
| 187 | $(INSTALL_DATA) "$$i" "$$b"; \
|
|---|
| 188 | fi;; \
|
|---|
| 189 | esac; \
|
|---|
| 190 | done; \
|
|---|
| 191 | done
|
|---|
| 192 | $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
|
|---|
| 193 | sed -e "s!%bundleid%!$(PYTHONFRAMEWORKIDENTIFIER)!g" \
|
|---|
| 194 | -e "s!%version%!`$(RUNSHARED) $(BUILDPYTHON) \
|
|---|
| 195 | -c 'import platform; print(platform.python_version())'`!g" \
|
|---|
| 196 | < "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in" \
|
|---|
| 197 | > "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist"
|
|---|
| 198 | rm "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in"
|
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 | install_IDLE:
|
|---|
| 202 | cd IDLE && make install
|
|---|
| 203 |
|
|---|
| 204 | install_BuildApplet:
|
|---|
| 205 | if ! $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) \
|
|---|
| 206 | -c 'import EasyDialogs' 2>/dev/null ; then \
|
|---|
| 207 | echo "EasyDialogs not available in this Python - skipping Build Applet.app" ; \
|
|---|
| 208 | else \
|
|---|
| 209 | $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \
|
|---|
| 210 | --destroot "$(DESTDIR)" \
|
|---|
| 211 | --python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \
|
|---|
| 212 | --output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \
|
|---|
| 213 | $(srcdir)/scripts/BuildApplet.py && \
|
|---|
| 214 | if [ -n "$(LIPO_32BIT_FLAGS)" ] ; then \
|
|---|
| 215 | rm "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app/Contents/MacOS/Python" && \
|
|---|
| 216 | lipo $(LIPO_32BIT_FLAGS) \
|
|---|
| 217 | -output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app/Contents/MacOS/Python" \
|
|---|
| 218 | $(BUILDPYTHON) ; \
|
|---|
| 219 | fi \
|
|---|
| 220 | fi
|
|---|
| 221 |
|
|---|
| 222 | MACLIBDEST=$(LIBDEST)/plat-mac
|
|---|
| 223 | MACTOOLSDEST=$(prefix)/Mac/Tools
|
|---|
| 224 | MACTOOLSSRC=$(srcdir)/Mac/Tools
|
|---|
| 225 | MACTOOLSSUBDIRS=IDE
|
|---|
| 226 |
|
|---|
| 227 | installmacsubtree:
|
|---|
| 228 | @for i in $(MACTOOLSDEST); \
|
|---|
| 229 | do \
|
|---|
| 230 | if test ! -d $(DESTDIR)$$i; then \
|
|---|
| 231 | echo "Creating directory $(DESTDIR)$$i"; \
|
|---|
| 232 | $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
|
|---|
| 233 | else true; \
|
|---|
| 234 | fi; \
|
|---|
| 235 | done
|
|---|
| 236 | @for d in $(MACTOOLSSUBDIRS); \
|
|---|
| 237 | do \
|
|---|
| 238 | a=$(MACTOOLSSRC)/$$d; \
|
|---|
| 239 | if test ! -d $$a; then continue; else true; fi; \
|
|---|
| 240 | b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
|
|---|
| 241 | if test ! -d $$b; then \
|
|---|
| 242 | echo "Creating directory $$b"; \
|
|---|
| 243 | $(INSTALL) -d -m $(DIRMODE) $$b; \
|
|---|
| 244 | else true; \
|
|---|
| 245 | fi; \
|
|---|
| 246 | done
|
|---|
| 247 | @for d in $(MACTOOLSSUBDIRS); \
|
|---|
| 248 | do \
|
|---|
| 249 | a=$(MACTOOLSSRC)/$$d; \
|
|---|
| 250 | if test ! -d $$a; then continue; else true; fi; \
|
|---|
| 251 | b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
|
|---|
| 252 | for i in $$a/*; \
|
|---|
| 253 | do \
|
|---|
| 254 | case $$i in \
|
|---|
| 255 | *CVS) ;; \
|
|---|
| 256 | *.svn) ;; \
|
|---|
| 257 | *.py[co]) ;; \
|
|---|
| 258 | *.orig) ;; \
|
|---|
| 259 | *~) ;; \
|
|---|
| 260 | *.rsrc) \
|
|---|
| 261 | echo $(CPMAC) $$i $$b ; \
|
|---|
| 262 | $(CPMAC) $$i $$b ; \
|
|---|
| 263 | ;; \
|
|---|
| 264 | *) \
|
|---|
| 265 | if test -d $$i; then continue; fi; \
|
|---|
| 266 | if test -x $$i; then \
|
|---|
| 267 | echo $(INSTALL_SCRIPT) $$i $$b; \
|
|---|
| 268 | $(INSTALL_SCRIPT) $$i $$b; \
|
|---|
| 269 | else \
|
|---|
| 270 | echo $(INSTALL_DATA) $$i $$b; \
|
|---|
| 271 | $(INSTALL_DATA) $$i $$b; \
|
|---|
| 272 | fi;; \
|
|---|
| 273 | esac; \
|
|---|
| 274 | done; \
|
|---|
| 275 | done
|
|---|
| 276 |
|
|---|
| 277 |
|
|---|
| 278 | $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST)
|
|---|
| 279 | $(RUNSHARED) $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
|
|---|
| 280 | $(RUNSHARED) $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
|
|---|
| 281 |
|
|---|
| 282 | $(INSTALLED_PYTHONAPP): install_Python
|
|---|
| 283 |
|
|---|
| 284 | installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py
|
|---|
| 285 | $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras"
|
|---|
| 286 | $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
|
|---|
| 287 | $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \
|
|---|
| 288 | "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo"
|
|---|
| 289 | $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/Demo \
|
|---|
| 290 | "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac"
|
|---|
| 291 |
|
|---|
| 292 |
|
|---|
| 293 | checkapplepython: $(srcdir)/Tools/fixapplepython23.py
|
|---|
| 294 | @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \
|
|---|
| 295 | echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \
|
|---|
| 296 | echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \
|
|---|
| 297 | fi
|
|---|
| 298 |
|
|---|
| 299 |
|
|---|
| 300 | clean:
|
|---|
| 301 | rm pythonw
|
|---|
| 302 | cd PythonLauncher && make clean
|
|---|
| 303 | cd IDLE && make clean
|
|---|
| 304 |
|
|---|
| 305 | Makefile: $(srcdir)/Makefile.in ../config.status
|
|---|
| 306 | cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status
|
|---|