summaryrefslogtreecommitdiffstats
path: root/Mac/OSX/Makefile.jaguar
blob: 3510b727249fdafbcb050c56f7c46fe639ca876e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# This Makefile, which should be run from the current directory, will build
# a MacPython based on the /usr/bin/python installed by Apple as of 10.2.

VERSION=2.2

builddir = ../..
srcdir = ../..
dstroot=/.
PYTHONAPPSPATH=/Applications/MacPython-OSX-$(VERSION)
PYTHONAPPSDIR=$(dstroot)$(PYTHONAPPSPATH)
prefix=/usr

# These are normally computed form the previous ones
osxdir=$(srcdir)/Mac/OSX
PYTHON=$(prefix)/bin/python
pythonw=$(prefix)/bin/pythonw
LIBDEST=$(prefix)/lib/python$(VERSION)
datadir=$(PYTHONAPPSDIR)/python-additions
MACLIBDEST=$(datadir)/Lib
MACDYNLIBDEST=$(datadir)/lib-dynload
MACTOOLSDEST=$(datadir)/Tools
APPNAME=Python
APPBUNDLENAME=$(APPNAME).app
INSTALLED_PYTHONW=$(datadir)/$(APPBUNDLENAME)/Contents/MacOS/$(APPNAME)

# The usual stuff
DIRMODE=755
INSTALL=/usr/bin/install -c
INSTALL_SYMLINK=ln -fs
INSTALL_PROGRAM=${INSTALL}
INSTALL_SCRIPT= ${INSTALL_PROGRAM}
INSTALL_DATA=	${INSTALL} -m 644

# These can be done as a normal user
install: preflight install_dirs install_dynlib install_lib \
	install_Python install_IDE install_IDLE install_BuildApplet \
	install_PythonLauncher install_pythonw 
	
preflight:
	@if test ! -w $(LIBDEST)/site-packages; then \
		echo Please make directory $(LIBDEST)/site-packages writeable; \
		exit 1; \
	fi
	@if grep "arch i386" $(LIBDEST)/config/Makefile >/dev/null; then \
		echo Please edit $(LIBDEST)/config/Makefile, see README.JAGUAR; \
		exit 1; \
	fi
	
install_dirs:
	$(INSTALL) -d -m $(DIRMODE) $(PYTHONAPPSDIR)
	$(INSTALL) -d -m $(DIRMODE) $(datadir)
	$(INSTALL) -d -m $(DIRMODE) $(MACDYNLIBDEST)
	
install_lib: Mac.jaguar.pth
	$(MAKE) -f $(osxdir)/Makefile installmacsubtree \
		LIBDEST=$(LIBDEST) MACLIBDEST=$(MACLIBDEST) MACTOOLSDEST=$(MACTOOLSDEST) \
		builddir=$(builddir) srcdir=$(srcdir) PTHFILE=Mac.jaguar.pth \
		PYTHON=$(PYTHON) compileall=$(LIBDEST)/compileall.py
		
Mac.jaguar.pth:
	echo $(MACLIBDEST) > Mac.jaguar.pth
	echo $(MACDYNLIBDEST) >> Mac.jaguar.pth
##	echo "import macresource; macresource.open_error_resource()" >> Mac.jaguar.pth
	
install_dynlib:
	$(PYTHON) $(osxdir)/setup.jaguar.py install --install-lib=$(MACDYNLIBDEST)
	touch $(MACDYNLIBDEST)/OverrideFrom23/__init__.py
		
install_Python:
	$(PYTHON) $(srcdir)/Mac/Lib/bundlebuilder.py -q --link-exec \
		-b $(datadir) \
		-n $(APPBUNDLENAME) \
		-r $(srcdir)/Mac/OSXResources/app/Resources/Applet-Info.plist \
		-r $(srcdir)/Mac/OSXResources/app/Resources/PythonApplet.icns \
		-e $(PYTHON) \
		build
		
install_IDE:
	$(MAKE) -f $(osxdir)/Makefile install_IDE \
		srcdir=$(srcdir) INSTALLED_PYTHONW=$(INSTALLED_PYTHONW) \
		PYTHONAPPSDIR=$(PYTHONAPPSDIR)
	
install_IDLE:
	$(MAKE) -f $(osxdir)/Makefile install_IDLE \
		srcdir=$(srcdir) INSTALLED_PYTHONW=$(INSTALLED_PYTHONW) \
		PYTHONAPPSDIR=$(PYTHONAPPSDIR)
	
install_BuildApplet:
	$(MAKE) -f $(osxdir)/Makefile install_BuildApplet \
		srcdir=$(srcdir) INSTALLED_PYTHONW=$(INSTALLED_PYTHONW) \
		PYTHONAPPSDIR=$(PYTHONAPPSDIR)
	
install_PythonLauncher:
	$(MAKE) -f $(osxdir)/Makefile install_PythonLauncher \
		srcdir=$(srcdir) dstroot=$(dstroot) \
		PYTHONAPPSPATH=$(PYTHONAPPSPATH)
	
install_pythonw:
	@if test ! -w $(prefix)/bin; then \
		echo Cannot write to $(prefix)/bin, use \"sudo make -f Makefile.jaguar install_pythonw\"; \
		exit 1; \
	fi
	echo "#!/bin/sh" > pythonw.sh
	echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh
	$(INSTALL) pythonw.sh $(prefix)/bin/pythonw