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 5VERSION=@VERSION@ 6ABIFLAGS=@ABIFLAGS@ 7LDVERSION=@LDVERSION@ 8ENSUREPIP=@ENSUREPIP@ 9builddir = .. 10srcdir=@srcdir@ 11prefix=@prefix@ 12exec_prefix=@exec_prefix@ 13LIBDEST=$(prefix)/lib/python$(VERSION) 14RUNSHARED=@RUNSHARED@ 15BUILDEXE=@BUILDEXEEXT@ 16BUILDPYTHON=$(builddir)/python$(BUILDEXE) 17DESTDIR= 18LDFLAGS=@LDFLAGS@ 19FRAMEWORKUNIXTOOLSPREFIX=@FRAMEWORKUNIXTOOLSPREFIX@ 20PYTHONFRAMEWORK=@PYTHONFRAMEWORK@ 21PYTHONFRAMEWORKIDENTIFIER=@PYTHONFRAMEWORKIDENTIFIER@ 22LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@ 23CC=@CC@ 24MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ 25export MACOSX_DEPLOYMENT_TARGET 26 27 28 29# These are normally glimpsed from the previous set 30BINDIR= @bindir@ 31PYTHONAPPSDIR=@FRAMEWORKINSTALLAPPSPREFIX@/$(PYTHONFRAMEWORK) $(VERSION) 32APPINSTALLDIR=$(prefix)/Resources/Python.app 33 34# Variables for installing the "normal" unix binaries 35INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK) 36 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 47CPMAC=CpMac 48 49APPTEMPLATE=$(srcdir)/Resources/app 50APPSUBDIRS=MacOS Resources 51compileall=$(srcdir)/../Lib/compileall.py 52 53installapps: install_Python install_PythonLauncher install_IDLE 54 55# 56# Install unix tools in /usr/local/bin. These are just aliases for the 57# actual installation inside the framework. 58# 59installunixtools: 60 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \ 61 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\ 62 fi 63 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ 64 for fn in \ 65 2to3 \ 66 idle3 \ 67 pydoc3 \ 68 python3 \ 69 python3-config \ 70 pyvenv \ 71 ; \ 72 do \ 73 rm -f $${fn} ; \ 74 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\ 75 done 76 -if test "x$(VERSION)" != "x$(LDVERSION)"; then \ 77 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ 78 for fn in \ 79 python$(VERSION)-config \ 80 ; \ 81 do \ 82 rm -f $${fn} ;\ 83 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\ 84 done ;\ 85 fi 86 -if test "x$(LIPO_32BIT_FLAGS)" != "x"; then \ 87 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ 88 for fn in \ 89 python3-32 \ 90 ; \ 91 do \ 92 rm -f $${fn} ;\ 93 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\ 94 done ;\ 95 fi 96 -if test "x$(ENSUREPIP)" != "xno" ; then \ 97 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ 98 for fn in \ 99 pip3 \ 100 ; \ 101 do \ 102 rm -f $${fn} ;\ 103 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\ 104 done ;\ 105 fi 106 107# 108# Like installunixtools, but only install links to the versioned binaries. 109# 110altinstallunixtools: 111 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \ 112 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\ 113 fi 114 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ 115 for fn in \ 116 2to3-$(VERSION) \ 117 idle$(VERSION) \ 118 pydoc$(VERSION) \ 119 python$(VERSION) \ 120 python$(LDVERSION)-config \ 121 pyvenv-$(VERSION) \ 122 ; \ 123 do \ 124 rm -f $${fn} ;\ 125 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\ 126 done 127 -if test "x$(VERSION)" != "x$(LDVERSION)"; then \ 128 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ 129 for fn in \ 130 python$(LDVERSION) \ 131 ; \ 132 do \ 133 rm -f $${fn} ;\ 134 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\ 135 done ;\ 136 fi 137 -if test "x$(LIPO_32BIT_FLAGS)" != "x"; then \ 138 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ 139 for fn in \ 140 python$(VERSION)-32 \ 141 ; \ 142 do \ 143 rm -f $${fn} ;\ 144 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\ 145 done ;\ 146 fi 147 -if test "x$(ENSUREPIP)" != "xno" ; then \ 148 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \ 149 for fn in \ 150 easy_install-$(VERSION) \ 151 pip$(VERSION) \ 152 ; \ 153 do \ 154 rm -f $${fn} ;\ 155 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\ 156 done ;\ 157 fi 158 159pythonw: $(srcdir)/Tools/pythonw.c Makefile 160 $(CC) $(LDFLAGS) -DPYTHONFRAMEWORK='"$(PYTHONFRAMEWORK)"' -o $@ \ 161 $(srcdir)/Tools/pythonw.c -I.. -I$(srcdir)/../Include \ 162 ../$(PYTHONFRAMEWORK).framework/Versions/$(VERSION)/$(PYTHONFRAMEWORK) 163 164install_PythonLauncher: 165 cd PythonLauncher && make install DESTDIR=$(DESTDIR) 166 167install_Python: 168 @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \ 169 if test ! -d "$(DESTDIR)$$i"; then \ 170 echo "Creating directory $(DESTDIR)$$i"; \ 171 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \ 172 fi;\ 173 done 174 @for i in $(APPSUBDIRS); do \ 175 if test ! -d "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; then \ 176 echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \ 177 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \ 178 else true; \ 179 fi; \ 180 done 181 @for d in . $(APPSUBDIRS); \ 182 do \ 183 a=$(APPTEMPLATE)/$$d; \ 184 if test ! -d $$a; then continue; else true; fi; \ 185 b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \ 186 for i in $$a/*; \ 187 do \ 188 case $$i in \ 189 *CVS) ;; \ 190 *.svn) ;; \ 191 *.py[co]) ;; \ 192 *.orig) ;; \ 193 *~) ;; \ 194 *idx) \ 195 echo $(CPMAC) "$$i" $$b; \ 196 $(CPMAC) "$$i" "$$b"; \ 197 ;; \ 198 *) \ 199 if test -d $$i; then continue; fi; \ 200 if test -x $$i; then \ 201 echo $(INSTALL_SCRIPT) "$$i" "$$b"; \ 202 $(INSTALL_SCRIPT) "$$i" "$$b"; \ 203 else \ 204 echo $(INSTALL_DATA) "$$i" "$$b"; \ 205 $(INSTALL_DATA) "$$i" "$$b"; \ 206 fi;; \ 207 esac; \ 208 done; \ 209 done 210 $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)" 211 sed -e "s!%bundleid%!$(PYTHONFRAMEWORKIDENTIFIER)!g" \ 212 -e "s!%version%!`$(RUNSHARED) $(BUILDPYTHON) \ 213 -c 'import platform; print(platform.python_version())'`!g" \ 214 < "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in" \ 215 > "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist" 216 rm "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in" 217 218 219install_IDLE: 220 test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)" 221 -test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -rf "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" 222 /bin/cp -PR "$(srcdir)/IDLE/IDLE.app" "$(DESTDIR)$(PYTHONAPPSDIR)" 223 ln -sf "$(INSTALLED_PYTHONAPP)" "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python" 224ifneq ($(LIPO_32BIT_FLAGS),) 225 rm "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python" 226 lipo $(LIPO_32BIT_FLAGS) -output "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python" "$(BUILDPYTHON)" 227endif 228 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" 229 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" 230 if [ -f "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" ]; then \ 231 /bin/cp -p "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" \ 232 "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" ; \ 233 sed -e 's!name= IDLE Classic Windows!name= IDLE Classic OSX!g' \ 234 < "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" \ 235 > "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" ; \ 236 rm "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" ; \ 237 fi 238 if [ -f "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" ]; then \ 239 /bin/cp -p "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" \ 240 "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" ; \ 241 sed -e 's!zoom-height=<Alt-Key-2>!zoom-height=<Option-Key-0>!g' \ 242 -e 's!<Alt-Key-!<Option-Key-!g' \ 243 < "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" \ 244 > "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" ; \ 245 rm "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" ; \ 246 fi 247 touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" 248 249$(INSTALLED_PYTHONAPP): install_Python 250 251installextras: $(srcdir)/Extras.install.py 252 $(INSTALL) -d "$(DESTDIR)$(prefix)/share/doc/python$(VERSION)/examples" 253 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Tools \ 254 "$(DESTDIR)$(prefix)/share/doc/python$(VERSION)/examples/Tools" ; \ 255 chmod -R ugo+rX,go-w "$(DESTDIR)$(prefix)/share/doc/python$(VERSION)/examples/Tools" 256 257clean: 258 rm pythonw 259 cd PythonLauncher && make clean 260 261Makefile: $(srcdir)/Makefile.in ../config.status 262 cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status 263