commit: c55b36e1b4aa36eb54f33d89aa5c18e2a740b98c Author: Pavel Denisov <pavel.a.denisov <AT> gmail <DOT> com> AuthorDate: Sun Nov 8 20:28:04 2015 +0000 Commit: Justin Lecher <jlec <AT> gentoo <DOT> org> CommitDate: Thu Nov 19 01:20:29 2015 +0000 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=c55b36e1
sci-misc/kaldi: Version bump, switch to OpenBLAS math library by default, add CUDA support Package-Manager: portage-2.2.24 sci-misc/kaldi/ChangeLog | 8 ++ .../kaldi/files/default_rules.mk.a7d9824.patch | 48 ++++++++++++ sci-misc/kaldi/kaldi-0_p20151106.ebuild | 91 ++++++++++++++++++++++ sci-misc/kaldi/metadata.xml | 11 ++- 4 files changed, 157 insertions(+), 1 deletion(-) diff --git a/sci-misc/kaldi/ChangeLog b/sci-misc/kaldi/ChangeLog index fe47981..b40d171 100644 --- a/sci-misc/kaldi/ChangeLog +++ b/sci-misc/kaldi/ChangeLog @@ -2,6 +2,14 @@ # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2 # $Id$ +*kaldi-0_p20151106 (08 Nov 2015) + + 08 Nov 2015; Pavel Denisov <[email protected]> + +files/default_rules.mk.a7d9824.patch, +kaldi-0_p20151106.ebuild, + metadata.xml: + sci-misc/kaldi: Version bump, switch to OpenBLAS math library by default, add + CUDA support + *kaldi-0_p20150709 (18 Jul 2015) 18 Jul 2015; Pavel Denisov <[email protected]> diff --git a/sci-misc/kaldi/files/default_rules.mk.a7d9824.patch b/sci-misc/kaldi/files/default_rules.mk.a7d9824.patch new file mode 100644 index 0000000..458d453 --- /dev/null +++ b/sci-misc/kaldi/files/default_rules.mk.a7d9824.patch @@ -0,0 +1,48 @@ +*** makefiles/default_rules.mk.orig 2015-10-28 22:11:07.903182744 -0400 +--- makefiles/default_rules.mk 2015-10-29 20:43:41.081851545 -0400 +*************** +*** 14,20 **** + LIBFILE = lib$(LIBNAME).so + #LDLIBS += -l$(LIBNAME) + endif +! LDFLAGS += -Wl,-rpath=$(shell readlink -f $(KALDILIBDIR)) -L. + LDFLAGS += $(foreach dep,$(ADDLIBS), -L$(dir $(dep)) ) + XDEPENDS = $(foreach dep,$(ADDLIBS), $(dir $(dep))/lib$(notdir $(basename $(dep))).so ) + else # Platform not supported +--- 14,20 ---- + LIBFILE = lib$(LIBNAME).so + #LDLIBS += -l$(LIBNAME) + endif +! LDFLAGS += -L. + LDFLAGS += $(foreach dep,$(ADDLIBS), -L$(dir $(dep)) ) + XDEPENDS = $(foreach dep,$(ADDLIBS), $(dir $(dep))/lib$(notdir $(basename $(dep))).so ) + else # Platform not supported +*************** +*** 75,81 **** + @{ result=0; \ + for x in $(TESTFILES); do \ + printf "Running $$x ..."; \ +! ./$$x >$$x.testlog 2>&1; \ + if [ $$? -ne 0 ]; then \ + echo "... FAIL $$x"; \ + result=1; \ +--- 75,81 ---- + @{ result=0; \ + for x in $(TESTFILES); do \ + printf "Running $$x ..."; \ +! LD_LIBRARY_PATH=$(KALDILIBDIR):${LD_LIBRARY_PATH} ./$$x >$$x.testlog 2>&1; \ + if [ $$? -ne 0 ]; then \ + echo "... FAIL $$x"; \ + result=1; \ +*************** +*** 99,101 **** +--- 99,107 ---- + # removing automatic making of "depend" as it's quite slow. + #.depend.mk: depend + -include .depend.mk ++ ++ print-binfiles: ++ @echo $(addprefix $(shell pwd)/, $(BINFILES)) ++ ++ print-libfiles: ++ @echo $(addsuffix .so, $(addprefix $(shell pwd)/lib, $(LIBNAME))) diff --git a/sci-misc/kaldi/kaldi-0_p20151106.ebuild b/sci-misc/kaldi/kaldi-0_p20151106.ebuild new file mode 100644 index 0000000..128c268 --- /dev/null +++ b/sci-misc/kaldi/kaldi-0_p20151106.ebuild @@ -0,0 +1,91 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +inherit eutils flag-o-matic + +DESCRIPTION="A toolkit for speech recognition" +HOMEPAGE="http://kaldi-asr.org/" +SRC_URI="http://gentoo.akreal.net/distfiles/${P}.tar.xz" + +LICENSE="Apache-2.0" +SLOT="0" +IUSE="doc test threads atlas cuda" +KEYWORDS="~amd64" + +RDEPEND=" + media-libs/speex + virtual/lapack + virtual/lapacke + >=sci-misc/openfst-1.4.1 + atlas? ( sci-libs/atlas[threads=] ) + !atlas? ( sci-libs/openblas[-openmp,-threads] sci-libs/lapack-reference ) + cuda? ( dev-util/nvidia-cuda-toolkit )" +DEPEND="${RDEPEND} + doc? ( app-doc/doxygen )" + +REQUIRED_USE="!atlas? ( !threads )" + +# We need write acccess /dev/nvidiactl, /dev/nvidia0 and /dev/nvidia-uvm and the portage +# user is (usually) not in the video group +RESTRICT="cuda? ( userpriv )" + +src_prepare() { + epatch \ + "${FILESDIR}"/configure.patch \ + "${FILESDIR}"/Makefile.patch \ + "${FILESDIR}"/default_rules.mk.a7d9824.patch +} + +src_configure() { + if use atlas; then + myconf+=( --atlas-root="${EPREFIX}/usr/include/atlas" ) + if use threads; then + myconf+=( --threaded-atlas=yes ) + fi + else + myconf+=( --openblas-root="${EPREFIX}/usr" ) + append-cxxflags "-I${EPREFIX}/usr/include/openblas" + append-libs -lreflapack + fi + + # Upstream's configure script is "hand-generated" and not autotools compatible, + # for this reason econf can not be used + ./configure \ + --shared \ + --fst-root="${EPREFIX}/usr" \ + $(use cuda && echo "--use-cuda=yes --cudatk-dir=${EPREFIX}/opt/cuda" \ + || echo --use-cuda=no) \ + "${myconf[@]}" || die "failed to run configure" + + use test || append-cxxflags -DNDEBUG + append-libs -lspeex + + sed -i \ + -e "s:-g # -O0 -DKALDI_PARANOID:-DHAVE_SPEEX ${CXXFLAGS} :" \ + -e "s:-lm -lpthread -ldl:-lm -lpthread -ldl ${LIBS} ${LDFLAGS}:" \ + -e "s:CUDA_FLAGS = -g:CUDA_FLAGS = -O2:" \ + kaldi.mk || die "sed unix/kaldi.mk failed" +} + +src_compile() { + default + use doc && doxygen +} + +src_test() { + if use cuda; then + addwrite /dev/nvidiactl + addwrite /dev/nvidia0 + addwrite /dev/nvidia-uvm + fi + default +} + +src_install() { + dolib.so $(make print-libfiles) + dobin $(make print-binfiles) + use doc && dohtml -r html/* +} diff --git a/sci-misc/kaldi/metadata.xml b/sci-misc/kaldi/metadata.xml index e961e51..ddeac84 100644 --- a/sci-misc/kaldi/metadata.xml +++ b/sci-misc/kaldi/metadata.xml @@ -3,6 +3,7 @@ <pkgmetadata> <maintainer> <email>[email protected]</email> + <name>Pavel Denisov</name> </maintainer> <longdescription lang="en"> Kaldi is a toolkit for speech recognition written @@ -10,6 +11,14 @@ Kaldi is intended for use by speech recognition researchers. </longdescription> <upstream> - <remote-id type="sourceforge">kaldi</remote-id> + <remote-id type="github">kaldi-asr/kaldi</remote-id> </upstream> + <use> + <flag name="atlas"> + Use <pkg>sci-libs/atlas</pkg> for math library. + </flag> + <flag name="cuda"> + Build with CUDA support. + </flag> + </use> </pkgmetadata>
