summaryrefslogtreecommitdiff
path: root/packages/sci-libs/eigen/eigen.exlib
blob: 530c132b85790048dc4a15649d64ed8345f86b50 (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
# Copyright 2008, 2009 Ingmar Vanhassel <ingmar@exherbo.org>
# Distributed under the terms of the GNU General Public License v2

require cmake [ api=2 ]

export_exlib_phases src_configure src_install

SUMMARY="A C++ template library for linear algebra (vectors, matrices, and related algorithms)"
DESCRIPTION="
Eigen is a C++ template library for linear algebra (vectors, matrices, and related algorithms). It is:
* Versatile. Eigen handles both fixed-size and dynamic-size matrices and vectors,
  without code duplication, and in a completely integrated way.
  It aims to provide not only vectors and matrices but also many algorithms.
* Fast. Expression templates remove temporaries and enable lazy evaluation.
  Explicit vectorization is performed for the SSE (2 and later) and AltiVec instruction sets,
  with graceful fallback to non-vectorized code. With fixed-size objects, dynamic memory allocation is avoided,
  and the loops are unrolled when that makes sense. For large matrices,
  special attention is paid to cache-friendliness.
* Good API. Expression templates allow for a very clean and expressive API.
  Implementing an algorithm on top of Eigen feels like just copying pseudocode.
"
HOMEPAGE="http://eigen.tuxfamily.org"
DOWNLOADS="https://bitbucket.org/${PN}/${PN}/get/${PV}.tar.bz2 -> ${PNV}.tar.bz2"

REMOTE_IDS="freecode:${PN}"

UPSTREAM_CHANGELOG="${HOMEPAGE}/index.php?title=ChangeLog#Eigen_${PV}"

LICENCES="LGPL-3 || ( GPL-2 GPL-3 )"
MYOPTIONS="
    sparse [[ description = [ Use SuiteSparse (Cholmod, UMFPACK) for sparse computations ] ]]
"

DEPENDENCIES="
    build:
        sparse? ( sci-libs/SuiteSparse )
"

CMAKE_SRC_CONFIGURE_PARAMS=(
    # benchmarks have extra dependencies
    -DEIGEN_BUILD_BTL:BOOL=FALSE
    # demos have extra dependencies
    -DEIGEN_BUILD_DEMOS:BOOL=FALSE
    # library causes compilation hangup
    -DEIGEN_BUILD_LIB:BOOL=FALSE
    -DEIGEN_BUILD_PKGCONFIG:BOOL=TRUE
    -DEIGEN_BUILD_TESTS:BOOL=TRUE
    -DEIGEN_TEST_NOQT:BOOL=TRUE
    -DEIGEN_TEST_NO_FORTRAN:BOOL=TRUE
)

if ever at_least 3.2.5 ; then
    DEPENDENCIES+="
        test:
            sci-libs/fftw
    "
    CMAKE_SRC_CONFIGURE_PARAMS+=(
        -DCMAKE_BUILD_TYPE:STRING=release
        -DBUILD_TESTING:BOOL=TRUE
        -DEIGEN_SPLIT_LARGE_TESTS:BOOL=TRUE
        -DEIGEN_TEST_NO_OPENGL:BOOL=TRUE
    )
fi

if [[ ${SLOT} == 2 ]] ; then
    MY_HGREV="b23437e61a07"
else
    MY_HGREV="b30b87236a1b"
fi
CMAKE_SOURCE=${WORKBASE}/${PN}-${PN}-${MY_HGREV}

eigen_src_configure() {
    export PKG_CONFIG_LIBDIR=/usr/$(exhost --target)/lib

    cmake_src_configure
}

eigen_src_install() {
    cmake_src_install

    if ever at_least 3.2.5 ; then
        insinto /usr/share/cmake/Modules
        doins "${CMAKE_SOURCE}"/cmake/FindEigen3.cmake

        edo rm -r "${IMAGE}"/usr/share/doc
    fi

    # TODO: report upstream, fix pkgconfig file
    if ever at_least 3.2.7 ; then
        edo sed \
            -e "s:-Iinclude:-I/usr/$(exhost --target)/include:g" \
            -i "${IMAGE}"/usr/$(exhost --target)/lib/pkgconfig/eigen3.pc
    fi
}