summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a1ef4ff3b1a3fdc2ebf5e72a07f0d0833e8ce7fc (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
# Maintainer of this PKBGUILD file: Martino Pilia <martino.pilia@gmail.com>
_name=pyca
pkgname=python2-pyca-git
pkgver=0.01.r434.gf31ab43
pkgrel=11
pkgdesc="Python for Computational Anatomy"
arch=('x86_64')
url="http://bitbucket.org/scicompanat/pyca"
license=('BSD')
depends=('python2-numpy')
makedepends=('cmake' 'git' 'python2' 'swig>=3.0.10' 'fftw' 'boost')
optdepends=('insight-toolkit: ITK file support'
            'cuda: for GPU computing'
            'python2-matplotlib: for full functionality in PyCA.Display and reading/writing png images'
            'python2-scipy: some additional image/linear algebra functionality')
source=('git+https://bitbucket.org/scicompanat/pyca.git')
md5sums=('SKIP')

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

prepare() {

	cd "$srcdir/$_name"

	# I think that CUDA architecture is not supported anymore
	# by the AUR cuda package
	sed -i 's/"20"/"30"/g' CMakeLists.txt

	mkdir build || :
	cd build

	# temporary bugfix, a PR has already been submitted upstream
	sed -i 's/<< std::cout <</<</g' "$srcdir/$_name/Code/Cxx/src/alg/MultiscaleManager.cxx"

	# Cuda requires a specific version of gcc
	if [ "" != "`pacman -Qi cuda 2>/dev/null | grep 'Version'`" ]; then
		_cc="/opt/cuda/bin/gcc"
		_use_cuda="ON"
	else
		_cc=""
		_use_cuda="OFF"
	fi

	CC="$_cc" cmake \
		-DCMAKE_INSTALL_PREFIX:PATH="/usr" \
		-DCMAKE_BUILD_TYPE=Release \
		-DPYTHON_EXECUTABLE=/usr/bin/python2 \
		-DPYTHON_INCLUDE_DIR=/usr/include/python2.7 \
		-DBUILD_SHARED_LIBS=ON \
		-DUSE_ITK=ON \
		-DUSE_CUDA=$_use_cuda \
		-DPYTHON_LIBRARY=/usr/lib/libpython2.7.so \
		-DPYTHON_INSTALL_DIR=/usr/lib/python2.7/site-packages \
		..

	# Do not include Python 3 stuff
	for f in `grep -nr . | grep 'python3\.6' | cut -f1 -d':'`
	do
		sed -i 's/[^ ;]\+python3\.[^ ;]\+//g' $f
	done
}

build() {
	cd "$srcdir/$_name/build"
	make

	if [ "$_use_cuda" == "ON" ]; then
		make CUDA_TPL_DEPS

		# Do not include Python 3 stuff
		for f in `grep -nr . | grep 'python3\.6' | cut -f1 -d':'`
		do
			sed -i 's/[^ ;]\+python3\.[^ ;]\+//g' $f
		done
	fi
}

package() {
	cd "$srcdir/$_name/build"
	make install DESTDIR="$pkgdir"

	install -D -m644 $srcdir/$_name/Copyright.txt \
		"${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}