aboutsummaryrefslogtreecommitdiffstats
path: root/math/octave/Makefile
blob: 41f8248dc5832110469fd8c8fa0c754b475ea0dc (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
# New ports collection makefile for:    octave
# Date created:     8 September 1998
# Whom:         chuckr@freebsd.org
#
# $FreeBSD$
#

PORTNAME=   octave
PORTVERSION=    3.6.3
PORTREVISION=   1
CATEGORIES= math
MASTER_SITES=   ftp://ftp.gnu.org/gnu/octave/ \
        ftp://ftp.u-aizu.ac.jp/pub/SciEng/numanal/Octave/bleeding-edge/

MAINTAINER= maho@FreeBSD.org
COMMENT=    High-level interactive language for numerical computations

BUILD_DEPENDS+= gnuplot:${PORTSDIR}/math/gnuplot \
        ${LOCALBASE}/bin/gperf:${PORTSDIR}/devel/gperf \
        gsed:${PORTSDIR}/textproc/gsed \
        dvips:${PORTSDIR}/print/dvipsk-tetex \
        ${LOCALBASE}/bin/makeinfo:${PORTSDIR}/print/texinfo
RUN_DEPENDS=    gnuplot:${PORTSDIR}/math/gnuplot \
        gsed:${PORTSDIR}/textproc/gsed \
        ${LOCALBASE}/bin/makeinfo:${PORTSDIR}/print/texinfo
LIB_DEPENDS=    GraphicsMagick.1:${PORTSDIR}/graphics/GraphicsMagick \
        arpack:${PORTSDIR}/math/arpack \
        curl:${PORTSDIR}/ftp/curl \
        fftw3:${PORTSDIR}/math/fftw3 \
        fftw3f:${PORTSDIR}/math/fftw3-float \
        fltk.1:${PORTSDIR}/x11-toolkits/fltk \
        ftgl:${PORTSDIR}/graphics/ftgl \
        hdf5:${PORTSDIR}/science/hdf5-18 \
        pcre.3:${PORTSDIR}/devel/pcre \
        qhull.5:${PORTSDIR}/math/qhull5 \
        qrupdate:${PORTSDIR}/math/qrupdate \
        umfpack.1:${PORTSDIR}/math/suitesparse \
        glpk.32:${PORTSDIR}/math/glpk

USE_BZIP2=  yes
USE_PERL5_BUILD=yes
USE_GMAKE=  yes
GNU_CONFIGURE=  yes
#USE_AUTOTOOLS= autoconf

INFO=       octave liboctave OctaveFAQ
MAN1=       octave.1 mkoctfile.1 octave-config.1

.include <bsd.port.pre.mk>

.if exists(${LOCALBASE}/lib/libopenblas.so)
WITH_BLAS?= openblas
.elif exists(${LOCALBASE}/lib/libgoto2.so)
WITH_BLAS?= gotoblas
.elif exists(${LOCALBASE}/lib/libatlas.so)
WITH_BLAS?= atlas
.else
WITH_BLAS?= reference
.endif

. if ${WITH_BLAS} == reference
LIB_DEPENDS+=   blas.2:${PORTSDIR}/math/blas
LIB_DEPENDS+=   lapack.4:${PORTSDIR}/math/lapack
BLAS=       -lblas
LAPACK=     -llapack
.elif ${WITH_BLAS} == openblas
LIB_DEPENDS+=   openblas:${PORTSDIR}/math/gotoblas
BLAS=       -lopenblasp
LAPACK=     -lopenblasp
.elif ${WITH_BLAS} == gotoblas
LIB_DEPENDS+=   goto2:${PORTSDIR}/math/gotoblas
BLAS=       -lgoto2p
LAPACK=     -lgoto2p
.elif ${WITH_BLAS} == atlas
LIB_DEPENDS+=   atlas:${PORTSDIR}/math/atlas
BLAS=       -lptf77blas
LAPACK=     -lalapack -lptcblas
.endif

USE_FORTRAN=    yes

OCTAVE_VERSION= ${PORTVERSION}
GNU_HOST=   ${ARCH}-portbld-freebsd${OSREL}
PLIST_SUB=  OCTAVE_VERSION=${OCTAVE_VERSION} GNU_HOST=${GNU_HOST}
INCLUDES=   -I${LOCALBASE}/include
LDFLAGS+=   -L${LOCALBASE}/lib ${PTHREAD_LIBS}
CFLAGS+=    ${INCLUDES}
CXXFLAGS+=  ${INCLUDES}
CPPFLAGS+=  ${INCLUDES}
CONFIGURE_ENV+= GPERF="${LOCALBASE}/bin/gperf" \
        CC="${CC}" \
        CXX="${CXX}" \
        MAKEINFO=${PREFIX}/bin/makeinfo
LDFLAGS+=   -L${LOCALBASE}/lib ${PTHREAD_LIBS}
CONFIGURE_ARGS= --host=${GNU_HOST} \
        --with-blas="-L${LOCALBASE}/lib ${BLAS}" \
        --with-lapack="${LAPACK}" \
        --enable-shared

.if (${OSVERSION} <= 700000)
WITH_PTMALLOC=yes
.endif

.if defined(WITH_PTMALLOC)
LIB_DEPENDS+=   ptmalloc:${PORTSDIR}/devel/ptmalloc
CONFIGURE_ENV+= LIBS="-L${LOCALBASE}/lib -lptmalloc"
.endif

post-patch:
    ${REINPLACE_CMD} 's+"makeinfo"+"${PREFIX}/bin/makeinfo"+' ${WRKSRC}/src/help.cc
    ${REINPLACE_CMD} 's+-lumfpack+-lumfpack -lcholmod -lcolamd -llapack+' ${WRKSRC}/configure

post-install:
    ${MKDIR} ${DESKTOPDIR}
    ${INSTALL_DATA} ${WRKSRC}/doc/icons/octave.desktop \
    ${DESKTOPDIR}/www.octave.org-octave.desktop
.if !defined(NOPORTDOCS)
    @${MKDIR} ${DOCSDIR}
.for file in faq/OctaveFAQ.ps liboctave/liboctave.ps \
    refcard/refcard-a4.ps refcard/refcard-legal.ps \
    refcard/refcard-letter.ps interpreter/octave.ps
    ${INSTALL_DATA} ${WRKSRC}/doc/${file} ${DOCSDIR}
.endfor
.endif
    ${RM} -f ${WRKDIR}/PLIST
.for d in ${PREFIX}/include/octave-${OCTAVE_VERSION} ${PREFIX}/share/octave/${OCTAVE_VERSION} ${PREFIX}/share/octave/site ${PREFIX}/lib/octave/${OCTAVE_VERSION}
    @${FIND} -s $d -not -type d | \
        ${SED} -e 's#^${PREFIX}/##' >> ${WRKDIR}/PLIST
    @${FIND} -s $d -type d -empty | \
        ${SED} -e 's,^${PREFIX}/,@exec ${MKDIR} %D/,' \
        -e 's,$$, 2>/dev/null || true,' >> ${WRKDIR}/PLIST
    @${FIND} -s $d -type d -depth | \
        ${SED} -e 's,^${PREFIX}/,@dirrm ,' >> ${WRKDIR}/PLIST
.endfor
.for d in ${PREFIX}/libexec/octave/${OCTAVE_VERSION} ${PREFIX}/libexec/octave/api-v45+ ${PREFIX}/libexec/octave/api-v48+ ${PREFIX}/libexec/octave/site ${PREFIX}/lib/octave/site
    @${FIND} -s $d -type d -empty | \
        ${SED} -e 's,^${PREFIX}/,@exec ${MKDIR} %D/,' \
        -e 's,$$, 2>/dev/null || true,' >> ${WRKDIR}/PLIST
    @${FIND} -s $d -type d -depth | \
        ${SED} -e 's,^${PREFIX}/,@dirrm ,' >> ${WRKDIR}/PLIST
.endfor
    ${ECHO_CMD} @dirrm libexec/octave >> ${WRKDIR}/PLIST
    ${ECHO_CMD} @dirrm share/octave >> ${WRKDIR}/PLIST
    cd ${WRKDIR} ; ${SED} -i -e "/PLIST/ r PLIST" ${TMPPLIST}

check:
    (cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_ARGS} check)

.include <bsd.port.post.mk>