aboutsummaryrefslogtreecommitdiffstats
path: root/math/py-matplotlib/Makefile
blob: f3141eb80a838db3c90040f7c391b48c649b6ee0 (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
# ex:ts=8
# Ports collection makefile for:    py-matplotlib
# Date created:         Aug 4, 2004
# Whom:             ijliao
#
# $FreeBSD$
#

PORTNAME=   matplotlib
PORTVERSION=    1.0.0
PORTREVISION=   1
CATEGORIES= math python
MASTER_SITES=   SF/${PORTNAME}/${PORTNAME}/${PORTNAME}-1.0/
PKGNAMEPREFIX=  ${PYTHON_PKGNAMEPREFIX}
DISTNAME=   ${PORTNAME}-1.0.0

MAINTAINER= mainland@apeiron.net
COMMENT=    A plotting library uses a syntax familiar to matlab users

BUILD_DEPENDS=  ${PYNUMPY} \
        ${PYTHON_PKGNAMEPREFIX}dateutil>=1.4:${PORTSDIR}/devel/py-dateutil \
        ${PYTHON_PKGNAMEPREFIX}pytz>0:${PORTSDIR}/devel/py-pytz
LIB_DEPENDS=    freetype.9:${PORTSDIR}/print/freetype2 \
        png.6:${PORTSDIR}/graphics/png
RUN_DEPENDS=    ${PYNUMPY}

USE_PYTHON= 2.4+
USE_PYDISTUTILS=    yes
CFLAGS+=    -I${LOCALBASE}/include
WRKSRC=     ${WRKDIR}/${PORTNAME}-1.0.0/

OPTIONS=        GTKBACKEND  "GTK backend support"       ON \
        GTKAGGBACKEND   "GTKAgg backend support"    ON \
        TKAGGBACKEND    "TKAgg backend support"     ON \
        WXAGGBACKEND    "WXAgg backend support"     OFF

UNIQUENAME= ${PORTNAME}

.include <bsd.port.options.mk>

.if defined(PACKAGE_BUILDING) && \
    (defined(WITH_GTKBACKEND) || defined(WITH_GTKAGGBACKEND) || \
    defined(WITH_TKAGGBACKEND) || defined(WITH_WXAGGBACKEND))
BUILD_DEPENDS+= Xvfb:${X_VFBSERVER_PORT}
.endif

.if defined(WITH_GTKBACKEND) || defined(WITH_GTKAGGBACKEND)
USE_GNOME=  gtk20 pygtk2
.endif

.if defined(WITH_GTKBACKEND) && !defined(WITHOUT_GTKBACKEND)
GTK_BACKEND=True

PLIST_SUB+= GTKBACKEND=""
.else
GTK_BACKEND=False

PLIST_SUB+= GTKBACKEND="@comment "
.endif

.if defined(WITH_GTKAGGBACKEND)
GTKAGG_BACKEND=True

PLIST_SUB+= GTKAGGBACKEND=""
.else
GTKAGG_BACKEND=False

PLIST_SUB+= GTKAGGBACKEND="@comment "
.endif

.if defined(WITH_TKAGGBACKEND)
BUILD_DEPENDS+= ${PYTHON_SITELIBDIR}/_tkinter.so:${PORTSDIR}/x11-toolkits/py-tkinter
RUN_DEPENDS+=   ${PYTHON_SITELIBDIR}/_tkinter.so:${PORTSDIR}/x11-toolkits/py-tkinter

USE_TCL_RUN=    yes
USE_TK_RUN= yes

TKAGG_BACKEND=True

PLIST_SUB+= TKAGGBACKEND=""
.else
TKAGG_BACKEND=False

PLIST_SUB+= TKAGGBACKEND="@comment "
.endif

.if defined(WITH_WXAGGBACKEND)
USE_WX= 2.6
WX_COMPS=   python
CONFIGURE_ENV+= WX_CONFIG="${WX_CONFIG}"

WXAGG_BACKEND=True

PLIST_SUB+= WXAGGBACKEND=""
.else
WXAGG_BACKEND=False

PLIST_SUB+= WXAGGBACKEND="@comment "
.endif

.include <bsd.port.pre.mk>

EXAMPLESDIR=    ${PREFIX}/share/examples/py-${PORTNAME}
post-extract:
    ${CHMOD} -R ga+r ${WRKDIR}

# bsd.tcl.mk doesn't set TK_VER, so we use TCL_VER instead
post-patch:
    ${REINPLACE_CMD} -e 's|png_infopp_NULL|NULL|' \
        ${WRKSRC}/src/_png.cpp
    ${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \
             -e 's|%%TCL_INCLUDEDIR%%|${TCL_INCLUDEDIR}|g' \
             -e 's|%%TK_INCLUDEDIR%%|${TK_INCLUDEDIR}|g' \
             -e 's|%%TCL_LIBDIR%%|${TCL_LIBDIR}|g' \
             -e 's|%%TK_LIBDIR%%|${TK_LIBDIR}|g' \
             -e 's|%%TCL_VER%%|${TCL_VER:S/.//}|g' \
             -e 's|%%TK_VER%%|${TCL_VER:S/.//}|g' \
        ${WRKSRC}/setupext.py
    ${REINPLACE_CMD} -e 's|%%GTK_BACKEND%%|${GTK_BACKEND}|g' \
             -e 's|%%GTKAGG_BACKEND%%|${GTKAGG_BACKEND}|g' \
             -e 's|%%TKAGG_BACKEND%%|${TKAGG_BACKEND}|g' \
             -e 's|%%WXAGG_BACKEND%%|${WXAGG_BACKEND}|g' \
        ${WRKSRC}/setup.cfg

.if !defined(NOPORTEXAMPLES)
post-install:
    @${MKDIR} ${EXAMPLESDIR}
    ${CP} -R ${WRKSRC}/examples/ ${EXAMPLESDIR}
.endif

.include <bsd.port.post.mk>