sys-process/glances: revbump 3.1.4.1, add missing doc dep
[gentoo.git] / sci-libs / shogun / shogun-5.0.0-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python3_6 )
7
8 inherit cmake-utils flag-o-matic python-single-r1 toolchain-funcs versionator
9
10 MYPV=$(get_version_component_range 1-2)
11 MYPD=${PN}-data-0.9
12
13 DESCRIPTION="Large Scale Machine Learning Toolbox"
14 HOMEPAGE="https://shogun-toolbox.org/"
15 SRC_URI="
16         ftp://shogun-toolbox.org/shogun/releases/${MYPV}/sources/${P}.tar.bz2
17         test? ( ftp://shogun-toolbox.org/shogun/data/${MYPD}.tar.bz2 )
18         examples? ( ftp://shogun-toolbox.org/shogun/data/${MYPD}.tar.bz2 )"
19
20 LICENSE="GPL-3 free-noncomm"
21 SLOT="0/16"
22 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
23 IUSE="cpu_flags_x86_sse doc examples lua octave opencl python R ruby static-libs test"
24 RESTRICT="!test? ( test )"
25
26 REQUIRED_USE="
27         python? ( ${PYTHON_REQUIRED_USE} )
28         test? ( python )"
29
30 RDEPEND="
31         app-arch/bzip2
32         app-arch/gzip
33         app-arch/lzma
34         app-arch/snappy
35         dev-libs/lzo
36         dev-cpp/eigen:3
37         dev-libs/json-c:=
38         dev-libs/libxml2
39         dev-libs/protobuf:=
40         net-misc/curl
41         sci-libs/arpack
42         sci-libs/arprec
43         sci-libs/colpack
44         sci-libs/hdf5:=
45         sci-libs/nlopt
46         sci-mathematics/glpk:=
47         sci-mathematics/lpsolve:=
48         sys-libs/readline:0=
49         sys-libs/zlib
50         virtual/blas
51         virtual/cblas
52         virtual/lapack
53         lua? ( dev-lang/lua:0 )
54         octave? ( >=sci-mathematics/octave-4.2.0:=[hdf5] )
55         opencl? ( virtual/opencl )
56         python? (
57                 ${PYTHON_DEPS}
58                 $(python_gen_cond_dep '
59                         dev-python/numpy[${PYTHON_MULTI_USEDEP}]
60                 ')
61         )
62         R? ( dev-lang/R )
63         ruby? ( dev-ruby/narray )"
64 DEPEND="${RDEPEND}
65         virtual/pkgconfig
66         doc? (
67                 >=app-doc/doxygen-1.8.13-r1[dot]
68                 dev-python/sphinx
69         )
70         lua? ( >=dev-lang/swig-3.0.12 )
71         octave? ( >=dev-lang/swig-3.0.12 )
72         python? (
73                 >=dev-lang/swig-3.0.12
74                 test? (
75                         sci-libs/scipy
76                 )
77         )
78         R? ( >=dev-lang/swig-3.0.12 )
79         ruby? ( >=dev-lang/swig-3.0.12 )
80         test? (
81                 $(python_gen_cond_dep '
82                         dev-python/jinja[${PYTHON_MULTI_USEDEP}]
83                 ')
84                 >=dev-cpp/gtest-1.8.0
85         )"
86
87 # javamodular needs jblas (painful to package properly)
88 # permodular work in progress (as 3.2.0)
89 # could actually support multiple pythons, multiple rubys
90 # feel free to do work for it
91
92 PATCHES=(
93         "${FILESDIR}"/${PN}-5.0.0-fix-buildsystem.patch
94         "${FILESDIR}"/${PN}-4.1.0-remove-C-linkage.patch
95 )
96
97 pkg_setup() {
98         use python && python-single-r1_pkg_setup
99 }
100
101 src_configure() {
102         export ATLAS_LIBRARY="$($(tc-getPKG_CONFIG) --libs cblas lapack)"
103         export CBLAS_LIBRARY="$($(tc-getPKG_CONFIG) --libs cblas)"
104         export ATLAS_LIBRARIES="$($(tc-getPKG_CONFIG) --libs blas cblas lapack)"
105         export LAPACK_LIBRARIES="$($(tc-getPKG_CONFIG) --libs lapack)"
106
107         append-cppflags "$($(tc-getPKG_CONFIG) --cflags cblas)"
108
109         local mycmakeargs=(
110                 -DCMAKE_SKIP_RPATH=ON
111                 -DCMAKE_SKIP_INSTALL_RPATH=ON
112                 -DLIB_INSTALL_DIR=$(get_libdir)
113                 -DENABLE_TESTING=$(usex test)
114                 -DBUILD_EXAMPLES=$(usex examples)
115                 -DDISABLE_SSE=$(usex !cpu_flags_x86_sse)
116                 -DCMAKE_DISABLE_FIND_PACKAGE_Pandoc=ON
117                 $(cmake-utils_use_find_package doc Sphinx)
118                 $(cmake-utils_use_find_package doc Doxygen)
119
120                 # Features:
121                 -DENABLE_COVERAGE=OFF
122                 -DENABLE_COLPACK=ON
123                 -DENABLE_PROTOBUF=ON
124                 -DENABLE_PYTHON_DEBUG=OFF
125                 -DENABLE_VIENNACL=$(usex opencl)
126                 -DUSE_ARPREC=ON
127                 -DUSE_HDF5=ON
128
129                 # Bindings:
130                 -DJavaModular=OFF
131                 -DPerlModular=OFF
132                 -DCSharpModular=OFF
133                 -DLuaModular=$(usex lua)
134                 -DOctaveModular=$(usex octave)
135                 -DPythonModular=$(usex python)
136                 -DRModular=$(usex R)
137                 -DRubyModular=$(usex ruby)
138
139                 # Disable bundled libs
140                 -DBUNDLE_COLPACK=OFF
141                 -DBUNDLE_JSON=OFF
142                 -DBUNDLE_NLOPT=OFF
143         )
144         cmake-utils_src_configure
145
146         # gentoo bug #302621
147         has_version 'sci-libs/hdf5[mpi]' && export CXX=mpicxx CC=mpicc
148 }
149
150 src_compile() {
151         cmake-utils_src_compile
152         use doc && cmake-utils_src_compile -C doc
153 }
154
155 src_install() {
156         cmake-utils_src_install
157
158         if use doc; then
159                 local i
160                 for i in lua octave python R ruby; do
161                         if use $i; then
162                                 docinto html/${i,}_modular
163                                 dodoc -r "${BUILD_DIR}"/src/interfaces/${i,}_modular/modshogun/doxygen_xml/.
164                         fi
165                 done
166         fi
167 }