aboutsummaryrefslogtreecommitdiffstats
path: root/cad/calculix/Makefile
blob: 4b879ac032f39512ce76367d9dec1744d6e1c7ff (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
# New ports collection makefile for:    CalculiX
# Date created:     19 April 2003
# Whom:         Pedro Giffuni <giffunip@asme.org>
#
# $FreeBSD$
#

PORTNAME=   CalculiX
PORTVERSION=    1.4
CATEGORIES= cad
MASTER_SITES=   http://www.dhondt.de/
DISTFILES=  ${DIST_SOURCES}
.if !defined(NOPORTDOCS)
DISTFILES+= ${DIST_HTM} ${DIST_PS}
.endif
.ifdef WITH_EXAMPLES
DISTFILES+= ${DIST_EXAMPLES}
.endif
DIST_SUBDIR=    calculix
EXTRACT_ONLY=   ${DIST_SOURCES}
.if !defined(NOPORTDOCS)
EXTRACT_ONLY+=  ${DIST_HTM} ccx_${PORTVERSION}.ps${EXTRACT_SUFX}
.endif
.ifdef WITH_EXAMPLES
EXTRACT_ONLY+=  ${DIST_EXAMPLES}
.endif

MAINTAINER= maho@FreeBSD.org
COMMENT=    A Three-Dimensional Structural Finite Element Program

BUILD_DEPENDS=  ${LOCALBASE}/lib/libarpack.a:${PORTSDIR}/math/arpack    \
        ${LOCALBASE}/lib/liblapack.a:${PORTSDIR}/math/lapack    \
        ${LOCALBASE}/lib/libspooles.a:${PORTSDIR}/math/spooles  \
        ${LOCALBASE}/lib/libmetis.a:${PORTSDIR}/math/metis  \
        ${LOCALBASE}/lib/libtaucs.a:${PORTSDIR}/math/taucs
LIB_DEPENDS=    atlas.1:${PORTSDIR}/math/atlas \
        glut.3:${PORTSDIR}/graphics/libglut

USE_BZIP2=  yes

DIST_SOURCES=   ccx_${PORTVERSION}.src${EXTRACT_SUFX}   \
        cgx_${PORTVERSION}.all${EXTRACT_SUFX}
DIST_HTM=   ccx_${PORTVERSION}.htm${EXTRACT_SUFX}   \
        cgx_${PORTVERSION}.htm${EXTRACT_SUFX}
DIST_PS=    ccx_${PORTVERSION}.ps${EXTRACT_SUFX}    \
        cgx_${PORTVERSION}.ps.bz2
DIST_EXAMPLES=  ccx_${PORTVERSION}.test${EXTRACT_SUFX}  \
        cgx_${PORTVERSION}.exa${EXTRACT_SUFX}

WRKSRC=     ${WRKDIR}/${PORTNAME}
USE_GMAKE=  yes
USE_GL= yes
USE_REINPLACE=  yes
BLAS_LIBS?= -lf77blas -latlas

BROWSER?=   mozilla
PSVIEWER?=  gv

.include <bsd.port.pre.mk>

.if ${OSREL} < 5.0
USE_GCC=    3.4
.endif

.if !defined(WITH_EXAMPLES)
PLIST_SUB=  WITH_EXAMPLES="@comment "
.else
PLIST_SUB=  WITH_EXAMPLES=""
.endif

.ifndef (WITH_EXAMPLES)
pre-everything::
    @${ECHO} "You can define WITH_EXAMPLES=yes to install example files"
.endif

pre-build:
    @${REINPLACE_CMD} -e 's+%%FC%%+${FC}+g ; s+%%CC%%+${CC}+g ; \
    s+%%PTHREAD_CFLAGS%%+-DUSE_MT ${PTHREAD_CFLAGS}+g; \
    s+%%PTHREAD_LIBS%%+${PTHREAD_LIBS}+g; \
    s+%%BLAS_LIBS%%+${BLAS_LIBS}+ ; \
    s+%%LOCALBASE%%+${LOCALBASE}+g;' \
        ${WRKSRC}/ccx_${PORTVERSION}/src/Makefile
    @${REINPLACE_CMD} -e 's+%%X11BASE%%+${X11BASE}+g; \
    s+%%PTHREAD_CFLAGS%%+${PTHREAD_CFLAGS}+g; \
    s+%%PTHREAD_LIBS%%+${PTHREAD_LIBS}+g;' \
        ${WRKSRC}/cgx_${PORTVERSION}/src/Makefile
    @${REINPLACE_CMD} -e 's+%%DOCSDIR%%+${DOCSDIR}+g; \
    s+"mozilla"+"${BROWSER}"+ ; \
    s+"ghostview"+"${PSVIEWER}"+ ;' \
        ${WRKSRC}/cgx_${PORTVERSION}/src/cgx.h
# This fixes bugs in ccx 1.4
    @${REINPLACE_CMD} -e 's+description[12]+description[13]+g;' \
        ${WRKSRC}/ccx_1.4/src/arpackbu.c    \
        ${WRKSRC}/ccx_1.4/src/arpack.c  \
        ${WRKSRC}/ccx_1.4/src/arpackcs.c    \
        ${WRKSRC}/ccx_1.4/src/dyna.c        \
        ${WRKSRC}/ccx_1.4/src/frdcyc.c  \
        ${WRKSRC}/ccx_1.4/src/nonlingeo.c   \
        ${WRKSRC}/ccx_1.4/src/prespooles.c  \
        ${WRKSRC}/ccx_1.4/src/profile.c \
        ${WRKSRC}/ccx_1.4/src/sensitivity.c \
        ${WRKSRC}/ccx_1.4/src/steadystate.c
    @${REINPLACE_CMD} -e 's+output[3]+output[4]+g;' \
        ${WRKSRC}/ccx_1.4/src/ccx_1.4.c

do-build:
    @(cd ${WRKSRC}/ccx_${PORTVERSION}/src; ${SETENV} ${MAKE_ENV} $(GMAKE) )
    @(cd ${WRKSRC}/libSNL/src; ${SETENV} ${MAKE_ENV} $(GMAKE) )
    @(cd ${WRKSRC}/cgx_${PORTVERSION}/src; ${SETENV} ${MAKE_ENV} $(GMAKE) )

do-install:
    @${INSTALL_PROGRAM} ${WRKSRC}/ccx_${PORTVERSION}/src/ccx_${PORTVERSION} \
      ${PREFIX}/bin/ccx
    @${INSTALL_PROGRAM} ${WRKSRC}/cgx_${PORTVERSION}/src/cgx \
      ${PREFIX}/bin/cgx
.if !defined(NOPORTDOCS)
    @${MKDIR} ${DOCSDIR}
    @${MKDIR} ${DOCSDIR}/ccx
    @${INSTALL_DATA} ${WRKSRC}/ccx_${PORTVERSION}/doc/ccx/* \
      ${DOCSDIR}/ccx
    @${MKDIR} ${DOCSDIR}/cgx
    @${INSTALL_DATA} ${WRKSRC}/cgx_${PORTVERSION}/doc/cgx/* \
      ${DOCSDIR}/cgx
    @${INSTALL_DATA} ${WRKSRC}/ccx_${PORTVERSION}/doc/*.ps ${DOCSDIR}
    @${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/cgx_${PORTVERSION}.ps.bz2    \
      ${DOCSDIR}
    bunzip2 ${DOCSDIR}/cgx_${PORTVERSION}.ps.bz2
    @${GZIP_CMD} ${DOCSDIR}/*.ps
.endif
.ifdef WITH_EXAMPLES
    @${MKDIR} ${EXAMPLESDIR}
    @${TAR} cf - -C ${WRKSRC}/cgx_${PORTVERSION}/examples . | ${TAR} xf - -C ${EXAMPLESDIR}
    @${CHOWN} -R ${SHAREOWN}:${SHAREGRP} ${EXAMPLESDIR}
    @${MKDIR} ${EXAMPLESDIR}/test
    @${TAR} cf - -C ${WRKSRC}/ccx_${PORTVERSION}/test . | ${TAR} xf - -C ${EXAMPLESDIR}/test
    @${CHOWN} -R ${SHAREOWN}:${SHAREGRP} ${EXAMPLESDIR}
.endif

.include <bsd.port.post.mk>