APKBUILD 3.18 KB
Newer Older
Natanael Copa's avatar
Natanael Copa committed
1 2
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=python
3
pkgver=2.7.11
4
_verbase=${pkgver%.*}
Carlo Landmeter's avatar
Carlo Landmeter committed
5
pkgrel=4
Natanael Copa's avatar
Natanael Copa committed
6 7
pkgdesc="A high-level scripting language"
url="http://www.python.org"
8
arch="all"
Natanael Copa's avatar
Natanael Copa committed
9
license="custom"
10
replaces="python-dev"
11
subpackages="$pkgname-dev $pkgname-doc $pkgname-tests
Carlo Landmeter's avatar
Carlo Landmeter committed
12
	py-gdbm:gdbm $pkgname-dbg"
13
depends=""
14
makedepends="expat-dev openssl-dev zlib-dev ncurses-dev bzip2-dev
15
	gdbm-dev sqlite-dev libffi-dev readline-dev linux-headers paxmark"
Natanael Copa's avatar
Natanael Copa committed
16
source="http://www.$pkgname.org/ftp/$pkgname/$pkgver/Python-$pkgver.tar.xz
17
	musl-find_library.patch
18
	unchecked-ioctl.patch"
Natanael Copa's avatar
Natanael Copa committed
19

20
prepare() {
Natanael Copa's avatar
Natanael Copa committed
21
	cd "$srcdir/Python-$pkgver"
Natanael Copa's avatar
Natanael Copa committed
22 23 24 25
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1
		esac
Natanael Copa's avatar
Natanael Copa committed
26
	done
27 28 29

	# Make sure we use system libs
	rm -r Modules/expat Modules/_ctypes/libffi* Modules/zlib || return 1
30 31 32 33 34 35 36

	# make sure our /dev/shm is world writeable
	if ! touch /dev/shm/$pkgname-$pkgver; then
		error "/dev/shm is not world writeable. this will cause a broken python build"
		return 1
	fi
	rm /dev/shm/$pkgname-$pkgver
37
}
Natanael Copa's avatar
Natanael Copa committed
38

39 40
build() {
	cd "$srcdir/Python-$pkgver"
41
	export OPT="$CFLAGS"
42 43 44 45
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
Natanael Copa's avatar
Natanael Copa committed
46 47
		--enable-shared \
		--with-threads \
48
		--enable-ipv6 \
49
		--with-system-ffi \
Natanael Copa's avatar
Natanael Copa committed
50
		--with-system-expat \
51
		--with-system-zlib \
52
		--enable-unicode=ucs4 \
53
		|| return 1
Natanael Copa's avatar
Natanael Copa committed
54
	make || return 1
55 56 57 58
}

package() {
	cd "$srcdir/Python-$pkgver"
59
	make -j1 DESTDIR="$pkgdir" install || return 1
Natanael Copa's avatar
Natanael Copa committed
60
	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
61
	rm "$pkgdir/usr/bin/2to3" || return 1
62
	# we need to enable emutramp - needed for virt-manager
63
	# disable mprotect - needed for cffi
64
	paxmark -zm "$pkgdir"/usr/bin/python$_verbase || return 1
Natanael Copa's avatar
Natanael Copa committed
65
}
66 67 68 69 70 71 72 73 74

_mv_files() {
	local i
	for i in "$@"; do
		mkdir -p "$subpkgdir"/${i%/*}
		mv "$pkgdir"/$i "$subpkgdir"/$i || return 1
	done
}

75 76 77 78 79 80 81 82
dev() {
	# pyconfig.h is needed runtime so we move it back
	default_dev
	mkdir -p "$pkgdir"/usr/include/python$_verbase
	mv "$subpkgdir"/usr/include/python$_verbase/pyconfig.h \
		"$pkgdir"/usr/include/python$_verbase/
}

83 84 85
tests() {
	pkgdesc="The test modules from the main python package"
	cd "$pkgdir"
Natanael Copa's avatar
Natanael Copa committed
86 87
	_mv_files usr/lib/python*/*/test \
		usr/lib/python*/test
88 89 90 91 92 93 94 95
}

gdbm() {
	pkgdesc="GNU dbm database support for Python"
	cd "$pkgdir"
	_mv_files $(find usr/lib -name '*gdbm*')
}

96
md5sums="1dbcc848b4cd8399a8199d000f9f823c  Python-2.7.11.tar.xz
Natanael Copa's avatar
Natanael Copa committed
97
e2ea88671f8f838142323aedc417be48  musl-find_library.patch
Eivind Uggedal's avatar
Eivind Uggedal committed
98
dada786a50fa332686a9b9260d84c110  unchecked-ioctl.patch"
99
sha256sums="962b4c45af50124ea61f11a30deb4342fc0bc21126790fa1d7f6c79809413f46  Python-2.7.11.tar.xz
Natanael Copa's avatar
Natanael Copa committed
100
5a2ec65881816a80de25530a274aa3998684e02d82cff6565c08405df11983c0  musl-find_library.patch
Eivind Uggedal's avatar
Eivind Uggedal committed
101
f9d37609bab83d9ffff96ec9a33e16568cfb14980d389f7fe34a1c837397e359  unchecked-ioctl.patch"
102
sha512sums="72166763a2fe6aab45ecf378f55a1efc7322d1742c4638bae84f4ed4b9fb4c01f2a0293733c64426ae2c70df24d95ff2b1e2a4f3c2715de00d8f320d4d939ea0  Python-2.7.11.tar.xz
Natanael Copa's avatar
Natanael Copa committed
103
dbc1538d519997175ca24c8fcb94aa20924a9be3065a44fd7693ea7eb3642f681ea0b337b72074e17baf19966b7ee6dbac1081d40e2fdc11e30b6b8a6eeb577e  musl-find_library.patch
Eivind Uggedal's avatar
Eivind Uggedal committed
104
5a8e013a4132d71c4360771f130d27b37275ae59330cf9a75378dc8a11236017f540eb224f2a148984e82ca3fb6b29129375b1080ba05b81044faa717520ab82  unchecked-ioctl.patch"