summaryrefslogtreecommitdiff
path: root/user/eigen/APKBUILD
blob: d0e15b7dd19ea27b228ae800b297ed55e2c71885 (plain) (blame)
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
# Contributor: Bradley J Chambers <brad.chambers@gmail.com>
# Maintainer: Dan Theisen <djt@hxx.in>
pkgname=eigen
pkgver=3.3.7
pkgrel=1
pkgdesc="Eigen is a C++ template library for linear algebra"
url="http://eigen.tuxfamily.org/index.php?title=Main_Page"
arch="noarch"
options="!check"  # manual verification
license="MPL-2.0 AND LGPL-2.1+ AND GPL-2.0+ AND GPL-3.0+ AND BSD-3-Clause AND Custom:MINPACK"
depends=""
makedepends="cmake gfortran doxygen graphviz"
checkdepends="fftw-dev mpfr-dev gmp-dev freeglut-dev glew-dev"
subpackages="$pkgname-doc $pkgname-examples::all"
source="$pkgname-$pkgver.tar.gz::http://bitbucket.org/eigen/$pkgname/get/$pkgver.tar.gz
	remove_piwik_crap.patch
	fix_path_FindEigen3.patch"

prepare() {
	mv "$srcdir"/eigen-eigen-* "$builddir"  # directory name contains hash
	default_prepare
}

build() {
	CXXFLAGS="-std=c++11" \
		cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=Debug \
		-Bbuild
	# TODO: documentation is missing LaTeX during build
	make -C build doc
}

check() {
	cd build
	# the full testsuite is 787 tests, it is quite comprehensive and takes
	# a LONG time to build. it has been disabled, for now because sometimes
	# it produces false positives. it should probably be manually tested
	# every once in a while. upstream doesn't expect these tests to pass
	# consistently because they are randomly seeded.
	EIGEN_MAKE_ARGS=-j$JOBS ./check.sh '.+'
}

package() {
	make DESTDIR=$pkgdir -C build install

	# Move pkgconfig to correct location and clean up afterwards
	install -Dm644 -t $pkgdir/usr/lib/pkgconfig \
		$pkgdir/usr/share/pkgconfig/eigen3.pc 
	rm -rf $pkgdir/usr/share/pkgconfig

	# Move docs and licenses to correct locations
	_docdir=$pkgdir/usr/share/doc/$pkgname
	_licdir=$pkgdir/usr/share/licenses/$pkgname
	install -Dm644 -t $_licdir $builddir/COPYING.*
	mkdir -p $_docdir
	mv build/doc/html $_docdir/
	install -m644 -t $_docdir $builddir/doc/tutorial.cpp
	_msg="More code samples are available in the $pkgname-examples package."
	echo $_msg > $_docdir/README.EXAMPLES
}

examples() {
	pkgdesc="Eigen C++ linear algebra template library examples"

	_sharedir=$subpkgdir/usr/share/$pkgname
	_exampledst=$_sharedir/examples
	_spexampdst=$_sharedir/special_examples
	_snippetdst=$_sharedir/snippets
	_builtdocs=$builddir/build/doc

	# Get objects and makefiles out of the way to make the next part easier
	find $builddir \
		\( -name '*.out' -o -name Makefile -o -name '*.cmake' \) -and \
		-delete -or \( -type d -name CMakeFiles -exec rm -rf '{}' + \)

	# Move example sources and binaries into place
	install -Dm644 -t $_exampledst/src $builddir/doc/examples/*.cpp*
	install -Dm755 -t $_exampledst/bin $_builtdocs/examples/*

	# Move special example sources and binaries into place
	install -Dm644 -t $_spexampdst/src $builddir/doc/special_examples/*.cpp*
	install -Dm755 -t $_spexampdst/bin $_builtdocs/special_examples/*

	# Move snippets sources and binaries into place
	install -Dm644 -t $_snippetdst/src $builddir/build/doc/snippets/*.cpp*
	find $builddir/build/doc/snippets -type f ! -name '*.cpp*' -print0 | \
		xargs -0 install -Dm755 -t $_snippetdst/bin
}

sha512sums="34cf600914cce719d61511577ef9cd26fbdcb7a6fad1d0ab8396f98b887fac6a5577d3967e84a8f56225cc50de38f3b91f34f447d14312028383e32b34ea1972  eigen-3.3.7.tar.gz
9d14e0c7f8bff5ec1af074666bafbdd6b597aef9fefa913cfd74a3c576c2f3af21c03327020e3777a9a83f528cecb07e5752a4204e99d5b1ca6c0b5b042bedfd  remove_piwik_crap.patch
bd94034d64d79823586f3c110835e9c58e8c1028086700cf631f0b48cc91fd8efa5b1040808fc8faa7a6e241b422159d86eedc4d770f1c8620ef304a6e1fd723  fix_path_FindEigen3.patch"