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