aboutsummaryrefslogtreecommitdiff
path: root/development/python/python.build
blob: 4eef21c6a6659175196df39d649f1b53798be3f9 (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
#!/bin/bash
#
# Maintainer: Deposite Pirate <ofni.sknuplatem@etaripd>

source /usr/src/ports/Build/build.sh

NAME=python
MAJOR=2.7
VERSION=${MAJOR}.4
BUILD=1
OPTDEPENDS=('gdbm >= 1.10-1' 'bzip2 >= 1.0.6-1' 'openssl >= 1.0.1e-1' 'expat >= 2.1.0-1' 'sqlite >= 3.7.16.1-1')

# Description

cat > ${PKG}/install/slack-desc <<EOF
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

$(padd)|-----handy-ruler------------------------------------------------------|
${NAME}: python (object-oriented interpreted programming language)
${NAME}:
${NAME}: Python is an interpreted, interactive, object-oriented programming
${NAME}: language that combines remarkable power with very clear syntax.
${NAME}: Python's basic power can be extended with your own modules written in
${NAME}: C or C++. Python is also adaptable as an extension language for
${NAME}: existing applications.
${NAME}:
${NAME}: Homepage: http://www.python.org
${NAME}:
${NAME}:
EOF

# Sources

PYTHONLIBDIR=${SYS_DIR[lib]}/python${MAJOR}

SRCNAME[0]=Python
SRCVERS[0]=${VERSION}
SRCPACK[0]=http://www.python.org/ftp/python/2.7.4/${SRCNAME[0]}-${SRCVERS[0]}.tar.xz

build0()
{
# Fix pkgconfig file location
sed -i 's|$(LIBDIR)/pkgconfig|$(datarootdir)/pkgconfig|g' Makefile.pre.in
# http://bugs.python.org/issue10835
sed -i "/progname =/s/python/python${_pybasever}/" Python/pythonrun.c
# Enable built-in SQLite module to load extensions
sed -i "/SQLITE_OMIT_LOAD_EXTENSION/d" setup.py
# On many systems /usr/local/bin is not in $PATH as passed to CGI scripts
# and /usr/local/bin is the default directory where Python is installed,
# so /usr/bin/env would be unable to find python. Granted, binary
# installations by Linux vendors often install Python in /usr/bin. So let
# those vendors patch cgi.py to match their choice of installation.
sed -i -e "s|^#.* /usr/local/bin/python|#!/usr/bin/python2|" Lib/cgi.py
# Fix python2.3
sed -i "s|python2.3|python2|g" \
 Lib/distutils/tests/test_{build,install}_scripts.py \
 Tools/scripts/gprof2html.py
# Use system versions of these libraries
rm -rf Modules/expat Modules/zlib Modules/_ctypes/{darwin,libffi}*
export OPT="${FLAGS}"
./configure \
 --build="${ARCH}-slackware-linux" \
 --enable-shared \
 --prefix="${SYS_DIR[usr]}" \
 --mandir="${SYS_DIR[man]}" \
 --sysconfdir="${SYS_DIR[etc]}" \
 --libdir="${SYS_DIR[lib]}" \
 --localstatedir="${SYS_DIR[var]}" \
 --with-threads \
 --with-dbmliborder=gdbm:ndbm \
 --with-system-expat \
 --with-system-ffi \
 --enable-ipv6 \
 --enable-unicode=ucs4
make ${JOBS}
make altinstall maninstall DESTDIR="${PKG}"
license LICENSE
#FIXME: Add docs, demos and tools when there is subpackage support
# A few symlinks
(
  cd ${PKG}${SYS_DIR[bin]}
  ln -sf python${MAJOR} python2
  ln -sf python${MAJOR} python
  ln -sf python${MAJOR}-config python2-config
)
(
  cd ${PKG}${SYS_DIR[man]}/man1
  rm -f python.1 python2.1
  echo ".so man1/python${MAJOR}.1" > python2.1
  echo ".so man1/python${MAJOR}.1" > python.1
)
# Fix conflicts with python 3.x
(
  cd ${PKG}${SYS_DIR[bin]}
  mv idle{,2}
  mv pydoc{,2}
  mv 2to3{,-${MAJOR}}
  ln -sf idle2 idle
  ln -sf pydoc2 pydoc
  ln -sf 2to3-${MAJOR} 2to3
)
# We don't need smtp.py in /usr/bin
mv ${PKG}${SYS_DIR[bin]}/smtpd.py ${PKG}${PYTHONLIBDIR}
# python -> python2
sed -i "s|#[ ]*![ ]*/usr/bin/env python$|#!/usr/bin/env python2|" \
 $(find ${PKG}${PYTHONLIBDIR} -name '*.py')
# More clean up...
sed -i "s|${PKG}/Python-${SRCVERS[0]}:||g" ${PKG}${PYTHONLIBDIR}/config/Makefile
}