summaryrefslogtreecommitdiffstats
path: root/base/python2/Pkgfile
blob: 416678f5cdfc5a419a2f39bbd8b6f62ba467a95b (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
# Description: Environnement de développement python
# URL: http://www.python.org
# Maintainer: NuTyX core team
# Packager: thierryn1 at hispeed dot ch
# Depends on:tk

name=python2
version=2.7.2
release=1
_pybasever=2.7

source=( http://www.python.org/ftp/python/$version/Python-$version.tar.bz2
	python-2.7-db51.diff)

build() {
	cd Python-$version

	sed -i "/progname =/s/python/python${_pybasever}/" Python/pythonrun.c

#	patch -Np1 -i ../python-2.7-db51.diff

	sed -i "/SQLITE_OMIT_LOAD_EXTENSION/d" setup.py
	sed -i -e "s|^#.* /usr/local/bin/python|#!/usr/bin/python2|" Lib/cgi.py

	rm -r Modules/expat
  	rm -r Modules/zlib
  	rm -r Modules/_ctypes/{darwin,libffi}*

	
	 export OPT="${CFLAGS}"
  	./configure --prefix=/usr --enable-shared --with-threads --enable-ipv6 \
              	    --enable-unicode=ucs4 --with-system-expat --with-system-ffi	

	make
	make DESTDIR=$PKG altinstall maninstall
	
	ln -sf python${_pybasever} $PKG/usr/bin/python2
  	ln -sf python${_pybasever}-config $PKG/usr/bin/python2-config
	ln -sf python${_pybasever}.1  $PKG/usr/share/man/man1/python2.1

  	ln -sf ../../libpython${_pybasever}.so \
    		$PKG/usr/lib/python${_pybasever}/config/libpython${_pybasever}.so



  	mv $PKG/usr/bin/smtpd.py $PKG/usr/lib/python${_pybasever}/

  	# some useful "stuff"
  	install -dm755 $PKG/usr/lib/python${_pybasever}/Tools/{i18n,scripts}
  	install -m755 Tools/i18n/{msgfmt,pygettext}.py \
    		$PKG/usr/lib/python${_pybasever}/Tools/i18n/
  	install -m755 Tools/scripts/{README,*py} \
    		$PKG/usr/lib/python${_pybasever}/Tools/scripts/

  	# fix conflicts with python
  	mv $PKG/usr/bin/idle{,2}
  	mv $PKG/usr/bin/pydoc{,2}

  	# clean up #!s
  	find $PKG/usr/lib/python2.7/ -name '*.py' | \
    		xargs sed -i "s|#[ ]*![ ]*/usr/bin/env python$|#!/usr/bin/env python2|"

  	# clean-up reference to build directory
  	sed -i "s#$SRC/Python-$version:##" \
    		$PKG/usr/lib/python${_pybasever}/config/Makefile
}