aboutsummaryrefslogtreecommitdiffstats
path: root/graphics/f90gl/Makefile
blob: 0338cfb3bb278b5cc07e582f6ab4e57af2fc67cb (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
# New ports collection makefile for:    f90gl
# Date created:             2007/7/21
# Whom:                 Nakata Maho <maho@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=   f90gl
PORTVERSION=    1.2.13
PORTREVISION=   3
CATEGORIES= graphics
MASTER_SITES=   http://math.nist.gov/f90gl/ \
        http://math.nist.gov/~WMitchell/papers/:doc
DISTFILES=  ${PORTNAME}-${PORTVERSION}.tar.gz
.if !defined(NOPORTDOCS)
DISTFILES+= nistir6134.ps.gz:doc nistir6134.pdf:doc \
        errata
.endif
DIST_SUBDIR=    ${PORTNAME}
EXTRACT_ONLY=   ${PORTNAME}-${PORTVERSION}.tar.gz

MAINTAINER= maho@FreeBSD.org
COMMENT=    Official Fortran 90 bindings for OpenGL

USE_GL=     glut glu
USE_XORG=   xaw
USE_LDCONFIG=   yes
USE_FORTRAN=    yes
FNAME=      UNDERSCORE

.include <bsd.port.pre.mk>

.if ${ARCH} == "sparc64" || ${ARCH} == "amd64"
FPIC=   -fPIC
.else
FPIC=   -fpic
.endif
SVERSION=1
WRKSRC_SHARED=${WRKSRC}_shared
CFLAGS_SHARED=${CFLAGS} ${FPIC}
FFLAGS_SHARED=${CFLAGS} ${FPIC}
.if !defined(WITH_EXAMPLES)
PLIST_SUB=  WITH_EXAMPLES="@comment "
.else
PLIST_SUB=  WITH_EXAMPLES=""
.endif

.if !defined (OPENGL_DISPLAY)
EXTRA_PATCHES=  ${PATCHDIR}/extra-disable-mkfppinc
.endif

post-patch:
    ${CP} -r ${WRKSRC} ${WRKSRC_SHARED}

pre-build:
    @${REINPLACE_CMD} -e 's,%%CC%%,${CC},g' \
            -e 's,%%CFLAGS%%,${CFLAGS},g' \
            -e 's,%%FC%%,${FC},g' \
            -e 's,%%FFLAGS%%,${FFLAGS},g' \
            -e 's,%%FNAME%%,${FNAME},g' \
            -e 's,%%LOCALBASE%%,${LOCALBASE},g' ${WRKSRC}/mf8lim7

    @${REINPLACE_CMD} -e 's,%%CC%%,${CC},g' \
            -e 's,%%CFLAGS%%,${CFLAGS_SHARED},g' \
            -e 's,%%FC%%,${FC},g' \
            -e 's,%%FFLAGS%%,${FFLAGS_SHARED},g' \
            -e 's,%%FNAME%%,${FNAME},g' \
            -e 's,%%LOCALBASE%%,${LOCALBASE},g' ${WRKSRC_SHARED}/mf8lim7

    @${REINPLACE_CMD} -e 's,%%WRKSRC%%,${WRKSRC},g' \
            -e 's,%%FC%%,${FC},g' \
            -e 's,%%FFLAGS%%,${FFLAGS},g' \
            -e 's,%%LOCALBASE%%,${LOCALBASE},g' ${WRKSRC_SHARED}/examples/mf8lnt

do-build:
.if !defined (OPENGL_DISPLAY)
    ${CP} ${FILESDIR}/glopt.h ${WRKSRC}/util
    ${CP} ${FILESDIR}/glopt.h ${WRKSRC_SHARED}/util
.endif
    cd ${WRKSRC}                 ; ${MAKE} -f mf8lim7
    cd ${WRKSRC_SHARED}          ; ${MAKE} -f mf8lim7
    cd ${WRKSRC_SHARED}/examples ; ${MAKE} -f mf8lnt

post-build:
    cd ${WRKSRC_SHARED}/lib ; for i in `ls *.a | ${SED}  's/\.a//' `; do \
        ld -Bshareable -o $${i}.so.${SVERSION} -x -soname $${i}.so.${SVERSION} --whole-archive $${i}.a ;\
        ${LN} -s $${i}.so.${SVERSION} $${i}.so ;\
    done

do-install:
    ${MKDIR} ${PREFIX}/include/GL
    ${INSTALL_DATA} ${WRKSRC}/include/GL/*  ${PREFIX}/include/GL
    ${INSTALL_DATA} ${WRKSRC}/lib/*.a   ${PREFIX}/lib
    ${INSTALL_DATA} ${WRKSRC_SHARED}/lib/*.so.${SVERSION}   ${PREFIX}/lib
    ${INSTALL_DATA} ${WRKSRC_SHARED}/lib/*.so   ${PREFIX}/lib
.if !defined(NOPORTDOCS)
    @${MKDIR} ${DOCSDIR}
.for i in nistir6134.ps.gz nistir6134.pdf errata
    ${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/${i} ${DOCSDIR}
.endfor
.for i in INSTALL USRGUIDE README
    ${INSTALL_DATA} ${WRKSRC}/${i} ${DOCSDIR}
.endfor
.endif
.if defined(WITH_EXAMPLES)
    @${MKDIR} ${EXAMPLESDIR}
    @${TAR} cf - -C ${WRKSRC_SHARED}/examples . | ${TAR} xf - -C ${EXAMPLESDIR}
.endif

.include <bsd.port.post.mk>