summaryrefslogtreecommitdiffstats
path: root/abs/core/python2/PKGBUILD
blob: 6e548de8fe4a80ba313043e28182cf212d8e9b21 (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
# $Id: PKGBUILD 96373 2010-10-20 03:29:47Z allan $
# Maintainer: Allan McRae <allan@archlinux.org>
# Contributer: Jason Chu <jason@archlinux.org>

pkgname=python2
pkgver=2.7
pkgrel=3
_pybasever=2.7
pkgdesc="A high-level scripting language"
arch=('i686' 'x86_64')
license=('PSF')
url="http://www.python.org"
depends=('db' 'bzip2' 'gdbm' 'openssl' 'zlib' 'expat' 'sqlite3')
makedepends=('tk')
optdepends=('tk: for IDLE')
conflicts=('python<3')
options=('!makeflags')
source=(http://www.python.org/ftp/python/${pkgver}/Python-${pkgver}.tar.bz2
        python-2.7-db51.diff)
md5sums=('0e8c9ec32abf5b732bea7d91b38c3339'
         'd9b8161568ce17a305c1b71e61ccd4b5')

build() {
  cd ${srcdir}/Python-${pkgver}

  patch -Np1 -i $srcdir/python-2.7-db51.diff

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

  make || return 1
}

package() {
  cd ${srcdir}/Python-${pkgver}
  make DESTDIR=${pkgdir} altinstall || return 1

  ln -sf python${_pybasever} $pkgdir/usr/bin/python2
  ln -sf python${_pybasever}-config $pkgdir/usr/bin/python2-config

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

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

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

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

  # clean up #!s
  find $pkgdir/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#$srcdir/Python-${pkgver}:##" \
    $pkgdir/usr/lib/python${_pybasever}/config/Makefile

  # license
  install -Dm644 LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
}