aboutsummaryrefslogtreecommitdiffstats
path: root/cad/opencascade/Makefile
blob: b4130e0672f0696bf8f21ae7850e7ae0eee2866d (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
# New ports collection makefile for:  opencascade
# Date created:               29 November 2005
# Whom:                       Thierry Thomas <thierry@pompo.net>
#
# $FreeBSD$
#

PORTNAME=       opencascade
PORTVERSION=        6.2
PORTREVISION=       3
CATEGORIES=     cad science
MASTER_SITES=       ${MASTER_SITE_LOCAL}
MASTER_SITE_SUBDIR= thierry

MAINTAINER= thierry@FreeBSD.org
COMMENT=    Open CASCADE Technology, 3D modeling & numerical simulation

BUILD_DEPENDS=  ${LOCALBASE}/include/stlport/algorithm:${PORTSDIR}/devel/stlport
RUN_DEPENDS=    ${LOCALBASE}/include/stlport/algorithm:${PORTSDIR}/devel/stlport    \
        autoexpect:${PORTSDIR}/lang/expect      \
        ${LIB_TCLX}:${PORTSDIR}/lang/tclX
LIB_DEPENDS=    itcl.${ITCL_VER}:${PORTSDIR}/lang/itcl      \
        itk.${ITK_VER}:${PORTSDIR}/x11-toolkits/itk \
        tix${TIX_VER}:${PORTSDIR}/x11-toolkits/tix  \
        fltk.1:${PORTSDIR}/x11-toolkits/fltk        \
        dps.0:${PORTSDIR}/x11/dgs

BROKEN=     Does not compile

USE_BZIP2=  yes
USE_BISON=  build
USE_TK=     yes
USE_TCL_BUILD=  84
USE_TCL_RUN=    84
USE_TCL_THREADS=yes
USE_JAVA=   yes
JAVA_VERSION=   1.4+
#.if defined(MAINTAINER_MODE)
# linux-sun-jdk was required for 6.1, but 6.2 is OK with diablo-jdk.
#JAVA_OS=   linux
#.endif

ITCL_VER=   3
ITCL_MM=    3.3
ITK_VER=    3
ITK_MM=     3.3
TIX_VER=    8184.1
TIX_MM=     8.1
LIB_TCLX=   ${LOCALBASE}/lib/tclx${TCL_VER}/libtclx${TCL_VER}.so

PATCH_WRKSRC=   ${WRKDIR}/${DISTNAME}
WRKSRC=     ${WRKDIR}/${DISTNAME}/ros
REINPLACE_ARGS= -i ""
GNU_CONFIGURE=  yes
CONFIGURE_TARGET=   --build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
CONFIGURE_ARGS= --with-tcl=${TCL_LIBDIR}                \
        --with-tk=${TK_LIBDIR}                  \
        --with-java-include=${JAVA_HOME}/include        \
        --with-dps-include=${X11BASE}/include           \
        --with-dps-library=${X11BASE}/lib           \
        --with-gl-include=${X11BASE}/include            \
        --with-gl-library=${X11BASE}/lib            \
        --with-xmu-include=${X11BASE}/include/X11       \
        --with-xmu-library=${X11BASE}/lib           \
        --with-stlport-include=${LOCALBASE}/include/stlport \
        --with-stlport-libname=stlport_${STL_COMPILER}      \
        --with-stlport-library=${LOCALBASE}/lib         \
        --enable-production=yes
CONFIGURE_ENV=  CPPFLAGS="${CXXFLAGS} ${GCC4WA} -I${X11BASE}/include    \
        -I${TCL_INCLUDEDIR} -I${TK_INCLUDEDIR}" ARCH=${ARCH}
# We strip the libs
MAKE_ENV=   INSTALL_STRIP_FLAG=-s OCC_BUILDDIR="${PATCH_WRKSRC}"    \
        OCC_INSTALLDIR="${OCCROOT}" PTHREAD_LIBS="${PTHREAD_LIBS}"
USE_LDCONFIG=   yes

STL_COMPILER?=  gcc
WANT_FORTRAN=   yes #dummy but future use
BUILD_DEPENDS+= gfortran42:${PORTSDIR}/lang/gcc42
FC=     gfortran42
F77=        gfortran42
CONFIGURE_ENV+= FC="${FC}" F77="${F77}" FFLAGS="${FFLAGS}"
FFLAGS?=    -O2

LOCCROOT=   OpenCAS
OCCROOT=    ${PREFIX}/${LOCCROOT}
CASROOT=    ${OCCROOT}/ros
PLIST_SUB=  OCCROOT="${LOCCROOT}"
SUB_LIST=   OCCROOT="${OCCROOT}" PORTNAME=${PORTNAME} FILESDIR=${FILESDIR}
SUB_FILES=  pkg-message LICENSE.${OPSYS}
PKGMESSAGE= ${WRKDIR}/pkg-message

FBSDBIN=    DRAWEXE wokprocess woksh
DIR2INST=   data tools wok
SRC2INST=   adm drv inc make src
.if !defined(NOPORTDOCS)
DIR2INST+=  doc
.endif

.include <bsd.port.pre.mk>

.if ${OSVERSION} > 700036 && defined(PACKAGE_BUILDING)
# Work-around for gcc-41+
GCC4WA=     -ffriend-injection -fpermissive
.endif

.if defined(MAINTAINER_MODE)    # Get the sources & roll the tarballs

PRIM_MASTER_SITES=  http://files.opencascade.com/OCC_${PORTVERSION}_release/
PRIM_DISTFILES=     OpenCASCADE_Linux.tgz
DISABLE_SIZE=       yes
WRKPREP=        ${WRKDIR}/prepare
#USE_LINUX=     yes

LINBIN= uninstall

get-sources:
    # The tarball provided by Open CASCADE requires Java (+ Linux emulation)
    # to be extracted, and it is interactive!
. if !exists(${_DISTDIR}/${PRIM_DISTFILES})
    ${MKDIR} ${_DISTDIR}
    cd ${_DISTDIR} &&   \
    ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS}    \
        ${PRIM_MASTER_SITES}${PRIM_DISTFILES} ${FETCH_AFTER_ARGS}
