1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils multilib versionator toolchain-funcs java-pkg-opt-2
9 MYPV=$(get_version_component_range 1-2)
12 DESCRIPTION="Large Scale Machine Learning Toolbox"
13 HOMEPAGE="http://shogun-toolbox.org/"
14 SRC_URI="ftp://shogun-toolbox.org/shogun/releases/${MYPV}/sources/${P}.tar.bz2
15 test? ( ftp://shogun-toolbox.org/shogun/data/${MYPD}.tar.bz2 )
16 examples? ( ftp://shogun-toolbox.org/shogun/data/${MYPD}.tar.bz2 )"
18 LICENSE="GPL-3 free-noncomm"
20 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
21 IUSE="arpack bzip2 doc examples glpk gzip hdf5 json lapack lpsolve mono lua lzma
22 lzo java R ruby octave python readline snappy static-libs superlu test xml"
27 arpack? ( sci-libs/arpack )
28 bzip2? ( app-arch/bzip2 )
29 glpk? ( sci-mathematics/glpk )
30 gzip? ( app-arch/gzip )
31 hdf5? ( sci-libs/hdf5 )
32 java? ( >=virtual/jdk-1.5 )
33 json? ( dev-libs/json-c )
34 lapack? ( virtual/cblas virtual/lapack )
35 lpsolve? ( sci-mathematics/lpsolve )
38 mono? ( dev-lang/mono )
39 octave? ( sci-mathematics/octave[hdf5=] )
40 python? ( dev-python/numpy )
42 readline? ( sys-libs/readline )
43 ruby? ( >=dev-ruby/narray-0.6.0.1-r2 )
44 snappy? ( app-arch/snappy )
45 superlu? ( sci-libs/superlu )
46 xml? ( dev-libs/libxml2 )"
50 doc? ( app-doc/doxygen[dot] )
51 java? ( dev-lang/swig dev-java/ant )
52 octave? ( dev-lang/swig )
53 python? ( dev-lang/swig test? ( sci-libs/scipy ) )
54 ruby? ( dev-lang/swig )"
56 S="${WORKDIR}/${P}/src"
60 "${FILESDIR}"/${P}-respect-ldflags.patch \
61 "${FILESDIR}"/${P}-test-snappy.patch \
62 "${FILESDIR}"/${P}-test-readline.patch \
63 "${FILESDIR}"/${P}-as-needed.patch
65 # dist-packages is only for debian
66 # remove exagarated optimizations (-O9 does not exist...)
67 # use gentoo lapack framework
69 -e 's/dist-packages/site-packages/g' \
71 -e "s:-llapack -lcblas:$($(tc-getPKG_CONFIG) --libs cblas lapack):g" \
74 # disable ldconfig which violates sandbox
75 # install in gentoo java standard paths
80 Makefile.template || die
84 # define interfaces to shogun library to build
86 for x in java lua octave python ruby ; do
87 use ${x} && iface="${iface}${x}_modular,"
89 use mono && iface="${iface}csharp_modular,"
90 use R && iface="${iface}r_modular,"
91 if use static-libs; then
92 iface="${iface}cmdline_static,"
93 use octave && iface="${iface}octave_static,"
94 use python && iface="${iface}python_static,"
95 use R && iface="${iface}r_static,"
96 use octave && use python && use R && iface="${iface}elwms_static,"
101 use hdf5 && has_version sci-libs/hdf5[mpi] && export CXX=mpicxx CC=mpicc
104 --disable-cpudetection \
106 --prefix="${EPREFIX}/usr" \
107 --mandir="${EPREFIX}/usr/share/man" \
108 --libdir="${EPREFIX}/usr/$(get_libdir)" \
110 --cxx="$(tc-getCXX)" \
111 --target="${CTARGET}" \
112 --interfaces=${iface} \
113 $(use_enable arpack) \
114 $(use_enable bzip2) \
115 $(use_enable doc doxygen) \
120 $(use_enable lapack) \
121 $(use_enable lpsolve) \
124 $(use_enable readline) \
125 $(use_enable snappy) \
126 $(use_enable static-libs static) \
127 $(use_enable superlu) \
128 $(use_enable xml) || die
133 use doc && emake -C ../doc
138 ln -s ../../${MYPD}/* ../data/
139 emake DESTDIR="${ED}" install
140 # disable because very long and buggy dynamic paths (assumed install)
142 emake -C shogun check-examples
147 use static-libs || rm -f "${ED}"/usr/$(get_libdir)/*.a
149 java-pkg_dojar interfaces/java_modular/shogun.jar
150 java-pkg_doso interfaces/java_modular/libmodshogun.so
153 use doc && dohtml -r ../doc/html/*
154 if use examples; then
155 insinto /usr/share/doc/${PF}
156 emake -C ../examples clean && doins -r ../examples
157 insinto /usr/share/doc/${PF}/data
158 doins -r "${WORKDIR}"/${MYPD}/*