aboutsummaryrefslogtreecommitdiffstats
path: root/community/python2-tkinter/APKBUILD
blob: 1c4b19642d53d4885dfe7ab5f853759230d4b5ee (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>

# This package must be synchronized with python2. It is splitted to avoid
# a cyclic dependency: python -> tk -> libx11 -> libxcb -> xcb-proto -> python

pkgname=python2-tkinter
pkgver=2.7.16
_verbase=${pkgver%.*}
pkgrel=0
pkgdesc="A graphical user interface for the Python"
url="https://wiki.python.org/moin/TkInter"
arch="all"
license="custom"
subpackages="$pkgname-tests python2-idle:_idle:noarch"
depends=""
makedepends="expat-dev openssl-dev zlib-dev ncurses-dev bzip2-dev
	gdbm-dev sqlite-dev libffi-dev readline-dev linux-headers paxmark
	tk tk-dev python2"
replaces="python2"
replaces_priority=1
source="https://www.python.org/ftp/python/$pkgver/Python-$pkgver.tar.xz
	musl-find_library.patch
	unchecked-ioctl.patch
	"
builddir="$srcdir/Python-$pkgver"

# secfixes:
#   2.7.15-r3:
#   - CVE-2019-5010
#   2.7.15-r0:
#   - CVE-2018-1060
#   - CVE-2018-1061

prepare() {
	local _pyapkbuild="$startdir"/../main/python2/APKBUILD
	if [ -e "$_pyapkbuild" ]; then
		_pver=$(. "$_pyapkbuild" ; echo $pkgver)
		if [ "$_pver" != "$pkgver" ]; then
			error "python version mismatch ($_pver). Set pkgver=$_pver"
			return 1
		fi
	fi
	default_prepare
	cd "$builddir"

	# Make sure we use system libs
	rm -rf Modules/expat Modules/_ctypes/libffi* Modules/zlib
}

build() {
	cd "$builddir"
	export OPT="$CFLAGS"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--enable-shared \
		--with-threads \
		--enable-ipv6 \
		--with-system-ffi \
		--with-system-expat \
		--with-system-zlib \
		--enable-unicode=ucs4
	make
}

package() {
	cd "$builddir"
	# we only care about idle, and tkinter
	make DESTDIR="$builddir"/tmpinstall sharedinstall libinstall \
		|| return 1

	mkdir -p "$pkgdir"/usr/lib/python${_verbase}/lib-dynload \
		"$pkgdir"/usr/bin

	for lib in idlelib lib-tk; do
		mv "$builddir"/tmpinstall/usr/lib/python${_verbase}/$lib \
			"$pkgdir"/usr/lib/python${_verbase}/
	done

	mv "$builddir"/tmpinstall/usr/lib/python${_verbase}/lib-dynload/_tkinter.so \
		"$pkgdir"/usr/lib/python${_verbase}/lib-dynload/

	mv "$builddir"/tmpinstall/usr/bin/idle \
		"$pkgdir"/usr/bin/idle${_verbase}
}

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

tests() {
	pkgdesc="The test modules from the main python package for tkinter"
	replaces="python-tests python2-tests"
	cd "$pkgdir"
	_mv_files usr/lib/python*/*/test
}

_idle() {
	pkgdesc="IDE for Python2 using Tkinter"
	depends="$pkgname=$pkgver-r$pkgrel"
	cd "$pkgdir"
	_mv_files usr/bin
}

sha512sums="16e814e8dcffc707b595ca2919bd2fa3db0d15794c63d977364652c4a5b92e90e72b8c9e1cc83b5020398bd90a1b397dbdd7cb931c49f1aa4af6ef95414b43e0  Python-2.7.16.tar.xz
ab8eaa2858d5109049b1f9f553198d40e0ef8d78211ad6455f7b491af525bffb16738fed60fc84e960c4889568d25753b9e4a1494834fea48291b33f07000ec2  musl-find_library.patch
5a8e013a4132d71c4360771f130d27b37275ae59330cf9a75378dc8a11236017f540eb224f2a148984e82ca3fb6b29129375b1080ba05b81044faa717520ab82  unchecked-ioctl.patch"