Ticket #38596: Portfile.diff

File Portfile.diff, 15.9 KB (added by stromnov (Andrey Stromnov), 11 years ago)
  • Portfile

     
    33
    44PortSystem          1.0
    55
    6 categories          math science
    76name                shogun
    8 version             0.9.3
    9 revision            1
     7version             2.1.0
    108set branch          [join [lrange [split ${version} .] 0 1] .]
     9revision            0
     10categories-append   science
     11platforms           darwin
    1112license             GPL-3
    12 maintainers         jameskyle
    1313
    14 platforms           darwin
     14maintainers         jameskyle openmaintainer
    1515
    1616description         The machine learning toolbox's focus is on large scale \
    1717                    kernel methods
     
    2323
    2424homepage            http://shogun-toolbox.org
    2525master_sites        ${homepage}/archives/shogun/releases/${branch}/sources/
     26
    2627use_bzip2           yes
    2728
    28 checksums           md5     99afbb304d524335fc181c553047cb51 \
    29                     sha1    d559dff3e11f777a23f00278d78d259ad896b829 \
    30                     rmd160  9638a6b747a1177b048720b8999c60f33c7df5ef
     29checksums           rmd160  5fece569be7d95bbe9ad406f1b5e10f06f4ac20e \
     30                    sha256  6c47941a98d506d7b1e21d5bfd511f8684a2e1f371accd4756cdc8821916a63b
    3131
    3232worksrcdir          ${name}-${version}/src
    3333
    34 patchfiles          swig_version.patch
     34patchfiles          patch-src_configure.diff
    3535
    36 depends_build       port:bzip2 \
    37                     port:gsed
     36post-patch {
     37    reinplace "s|@@MAKEDEPEND@@|${configure.cc} -MM|g" ${worksrcpath}/configure
     38}
    3839
    39 depends_lib         port:swig-python \
     40depends_lib         port:hdf5-18 \
     41                    port:json-c \
     42                    port:libxml2 \
     43                    port:readline \
    4044                    port:atlas \
    41                     port:readline \
     45                    port:arpack \
     46                    port:eigen3 \
     47                    port:lp_solve \
    4248                    port:glpk \
    43                     port:python26 \
    44                     port:py26-numpy \
    45                     port:hdf5-18
     49                    port:lzo2 \
     50                    port:snappy \
     51                    port:gzip \
     52                    port:bzip2 \
     53                    port:xz
    4654
    4755universal_variant   no
    4856
    49 set python_prefix   ${prefix}/Library/Frameworks/Python.framework/Versions/2.6
    50 configure.args      --disable-svm-light \
    51                     --libs=${prefix}/lib \
    52                     --install-path=${prefix} \
    53                     --includes=${prefix}/include \
    54                     --destdir=${destroot} \
    55                     --includes=${python_prefix}/include/python2.6 \
    56                     --python=${python_prefix}/bin/python2.6 \
    57                     --pydir=${python_prefix}/lib/python2.6/site-packages \
    58                     --disable-doxygen \
    59                     --disable-hdf5
    60 
    6157pre-fetch {
    62   if {[ regexp {^[2-8]} ${os.major}]} {
    63     return -code error "Shogun is only supported on leopard or above"
    64   }
     58    if {${os.major} <= 8} {
     59        return -code error "Shogun is only supported on Leopard or above"
     60    }
    6561}
    6662
    67 proc lremove {list elem} {
    68     set index [lsearch -exact $list $elem]
    69     return [lreplace $list $index $index]
     63# Define compilers variants
     64variant gcc45 conflicts gcc46 gcc47 gcc48 clang33 description {Compile with gcc 4.5} {
     65    configure.compiler      macports-gcc-4.5
     66    depends_lib-append      port:gcc45
     67    configure.args-append   --ldflags=-lgfortran
    7068}
    7169
    72 # Interfaces are added by a comma delimited argument list to --interfaces.
    73 # We check for variants and then build this list accordingly
    74 set interfaces "libshogun libshogunui cmdline python python_modular"
     70variant gcc46 conflicts gcc45 gcc47 gcc48 clang33 description {Compile with gcc 4.6} {
     71    configure.compiler      macports-gcc-4.6
     72    depends_lib-append      port:gcc46
     73    configure.args-append   --ldflags=-lgfortran
     74}
    7575
    76 if {[variant_isset r]} {lappend interfaces "r"}
    77 if {[variant_isset octave]} {lappend interfaces "octave,octave_modular"}
    78 if {[variant_isset elwms]  && !([variant_isset python] &&
    79     [variant_isset octave] &&   [variant_isset r])} {
    80   return -code error "Must set python and both r and octave variants to build elwms interface"
    81 } elseif {[variant_isset elwms]} {
    82   lappend interfaces "elwms"
     76variant gcc47 conflicts gcc45 gcc46 gcc48 clang33 description {Compile with gcc 4.7} {
     77    configure.compiler      macports-gcc-4.7
     78    depends_lib-append      port:gcc47
     79    configure.args-append   --ldflags=-lgfortran
    8380}
    8481
    85 # remove python interface if necessary before appending to args
    86 if {[variant_isset no_python26] && ![variant_isset python25]} {
    87     set interfaces [lremove ${interfaces} "python"]
    88     set interfaces [lremove ${interfaces} "python_modular"]
    89     depends_lib-delete port:swig-python
     82variant gcc48 conflicts gcc45 gcc46 gcc47 clang33 description {Compile with gcc 4.8} {
     83    configure.compiler      macports-gcc-4.8
     84    depends_lib-append      port:gcc48
     85    configure.args-append   --ldflags=-lgfortran
    9086}
    9187
    92 #if {[variant_isset matlab]} {lappend interfaces "matlab"}
    93 set interfaces [join $interfaces ","]
     88variant clang33 conflicts gcc45 gcc46 gcc47 gcc48 description {Compile with clang 3.3} {
     89    configure.compiler      macports-clang-3.3
     90    depends_lib-append      port:clang-3.3 \
     91                            port:gcc47
     92    configure.args-delete   --disable-cpudetection
     93    configure.args-append   --enable-cpudetection \
     94                            --ldflags=-lgfortran
     95    configure.env-append    POSTLINKFLAGS="-L${prefix}/lib/gcc47"
     96}
    9497
    95 configure.args-append --interfaces=$interfaces
     98if {![variant_isset gcc45] && ![variant_isset gcc46] &&
     99    ![variant_isset gcc48] && ![variant_isset clang33]
     100} then {
     101    default_variants +gcc47
     102}
    96103
    97 variant elwms description {Build elwms interface. requires python plus  one other interface} {}
     104# Define python variants
     105set pythons_suffixes {26 27}
    98106
    99 variant python25 requires no_python26 description {Build Python 2.5 API} {
    100     configure.args-append \
    101         --includes=${prefix}/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 \
    102         --python=${prefix}/Library/Frameworks/Python.framework/Versions/2.5/bin/python \
    103         --pydir=${prefix}/Library/Frameworks/Python.framework/Versions/2.5/site-packages
    104     depends_lib-append port:python25 \
    105                        port:py25-numpy
     107set pythons_ports {}
     108foreach s ${pythons_suffixes} {
     109    lappend pythons_ports python${s}
    106110}
    107111
    108 variant hmm_parallel description {Enable parallel structures in hmm training} {
    109   configure.args-append --enable-hmm-parallel
     112proc python_prefix {} {
     113    global prefix pythons_suffixes
     114    foreach s ${pythons_suffixes} {
     115        if {[variant_isset python${s}]} {
     116            set p ${prefix}/bin/python[string index ${s} 0].[string index ${s} 1]
     117            return [file normalize [exec ${p} -c "import sys; print(sys.prefix)"]]
     118        }
     119    }
     120    error "Python support not enabled."
    110121}
    111122
    112 variant no_python26 description {Do not build Python 2.6 API} {
    113   configure.args-delete \
    114   --includes=${python_prefix}/include/python2.6 \
    115   --python=${python_prefix}/bin/python2.6 \
    116   --pydir=${python_prefix}/lib/python2.6/site-packages
     123foreach s ${pythons_suffixes} {
     124    set p python${s}
     125    set v [string index ${s} 0].[string index ${s} 1]
     126    set i [lsearch -exact ${pythons_ports} ${p}]
     127    set c [lreplace ${pythons_ports} ${i} ${i}]
     128    eval [subst {
     129        variant ${p} description "Use Python ${v} for python bindings" conflicts ${c} {
     130            depends_lib-append      port:${p} \
     131                                    port:py${s}-numpy \
     132                                    port:swig-python
     133            set py_prefix \[python_prefix\]
     134            configure.args-append   --python=${prefix}/bin/python${v} \
     135                                    --pydir=\${py_prefix}/lib/python${v}/site-packages \
     136                                    --includes=\${py_prefix}/include/python${v}
     137            post-patch {
     138                reinplace "s|^PYTHON=python$|PYTHON=${prefix}/bin/python${v}|g" ${worksrcpath}/configure
     139            }
     140        }
     141    }]
     142}
    117143
    118 
    119   depends_lib-delete port:python26 \
    120                      port:py26-numpy
    121 
     144variant perl description {Build the Perl API} {
     145    depends_lib-append  port:swig-perl
    122146}
    123147
    124148variant r description {Build the R API} {
    125     depends_lib-append port:swig-r
     149    depends_lib-append  port:swig-r
    126150}
    127151
    128152variant octave description {Build the Octave API} {
    129     depends_lib-append port:swig-octave
     153    depends_lib-append  port:swig-octave
    130154}
    131155
    132 variant no_glpk description {Disable glpk support} {
    133     configure.args-append --disable-glpk
    134      depends_lib-delete port:glpk
     156variant java description {Build the Java API} {
     157    depends_lib-append  port:swig-java
    135158}
    136159
    137 #variant matlab description {Build the Matlab API} {}
    138 # variant doc description {Install the documentation for shogun} {
    139 #   depends_build-append port:texlive \
    140 #                        path:bin/dot:graphviz \
    141 #                        port:doxygen
    142 #
    143 #   configure.args-delete --disable-doxygen
    144 # }
     160variant csharp description {Build the C# API} {
     161    depends_lib-append  port:swig-csharp
     162}
    145163
    146 variant gcc43 conflicts gcc44 gcc45 gcc46 gcc47 description {build with gcc 4.3} {}
    147 variant gcc44 conflicts gcc43 gcc45 gcc46 gcc47 description {build with gcc 4.4} {}
    148 variant gcc45 conflicts gcc43 gcc44 gcc46 gcc47 description {build with gcc 4.5} {}
    149 variant gcc46 conflicts gcc43 gcc44 gcc45 gcc47 description {build with gcc 4.6} {}
    150 variant gcc47 conflicts gcc43 gcc44 gcc45 gcc46 description {build with gcc 4.7} {}
     164variant lua description {Build the Lua API} {
     165    depends_lib-append  port:swig-lua
     166}
    151167
    152 if {[variant_isset gcc43]} {
    153     set gccversion 4.3
    154 } elseif {[variant_isset gcc44]} {
    155     set gccversion 4.4
    156 } elseif {[variant_isset gcc45]} {
    157     set gccversion 4.5
    158 } elseif {[variant_isset gcc46]} {
    159     set gccversion 4.6
    160 } else {
    161     default_variants +gcc47
    162     set gccversion 4.7
     168variant ruby description {Build the Ruby API} {
     169    depends_lib-append  port:swig-ruby
    163170}
    164171
    165 set gccnumber [join [split ${gccversion} .] ""]
     172variant elwms description {Build the elwms (eierlegende wollmilchsau) interface. Requires python plus one other interface} {
     173}
    166174
    167 depends_lib-append      port:gcc${gccnumber}
    168 configure.cc            ${prefix}/bin/gcc-mp-${gccversion}
    169 configure.compiler      macports-gcc-${gccversion}
    170 configure.args-append   --cc=${prefix}/bin/gcc-mp-${gccversion} \
    171                         --cxx=${prefix}/bin/g++-mp-${gccversion}
     175variant hmm_parallel description {Enable parallel structures in hmm training} {
     176    configure.args-delete --disable-hmm-parallel
     177    configure.args-append --enable-hmm-parallel
     178}
    172179
    173 pre-configure {
    174   reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/configure
    175   reinplace "s|= $\{_libdir\}/$\{_pydir\}|= $\{_pydir\}|g" ${worksrcpath}/configure
     180proc lremove {list elem} {
     181    set index [lsearch -exact $list $elem]
     182    return [lreplace $list $index $index]
    176183}
    177 post-destroot {
    178   if {[variant_isset doc]} {
    179     system "cd ${worksrcpath}/../doc && make"
    180     file mkdir ${destroot}${prefix}/share/doc/${name}
    181     file copy ${worksrcpath}/../doc ${destroot}${prefix}/share/doc/${name}/doc
    182184
    183   }
     185# Interfaces are added by a comma delimited argument list to --interfaces.
     186# We check for variants and then build this list accordingly
     187set interfaces "cmdline_static"
     188
     189if {[variant_isset python26] || [variant_isset python27]} {
     190    lappend interfaces "python_modular"
    184191}
    185192
    186 livecheck.url http://www.shogun-toolbox.org
    187 livecheck.regex {SHOGUN Version ([0-9.]+).*}
     193if {[variant_isset perl]} {
     194    lappend interfaces "perl_modular"
     195}
     196
     197if {[variant_isset r]} {
     198    lappend interfaces "r_modular"
     199}
     200
     201if {[variant_isset octave]} {
     202    lappend interfaces "octave_modular"
     203}
     204
     205if {[variant_isset java]} {
     206    lappend interfaces "java_modular"
     207}
     208
     209if {[variant_isset csharp]} {
     210    lappend interfaces "csharp_modular"
     211}
     212
     213if {[variant_isset lua]} {
     214    lappend interfaces "lua_modular"
     215}
     216
     217if {[variant_isset ruby]} {
     218    lappend interfaces "ruby_modular"
     219}
     220
     221if {[variant_isset elwms] && !(([variant_isset python26] || [variant_isset python27]) && [variant_isset octave] && [variant_isset r])} {
     222    return -code error "Must set python2x and both r and octave variants to build elwms interface"
     223} elseif {[variant_isset elwms]} {
     224    lappend interfaces "elwms_static"
     225}
     226
     227configure.args-append \
     228                    --enable-hdf5 \
     229                    --enable-json \
     230                    --enable-xml \
     231                    --enable-readline \
     232                    --enable-largefile \
     233                    --disable-spinlocks \
     234                    --enable-lapack \
     235                    --enable-arpack \
     236                    --disable-mosek \
     237                    --disable-superlu \
     238                    --disable-nlopt \
     239                    --enable-eigen3 \
     240                    --disable-cplex \
     241                    --enable-lpsolve \
     242                    --enable-glpk \
     243                    --enable-lzo \
     244                    --enable-snappy \
     245                    --enable-gzip \
     246                    --enable-bzip2 \
     247                    --enable-lzma \
     248                    --enable-bigstates \
     249                    --enable-hmmcache \
     250                    --enable-svm-light \
     251                    --disable-logcache \
     252                    --enable-shortrealkernelcache \
     253                    --enable-logsum-array \
     254                    --disable-hmm-parallel \
     255                    --disable-doxygen \
     256                    --enable-optimization \
     257                    --disable-cpudetection \
     258                    --includes=${prefix}/include \
     259                    --libs=${prefix}/lib \
     260                    --destdir=${destroot} \
     261                    --prefix=${prefix}
     262
     263set interfaces [join $interfaces ","]
     264
     265configure.args-append --interfaces=$interfaces
     266
     267livecheck.type      regex
     268livecheck.url       http://www.shogun-toolbox.org
     269livecheck.regex     {SHOGUN ([0-9.]+)}
  • files/patch-src_configure.diff

     
     1--- configure.orig      2013-03-28 23:54:09.000000000 +0400
     2+++ configure   2013-03-30 23:32:20.000000000 +0400
     3@@ -16,7 +16,7 @@
     4 # some hopefully reasonable defaults
     5 LDD=ldd
     6 POSTLINKCMD="true"
     7-MAKEDEPEND="gcc -MM"
     8+MAKEDEPEND="@@MAKEDEPEND@@"
     9 MAKEDEPENDOPTS=""
     10 SRCDIR="`dirname $0`"
     11 LIBRARY_PATH=LD_LIBRARY_PATH
     12@@ -184,7 +184,7 @@
     13 DEFINES_SWIG=
     14 PRELINKFLAGS=
     15 LINKFLAGS=
     16-POSTLINKFLAGS=
     17+test "$POSTLINKFLAGS" && POSTLINKFLAGS="$POSTLINKFLAGS"
     18 
     19 INCLUDES_STATIC_INTERFACES=
     20 LINKFLAGS_STATIC_INTEFACES=
     21@@ -4003,7 +4003,7 @@
     22 }
     23 EOF
     24                echocheck "lpsolve Developer Files"
     25-               LPSOLVELINKFLAGS="-L /usr/lib/lp_solve -llpsolve55"
     26+               LPSOLVELINKFLAGS="-llpsolve55"
     27                if cc_check $LPSOLVELINKFLAGS
     28                then
     29                        echores "yes"
     30@@ -5011,6 +5011,7 @@
     31                if test "$_readline" = yes || test "$_readline" = auto;
     32                then
     33 cat > $TMPC << EOF
     34+#include <stdio.h>
     35 #include <readline/readline.h>
     36 int main(void) { return 0; }
     37 EOF
     38@@ -5274,7 +5275,7 @@
     39 CONFDIR                        = ${_confdir}
     40 INCDIR                 = ${_incdir}
     41 LIBDIR                 = ${_libdir}
     42-PYDIR                  = ${_libdir}/${_pydir}
     43+PYDIR                  = ${_pydir}
     44 OCTDIR                 = ${_octdir}
     45 RDIR                   = ${_rdir}
     46 EOF
  • files/swig_version.patch

     
    1 --- configure.old       2010-06-29 10:41:05.000000000 -0700
    2 +++ configure   2010-06-29 10:42:07.000000000 -0700
    3 @@ -2864,7 +2864,8 @@
    4                                 die "swig did not return version information"
    5                         fi
    6                         if [ `echo $_swig_version | cut -f 2 -d '.'` -ge 4 ] || \
    7 -                               [ `echo $_swig_version | cut -f 3 -d '.'` -ge 29 ]
    8 +                               [ `echo $_swig_version | cut -f 3 -d '.'` -ge 29 ] || \
    9 +        [ `echo $_swig_version | cut -f 1 -d '.'` -ge 2 ]
    10                         then
    11                                 echores "`${SWIG} -version 2>&1 | grep Version | cut -f 3 -d ' '`"
    12