Ticket #36130: Portfile.5

File Portfile.5, 4.9 KB (added by andre.dos.anjos@…, 12 years ago)

Less mantainers

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