blob: 1e4f65f3c36a0b234f32b690039675ddf8f63617 (
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
# Copyright 1999-2000 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Author Daniel Robbins <drobbins@gentoo.org>
# Modified Tod M. Neidt <tneidt@fidnet.com>
# /home/cvsroot/gentoo-x86/dev-lang/python/python-2.0-r4.ebuild,v 1.1 2001/06/04 19:49:02 drobbins Exp
# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.0-r6.ebuild,v 1.3 2001/11/08 18:04:51 achim Exp $
S=${WORKDIR}/Python-2.0
S2=${WORKDIR}/python-fchksum-1.1
DESCRIPTION="A really great language"
SRC_URI="http://www.python.org/ftp/python/2.0/BeOpen-Python-2.0.tar.bz2
http://www.azstarnet.com/~donut/programs/fchksum/python-fchksum-1.1.tar.gz"
HOMEPAGE="http://www.python.org http://www.azstarnet.com/~donut/programs/fchksum/"
#tcltk depends is = becasue need to automate tcltk version number below
DEPEND="virtual/glibc >=sys-libs/zlib-1.1.3
readline? ( >=sys-libs/readline-4.1 >=sys-libs/ncurses-5.2 )
berkdb? ( >=sys-libs/db-3 )
tcltk? ( >=dev-lang/tcl-tk-8.0 )"
RDEPEND="$DEPEND"
PROVIDE="virtual/python-2.0"
src_unpack() {
local mylibs
unpack BeOpen-Python-2.0.tar.bz2
cd ${S}/Modules
if [ "`use readline`" ]
then
sed -e 's/#readline/readline/' -e 's/-lreadline -ltermcap/-lreadline/' \
-e 's/#_curses _cursesmodule.c -lcurses -ltermcap/_curses _cursesmodule.c -lncurses/' \
-e 's/#crypt/crypt/' -e 's/# -lcrypt/-lcrypt/' \
Setup.in > Setup.new
mv Setup.new Setup.in
mylibs="-lreadline -lncurses -lcrypt"
fi
#Added check for tcltk USE variable, if set build _tkinter
#Need to automate tk and tcl version determination
if [ "`use tcltk`" ]
then
#Determine tcl version by greping tcl.h
#Probably don't need same for tk, but play it safe
local tcl_version
local tk_version
tcl_version=$(grep TCL_VERSION /usr/include/tcl.h | \
sed -e 's/.*\([0-9]\.[0-9]\).*/\1/')
tk_version=$(grep TK_VERSION /usr/include/tk.h | \
sed -e 's/.*\([0-9]\.[0-9]\).*/\1/')
sed -e 's:# _tkinter:_tkinter:' \
-e 's:#[[:blank:]]*-I/usr/local/include:-I/usr/include:' \
-e 's:#[[:blank:]]*-I/usr/X11R6/include:-I/usr/X11R6/include:' \
-e 's:#[[:blank:]]*-L/usr/local/lib:-L/usr/lib:' \
-e 's:#[[:blank:]]*-ltk8.0 -ltcl8.0:-ltk'${tk_version}' -ltcl'${tcl_version}':' \
-e 's:#[[:blank:]]*-L/usr/X11R6/lib:-L/usr/X11R6/lib:' \
-e 's:#[[:blank:]]-lX11:-lX11:' \
Setup.in > Setup.new
mv Setup.new Setup.in
mylibs="$mylibs -ltk${tk_version} -ltcl${tcl_version} -L/usr/X11R6/lib -lX11"
fi
if [ "`use berkdb`" ]
then
sed -e 's:#dbm.*:dbm dbmmodule.c -I/usr/include/db3 -ldb-3.2:' \
Setup.in > Setup.new
mv Setup.new Setup.in
mylibs="$mylibs -ldb-3.2"
fi
#Removed the commenting out of TKPATH
sed -e 's/#_locale/_locale/' \
-e 's/#syslog/syslog/' \
-e 's:#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz:zlib zlibmodule.c -lz:' \
-e 's:^#termios:termios:' -e 's:^#resource:resource:' \
Setup.in > Setup
echo "fchksum fchksum.c md5_2.c" >> Setup
mylibs="-lpython2.0 $mylibs -lz -lutil"
cd ${S}/Modules
if [ "`use berkdb`" ]
then
#patch the dbmmodule to use db3's dbm compatibility code. That way, we're depending on db3 rather than
#old db1. We'll link with db3, of course.
cp dbmmodule.c dbmmodule.c.orig
sed -e '10,25d' -e '26i\' -e '#define DB_DBM_HSEARCH 1\' -e 'static char *which_dbm = "BSD db";\' -e '#include <db3/db.h>' dbmmodule.c.orig > dbmmodule.c
fi
cp ${FILESDIR}/pfconfig.h .
unpack python-fchksum-1.1.tar.gz
cd python-fchksum-1.1
mv md5.h ../md5_2.h
sed -e 's:"md5.h":"md5_2.h":' md5.c > ../md5_2.c
sed -e 's:"md5.h":"md5_2.h":' fchksum.c > ../fchksum.c
#for some reason, python 2.0 can't find /usr/lib/python2.0 without this fix to the source code.
cd ${S}/Python
cp pythonrun.c pythonrun.c.orig
sed -e 's:static char \*default_home = NULL:static char \*default_home = "/usr":' pythonrun.c.orig > pythonrun.c
cat <<END > ${S}/python-config
#!/bin/sh
echo -lm $mylibs
END
}
src_compile() {
cd ${S}
try ./configure --prefix=/usr --without-libdb
#libdb3 support is available from http://pybsddb.sourceforge.net/; the one
#included with python is for db 1.85 only.
cp Makefile Makefile.orig
sed -e "s/-g -O2/${CFLAGS}/" Makefile.orig > Makefile
cd ${S}/Modules
cp Makefile.pre Makefile.orig
sed -e "s:MODOBJS=:MODOBJS=fchksum.o md5_2.o:" \
Makefile.orig > Makefile.pre
# Parallel make does not work
cd ${S}
try make
}
src_install() {
dodir /usr
try make install prefix=${D}/usr
rm ${D}/usr/bin/python
dosym python2.0 /usr/bin/python
exeinto /usr/bin
doexe python-config
dodoc README
#Change OPT setting in /usr/lib/python2.0/config/Makefile
#to CFLAG from /etc/make.conf so optimaization is set for
#subsequent module installs using distutil.
#There is probably a better way :)
cd ${D}/usr/lib/python2.0/config
sed -e "s/OPT=[[:blank:]]*-g -O2 -Wall -Wstrict-prototypes/OPT= ${CFLAGS}/" \ Makefile > Makefile.new
mv Makefile.new Makefile
#If USE tcltk lets install idle
#Need to script the python version in the path
if [ "`use tcltk`" ]
then
mkdir ${D}/usr/lib/python2.0/tools
cd ${S}
mv Tools/idle ${D}/usr/lib/python2.0/tools/
#don't quit understand dosym; put idle in PATH
ln -s /usr/lib/python2.0/tools/idle/idle.py ${D}/usr/bin/idle.py
fi
}
|