aboutsummaryrefslogtreecommitdiffstats
path: root/math/taucs/Makefile
blob: 0a19de51fef618ec5776bb265f5de8ddb0eb93bf (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
# New ports collection makefile for:    taucs
# Date created:     5 July 2003
# Whom:         Pedro Giffuni <giffunip@asme.org>
#
# $FreeBSD$
#

PORTNAME=   taucs
PORTVERSION=    2.2
PORTREVISION=   6
CATEGORIES= math
MASTER_SITES=   http://www.tau.ac.il/~stoledo/taucs/${PORTVERSION}/
DISTNAME=   ${PORTNAME}
EXTRACT_SUFX=   .tgz

MAINTAINER= ports@FreeBSD.org
COMMENT=    C library of sparse linear solvers

USE_FORTRAN=    yes

.include <bsd.port.pre.mk>

LIB_DEPENDS+=   metis.1:${PORTSDIR}/math/metis
.if exists(${LOCALBASE}/lib/libatlas_r.so) && !defined(WITH_BLAS)
WITH_ATLAS= yes
.endif
.if defined(WITH_ATLAS)
LIB_DEPENDS+=   atlas.2:${PORTSDIR}/math/atlas
BLAS=       -lf77blas -lcblas -latlas
LAPACK=     -lalapack
.else
LIB_DEPENDS+=   lapack.4:${PORTSDIR}/math/lapack
LIB_DEPENDS+=   blas.2:${PORTSDIR}/math/blas
BLAS=       -lblas
LAPACK=     -llapack
.endif

HAS_CONFIGURE=  yes
WRKSRC=     ${WRKDIR}/${PORTNAME}
MAKEFILE=   makefile
ALL_TARGET=

.if ${ARCH} == "sparc64"
PICFLAG?=   -fPIC
.else
PICFLAG?=   -fpic
.endif

do-extract:
    ${MKDIR} ${WRKSRC} ; cd ${WRKSRC} ; ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/${DISTNAME}${EXTRACT_SUFX} ${EXTRACT_AFTER_ARGS}

post-patch:
    @${MKDIR} ${WRKSRC}_SHARED ; ${CP} -r ${WRKSRC}/* ${WRKSRC}_SHARED

do-configure:
    cd ${WRKSRC}; ./configure
    cd ${WRKSRC}_SHARED; ./configure

post-configure:
    @(cd ${WRKSRC}; ${PATCH} <${FILESDIR}/extra-patch-build-FreeBSD-makefile)
    @(cd ${WRKSRC}_SHARED; ${PATCH} <${FILESDIR}/extra-patch-build-FreeBSD-makefile)
    @${REINPLACE_CMD} -e 's+%%LOCALBASE%%+${LOCALBASE}+g;' -e 's+%%FC%%+${FC}+g;' -e 's+%%BLAS%%+${BLAS}+g;' -e 's+%%LAPACK%%+${LAPACK}+g;' -e 's+%%CC%%+${CC}+g;' -e 's+%%CFLAGS%%+${CFLAGS}+g;' -e 's+%%FFLAGS%%+${FFLAGS}+g;' ${WRKSRC}/config/FreeBSD.mk
    @${REINPLACE_CMD} -e 's+%%LOCALBASE%%+${LOCALBASE}+g;' -e 's+%%FC%%+${FC}+g;' -e 's+%%BLAS%%+${BLAS}+g;' -e 's+%%LAPACK%%+${LAPACK}+g;' -e 's+%%CC%%+${CC}+g;' -e 's+%%CFLAGS%%+${CFLAGS} ${PICFLAG}+g;' -e 's+%%FFLAGS%%+${FFLAGS} ${PICFLAG}+g;' ${WRKSRC}_SHARED/config/FreeBSD.mk

do-build:
    cd ${WRKSRC} ; ${MAKE}
    cd ${WRKSRC}_SHARED ; ${SETENV} CFLAGS="${CFLAGS} ${PICFLAG}" ${MAKE}
    cd ${WRKSRC}_SHARED/lib/FreeBSD ; ld -Bshareable -o libtaucs.so.1 -x -soname libtaucs.so.1 --whole-archive libtaucs.a
do-install:
    @${INSTALL_DATA} ${WRKSRC}/lib/FreeBSD/libtaucs.a ${PREFIX}/lib
    @${INSTALL_DATA} ${WRKSRC}_SHARED/lib/FreeBSD/libtaucs.so.1 ${PREFIX}/lib
    @${LN} -sf libtaucs.so.1 ${PREFIX}/lib/libtaucs.so
    @${INSTALL_DATA} ${WRKSRC}/build/FreeBSD/*.h ${PREFIX}/include
    @${INSTALL_DATA} ${WRKSRC}/src/*.h ${PREFIX}/include
    @${INSTALL_PROGRAM} ${WRKSRC}/bin/FreeBSD/direct ${PREFIX}/bin
    @${INSTALL_PROGRAM} ${WRKSRC}/bin/FreeBSD/iter ${PREFIX}/bin

.if !defined(NOPORTDOCS)
    @${MKDIR} ${DOCSDIR}
    @${INSTALL_DATA} ${WRKSRC}/doc/*.pdf ${DOCSDIR}
.endif

.include <bsd.port.post.mk>