source: trunk/dports/python/py-graph-tool/Portfile

Last change on this file was 153180, checked in by mmoll@…, 10 months ago

py-graph-tool: patch to fix compilation problem with newest CGAL. Closes #52374.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.7 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; c-basic-offset: 4 -*-
2# $Id: Portfile 153180 2016-09-26 15:06:08Z ryandesign@macports.org $
3
4PortSystem          1.0
5PortGroup           python 1.0
6PortGroup           active_variants 1.1
7PortGroup           compiler_blacklist_versions 1.0
8
9set realname        graph-tool
10name                py-${realname}
11version             2.16
12revision            0
13epoch               20160425
14categories          python science
15platforms           darwin
16license             GPL-3
17maintainers         skewed.de:tiago mmoll
18description         Efficient python graph module
19long_description    graph-tool is an efficient python module for manipulation \
20                    and statistical analysis of graphs. The internal data \
21                    structures and most algorithms are implemented in C++ with \
22                    the Boost Graph Library.
23homepage            http://graph-tool.skewed.de
24master_sites        http://downloads.skewed.de/graph-tool/
25use_bzip2           yes
26checksums           md5     c87ba05c20e619e2de933e11abae1591 \
27                    sha1    c9fde996179c4b9196be6cefa3bd28037fe62f20 \
28                    rmd160  7b99c438897145dfd68bb28a0b242541ada75f04
29distname            ${realname}-${version}
30
31python.versions     27 34 35
32python.default_version 27
33
34if {${os.major} <= 12 && ${os.platform} eq "darwin"} {
35    version         2.2.26
36    distname        ${realname}-${version}
37    checksums       md5     317b29de0d3ef715fdc9281e078cfb17 \
38                    sha1    108be4cf6212eb6886f172ea03813187f73e4c3c \
39                    rmd160  cd2e8506522821750d70a97b951254f0a133d218
40} else {
41    if {${name} ne ${subport}} {
42        compiler.blacklist *gcc* {clang <= 700.1.81} {macports-clang-3.[0-6]}
43        compiler.fallback-append macports-clang-3.7
44        patch.pre_args -p1
45        patchfiles 0001-Fix-compilation-problem-with-newer-CGAL.patch
46        configure.cxxflags-append -std=c++14 -stdlib=libc++
47
48        variant openmp description "Enable OpenMP" {
49            # make sure libomp is installed at runtime, even if the compiler gets uninstalled
50            depends_lib-append    lib:${prefix}/lib/libomp/libomp:libomp
51            configure.args-append --enable-openmp
52        }
53        variant clang37 requires openmp conflicts clang38 clang39 description "Use clang-3.7+openmp and enable OpenMP"  {
54            require_active_variants clang-3.7 openmp
55            configure.compiler  macports-clang-3.7
56        }
57        variant clang38 requires openmp conflicts clang37 clang39 description "Use clang-3.8 and enable OpenMP"  {
58            configure.compiler  macports-clang-3.8
59        }
60
61        variant clang39 requires openmp conflicts clang37 clang38 description "Use clang-3.9 and enable OpenMP" {
62            configure.compiler  macports-clang-3.9
63        }
64        default_variants +openmp
65        if {![variant_isset clang37] && ![variant_isset clang39]} {
66            default_variants-append +clang38
67        }
68    }
69}
70
71
72if {${name} ne ${subport}} {
73    universal_variant  no
74    depends_build-append port:pkgconfig
75    depends_lib-append port:boost \
76                       port:cairomm \
77                       port:cgal \
78                       port:expat \
79                       path:bin/dot:graphviz \
80                       port:py${python.version}-numpy \
81                       port:py${python.version}-scipy \
82                       port:py${python.version}-gobject3 \
83                       port:py${python.version}-cairo
84    use_configure      yes
85    # parallel build starts swapping with 8GB of RAM.
86    use_parallel_build no
87
88    # graph-tool relies on Boost.Python, so make sure it is installed.
89    require_active_variants boost python${python.version}
90
91    # PYTHON_EXTRA_LDFLAGS is set to work around incorrect detection of
92    # link flags by configure
93    configure.env-append PYTHON=${python.bin} \
94                         PYTHON_VERSION=${python.branch} \
95                         PYTHON_CPPFLAGS=-I${python.include} \
96                         PYTHON_LDFLAGS="-L${python.libdir}/.. -lpython${python.branch}" \
97                         PYTHON_EXTRA_LDFLAGS="-L${python.libdir}/.. -lpython${python.branch}"
98    # With python2.7 PYTHON_EXTRA_LIBS is determined to be
99    # '-u _PyMac_Error Python.framework/Versions/2.7/Python'. Not clear whether
100    # python2.7 or py-graph-tool's configure script is to blame, but we can easily
101    # work around this:
102    if {${python.version} eq "27"} {
103        configure.env-append PYTHON_EXTRA_LIBS="-u _PyMac_Error"
104    }
105    configure.cppflags-append -I${prefix}/include -I${python.include}/..
106    configure.ldflags-append -L${prefix}/lib
107    configure.args-append --with-boost=${prefix} --exec-prefix=${python.prefix}
108    # Clang uses the old libstc++ from gcc 4.2 before OS X 10.9. Boost doesn't
109    # include some of the tr1 headers in libstdc++ and defines its own tr1
110    # classes. This causes conflicts with sparsehash which insists on using
111    # the old tr1 headers.
112    if {[string match *gcc* ${configure.compiler}] ||
113        ${os.major} >= 13 && ${os.platform} eq "darwin"} {
114        depends_lib-append port:sparsehash
115    } else {
116        configure.args-append --disable-sparsehash
117    }
118    build.cmd          make
119    build.target       all
120    destroot.cmd       make
121    destroot.destdir   DESTDIR=${destroot}
122
123    variant gtk3 description "Enable interactive drawing with gtk3" {
124        depends_lib-append port:gtk3 \
125                           port:librsvg
126    }
127
128    post-destroot {
129        file rename ${destroot}${prefix}/share/doc/graph-tool \
130            ${destroot}${prefix}/share/doc/py${python.version}-graph-tool
131    }
132}
133
134if {${name} eq ${subport}} {
135    livecheck.type      regex
136    livecheck.url       $homepage
137    livecheck.regex     Download version (\[0-9.\]+)
138} else {
139    livecheck.type      none
140}
Note: See TracBrowser for help on using the repository browser.