aboutsummaryrefslogtreecommitdiffstats
path: root/main/python3/APKBUILD
blob: 80f9a66fdc8ca68d3591dbca2c37e2c3c1b89e0f (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:
# Contributor: Kiyoshi Aman <kiyoshi.aman@gmail.com>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@alpinelinux.org>

pkgname=python3
pkgver=3.5.1
pkgrel=1
pkgdesc="A high-level scripting language"
url="http://www.python.org"
arch="all"
license="custom"
subpackages="$pkgname-dev $pkgname-doc $pkgname-tests"
depends=""
makedepends="expat-dev openssl-dev zlib-dev ncurses-dev bzip2-dev
	sqlite-dev libffi-dev tcl-dev linux-headers gdbm-dev libedit-dev"
source="http://www.python.org/ftp/python/$pkgver/Python-$pkgver.tar.xz"

_builddir="$srcdir"/Python-$pkgver
prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done

	# force system libs
	rm -r Modules/expat \
		Modules/zlib \
		Modules/_ctypes/darwin* \
		Modules/_ctypes/libffi* \
		|| return 1
}

build() {
	cd "$_builddir"
	./configure \
		--prefix=/usr \
		--enable-shared \
		--enable-ipv6 \
		--with-computed-gotos \
		--with-threads \
		--with-system-ffi \
		--with-system-expat \
		--with-dbmliborder=gdbm:ndbm \
		--enable-loadable-sqlite-extensions \
	        --disable-rpath \
		|| return 1
	make EXTRA_CFLAGS="$CFLAGS" || return 1
}

package() {
	cd "$_builddir"
	make -j1 DESTDIR="$pkgdir" EXTRA_CFLAGS="$CFLAGS" install maninstall \
		|| return 1
	mv "$pkgdir"/usr/bin/2to3 "$pkgdir"/usr/bin/2to3-3.3
	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

_mv_files() {
	cd "$pkgdir"/usr/lib/python${pkgver%.*}
	for i in */test */tests; do
		mkdir -p "$subpkgdir"/usr/lib/python${pkgver%.*}/"$i"
		mv "$i"/* "$subpkgdir"/usr/lib/python${pkgver%.*}/"$i"
		rm -rf "$i"
	done
	mv "$pkgdir"/usr/lib/python${pkgver%.*}/test \
		"$subpkgdir"/usr/lib/python${pkgver%.*}
}

dev() {
	# pyconfig.h is needed runtime so we move it back
	default_dev
	mkdir -p "$pkgdir"/usr/include/python${pkgver%.*}m
	mv "$subpkgdir"/usr/include/python${pkgver%.*}m/pyconfig.h \
		"$pkgdir"/usr/include/python${pkgver%.*}m/
}

tests() {
	pkgdesc="The test modules from the main python package"
	arch="noarch"
	cd "$pkgdir"
	_mv_files
}

md5sums="e9ea6f2623fffcdd871b7b19113fde80  Python-3.5.1.tar.xz"
sha256sums="c6d57c0c366d9060ab6c0cdf889ebf3d92711d466cc0119c441dbf2746f725c9  Python-3.5.1.tar.xz"
sha512sums="261c9e42ae351853c718707a8887817e308b3ba7a37e9463a0bc8f50ee9be9ac1a011b2891f8877ecdb40beab99279bcfa8e04f813b8998fcf6cefb7fd52d850  Python-3.5.1.tar.xz"