summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5d4707e6c86278f1d1b9e314cd662fb85061231a (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
# Maintainer: Maximilian Stahlberg <maximilian.stahlberg tu-berlin de>

pkgname=python-swiglpk-git
pkgver=4.65.1.r1.gec985c1
pkgrel=4
pkgdesc='A Python interface to the GLPK optimization solver. Git version.'
arch=('any')
url='https://github.com/biosustain/swiglpk'
license=('GPL3')
depends=('python' 'glpk')
makedepends=('git' 'swig' 'python-setuptools')
provides=('python-swiglpk')
conflicts=('python-swiglpk')
source=("swiglpk::git+https://github.com/biosustain/swiglpk.git")
md5sums=('SKIP')

pkgver() {
	cd "${srcdir}/swiglpk"
	git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
	cd "${srcdir}/swiglpk"

	# Work around https://github.com/biosustain/swiglpk/issues/40.
	cp /usr/include/glpk.h .
}

build() {
	cd "${srcdir}/swiglpk"
	python setup.py build
}

check() {
	_arch="linux-$(uname -m)"
	_pymajver="$(python -V | awk '{print $2}' | awk -F. '{print $1"."$2}')"

	cd "${srcdir}/swiglpk/build/lib.${_arch}-${_pymajver}"
	python -Bc "import swiglpk"
}

package() {
	cd "${srcdir}/swiglpk"
	python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
}