source: trunk/dports/science/ompl/Portfile

Last change on this file was 152075, checked in by mmoll@…, 11 months ago

science/ompl: disable building tests, since they aren't run anyway

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.0 KB
Line 
1# $Id: Portfile 152075 2016-08-28 20:47:45Z ryandesign@macports.org $
2
3PortSystem 1.0
4PortGroup           cmake 1.0
5PortGroup           active_variants 1.1
6PortGroup           cxx11 1.0
7cmake.out_of_source yes
8
9name                ompl
10version             1.2.1
11categories          science
12maintainers         mmoll
13description         The Open Motion Planning Library (OMPL)
14long_description    The Open Motion Planning Library (OMPL) consists of a set \
15                    of sampling-based motion planning algorithms.
16homepage            http://ompl.kavrakilab.org
17platforms           darwin
18license             BSD
19master_sites        https://bitbucket.org/ompl/ompl/downloads
20distname            ${name}-${version}-Source
21checksums           rmd160  7f4ccd3c36acca52d5ccb2e3c9ff8e388af12f1d \
22                    sha256  9d00fdb262222ba5ff5732be84212c6b0ba769b0b0fb64a1189e5f1db1c568eb
23depends_lib-append  port:boost port:ode port:flann port:triangle port:eigen3
24
25configure.args-append   -DOMPL_BUILD_DEMOS=OFF -DOMPL_BUILD_TESTS=OFF
26# generate the extra C++ code needed for Python bindings. This code seems
27# somewhat dependent on compiler and/or boost version, so we can't
28# pre-generate them and make them available as an extra download.
29post-configure {
30    if {[variant_isset python27] || [variant_isset python34] || [variant_isset python35]} {
31        # enable parallel build on at most 2 cores. Generating the bindings
32        # uses large amounts of memory, so don't use more cores.
33        if { ${use_parallel_build} } { set cj "-j 2" } else { set cj "" }
34        system -W ${cmake.build_dir} "${build.cmd} ${cj} update_bindings"
35    }
36}
37
38# The +app variant includes all the content of the regular OMPL version, but
39# adds a simple GUI and an extra library with bindings to the assimp and fcl
40# libraries. The cascade of dependencies due to pyqt5 is rather large, so by
41# default the +app variant is not enabled. Also, the additions to OMPL in
42# this variant are distributed under a slightly different license than the
43# regular OMPL version.
44variant app description {Include GUI and extra demo code} {
45    license             noncommercial
46    pre-extract {
47        ui_warn "The +app variant causes some extra code to be compiled that is
48distributed under the Rice University Software Distribution License. For
49details, please read:
50http://ompl.kavrakilab.org/license.html#ricelicense"
51    }
52    depends_build-append port:pkgconfig
53    depends_lib-append  port:assimp port:fcl port:redis
54    configure.args-append -DOMPLAPP_PQP=OFF -DOMPLAPP_RESOURCE_DIR=${prefix}/share/ompl/resources
55    distname            omplapp-${version}-Source
56    checksums           rmd160  9146096d1826a2f11b9b5eb89a6bbb8c1e4b5160 \
57                        sha256  e2a17e311ac980c73011e06902539314782da8eb54bb28d80abeeeeac2adb00d
58    notes "
59    If you intend to use ompl_webapp, you need to first launch the redis server:
60
61        sudo port load redis
62    "
63}
64
65set pythons_suffixes {27 34 35}
66
67set pythons_ports {}
68foreach s ${pythons_suffixes} {
69    lappend pythons_ports python${s}
70}
71
72proc python_dir {} {
73    global pythons_suffixes
74    foreach s ${pythons_suffixes} {
75        if {[variant_isset python${s}]} {
76            set p python[string index ${s} 0].[string index ${s} 1]
77            return [file normalize [exec ${p} -c "import sys; print(sys.prefix)"]/lib/${p}/site-packages]
78        }
79    }
80    error "Python support not enabled."
81}
82
83foreach s ${pythons_suffixes} {
84    set p python${s}
85    set v [string index ${s} 0].[string index ${s} 1]
86    set i [lsearch -exact ${pythons_ports} ${p}]
87    set c [lreplace ${pythons_ports} ${i} ${i}]
88    eval [subst {
89        variant ${p} description "Use Python ${v} for python bindings" conflicts ${c} debug {
90            depends_build-append    port:py${s}-pyplusplus
91            depends_lib-append      port:${p}
92            configure.args-append   -DPYTHON_EXEC=${prefix}/bin/python${v}
93
94            # the python bindings rely on Boost.Python, so make sure it is installed.
95            require_active_variants boost ${p}
96
97            if { [variant_isset app] } {
98                depends_lib-append \
99                    port:py${s}-pyqt5 \
100                    port:py${s}-opengl \
101                    port:py${s}-flask \
102                    port:py${s}-celery \
103                    port:py${s}-redis
104                post-destroot {
105                    reinplace "s|#!/usr/bin/env python|#!${prefix}/bin/python${v}|g" \
106                        ${destroot}${prefix}/bin/ompl_app \
107                        ${destroot}${prefix}/bin/ompl_benchmark_statistics.py
108                    reinplace "s|broker=rabbitmq|broker=redis|g" \
109                        ${destroot}${prefix}/share/ompl/ompl.conf
110                    reinplace "s|python ./omplweb.py|${prefix}/bin/python${v} ./omplweb.py|g" \
111                        ${destroot}${prefix}/share/ompl/webapp/omplweb.py
112                    # extra copy of libs not needed in site_packages and causes problems with rpaths
113                    set site_packages \[python_dir\]
114                    delete ${destroot}\${site_packages}/ompl/util/libompl.dylib \
115                           ${destroot}\${site_packages}/ompl/app/libompl_app.dylib \
116                           ${destroot}\${site_packages}/ompl/app/libompl_app_base.dylib
117                }
118            } else {
119                post-destroot {
120                    reinplace "s|#!/usr/bin/env python|#!${prefix}/bin/python${v}|g" \
121                        ${destroot}${prefix}/bin/ompl_benchmark_statistics.py
122                    # extra copy of libs not needed in site_packages and causes problems with rpaths
123                    set site_packages \[python_dir\]
124                    delete ${destroot}\${site_packages}/ompl/util/libompl.dylib
125                }
126            }
127        }
128    }]
129}
130
131# enable one python variant so that the python bindings can be compiled
132set selected_python python27
133foreach s ${pythons_suffixes} {
134    if {[variant_isset python${s}]} {
135        set selected_python python${s}
136    }
137}
138default_variants +${selected_python}
139
140livecheck.type  regex
141livecheck.url   http://ompl.kavrakilab.org/download.html
142livecheck.regex (\[0-9.\]+), released
Note: See TracBrowser for help on using the repository browser.