aboutsummaryrefslogtreecommitdiffstats
path: root/graphics/wildmagic/Makefile
blob: 1e778bf4867537c93e24160bebb6369bb8183159 (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
# New ports collection makefile for:    WildMagic
# Date created:     Sun 1 apr 2007
# Whom:         thierry@pompo.net
#
# $FreeBSD$
#

PORTNAME=   WildMagic
DISTVERSION=    4p5
CATEGORIES= graphics
MASTER_SITES=   http://www.geometrictools.com/Downloads/
DISTNAME=   ${PORTNAME}${DISTVERSION}

MAINTAINER= thierry@FreeBSD.org
COMMENT=    The Wild Magic Real-Time 3D Graphics Engine

USE_ZIP=    yes
USE_DOS2UNIX=   yes
USE_GL=     gl glut
USE_GMAKE=  yes
USE_LDCONFIG=   yes

WRKSRC=     ${WRKDIR}/GeometricTools/${PORTNAME}${MV}
DOS2UNIX_REGEX= .*\.(wm${MV}|h|inl|cpp)
MAKEFILE=   makefile.wm${MV}
ALL_TARGET= build
MAKE_ARGS=  CFG=${CONFIG} SYS=${OPSYS:L} GRF=${GRF}
MAKE_ENV=   CC=${CXX} GCC=${CXX} AR=${AR} EGL=${EGL} EGL0=glx EGL1=Glx  \
        INCPATH="-I${LOCALBASE}/include"        \
        LIBPATH="-L${LOCALBASE}/lib"            \
        XLIBS="-lX11 -lXext" GLIBS="-lGL -lGLU"
PLIST_SUB=  CFG=${CONFIG} GRF=${GRF} WM=Wm${MV}

.if defined(WITH_OPENGL)
GRF=        OpenGL
EGL=        Glx
PLIST_SUB+= OGL="" SOFT="@comment "
IGNORE=     this version does not run with OpenGL
.else
GRF=        Soft
EGL=        XSoft
PLIST_SUB+= OGL="@comment " SOFT=""
.endif

MV=     ${PORTVERSION:R}
SAMPLEDIRS= SampleFoundation SampleGraphics SampleImagics SamplePhysics
SOLIBS=     Foundation Graphics Imagics Physics ${GRF}Application ${GRF}Renderer

CFLAGS+=    -fPIC
.if defined(WITH_DEBUG)
CONFIG=     Debug
CFLAGS+=    -D_DEBUG
.else
# Legit values: Debug, Release, DebugMemory, ReleaseMemory
CONFIG=     Release
#CFLAGS+=   -DNDEBUG
.endif

pre-configure:
    ${FIND} ${WRKSRC} -name "*.wm${MV}" | ${XARGS}  \
    ${REINPLACE_CMD} -e 's|make -f|${SETENV} ${MAKE_ENV} ${GMAKE} -f|;  \
            s|; make |; ${SETENV} ${MAKE_ENV} ${GMAKE} |;       \
            s|-O2 -DNDEBUG|${CFLAGS} |;s|CFLAGS := -c|CFLAGS += -c|;\
            s|INCPATH := |INCPATH += |; s|LIBPATH := |LIBPATH += |; \
            s|$$(CC)|$$(CXX)|'
    ${REINPLACE_CMD} -e 's|GetEnv("WM4_PATH")|"${DATADIR}"|'    \
        ${WRKSRC}/LibFoundation/System/Wm4System.cpp

post-build:
.for sd in ${SAMPLEDIRS}
    ${FIND} ${WRKSRC}/${sd} -type f -perm 755 -exec \
        ${STRIP_CMD} {} \;
.endfor

do-install:
    ${MKDIR} ${PREFIX}/include/Wm${MV} ${DATADIR}
.for li in ${SOLIBS}
    ${INSTALL_DATA} ${WRKSRC}/SDK/Library/${CONFIG}/libWm${MV}${li}.a   \
        ${PREFIX}/lib
    ${INSTALL_PROGRAM} ${WRKSRC}/SDK/Library/${CONFIG}/libWm${MV}${li}.so.0 \
        ${PREFIX}/lib
    (cd ${PREFIX}/lib && ${LN} -sf libWm${MV}${li}.so.0 libWm${MV}${li}.so)
.endfor
    ${FIND} ${WRKSRC}/SDK/Include  -name "Wm*" -exec    \
        ${INSTALL_DATA} {} ${PREFIX}/include/Wm${MV} \;
    ${CP} -R ${WRKSRC}/Data ${DATADIR}
.ifndef NOPORTDOCS
    ${MKDIR} ${EXAMPLESDIR}
. for sd in ${SAMPLEDIRS}
    ${CP} -R ${WRKSRC}/${sd} ${EXAMPLESDIR}
. endfor
    # make clean
    ${FIND} ${EXAMPLESDIR} -type d -name ${CONFIG} -exec    \
        ${RM} -rf {} \; 2>/dev/null || ${TRUE}
    ${FIND} ${EXAMPLESDIR} -name "*.orig" -delete
    ${FIND} ${EXAMPLESDIR} -name "*.bak" -delete
.endif

.include <bsd.port.mk>