summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 60ad1db09465508e202f0d5bf41751bc3a0b5ebc (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
# Maintainer: Daniel Bershatsky <bepshatsky@yandex.ru>

pkgname=python-dbg
pkgver=3.8.6
pkgrel=1
epoch=0
pkgdesc="Python 3 debug symbols."
arch=('i686' 'x86_64')
url='http://www.python.org/'
license=('custom')
depends=('expat' 'bzip2' 'gdbm' 'openssl' 'libffi' 'zlib')
makedepends=('gcc' 'make' 'm4' 'autoconf' 'valgrind')
checkdepends=()
optdepends=()
provides=('python')
conflicts=()
replaces=()
backup=()
options=(!debug !strip)

source=("https://www.python.org/ftp/python/${pkgver%rc*}/Python-${pkgver}.tar.xz")
md5sums=('69e73c49eeb1a853cefd26d18c9d069d')

prepare() {
    cd Python-${pkgver}

    # FS#23997
    sed -i -e "s|^#.* /usr/local/bin/python|#!/usr/bin/python|" Lib/cgi.py

    # Ensure that we are using the system copy of various libraries (expat, libffi, and libmpdec),
    # rather than copies shipped in the tarball
#    rm -rf Modules/expat
#    rm -rf Modules/_ctypes/{darwin,libffi}*
#    rm -rf Modules/_decimal/libmpdec
}

build() {
    cd Python-${pkgver}

    # Disable bundled pip & setuptools
    ./configure --prefix=/usr \
                --enable-ipv6 \
                --enable-loadable-sqlite-extensions \
                --enable-optimizations \
                --enable-shared \
                --with-computed-gotos \
                --with-dbmliborder=gdbm:ndbm \
                --with-lto \
                --with-pydebug \
                --with-system-expat \
                --with-system-ffi \
                --with-system-libmpdec \
                --with-threads \
                --with-valgrind \
                --without-ensurepip


    # Obtain next free server number for xvfb-run; this even works in a chroot environment.
    #export servernum=99
    #while ! xvfb-run -a -n "$servernum" /bin/true 2>/dev/null; do servernum=$((servernum+1)); done

    LC_CTYPE=en_US.UTF-8 make EXTRA_CFLAGS="$CFLAGS" -j4
}

package() {
    cd Python-${pkgver}

    # Hack to avoid building again
    sed -i 's/^all:.*$/all: build_all/' Makefile

    make DESTDIR="${pkgdir}" EXTRA_CFLAGS="$CFLAGS" install
    find . -iname '*.so' -exec objcopy --only-keep-debug '{}' '{}.debug' \;

    # Why are these not done by default...
    ln -s python3               "${pkgdir}"/usr/bin/python
    ln -s python3-config        "${pkgdir}"/usr/bin/python-config
    ln -s idle3                 "${pkgdir}"/usr/bin/idle
    ln -s pydoc3                "${pkgdir}"/usr/bin/pydoc
    ln -s python${_pybasever}.1 "${pkgdir}"/usr/share/man/man1/python.1

    # some useful "stuff" FS#46146
    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/

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