summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1c4644eb306b7dce0b30cb57d090d3c55d104a70 (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
# Maintainer: Alex Dewar <a.dewar@imperial.ac.uk>
pkgname=genn
pkgver=4.9.0
pkgrel=1
pkgdesc="GeNN: GPU-enhanced neural networks"
epoch=2
arch=(x86_64)
url="https://github.com/genn-team/genn"
license=('GPL')
depends=(cuda)
makedepends=(doxygen doxypypy python python-setuptools python-numpy swig)
optdepends=("python: for pygenn" "python-numpy: for pygenn" "spinecreator: for spineml2genn")
options=(staticlibs !emptydirs)
source=("$url/archive/${pkgver//_/-}.tar.gz")
sha256sums=('51bb5be2fe0dd6b2e4cc3bb5f540da1a5fef499bd558718e75ecbb6b4d7d163a')
install="${pkgname}.install"

export CUDA_PATH=/opt/cuda

prepare() {
	cd genn-${pkgver//_/-}

	# Set output dir
	sed -i "s|/usr/local|$pkgdir/usr|" Makefile

	# Delete tmp files
	find . -name '*~' -delete
}

build() {
	cd genn-${pkgver//_/-}

	# Generate documentation with doxygen
	msg2 "Generating documentation"
	sh ./makedoc.sh > /dev/null

	# Build libgenn.a etc.
	make
	make cuda

	# Build pygenn
	make DYNAMIC=1 LIBRARY_DIRECTORY=`pwd`/pygenn/genn_wrapper/
	python setup.py build

	# Build SpineML stuff
	cd src/spineml/
	for dname in common simulator standalone_simulator; do
		make -C $dname
	done
	cd generator
	make -f MakefileCUDA
}

package() {
	cd genn-${pkgver//_/-}

	# Install libs and headers
	PREFIX="$pkgdir"/usr/ make install

	# Install documentation
	mkdir -p "$pkgdir"/usr/share/doc/genn
	cp -rf documentation/html/* "$pkgdir"/usr/share/doc/genn

	# Copy userproject folder
	mkdir -p "$pkgdir"/usr/share/genn
	cp -R userproject "$pkgdir"/usr/share/genn/

	# Make symlinks to userproject headers
	pushd "$pkgdir"/usr/share/genn/userproject/include
	for file in *; do
		ln -s /usr/share/genn/userproject/include/$file "$pkgdir"/usr/include/genn/
	done
	popd

	# Install standalone SpineML generator
	install -m755 bin/spineml_* "$pkgdir"/usr/bin

	# Install SpineML2GeNN libs
	install -m644 lib/libspineml_*.a "$pkgdir"/usr/lib

	# Automatically set CUDA_PATH environment variable
	install -d "${pkgdir}"/etc/profile.d
	echo export CUDA_PATH=/opt/cuda > "${pkgdir}"/etc/profile.d/cuda_path.s

	# Copy SpineML2GeNN headers
	cp -R include/spineml "$pkgdir"/usr/include/

	# The headers in common don't seem to always get included properly
	pushd "$pkgdir"/usr/include/spineml/common
	for f in *;do
		ln -s /usr/include/spineml/common/$f "$pkgdir"/usr/include/spineml/
	done
	popd

	# Install pygenn
	python setup.py install --prefix=/usr --root="$pkgdir"
}