Ticket #49899: Portfile

File Portfile, 6.0 KB (added by vsuorant (Ville), 8 years ago)
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 141911 2015-10-30 23:38:38Z sean@macports.org $
3
4PortSystem          1.0
5PortGroup           python 1.0
6PortGroup           github 1.0
7
8github.setup        matplotlib matplotlib 1.5.0 v
9
10name                py-matplotlib
11categories-append   graphics math
12platforms           darwin
13license             {PSF BSD}
14
15python.versions     26 27 33 34 35
16
17maintainers         sean openmaintainer
18
19description         Matplotlib is a python plotting library
20
21long_description    Matplotlib strives to produce publication quality 2D \
22                    graphics for interactive graphing, scientific publishing, \
23                    user interface development and web application servers \
24                    targeting multiple user interfaces and hardcopy output \
25                    formats. There is a 'pylab' mode which emulates matlab \
26                    graphics. The library uses numpy for handling large data \
27                    sets and supports a variety of output backends. This port \
28                    provides variants for the different GUIs (gtk2, tkinter, \
29                    qt4, cairo, latex).
30
31homepage            http://matplotlib.org/
32
33checksums           rmd160  3da4768be680445b64d1983e2af17c813bc72d7a \
34                    sha256  fa9fbbd03e8908755390ac8665754f595b8da97cbd5b215c0e5c79ff95ca89fb
35
36if {${name} ne ${subport}} {
37    depends_build-append \
38                        port:pkgconfig
39
40    depends_lib-append  port:freetype \
41                        port:libpng \
42                        port:qhull \
43                        port:py${python.version}-dateutil \
44                        port:py${python.version}-numpy \
45                        port:py${python.version}-parsing \
46                        port:py${python.version}-pyobjc-cocoa \
47                        port:py${python.version}-six \
48                        port:py${python.version}-tornado \
49                        port:py${python.version}-tz \
50                        port:py${python.version}-cycler
51
52    patchfiles-append   patch-setup.cfg.diff \
53                        patch-setupext.py.diff
54
55    build.env           PKG_CONFIG_PATH="${python.prefix}/lib/pkgconfig"
56
57    post-patch {
58        reinplace "s|@@PREFIX@@|${prefix}|" ${worksrcpath}/setup.cfg
59    }
60
61    # build fails with gcc-4.0 on Leopard, use gcc-4.2 (#37069)
62    compiler.blacklist gcc-4.0
63
64    post-destroot {
65        if {${name} ne ${subport}} {
66            xinstall -m 755 -d ${destroot}${prefix}/share/doc/${subport} \
67                ${destroot}${prefix}/share/${subport}
68            xinstall -m 644 -W ${worksrcpath} CHANGELOG README.rst matplotlibrc.template \
69                ${destroot}${prefix}/share/doc/${subport}
70            file copy ${worksrcpath}/examples \
71                ${destroot}${prefix}/share/${subport}
72        }
73    }
74
75    variant webagg description "Enable WebAgg backend" {
76        depends_run-append  port:py${python.version}-tornado
77    }
78
79    variant tkinter description "Enable tkAgg backend" {
80        depends_lib-append  port:py${python.version}-tkinter
81        post-patch {
82            reinplace "s|^tkagg=False|tkagg=True|" ${worksrcpath}/setup.cfg
83        }
84    }
85
86    if {${python.version} < 30} {
87        variant gtk2 description "Enable GTKAgg backend" {
88            depends_lib-append  port:py${python.version}-pygtk
89            post-patch {
90                reinplace "s|^gtk=False|gtk=True|" ${worksrcpath}/setup.cfg
91                reinplace "s|^gtkagg=False|gtkagg=True|" ${worksrcpath}/setup.cfg
92            }
93        }
94    }
95
96    if {${python.version} > 26 && ${python.version} < 30} {
97        variant gtk3 description "Enable GTK3Agg backend" {
98            depends_lib-append  port:py${python.version}-gobject3 port:gtk3
99            post-patch {
100                reinplace "s|^gtk3agg=False|gtk3agg=True|" ${worksrcpath}/setup.cfg
101            }
102        }
103    }
104
105    variant qt4 description "Enable QT4Agg backend" {
106        # Can use either py*-pyqt4 or py*-pyqt4-devel.
107        depends_lib-append  path:share/py${python.version}-sip/PyQt4:py${python.version}-pyqt4
108        post-patch {
109            reinplace "s|^qt4agg=False|qt4agg=True|" ${worksrcpath}/setup.cfg
110        }
111    }
112
113    if {${python.version} == 27 || ${python.version} == 34} {
114        variant pyside description "Enable PySide backend" {
115            depends_lib-append  port:py${python.version}-pyside
116            post-patch {
117                reinplace "s|^pyside=False|pyside=True|" ${worksrcpath}/setup.cfg
118            }
119        }
120    }
121
122    variant cairo description "Enable Cairo backends" {
123        depends_lib-append  port:py${python.version}-cairo
124        post-patch {
125            reinplace "s|^cairo=False|cairo=True|" ${worksrcpath}/setup.cfg
126        }
127    }
128
129    variant dvipng description "Enable dvipng support" {
130        depends_run-append  port:dvipng
131    }
132
133    variant ghostscript description "Enable GhostScript support" {
134        depends_run-append  port:ghostscript
135    }
136
137    variant latex description "Enable LaTeX support" {
138        depends_run-append  bin:latex:texlive
139    }
140
141    variant pdftops description "Enable pdftops support" {
142        depends_run-append  bin:pdftops:poppler
143    }
144
145    if { ![variant_isset gtk2] && ![variant_isset tkinter] && ![variant_isset qt4] && ![variant_isset pyside] } {
146        default_variants-append +cairo
147    }
148
149    post-patch {
150        reinplace "s|^agg=False|agg=True|" ${worksrcpath}/setup.cfg
151        if {[variant_isset gtk3] && [variant_isset cairo]} {
152            reinplace "s|^gtk3cairo=False|gtk3cairo=True|" ${worksrcpath}/setup.cfg
153        }
154    }
155
156    livecheck.type      none
157
158    notes "
159The default backend is the interactive Mac OS X backend. Different\
160backends can be specified using the ~/.matplotlib/matplotlibrc file.\
161More details regarding backends can be found in the matplotlib FAQ:
162
163http://matplotlib.sourceforge.net/faq/installing_faq.html#what-is-a-backend
164"
165} else {
166    livecheck.regex     archive/[join ${github.tag_prefix} ""](\[\\d+(?:\\.\\d+)*"\]+)${extract.suffix}"
167}