. endif
. if !exists(${WRKPREP}/install.csh)
    ${MKDIR} ${PATCH_WRKSRC} ${WRKPREP} ${WRKDIR}/tmp
    cd ${WRKPREP} && ${TAR} xf ${_DISTDIR}${PRIM_DISTFILES}
    ${RM} -f ${HOME}/vpd.properties
    #${BRANDELF} -t Linux ${WRKPREP}/Linux/setupLinux.bin
    @${ECHO_MSG} "========================================================================"
    @${ECHO_MSG} "Accept license, change destination directory to ${PATCH_WRKSRC}"
    @${ECHO_MSG} "select \"Complete installation\" and \"Install\"."
    @${ECHO_MSG} "========================================================================"
    #cd ${WRKPREP} && LANG=C JAVAHOME=. OS_NAME=${OPSYS} ./Linux/setupLinux.bin
    cd ${WRKPREP} &&    \
        ${JAVA} -cp ./Linux/setup.jar -DOS_NAME=Linux -Dtemp.dir=${WRKDIR}/tmp run
. endif

tarballs:   get-sources
    # Remove Linux binaries
    ${RM} -rf ${LINBIN:S|^|${PATCH_WRKSRC}/|}
    # Make separate tarballs / ports for samples
    ${MV} ${PATCH_WRKSRC}/samples ${WRKDIR}
    cd ${WRKDIR} && ${TAR} cfj ${_DISTDIR}${DISTFILES} ${DISTNAME}
    ${MV} ${WRKDIR}/samples ${PATCH_WRKSRC}
    cd ${WRKDIR} && \
    ${TAR} cfj ${_DISTDIR}${PORTNAME}-tutorial-${PORTVERSION}${EXTRACT_SUFX}    \
            ${DISTNAME}/samples/tutorial
    cd ${WRKDIR} && \
    ${TAR} cfj ${_DISTDIR}${PORTNAME}-samples-java-${PORTVERSION}${EXTRACT_SUFX}    \
            ${DISTNAME}/samples/standard/java
    cd ${WRKDIR} && \
    ${TAR} cfj ${_DISTDIR}${PORTNAME}-samples-qt-${PORTVERSION}${EXTRACT_SUFX}  \
            ${DISTNAME}/samples/standard/qt

.endif  # The sources tarballs are now available

pre-everything::
    @${ECHO_MSG}
    @${ECHO_MSG} "Warning: to build OpenCascade, you should have at least"
    @${ECHO_MSG} "3.7 Gb of free disk space in build area!"
    @${ECHO_MSG}

