summaryrefslogtreecommitdiff
blob: 188a784043258f472ba327cd9d0da5ec30cc75cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-libs/shogun/shogun-3.2.0.ebuild,v 1.3 2015/01/27 14:41:32 jlec Exp $

EAPI=5

PYTHON_COMPAT=( python2_7 python3_{3,4} )

inherit cmake-utils multilib python-single-r1 toolchain-funcs versionator

MYPV=$(get_version_component_range 1-2)
MYPD=${PN}-data-0.8

DESCRIPTION="Large Scale Machine Learning Toolbox"
HOMEPAGE="http://shogun-toolbox.org/"
SRC_URI="
	ftp://shogun-toolbox.org/shogun/releases/${MYPV}/sources/${P}.tar.bz2
	test? ( ftp://shogun-toolbox.org/shogun/data/${MYPD}.tar.bz2 )
	examples? ( ftp://shogun-toolbox.org/shogun/data/${MYPD}.tar.bz2 )"

LICENSE="GPL-3 free-noncomm"
SLOT="0/16"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="doc examples lua mono octave python R ruby static-libs test"

REQUIRED_USE="
	python? ( ${PYTHON_REQUIRED_USE} )
	test? ( python )
	"

RDEPEND="
	app-arch/bzip2:=
	app-arch/gzip:=
	app-arch/lzma:=
	app-arch/snappy:=
	dev-libs/lzo:=
	>=dev-cpp/eigen-3.1
	dev-libs/json-c:=
	dev-libs/libxml2:=
	dev-libs/protobuf:=
	net-misc/curl:=
	sci-libs/arpack:=
	sci-libs/arprec:=
	sci-libs/colpack:=
	sci-libs/hdf5:=
	sci-libs/nlopt:=
	sci-mathematics/glpk:=
	sci-mathematics/lpsolve:=
	sys-libs/readline
	sys-libs/zlib:=
	virtual/blas
	virtual/cblas
	virtual/lapack
	lua? ( dev-lang/lua )
	mono? ( dev-lang/mono )
	octave? ( sci-mathematics/octave[hdf5] )
	python? ( dev-python/numpy[${PYTHON_USEDEP}] )
	R? ( dev-lang/R )
	ruby? ( dev-ruby/narray )"

DEPEND="${RDEPEND}
	virtual/pkgconfig
	doc? ( app-doc/doxygen[dot] )
	lua? ( >=dev-lang/swig-2.0.4 )
	mono? ( >=dev-lang/swig-2.0.4 )
	octave? ( >=dev-lang/swig-2.0.4 )
	python? ( >=dev-lang/swig-2.0.4 test? ( sci-libs/scipy ) )
	R? ( >=dev-lang/swig-2.0.4 )
	ruby? ( >=dev-lang/swig-2.0.4 )
	test? (
		dev-python/jinja[${PYTHON_USEDEP}]
		dev-cpp/gmock
		)"

# javamodular needs jblas (painful to package properly)
# permodular work in progress (as 3.2.0)
# could actually support multiple pythons, multiple rubys
# feel free to do work for it

PATCHES=(
	"${FILESDIR}"/${P}-atlas.patch
)

pkg_setup() {
	use python && python-single-r1_pkg_setup
}

src_configure() {
	export ATLAS_LIBRARY="$($(tc-getPKG_CONFIG) --libs cblas lapack)"
	export CBLAS_LIBRARY="$($(tc-getPKG_CONFIG) --libs cblas)"
	export ATLAS_LIBRARIES="$($(tc-getPKG_CONFIG) --libs blas cblas lapack)"
	export LAPACK_LIBRARIES="$($(tc-getPKG_CONFIG) --libs lapack)"
	local mycmakeargs=(
		-DBUILD_EXAMPLES=OFF
		-DBUNDLE_ARPREC=OFF
		-DBUNDLE_COLPACK=OFF
		-DBUNDLE_EIGEN=OFF
		-DBUNDLE_JSON=OFF
		-DBUNDLE_NLOPT=OFF
		-DENABLE_COVERAGE=OFF
		-DJavaModular=OFF
		-DPerlModular=OFF
		-DLIB_INSTALL_DIR=$(get_libdir)
		$(cmake-utils_use lua LuaModular)
		$(cmake-utils_use mono CSharpModular)
		$(cmake-utils_use octave OctaveModular)
		$(cmake-utils_use octave OctaveStatic)
		$(cmake-utils_use python PythonModular)
		$(cmake-utils_use python PythonStatic)
		$(cmake-utils_use R RModular)
		$(cmake-utils_use R RStatic)
		$(cmake-utils_use ruby RubyModular)
		$(cmake-utils_use test ENABLE_TESTING)
	)
	cmake-utils_src_configure
	# gentoo bug #302621
	has_version sci-libs/hdf5[mpi] && export CXX=mpicxx CC=mpicc
}

src_compile() {
	cmake-utils_src_compile
	use doc && emake -C doc
}

src_install() {
	cmake-utils_src_install
	use doc && dohtml -r doc/html/*
	if use examples; then
		insinto /usr/share/doc/${PF}
		emake -C examples clean
		doins -r examples
		docompress -x /usr/share/doc/${PF}/examples
		insinto /usr/share/doc/${PF}/data
		doins -r "${WORKDIR}"/${MYPD}/*

	fi
}