aboutsummaryrefslogtreecommitdiffstats
path: root/community/py-sip/APKBUILD
blob: 782dc6704bbe4ceb606195f4227b72d62fc3f853 (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
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer:  Francesco Colista <fcolista@alpinelinux.org>
pkgname=py-sip
_pkgname=sip
pkgver=4.19.18
pkgrel=1
pkgdesc="A tool that makes it easy to create Python bindings for C and C++ libraries"
url="http://www.riverbankcomputing.com/software/sip/"
arch="all"
license="custom:sip"
makedepends="python2-dev python3-dev"
subpackages="
	py2-${pkgname#py-}:_py2
	py2-${pkgname#py-}-pyqt5:_py2qt5
	py3-${pkgname#py-}:_py3
	py3-${pkgname#py-}-pyqt5:_py3qt5
	$pkgname-dev:_dev:noarch
	$pkgname-doc"
source="https://www.riverbankcomputing.com/static/Downloads/${_pkgname}/$pkgver/${_pkgname}-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

prepare() {
	default_prepare
	mkdir -p "$srcdir"/python2-sip
	mkdir -p "$srcdir"/python3-sip
	mkdir -p "$srcdir"/python2-PyQt5.sip
	mkdir -p "$srcdir"/python3-PyQt5.sip
}

build() {
	cd "$srcdir"/python2-sip
	python2 "$builddir"/configure.py CFLAGS="$CFLAGS" LFLAGS="$LDFLAGS"

	cd "$srcdir"/python2-PyQt5.sip
	python2 "$builddir"/configure.py CFLAGS="$CFLAGS" LFLAGS="$LDFLAGS" --sip-module PyQt5.sip --no-tools

	cd "$srcdir"/python3-sip
	python3 "$builddir"/configure.py CFLAGS="$CFLAGS" LFLAGS="$LDFLAGS"

	cd "$srcdir"/python3-PyQt5.sip
	python3 "$builddir"/configure.py CFLAGS="$CFLAGS" LFLAGS="$LDFLAGS" --sip-module PyQt5.sip --no-tools
}

package() {
	install -Dm644 "$builddir"/LICENSE "${pkgdir}"/usr/share/licenses/custom/${pkgname}/LICENSE
}

_py2() {
	replaces="$pkgname"
	_py python2 sip
}

_py3() {
	_py python3 sip
}

_py2qt5() {
	_py python2 PyQt5.sip
}

_py3qt5() {
	_py python3 PyQt5.sip
}

_py() {
	local python="$1" module="$2"
	pkgdesc="$python SIP bindings for C and C++ libraries"
	install_if="$pkgname=$pkgver-r$pkgrel $python"

	cd "$srcdir/$python-$module"

	make DESTDIR="$pkgdir" install

	if [ "$module" = "sip" ]; then
		# Conflicts with py-sip-dev
		rm -r "$pkgdir"/usr/bin
		rm -r "$pkgdir"/usr/include
	fi

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/${python}.* "$subpkgdir"/usr/lib/
}

_dev() {
	cd "$srcdir"/python3-sip
	make DESTDIR="$pkgdir" install -C sipgen
	mv "$pkgdir"/usr/include/python*/sip.h "$pkgdir"/usr/include
	rm -r "$pkgdir"/usr/include/python*

	depends_dev="py-sip" # Depend on the package that provides the sip binary
	default_dev
}

sha512sums="e3c58cc6c38b277b3b9fd7adf33df91b47e0385e59d52c543e630a194d73d04d91e0a3845cb3973d1955f77049e75246fa7e6f544e02e1efe0086a297cf1d887  sip-4.19.18.tar.gz"