pre-configure:
    ${CHMOD} a+x ${WRKSRC}/${CONFIGURE_SCRIPT}
    ${REINPLACE_CMD} -e 's|%%CASROOT%%|${CASROOT}|' \
        -e 's|%%LOCALBASE%%|${LOCALBASE}|'  \
        -e 's|%%TCL_LIBDIR%%|${TCL_LIBDIR}|'    \
        -e 's|%%TK_LIBDIR%%|${TK_LIBDIR}|'  \
        -e 's|%%ITCLMM%%|${ITCL_VER}|'      \
        -e 's|%%ITKMM%%|${ITK_MM}|'     \
        -e 's|%%TIX_MM%%|${TIX_MM}|'        \
        -e 's|!/bin/ksh|! ${LOCALBASE}/bin/ksh|'\
        ${WRKSRC}/env.csh ${WRKSRC}/env.ksh
    ${REINPLACE_CMD} -e 's|/tmp/OCC50|${CASROOT}|'  \
        -e 's|/usr/bin/g++|${CXX}|'     \
        -e 's|/usr/bin/gcc|${CC}|'      \
        -e 's|%%JAVAHOME%%|${JAVA_HOME}|'   \
        -e 's|/usr/local|${LOCALBASE}|'     \
        -e 's|/usr/X11R6|${X11BASE}|'       \
        ${WRKSRC}/src/OS/Draw.tcl       \
        ${WRKSRC}/src/OS/Visualization.tcl  \
        ${WRKSRC}/src/OS/ApplicationFramework.tcl
    ${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|'\
        -e 's|/usr/X11R6|${X11BASE}|'       \
        -e 's|/usr/local/bin/tclsh8.4|${TCLSH}|'\
        ${PATCH_WRKSRC}/wok/site/wokinit.csh    \
        ${WRKSRC}/src/WOKsite/wokinit.csh   \
        ${WRKSRC}/src/OS/WOK.tcl
    ${REINPLACE_CMD} -e 's|$${TCLBIN}/tclsh|${TCLSH}|'  \
        ${PATCH_WRKSRC}/wok/site/wok.csh        \
        ${WRKSRC}/src/WOKsite/wok.csh
    ${REINPLACE_CMD} -e 's|/usr/bin/g++|${CXX}|'    \
        -e 's|/usr/bin/gcc|${CC}|'      \
        -e 's|/usr/bin/f77|${F77}|'     \
        -e 's|/usr/bin/ld|${LD}|'       \
        -e 's|%%CXXFLAGS%%|${CXXFLAGS}|'    \
        -e 's|%%CFLAGS%%|${CFLAGS}|'        \
        -e 's|%%FFLAGS%%|${FFLAGS}|'        \
        -e 's|%%LOCALBASE%%|${LOCALBASE}|'  \
        -e 's|%%/usr/X11R6%%|${X11LBASE}|'  \
        -e 's|%%STL_COMPILER%%|${STL_COMPILER}|'\
        -e 's|%%TCL_INCDIR%%|${TCL_INCLUDEDIR}|'\
        -e 's|%%JAVA_HOME%%|${JAVA_HOME}|'  \
        ${WRKSRC}/src/WOKBuilderDef/CSF.edl \
        ${PATCH_WRKSRC}/wok/lib/CSF.edl     \
        ${WRKSRC}/src/WOKBuilderDef/CMPLRS.edl  \
        ${PATCH_WRKSRC}/wok/lib/CMPLRS.edl  \
        ${WRKSRC}/src/WOKBuilderDef/LDEXE.edl   \
        ${PATCH_WRKSRC}/wok/lib/LDEXE.edl   \
        ${WRKSRC}/src/WOKBuilderDef/LDSHR.edl   \
        ${PATCH_WRKSRC}/wok/lib/LDSHR.edl
    cd ${WRKSRC} && \
        ${TAR} cfz ${WRKDIR}/ros_src_to_avoid_make_clean.tbz ${SRC2INST}

post-install:
    ${MKDIR} ${CASROOT}/bsd/bin ${OCCROOT}/samples
    ${LN} -sf ${FBSDBIN:S|^|${PREFIX}/bin/|} ${CASROOT}/bsd/bin
    ${LN} -sf ${PREFIX}/lib ${CASROOT}/bsd/lib
    ${LN} -sf ${CASROOT}/bsd ${CASROOT}/${OPSYS}
    ${INSTALL_DATA} ${PATCH_WRKSRC}/LICENSE ${OCCROOT}
    ${INSTALL_DATA} ${WRKDIR}/LICENSE.${OPSYS} ${OCCROOT}
    @${ECHO_CMD} "To populate this directory, please install the following ports:"\
        > ${OCCROOT}/samples/README
    @${ECHO_CMD} "- cad/${PORTNAME}-tutorial" >> ${OCCROOT}/samples/README
    @${ECHO_CMD} "- cad/${PORTNAME}-samples-qt" >> ${OCCROOT}/samples/README
    @${ECHO_CMD} "- cad/${PORTNAME}-samples-java" >> ${OCCROOT}/samples/README
.for di in ${DIR2INST}
    cd ${PATCH_WRKSRC} &&   \
        ${FIND} ${di} -type d -exec ${MKDIR} ${OCCROOT}/{} \;
    cd ${PATCH_WRKSRC} &&   \
        ${FIND} ${di} -type f -exec ${INSTALL_DATA} {} ${OCCROOT}/{} \;
.endfor
    ${LN} -sf ${PREFIX}/lib ${OCCROOT}/wok/lib/bsd
    cd ${OCCROOT} &&    \
        ${FIND} ${DIR2INST} -name "*sh" -exec ${CHMOD} ${BINMODE} {} \;
.for es in env.csh env.ksh
    ${INSTALL_SCRIPT} ${WRKSRC}/${es} ${CASROOT}
.endfor
    cd ${CASROOT} &&    \
        ${TAR} xfz ${WRKDIR}/ros_src_to_avoid_make_clean.tbz
    ${CHOWN} -R ${SHAREOWN}:${SHAREGRP} ${CASROOT}/src
    ${FIND} ${OCCROOT} -name "*.orig" -exec ${RM} {} \;
    ${FIND} ${CASROOT}/drv -type d -empty -exec ${TOUCH} {}/.keep-me \;
    @${ECHO_MSG}
    @${CAT} ${PKGMESSAGE}
    @${ECHO_MSG}

.include <bsd.port.post.mk>