aboutsummaryrefslogtreecommitdiffstats
path: root/math/fflas-ffpack/Makefile
blob: de8e46afcfc85e6fcdacce6d46e4d2dab44656e6 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# New ports collection makefile for:    fflas-ffpack
# Date created:     5 Oct 2011
# Whom:     b.f. <bf@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=   fflas-ffpack
PORTVERSION=    1.4.3
CATEGORIES= math
MASTER_SITES=   http://linalg.org/ LOCAL/bf

MAINTAINER= bf@FreeBSD.org
COMMENT=    A library for dense linear algebra over word-size finite fields

LICENSE=    LGPL20

LIB_DEPENDS=    gmp.10:${PORTSDIR}/math/gmp

GNU_CONFIGURE=  yes
CONFIGURE_ARGS =    --with-gmp="${LOCALBASE}"

.if defined(PACKAGE_BUILDING)
OPTIMIZATION_DEFAULT=   off
.else
OPTIMIZATION_DEFAULT=   on
.endif

OPTIONS=    DOCS "build HTML documents (requires doxygen)" off \
        OPTIMIZATION "optimize for the build machine" ${OPTIMIZATION_DEFAULT}

.include <bsd.port.pre.mk>

.if ${LOCALBASE} == "/usr/local"
CPPFLAGS+=  -I${LOCALBASE}/include
LDFLAGS+=   -L${LOCALBASE}/lib
.endif

.if defined(MAINTAINER_MODE)
CONFIGURE_ARGS+=     --with-givaro="${LOCALBASE}"
LIB_DEPENDS+=   givaro.3:${PORTSDIR}/math/givaro
.else
CONFIGURE_ARGS+=    --with-givaro=no
.endif

#a C interface to BLAS is needed
WITH_BLAS?= gsl

.if ${WITH_BLAS} == "gotoblas"
CONFIGURE_ARGS+=    --with-gotoblas2="${LOCALBASE}" --with-lapack=blas
LIB_DEPENDS+=   goto2p:${PORTSDIR}/math/gotoblas
USE_FORTRAN=    yes
.elif ${WITH_BLAS} == "atlas"
CONFIGURE_ARGS+=    --with-cblas="${LOCALBASE}" --with-lapack=blas
LIB_DEPENDS+=   cblas.2:${PORTSDIR}/math/atlas
USE_FORTRAN=    yes
.elif ${WITH_BLAS} == "gsl"
CONFIGURE_ARGS+=    --with-gsl="${LOCALBASE}"
LIB_DEPENDS+=   gslcblas.0:${PORTSDIR}/math/gsl
.else
IGNORE =    unknown value of WITH_BLAS: ${WITH_BLAS}
.endif

.if defined(WITH_DOCS) && !defined(NOPORTDOCS)
BUILD_DEPENDS +=    doxygen:${PORTSDIR}/devel/doxygen
CONFIGURE_ARGS+=    --enable-doc --with-docdir="${DOCSDIR}"
.elifndef(NOPORTDOCS)
NOPORTDOCS= yes
.endif

.if defined(WITH_OPTIMIZATION)
MANUAL_PACKAGE_BUILD=   : optimizes for the build machine
.else
CONFIGURE_ARGS+=    --disable-optimization
.endif

post-patch:
    ${REINPLACE_CMD} -e '/DEFAULT_CFLAGS=/{s/-O2 //;s/-pipe//;}' \
        -e '/DEBUG_CFLAGS=.*-DNDEBUG/s/$${DEBUG_CFLAGS} //' \
        -e '/^WARN_CFLAGS="-Wall"/d' \
        -e '/if test "x$$WARN" = "xyes"/s/$$/ WARN_CFLAGS="-Wall" ;/' \
        -e 's/\(-lgoto2\)\( -pthread\)\{0,1\}/\1p/g' -e 's/libgoto2/&p/g' \
        -e '/"GOTO2")/{N; s/LAPACK_LIBS=""/LAPACK_LIBS="-lgoto2p"/; }' \
        -e 's/liblapack_atlas/libalapack/g' \
        -e 's/$${LAPACK_LIBS} -llapack_atlas/-lalapack -lf77blas -lcblas/g' \
        ${WRKSRC}/configure
#Unfortunately, we must leave stdint.h --> cstdint unresolved when not using
#lang/gcc4*, or switch to TR1 headers, due to our aging base system libstdc++
    ${REINPLACE_CMD} -E \
    -e 's/(#include[[:blank:]]+<)(std)(arg|def|io|lib)(\.h>)/\1c\2\3>/' \
        ${WRKSRC}/fflas-ffpack/field/nonzero-randiter.h \
        ${WRKSRC}/fflas-ffpack/field/modular-randiter.h \
        ${WRKSRC}/fflas-ffpack/utils/args-parser.h \
        ${WRKSRC}/fflas-ffpack/utils/debug.h \
        ${WRKSRC}/fflas-ffpack/utils/Matio.h \
        ${WRKSRC}/utils/args-parser.h \
        ${WRKSRC}/utils/debug.h \
        ${WRKSRC}/utils/Matio.h
.if defined(WITH_DOCS) && !defined(NOPORTDOCS)
    @${REINPLACE_CMD} -e 's/sed -i/& ""/' ${WRKSRC}/doc/Makefile.in
.endif

.if defined(WITH_DOCS) && !defined(NOPORTDOCS)
post-install:
    @${TOUCH} ${DOCSDIR}/fflas-ffpack-dev-html/.keep-me

.endif

.if defined(MAINTAINER_MODE)
check regression-test test: build
    @cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${_MAKE_JOBS} \
    ${MAKE_ARGS} check

.endif

.include <bsd.port.post.mk>