##// END OF EJS Templates
contrib: make Python 2.7.9 the default in Makefile.python...
Mads Kiilerich -
r23880:c0c4713c default
parent child Browse files
Show More
@@ -1,79 +1,79 b''
1 PYTHONVER=2.7.8
1 PYTHONVER=2.7.9
2 PYTHONNAME=python-
2 PYTHONNAME=python-
3 PREFIX=$(HOME)/bin/prefix-$(PYTHONNAME)$(PYTHONVER)
3 PREFIX=$(HOME)/bin/prefix-$(PYTHONNAME)$(PYTHONVER)
4 SYMLINKDIR=$(HOME)/bin
4 SYMLINKDIR=$(HOME)/bin
5
5
6 help:
6 help:
7 @echo
7 @echo
8 @echo 'Make a custom installation of a Python version'
8 @echo 'Make a custom installation of a Python version'
9 @echo
9 @echo
10 @echo 'Common make parameters:'
10 @echo 'Common make parameters:'
11 @echo ' PYTHONVER=... [$(PYTHONVER)]'
11 @echo ' PYTHONVER=... [$(PYTHONVER)]'
12 @echo ' PREFIX=... [$(PREFIX)]'
12 @echo ' PREFIX=... [$(PREFIX)]'
13 @echo ' SYMLINKDIR=... [$(SYMLINKDIR) creating $(PYTHONNAME)$(PYTHONVER)]'
13 @echo ' SYMLINKDIR=... [$(SYMLINKDIR) creating $(PYTHONNAME)$(PYTHONVER)]'
14 @echo
14 @echo
15 @echo 'Common make targets:'
15 @echo 'Common make targets:'
16 @echo ' python - install Python $$PYTHONVER in $$PREFIX'
16 @echo ' python - install Python $$PYTHONVER in $$PREFIX'
17 @echo ' symlink - create a $$SYMLINKDIR/$(PYTHONNAME)$$PYTHONVER symlink'
17 @echo ' symlink - create a $$SYMLINKDIR/$(PYTHONNAME)$$PYTHONVER symlink'
18 @echo
18 @echo
19 @echo 'Example: create a temporary Python installation:'
19 @echo 'Example: create a temporary Python installation:'
20 @echo ' $$ make -f Makefile.python python PYTHONVER=2.4 PREFIX=/tmp/p24'
20 @echo ' $$ make -f Makefile.python python PYTHONVER=2.4 PREFIX=/tmp/p24'
21 @echo ' $$ /tmp/p24/bin/python -V'
21 @echo ' $$ /tmp/p24/bin/python -V'
22 @echo ' Python 2.4'
22 @echo ' Python 2.4'
23 @echo
23 @echo
24 @echo 'Some external libraries are required for building Python: zlib bzip2 openssl.'
24 @echo 'Some external libraries are required for building Python: zlib bzip2 openssl.'
25 @echo 'Make sure their development packages are installed systemwide.'
25 @echo 'Make sure their development packages are installed systemwide.'
26 # fedora: yum install zlib-devel bzip2-devel openssl-devel
26 # fedora: yum install zlib-devel bzip2-devel openssl-devel
27 # debian: apt-get install zlib1g-dev libbz2-dev libssl-dev
27 # debian: apt-get install zlib1g-dev libbz2-dev libssl-dev
28 @echo
28 @echo
29 @echo 'To build a nice collection of interesting Python versions:'
29 @echo 'To build a nice collection of interesting Python versions:'
30 @echo ' $$ for v in 2.{4{,.2,.3},5{,.6},6{,.1,.2,.9},7{,.8}}; do'
30 @echo ' $$ for v in 2.{4{,.2,.3},5{,.6},6{,.1,.2,.9},7{,.8,.9}}; do'
31 @echo ' make -f Makefile.python symlink PYTHONVER=$$v || break; done'
31 @echo ' make -f Makefile.python symlink PYTHONVER=$$v || break; done'
32 @echo 'To run a Mercurial test on all these Python versions:'
32 @echo 'To run a Mercurial test on all these Python versions:'
33 @echo ' $$ for py in `cd ~/bin && ls $(PYTHONNAME)2.*`; do'
33 @echo ' $$ for py in `cd ~/bin && ls $(PYTHONNAME)2.*`; do'
34 @echo ' echo $$py; $$py run-tests.py test-http.t; echo; done'
34 @echo ' echo $$py; $$py run-tests.py test-http.t; echo; done'
35 @echo
35 @echo
36
36
37 export LANGUAGE=C
37 export LANGUAGE=C
38 export LC_ALL=C
38 export LC_ALL=C
39
39
40 python: $(PREFIX)/bin/python docutils
40 python: $(PREFIX)/bin/python docutils
41 printf 'import sys, zlib, bz2, docutils\nif sys.version_info >= (2,6):\n import ssl' | $(PREFIX)/bin/python
41 printf 'import sys, zlib, bz2, docutils\nif sys.version_info >= (2,6):\n import ssl' | $(PREFIX)/bin/python
42
42
43 PYTHON_SRCDIR=Python-$(PYTHONVER)
43 PYTHON_SRCDIR=Python-$(PYTHONVER)
44 PYTHON_SRCFILE=$(PYTHON_SRCDIR).tgz
44 PYTHON_SRCFILE=$(PYTHON_SRCDIR).tgz
45
45
46 $(PREFIX)/bin/python:
46 $(PREFIX)/bin/python:
47 [ -f $(PYTHON_SRCFILE) ] || wget http://www.python.org/ftp/python/$(PYTHONVER)/$(PYTHON_SRCFILE) || curl -OL http://www.python.org/ftp/python/$(PYTHONVER)/$(PYTHON_SRCFILE) || [ -f $(PYTHON_SRCFILE) ]
47 [ -f $(PYTHON_SRCFILE) ] || wget http://www.python.org/ftp/python/$(PYTHONVER)/$(PYTHON_SRCFILE) || curl -OL http://www.python.org/ftp/python/$(PYTHONVER)/$(PYTHON_SRCFILE) || [ -f $(PYTHON_SRCFILE) ]
48 rm -rf $(PYTHON_SRCDIR)
48 rm -rf $(PYTHON_SRCDIR)
49 tar xf $(PYTHON_SRCFILE)
49 tar xf $(PYTHON_SRCFILE)
50 # Ubuntu disables SSLv2 the hard way, disable it on old Pythons too
50 # Ubuntu disables SSLv2 the hard way, disable it on old Pythons too
51 -sed -i 's,self.*SSLv2_method(),0;//\0,g' $(PYTHON_SRCDIR)/Modules/_ssl.c
51 -sed -i 's,self.*SSLv2_method(),0;//\0,g' $(PYTHON_SRCDIR)/Modules/_ssl.c
52 # Find multiarch system libraries on Ubuntu with Python 2.4.x
52 # Find multiarch system libraries on Ubuntu with Python 2.4.x
53 # http://lipyrary.blogspot.dk/2011/05/how-to-compile-python-on-ubuntu-1104.html
53 # http://lipyrary.blogspot.dk/2011/05/how-to-compile-python-on-ubuntu-1104.html
54 -sed -i "s|lib_dirs = .* \[|\0'/usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`',|g" $(PYTHON_SRCDIR)/setup.py
54 -sed -i "s|lib_dirs = .* \[|\0'/usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`',|g" $(PYTHON_SRCDIR)/setup.py
55 # Find multiarch system libraries on Ubuntu and disable fortify error when setting argv
55 # Find multiarch system libraries on Ubuntu and disable fortify error when setting argv
56 LDFLAGS="-L/usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`"; \
56 LDFLAGS="-L/usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`"; \
57 BASECFLAGS=-U_FORTIFY_SOURCE; \
57 BASECFLAGS=-U_FORTIFY_SOURCE; \
58 export LDFLAGS BASECFLAGS; \
58 export LDFLAGS BASECFLAGS; \
59 cd $(PYTHON_SRCDIR) && ./configure --prefix=$(PREFIX) && make all SVNVERSION=pwd && make install
59 cd $(PYTHON_SRCDIR) && ./configure --prefix=$(PREFIX) && make all SVNVERSION=pwd && make install
60 printf 'import sys, zlib, bz2\nif sys.version_info >= (2,6):\n import ssl' | $(PREFIX)/bin/python
60 printf 'import sys, zlib, bz2\nif sys.version_info >= (2,6):\n import ssl' | $(PREFIX)/bin/python
61 rm -rf $(PYTHON_SRCDIR)
61 rm -rf $(PYTHON_SRCDIR)
62
62
63 DOCUTILSVER=0.12
63 DOCUTILSVER=0.12
64 DOCUTILS_SRCDIR=docutils-$(DOCUTILSVER)
64 DOCUTILS_SRCDIR=docutils-$(DOCUTILSVER)
65 DOCUTILS_SRCFILE=$(DOCUTILS_SRCDIR).tar.gz
65 DOCUTILS_SRCFILE=$(DOCUTILS_SRCDIR).tar.gz
66
66
67 docutils: $(PREFIX)/bin/python
67 docutils: $(PREFIX)/bin/python
68 @$(PREFIX)/bin/python -c 'import docutils' || ( set -ex; \
68 @$(PREFIX)/bin/python -c 'import docutils' || ( set -ex; \
69 [ -f $(DOCUTILS_SRCFILE) ] || wget http://downloads.sourceforge.net/project/docutils/docutils/$(DOCUTILSVER)/$(DOCUTILS_SRCFILE) || [ -f $(DOCUTILS_SRCFILE) ]; \
69 [ -f $(DOCUTILS_SRCFILE) ] || wget http://downloads.sourceforge.net/project/docutils/docutils/$(DOCUTILSVER)/$(DOCUTILS_SRCFILE) || [ -f $(DOCUTILS_SRCFILE) ]; \
70 rm -rf $(DOCUTILS_SRCDIR); \
70 rm -rf $(DOCUTILS_SRCDIR); \
71 tar xf $(DOCUTILS_SRCFILE); \
71 tar xf $(DOCUTILS_SRCFILE); \
72 cd $(DOCUTILS_SRCDIR) && $(PREFIX)/bin/python setup.py install --prefix=$(PREFIX); \
72 cd $(DOCUTILS_SRCDIR) && $(PREFIX)/bin/python setup.py install --prefix=$(PREFIX); \
73 $(PREFIX)/bin/python -c 'import docutils'; \
73 $(PREFIX)/bin/python -c 'import docutils'; \
74 rm -rf $(DOCUTILS_SRCDIR); )
74 rm -rf $(DOCUTILS_SRCDIR); )
75
75
76 symlink: python $(SYMLINKDIR)
76 symlink: python $(SYMLINKDIR)
77 ln -sf $(PREFIX)/bin/python $(SYMLINKDIR)/$(PYTHONNAME)$(PYTHONVER)
77 ln -sf $(PREFIX)/bin/python $(SYMLINKDIR)/$(PYTHONNAME)$(PYTHONVER)
78
78
79 .PHONY: help python docutils symlink
79 .PHONY: help python docutils symlink
General Comments 0
You need to be logged in to leave comments. Login now