Ticket #36130: Portfile.4

File Portfile.4, 5.1 KB (added by ci42, 12 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$
3
4PortSystem          1.0
5PortGroup           cmake 1.0
6
7name                bob
8version             1.0.6
9set soversion       1.0
10categories          science math devel
11platforms           darwin
12maintainers         idiap.ch:andre.anjos \
13                    idiap.ch:laurent.el-shafey \
14                    idiap.ch:sebastien.marcel \
15                    idiap.ch:manuel.guenther \
16                    idiap.ch:ivana.chingovska \
17                    idiap.ch:elie.khoury
18
19description         Bob is a signal-processing and machine learning toolbox
20
21long_description    Bob is a signal-processing and machine learning toolbox \
22                    developed at the Idiap Research Institute, in Martigny, \
23                    Switzerland. The toolbox is written in a mix of Python \
24                    and C++ and is designed to be both efficient and to \
25                    reduce development time.
26
27license             GPL-3
28homepage            http://idiap.github.com/bob/
29master_sites        https://github.com/idiap/bob/downloads/
30use_zip             yes
31
32checksums           rmd160 eac3e390ed25c69d8c6038f815ea473c21118a0f \
33                    sha256 767e22bddb2bfb59458b76eb37cab3791bf1bfbe33fc7ad11ca29038343b5dea
34
35use_parallel_build  no
36
37depends_lib         port:blitz \
38    port:ffmpeg \
39    port:matio \
40    port:imagemagick \
41    port:hdf5-18 \
42    port:boost \
43    port:fftw-3 \
44    port:vlfeat \
45    port:libsvm
46
47configure.args      -DCMAKE_BUILD_TYPE=Release -DBOB_VERSION=${version} -DBOB_SOVERSION=${soversion}
48
49compiler.blacklist  clang
50
51universal_variant   no
52default_variants    +qt4 +opencv
53
54if { ![variant_isset python26] } {
55    default_variants-append +python27
56}
57
58variant python26 conflicts python27 description "Builds for python 2.6." {
59    depends_lib-append    port:py26-numpy \
60      port:py26-matplotlib \
61      port:py26-sqlalchemy \
62      port:py26-argparse \
63      port:py26-scipy
64}
65
66variant python27 conflicts python26 description "Builds for python 2.7." {
67    depends_lib-append    port:py27-numpy \
68      port:py27-matplotlib \
69      port:py27-sqlalchemy \
70      port:py27-scipy
71}
72
73variant qt4 description "Compile Qt4 extensions." {
74    depends_lib-append      port:qt4-mac
75}
76
77variant opencv description "Compile OpenCV extensions." {
78    depends_lib-append      port:opencv
79}
80
81variant doc description "Builds documentation." {
82    depends_build-append    port:dvipng \
83        port:doxygen \
84        port:texlive-latex-extra \
85        port:texlive-fonts-recommended
86    destroot.target-append  sphinx-latex install-sphinx install-doxygen
87
88    if {[variant_isset python26]} {
89      depends_build-append  port:py26-sphinx
90    }
91    if {[variant_isset python27]} {
92      depends_build-append  port:py27-sphinx
93    }
94    test.run yes
95    test.target sphinx-doctest
96}
97
98pre-configure {
99    if {[variant_isset python26]} {
100        configure.args-append -DWITH_PYTHON=${prefix}/bin/python2.6
101    } elseif {[variant_isset python27]} {
102        configure.args-append -DWITH_PYTHON=${prefix}/bin/python2.7
103    } 
104}
105
106post-destroot {
107    if {[variant_isset python26]} {
108        set pypath ${prefix}/lib/python2.6/site-packages
109        set pycompile ${prefix}/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
110        xinstall -d ${destroot}/${pycompile}
111        system "${prefix}/bin/python2.6 -m compileall ${destroot}/${pypath}/bob"
112        move ${destroot}/${pypath}/bob ${destroot}/${pycompile}/bob
113        move ${destroot}/${pypath}/bob-${version}-py2.6.egg-info ${destroot}/${pycompile}/
114    } elseif {[variant_isset python27]} {
115        set pypath ${prefix}/lib/python2.7/site-packages
116        set pycompile ${prefix}/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
117        xinstall -d ${destroot}/${pycompile}
118        system "${prefix}/bin/python2.7 -m compileall ${destroot}/${pypath}/bob"
119        move ${destroot}/${pypath}/bob ${destroot}/${pycompile}/bob
120        move ${destroot}/${pypath}/bob-${version}-py2.7.egg-info ${destroot}/${pycompile}/
121    }
122}
123
124# check if boost is installed with the required python variant
125if {[variant_isset python26]} {
126    set boost_python_required   2.6
127    set boost_variant           +python26
128} elseif {[variant_isset python27]} {
129    set boost_python_required   2.7
130    set boost_variant           +python27
131}
132
133set boost_python_lib ${prefix}/lib/libboost_python-mt.dylib
134set boost_python_version "0"
135if {[file exists ${boost_python_lib}]} {
136    set boost_python_version [exec /usr/bin/otool -L ${boost_python_lib} | /usr/bin/grep Python | /usr/bin/sed -e "s|^.*Versions/||" -e "s|/.*||"]
137}
138if {${boost_python_version} != ${boost_python_required}} {
139    depends_lib-delete port:boost
140    pre-configure {
141        ui_error "${name} requires boost installed with variant ${boost_variant}."
142        ui_error "Please install boost as follows and try installing ${name} again:"
143        ui_error "sudo port install boost ${boost_variant}"
144        return -code error "incompatible boost installation"
145    }
146}