blob: ec5e8eb0703e15181370553fa46a1fcd79d69181 (
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
# New ports collection makefile for: atlas
# Date created: 12 February 2001
# Whom: Nakata Maho <maho@FreeBSD.org>
#
# $FreeBSD$
#
PORTNAME= atlas
PORTVERSION= 3.8.4
PORTREVISION= 1
PORTEPOCH= 1
CATEGORIES= math
MASTER_SITES= SF/math-${PORTNAME}/Stable/${PORTVERSION}
DISTNAME= ${PORTNAME}${PORTVERSION}
MAINTAINER= bf@FreeBSD.org
COMMENT= Automatically Tuned Linear Algebra Software (ATLAS)
LICENSE= BSD
BUILD_DEPENDS= ${NONEXISTENT}:${PORTSDIR}/math/lapack:checksum
USE_BZIP2= yes
USE_FORTRAN= yes
CONFLICTS= atlas-devel-[0-9]* cblas-[0-9]*
MANUAL_PACKAGE_BUILD= Optimizes for the local machine.
OPTIONS= ARCHDEF "Use a specified architectural default" off \
SHARED "Build static PIC archives and shared libraries" on \
STATIC "Build static (non-PIC) archives" off \
TSC "If WALL_TIMER is enabled, use the TSC" off \
WALL_TIMER "Use less robust timing with higher resolution" off
PORTSCOUT= limitw:1,even
WRKSRC= ${WRKDIR}/ATLAS
.include <bsd.port.pre.mk>
#Increase ATLAS_MAXMALLOC if the atlas threaded libraries perform poorly on large problems:
# http://math-atlas.sourceforge.net/errata.html#MaxMalloc
ATLAS_MAXMALLOC?= 67108864
.if ${ARCH} == "sparc64"
PICFLAG?= -fPIC
.else
PICFLAG?= -fpic
.endif
.if !empty(ARCH:M*64*)
POINTER?= 64
.else
POINTER?= 32
.endif
.if defined(MAINTAINER_MODE)
LIB_DEPENDS+= blas.2:${PORTSDIR}/math/blas
.endif
.for i in DATA DOCS
. if !defined(NOPORT${i})
PORT${i}= *
. endif
.endfor
.if defined(WITH_ARCHDEF)
. if defined(ARCHDEF)
. if ${ARCHDEF} == "NONE"
ARCHDEFFLAG= -Si archdef 0
. endif
. else
IGNORE = : You have set WITH_ARCHDEF, but have not defined ARCHDEF
. endif
.endif
.if defined(WITH_SHARED)
USE_LDCONFIG= yes
.elifndef(WITH_STATIC)
IGNORE = : You must select at least one of WITH_SHARED and WITH_STATIC
.endif
.for opt in SHARED STATIC
. if defined(WITH_${opt})
PLIST_SUB+= ${opt}=""
. else
PLIST_SUB+= ${opt}="@comment "
. endif
.endfor
EXTRA_FLAGS?= -Wl,-rpath=${LOCALBASE}/lib/${_GCC_BUILD_DEPENDS}
SHARED_FLAGS= ${PTHREAD_CFLAGS} ${PICFLAG} -DPIC
SHARED_LAPACK_WRKSRC= WRKSRC_SHARED
STATIC_FLAGS= ${PTHREAD_CFLAGS}
STATIC_LAPACK_WRKSRC= WRKSRC
post-patch:
@cd ${WRKSRC}/CONFIG/ARCHS ; for t in *.tgz ; do \
${MV} $${t} $${t}.bak ; \
${TAR} -s '/gcc/${CC}/' -xf $${t}.bak ; \
${TAR} -czf $${t} $${t%.tgz} ; \
${RM} -r $${t%.tgz} $${t}.bak ; \
done
@${REINPLACE_CMD} -e 's|$$(ARCH)|$$(ATLAS_ARCH)|g' \
${WRKSRC}/Make.top \
${WRKSRC}/makes/Make.bin \
${WRKSRC}/makes/Make.lib \
${WRKSRC}/makes/Make.sysinfo \
${WRKSRC}/CONFIG/src/Makefile \
${WRKSRC}/CONFIG/ARCHS/Makefile
@${REINPLACE_CMD} -e "s|gcc|${CC}|" ${WRKSRC}/CONFIG/ARCHS/Makefile
@${REINPLACE_CMD} -e "\|OS=ALL|{N; s|'gcc'|'${CC}'|; \
s|'gfortran'|'${FC}'|; s|-mavx|-msse3|;s|'| ${EXTRA_FLAGS}'|4;}" \
${WRKSRC}/CONFIG/src/atlcomp.txt
@${REINPLACE_CMD} -e "s|%%PTHREAD_LIBS%%|${PTHREAD_LIBS}|" \
-e "s|%%CC%%|${CC}|" \
${WRKSRC}/CONFIG/src/SpewMakeInc.c
@${REINPLACE_CMD} -E -e \
"\|(#define ATL_MaxMalloc[[:blank:]]+)([[:digit:]]+)|s||\1${ATLAS_MAXMALLOC}|" \
${WRKSRC}/include/atlas_lvl3.h
@${CAT} ${FILESDIR}/tuning-message
do-configure:
@if [ "x${WITH_WALL_TIMER}" != "x" ] ; then \
TIMEFLAG= ; \
if [ \( ${ARCH} = "i386" -o ${ARCH} = "amd64" \) -a "x${WITH_TSC}" != "x" ] ; then \
freq=`${SYSCTL} -ni machdep.tsc_freq` ; \
if [ "x$${freq}" != "x" ] ; then \
if [ $${freq} -gt 1000000 ] ; then \
MHZ=$$(($${freq}/1000000)) ; \
TIMEFLAG="-D c -DPentiumCPS=$${MHZ}" ; \
fi ; \
fi ; \
fi ; \
if [ "x$${TIMEFLAG}" = "x" ] ; then \
TIMEFLAG="-D c -DWALL" ; \
fi ; \
fi ; \
${ECHO_CMD} "TIMEFLAG = $${TIMEFLAG}" \
> ${WRKSRC}/saved_flags ; \
${ECHO_CMD} "Dummy configuration of ATLAS to obtain compiler flags:" ; \
${MKDIR} ${WRKSRC}/static ; cd ${WRKSRC}/static ; \
../configure --cc="${CC}" --cflags="${CFLAGS}" \
--prefix="${PREFIX}" -v 2 $${TIMEFLAG} ${ARCHDEFFLAG} \
-Ss f77lib " " -Ss pmake "${MAKE} ${_MAKE_JOBS}" \
-Fa alg "${STATIC_FLAGS} " -b ${POINTER}
@${SED} -ne "\|F77FLAGS =|p" ${WRKSRC}/static/Make.inc \
>> ${WRKSRC}/saved_flags
post-configure:
@${RM} -r ${WRKSRC}/static
do-build:
.for opt in shared static
. if defined(WITH_${opt:U})
@${ECHO_CMD} "Building the LAPACK archives with ${opt} ATLAS flags:"
F77FLAGS="`${MAKE} -f ${WRKSRC}/saved_flags -V F77FLAGS` ${EXTRA_FFLAGS}" ; \
LW=`${MAKE} -C ${PORTSDIR}/math/lapack -V ${${opt:U}_LAPACK_WRKSRC}` ; \
${MAKE} -C ${PORTSDIR}/math/lapack WITH_${opt:U}=yes \
clean patch ; \
cd $${LW} ; ${SETENV} ${MAKE_ENV:NFFLAGS=*} EXTRAFLAGS="${${opt:U}_FLAGS}" \
FFLAGS="-pipe $${F77FLAGS}" ${MAKE} ${_MAKE_JOBS} ${MAKE_ARGS} \
ARCH="${AR}" lapacklib ; \
TIMEFLAG=`${MAKE} -f ${WRKSRC}/saved_flags -V TIMEFLAG` ; \
${MKDIR} ${WRKSRC}/${opt} ; cd ${WRKSRC}/${opt} ; \
${MV} $${LW}/liblapack.a liblapack_${opt}.a ; \
${MAKE} -C ${PORTSDIR}/math/lapack clean ; \
${ECHO_CMD} "Configuring ${opt} ATLAS:" ; \
../configure --cc="${CC}" --cflags="${CFLAGS}" \
--with-netlib-lapack="${WRKSRC}/${opt}/liblapack_${opt}.a" \
--prefix="${PREFIX}" -v 2 $${TIMEFLAG} ${ARCHDEFFLAG} \
-Ss f77lib " " -Ss pmake "${MAKE} ${_MAKE_JOBS}" \
-Fa alg "${${opt:U}_FLAGS} " -b ${POINTER} ; \
if [ "x${WITH_ARCHDEF}" != "x" ] ; then \
if [ "x${ARCHDEF}" != "xNONE" ] ; then \
if [ -f ${ARCHDEF} ] ; then \
${CP} -f ${ARCHDEF} ${WRKSRC}/CONFIG/ARCHS/ ; \
elif [ ! -f ${WRKSRC}/CONFIG/ARCHS/${ARCHDEF} ] ; then \
${ECHO_CMD} \
"==> ${PKGNAME} : ARCHDEF \"${ARCHDEF}\" does not exist" ; \
exit 1 ; \
fi ; \
${REINPLACE_CMD} -E -e \
"\|[[:blank:]]*ARCH =|s|=.*|= ${ARCHDEF:T:S/.tgz$//}|" \
${WRKSRC}/${opt}/Make.inc ; \
fi ; \
fi ; \
${ECHO_CMD} "Building ${opt} ATLAS:" ; cd ${WRKSRC}/${opt} ; \
${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_ARGS} all
. endif
.endfor
L1= ${FC} $${F77FLAGS} ${SHARED_FLAGS} ${LDFLAGS} -shared -Wl,-x \
-Wl,--whole-archive -Wl,-soname,
L2= -Wl,--no-whole-archive -Wl,--as-needed ${PTHREAD_LIBS}
post-build:
.for opt in shared static
. if defined(WITH_${opt:U})
@${ECHO_CMD} "Timing ${opt} ATLAS:"
@cd ${WRKSRC}/${opt} ; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_ARGS} time ; \
cd ARCHS ; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_ARGS} ArchNew tarfile
. endif
.endfor
.if defined(WITH_SHARED)
@${ECHO_CMD} "Building ATLAS shared libraries:"
@F77FLAGS="`${MAKE} -f ${WRKSRC}/saved_flags -V F77FLAGS` ${EXTRA_FFLAGS}" ; \
cd ${WRKSRC}/shared/lib ; \
${L1}libatlas.so.2 -o libatlas.so.2 libatlas.a ${L2} ; \
${L1}libf77blas.so.2 -o libf77blas.so.2 libf77blas.a ${L2} libatlas.so.2 ; \
${L1}libptf77blas.so.2 -o libptf77blas.so.2 libptf77blas.a ${L2} libatlas.so.2 ; \
${L1}libcblas.so.2 -o libcblas.so.2 libcblas.a ${L2} libatlas.so.2 ; \
${L1}libptcblas.so.2 -o libptcblas.so.2 libptcblas.a ${L2} libatlas.so.2 ; \
${L1}libalapack.so.2 -o libalapack.so.2 liblapack.a ${L2} libatlas.so.2
.endif
.if defined(MAINTAINER_MODE)
STATIC_BLAS= ${LOCALBASE}/lib/libblas.a
SHARED_BLAS= -L${LOCALBASE}/lib -lblas
check regression-test test: build
. for opt in shared static
. if defined(WITH_${opt:U})
@${ECHO_CMD} "Testing ${opt} ATLAS:"
@cd ${WRKSRC}/${opt} ; ${SETENV} ${MAKE_ENV} BLAS="${${opt:U}_BLAS}" \
${MAKE} ${MAKE_ARGS} check ptcheck error_report
. endif
. endfor
.endif
do-install:
.for i in libatlas libcblas libf77blas liblapack libptcblas libptf77blas
. if defined(WITH_STATIC)
@${INSTALL_DATA} ${WRKSRC}/static/lib/${i}.a ${PREFIX}/lib/${i:S|lapack|alapack|}.a
. endif
. if defined(WITH_SHARED)
@${INSTALL_DATA} ${WRKSRC}/shared/lib/${i}.a ${PREFIX}/lib/${i:S|lapack|alapack|}_pic.a
@${INSTALL_DATA} ${WRKSRC}/shared/lib/${i:S|lapack|alapack|}.so.2 ${PREFIX}/lib
@${LN} -sf ${i:S|lapack|alapack|}.so.2 ${PREFIX}/lib/${i:S|lapack|alapack|}.so
. endif
.endfor
@${INSTALL_DATA} ${WRKSRC}/include/cblas.h ${PREFIX}/include
@${INSTALL_DATA} ${WRKSRC}/include/clapack.h ${PREFIX}/include
.for opt in shared static
. if defined(WITH_${opt:U})
@${MKDIR} ${PREFIX}/include/atlas/${opt}
@${INSTALL_DATA} ${WRKSRC}/${opt}/include/* ${PREFIX}/include/atlas/${opt}
@cd ${PREFIX} ; \
${FIND} include/atlas/${opt} -type f -o -type l | ${SORT} >> ${TMPPLIST}
@${ECHO_CMD} "@dirrm include/atlas/${opt}" >> ${TMPPLIST}
. if !defined(NOPORTDATA)
@${MKDIR} ${DATADIR}/${opt}
@cd ${WRKSRC}/${opt}/bin ; ${TAR} -czf INSTALL_LOG.tgz INSTALL_LOG ; \
${INSTALL_DATA} INSTALL_LOG.tgz ${DATADIR}/${opt}
@${INSTALL_DATA} ${WRKSRC}/${opt}/ARCHS/*.tgz ${DATADIR}/${opt}
. endif
. endif
.endfor
@${ECHO_CMD} "@dirrm include/atlas" >> ${TMPPLIST}
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
@${INSTALL_DATA} ${WRKSRC}/doc/* ${DOCSDIR}
.endif
.include <bsd.port.post.mk>
|