@@ -0,0 +1,46 @@
1+{ stdenv, fetchurl, cmake, gfortran, cudatoolkit, libpthreadstubs, liblapack }:
2+
3+with stdenv.lib;
4+
5+let version = "2.0.2";
6+
7+in stdenv.mkDerivation {
8+ name = "magma-${version}";
9+ src = fetchurl {
10+ url = "http://icl.cs.utk.edu/projectsfiles/magma/downloads/magma-${version}.tar.gz";
11+ sha256 = "0w3z6k1npfh0d3r8kpw873f1m7lny29sz2bvvfxzk596d4h083lk";
12+ name = "magma-${version}.tar.gz";
13+ };
14+
15+ buildInputs = [ gfortran cudatoolkit libpthreadstubs liblapack cmake ];
16+
17+ doCheck = false;
18+ #checkTarget = "tests";
19+
20+ enableParallelBuilding=true;
21+
22+ # MAGMA's default CMake setup does not care about installation. So we copy files directly.
23+ installPhase = ''
24+ mkdir -p $out
25+ mkdir -p $out/include
26+ mkdir -p $out/lib
27+ mkdir -p $out/lib/pkgconfig
28+ cp -a ../include/*.h $out/include
29+ #cp -a sparse-iter/include/*.h $out/include
30+ cp -a lib/*.a $out/lib
31+ cat ../lib/pkgconfig/magma.pc.in | \
32+ sed -e s:@INSTALL_PREFIX@:"$out": | \
33+ sed -e s:@CFLAGS@:"-I$out/include": | \
34+ sed -e s:@LIBS@:"-L$out/lib -lmagma -lmagma_sparse": | \
35+ sed -e s:@MAGMA_REQUIRED@:: \
36+ > $out/lib/pkgconfig/magma.pc
37+ '';
38+
39+ meta = with stdenv.lib; {
40+ description = "Matrix Algebra on GPU and Multicore Architectures";
41+ license = licenses.bsd3;
42+ homepage = "http://icl.cs.utk.edu/magma/index.html";
43+ platforms = platforms.unix;
44+ maintainers = with maintainers; [ ianwookim ];
45+ };
46+}