aboutsummaryrefslogtreecommitdiffstats
path: root/math/atlas-devel/Makefile
blob: c78d03034dd0b6e973b6be397b6143f2b0ae2a90 (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
# New ports collection makefile for:    atlas-devel
# Date created:     14 September 2003
# Whom:         Nakata Maho <maho@FreeBSD.org>
#
# $FreeBSD$
#

# NOTE: This port purposely ignores the CC and CFLAGS settings.
#       Program and compiler flags are finetuned to gcc 2.95/3.1.

PORTNAME=   atlas
PORTVERSION=    3.5.11
CATEGORIES= math
MASTER_SITES=   ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= math-atlas
DISTNAME=   ${PORTNAME}${PORTVERSION}

MAINTAINER= maho@FreeBSD.org
COMMENT=        Development version of math/atlas

LIB_DEPENDS=    lapack:${PORTSDIR}/math/lapack

USE_BZIP2=  yes
WRKSRC=     ${WRKDIR}/ATLAS
INSTALLS_SHLIB= yes
USE_REINPLACE=  yes
PKGNAMESUFFIX=  -devel

post-patch:
    @${REINPLACE_CMD} -e 's+%%PTHREAD_CFLAGS%%+ ${PTHREAD_CFLAGS}+' \
        ${WRKSRC}/config.c
    @${REINPLACE_CMD} -e 's+%%PTHREAD_LIBS%%+ ${PTHREAD_LIBS}+' \
        ${WRKSRC}/config.c
.if (${MACHINE_ARCH} == "alpha")
    @(cd ${WRKSRC}; ${PATCH} < ${FILESDIR}/alpha-patch)
.endif

do-configure:
    @(cd ${WRKSRC}; ${PATCH} < ${FILESDIR}/non-thread-patch)
    @(cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} config < ${FILESDIR}/answer)
    @(cd ${WRKSRC}; ${PATCH} < ${FILESDIR}/thread-patch)
    @(cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} config < ${FILESDIR}/answer)

NON_THREADED_ATLAS=`cat ${WRKSRC}/ARCHNAME-NON-THREADED`
THREADED_ATLAS=`cat ${WRKSRC}/ARCHNAME-THREADED`
ATLAS_LIBS1=libatlas libcblas libf77blas libtstatlas libalapack
ATLAS_LIBS2=libptcblas libptf77blas

post-configure:
.if defined(USE_GCC)
    @${REINPLACE_CMD} -e 's|/usr/bin/gcc|${CC}|g;' ${WRKSRC}/Make.${NON_THREADED_ATLAS}
    @${REINPLACE_CMD} -e 's|/usr/bin/gcc|${CC}|g;' ${WRKSRC}/Make.${THREADED_ATLAS}
.endif

do-build:
# non thread version
    (cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} install arch=${NON_THREADED_ATLAS})
#   (cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} sanity_test arch=${NON_THREADED_ATLAS})
    (cd ${WRKSRC}; ${MKDIR} tmp ; \
        ${CP} ${LOCALBASE}/lib/liblapack.a tmp ;\
        cd tmp ;\
        ar x liblapack.a ;\
        ar x ../lib/${NON_THREADED_ATLAS}/liblapack.a ;\
        ar r ../lib/${NON_THREADED_ATLAS}/libalapack.a *.o ;\
        ranlib ../lib/${NON_THREADED_ATLAS}/libalapack.a )
.for i in ${ATLAS_LIBS1}
    ( cd ${WRKSRC}/lib/${NON_THREADED_ATLAS}/ ; \
        ld -Bshareable -o ${i}.so.1 -x -soname ${i}.so.1 --whole-archive ${i}.a )
.endfor

# thread version
    (cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} install arch=${THREADED_ATLAS})
#   (cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} sanity_test arch=${THREADED_ATLAS})
    (cd ${WRKSRC}; ${MKDIR} tmp2 ; \
        ${CP} ${LOCALBASE}/lib/liblapack.a tmp2 ;\
        cd tmp2 ;\
        ar x liblapack.a ;\
        ar x ../lib/${THREADED_ATLAS}/liblapack.a ;\
        ar r ../lib/${THREADED_ATLAS}/libalapack.a *.o ;\
        ranlib ../lib/${THREADED_ATLAS}/libalapack.a )
.for i in ${ATLAS_LIBS1} ${ATLAS_LIBS2}
    ( cd ${WRKSRC}/lib/${THREADED_ATLAS}/ ; \
        ld -Bshareable -o ${i}.so.1 -x -soname ${i}.so.1 --whole-archive ${i}.a )
.endfor

do-install:
.for i in ${ATLAS_LIBS1}
    @${INSTALL_DATA} ${WRKSRC}/lib/${NON_THREADED_ATLAS}/${i}.a       ${PREFIX}/lib
    @${INSTALL_DATA} ${WRKSRC}/lib/${NON_THREADED_ATLAS}/${i}.so.1    ${PREFIX}/lib
    @${LN} -sf ${i}.so.1 ${PREFIX}/lib/${i}.so
.endfor
.for i in ${ATLAS_LIBS1}
    @${INSTALL_DATA} ${WRKSRC}/lib/${THREADED_ATLAS}/${i}.a       ${PREFIX}/lib/${i}_r.a
    @${INSTALL_DATA} ${WRKSRC}/lib/${THREADED_ATLAS}/${i}.so.1    ${PREFIX}/lib/${i}_r.so.1
    @${LN} -sf ${i}_r.so.1 ${PREFIX}/lib/${i}_r.so
.endfor
.for i in ${ATLAS_LIBS2}
    @${INSTALL_DATA} ${WRKSRC}/lib/${THREADED_ATLAS}/${i}.a       ${PREFIX}/lib
    @${INSTALL_DATA} ${WRKSRC}/lib/${THREADED_ATLAS}/${i}.so.1    ${PREFIX}/lib
    @${LN} -sf ${i}.so.1 ${PREFIX}/lib/${i}.so
.endfor
    @${INSTALL_DATA} ${WRKSRC}/include/cblas.h   ${PREFIX}/include
    @${INSTALL_DATA} ${WRKSRC}/include/clapack.h ${PREFIX}/include
    @${INSTALL_DATA} ${FILESDIR}/blas.h    ${PREFIX}/include
    @${INSTALL_DATA} ${FILESDIR}/lapack.h  ${PREFIX}/include
.if !defined(NOPORTDOCS)
    @${MKDIR} ${DOCSDIR}
    ${INSTALL_DATA} ${WRKSRC}/doc/* ${DOCSDIR}
.endif

.include <bsd.port.mk>