aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Denisov <pavel.a.denisov@gmail.com>2015-01-11 16:33:12 -0400
committerPavel Denisov <pavel.a.denisov@gmail.com>2015-01-11 16:33:12 -0400
commit5cd47e2a74e68776d2d16d02fb5e05c4278d6b84 (patch)
tree8a6c0c55ddae71238cb26d73e55bcef09cf07421 /sci-misc
parentMerge pull request #330 from marbre/matio (diff)
downloadsci-5cd47e2a74e68776d2d16d02fb5e05c4278d6b84.tar.gz
sci-5cd47e2a74e68776d2d16d02fb5e05c4278d6b84.tar.bz2
sci-5cd47e2a74e68776d2d16d02fb5e05c4278d6b84.zip
sci-misc/kaldi: New package
Package-Manager: portage-2.2.15
Diffstat (limited to 'sci-misc')
-rw-r--r--sci-misc/kaldi/ChangeLog10
-rw-r--r--sci-misc/kaldi/files/Makefile.patch19
-rw-r--r--sci-misc/kaldi/files/configure.patch71
-rw-r--r--sci-misc/kaldi/files/default_rules.mk.patch20
-rw-r--r--sci-misc/kaldi/kaldi-0_p20150101.ebuild57
-rw-r--r--sci-misc/kaldi/metadata.xml12
6 files changed, 189 insertions, 0 deletions
diff --git a/sci-misc/kaldi/ChangeLog b/sci-misc/kaldi/ChangeLog
new file mode 100644
index 000000000..f7406faf9
--- /dev/null
+++ b/sci-misc/kaldi/ChangeLog
@@ -0,0 +1,10 @@
+# ChangeLog for sci-misc/kaldi
+# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+*kaldi-0_p20150101 (11 Jan 2015)
+
+ 11 Jan 2015; Pavel Denisov <pavel.a.denisov@gmail.com> +files/Makefile.patch,
+ +files/configure.patch, +files/default_rules.mk.patch,
+ +kaldi-0_p20150101.ebuild, +metadata.xml:
+ sci-misc/kaldi: New package
diff --git a/sci-misc/kaldi/files/Makefile.patch b/sci-misc/kaldi/files/Makefile.patch
new file mode 100644
index 000000000..07302d6d4
--- /dev/null
+++ b/sci-misc/kaldi/files/Makefile.patch
@@ -0,0 +1,19 @@
+--- Makefile.orig 2015-01-01 21:51:30.999356027 -0400
++++ Makefile 2015-01-04 16:54:02.527824499 -0400
+@@ -131,6 +131,16 @@
+ ext_depend: check_portaudio
+ -for x in $(EXT_SUBDIRS); do $(MAKE) -C $$x depend; done
+
++print-binfiles: $(addsuffix /print-binfiles, $(SUBDIRS))
++
++%/print-binfiles:
++ @$(MAKE) --no-print-directory -C $(dir $@) print-binfiles
++
++print-libfiles: $(addsuffix /print-libfiles, $(SUBDIRS))
++
++%/print-libfiles:
++ @$(MAKE) --no-print-directory -C $(dir $@) print-libfiles
++
+
+ .PHONY: $(SUBDIRS)
+ $(SUBDIRS) : mklibdir
diff --git a/sci-misc/kaldi/files/configure.patch b/sci-misc/kaldi/files/configure.patch
new file mode 100644
index 000000000..07d663e93
--- /dev/null
+++ b/sci-misc/kaldi/files/configure.patch
@@ -0,0 +1,71 @@
+--- configure.orig 2015-01-01 21:51:05.611960184 -0400
++++ configure 2015-01-01 22:06:11.027064734 -0400
+@@ -45,15 +45,6 @@
+ fi
+ }
+
+-
+-
+-## First do some checks. These verify that all the things are
+-## here that should be here.
+-if [ "`basename $PWD`" != "src" ]; then
+- echo 'You must run "configure" from the src/ directory.'
+- exit 1
+-fi
+-
+ ## Default locations for FST and linear algebra libraries.
+ MATHLIB='ATLAS'
+ ATLASROOT=`rel2abs ../tools/ATLAS/`
+@@ -473,6 +464,23 @@
+ exit_success;
+ }
+
++function linux_configure_gentoo {
++ m=$1 # 64 or empty.
++ ATLASLIBS="/usr/lib$m/libatlas.so.3 /usr/lib$m/libf77blas.so.3 /usr/lib$m/libatlcblas.so.3 /usr/lib$m/libatlclapack.so.3"
++ for f in $ATLASLIBS; do
++ [ ! -f $f ] && return 1;
++ done
++ libdir=$(dirname $(echo $ATLASLIBS | awk '{print $1}'))
++ [ -z "$libdir" ] && echo "Error getting libdir in linux_configure_gentoo" && exit 1;
++ echo ATLASINC = $ATLASROOT >> kaldi.mk
++ echo ATLASLIBS = $ATLASLIBS -Wl,-rpath=$libdir >> kaldi.mk
++ echo
++ cat makefiles/linux_atlas.mk >> kaldi.mk
++ fix_cxx_flag
++ echo "Successfully configured for gentoo [dynamic libraries] with ATLASLIBS =$ATLASLIBS"
++ $use_cuda && linux_configure_cuda
++ exit_success;
++}
+
+ function linux_configure_static {
+ if $threaded_atlas; then pt=pt; else pt=""; fi
+@@ -716,8 +724,8 @@
+
+ echo "On Linux: Checking for linear algebra header files ..."
+ if [ "$MATHLIB" == "ATLAS" ]; then
+- if [ ! -f $ATLASROOT/include/cblas.h ] || [ ! -f $ATLASROOT/include/clapack.h ] ; then
+- failure "Could not find required header files cblas.h or clapack.h in ATLAS dir '$ATLASROOT/include'"
++ if ( [ ! -f $ATLASROOT/include/cblas.h ] || [ ! -f $ATLASROOT/include/clapack.h ] ) && ( [ ! -f $ATLASROOT/cblas.h ] || [ ! -f $ATLASROOT/clapack.h ] ) ; then
++ failure "Could not find required header files cblas.h or clapack.h in ATLAS dirs '$ATLASROOT/include' or '$ATLASROOT'"
+ fi
+ echo "Using ATLAS as the linear algebra library."
+
+@@ -741,6 +749,8 @@
+ linux_configure_debian7 || \
+ linux_configure_redhat 64 || \
+ linux_configure_redhat || \
++ linux_configure_gentoo 64 || \
++ linux_configure_gentoo || \
+ linux_atlas_failure "Failed to configure ATLAS lbiraries";
+ else
+ # Prefer dynamic to static math.
+@@ -751,6 +761,8 @@
+ linux_configure_debian7 || \
+ linux_configure_redhat 64 || \
+ linux_configure_redhat || \
++ linux_configure_gentoo 64 || \
++ linux_configure_gentoo || \
+ linux_atlas_failure "Failed to configure ATLAS lbiraries";
+ fi
+
diff --git a/sci-misc/kaldi/files/default_rules.mk.patch b/sci-misc/kaldi/files/default_rules.mk.patch
new file mode 100644
index 000000000..26c7f3616
--- /dev/null
+++ b/sci-misc/kaldi/files/default_rules.mk.patch
@@ -0,0 +1,20 @@
+--- makefiles/default_rules.mk.orig 2015-01-10 19:56:03.918751769 -0400
++++ makefiles/default_rules.mk 2015-01-11 13:34:14.596055674 -0400
+@@ -14,7 +14,7 @@
+ LIBFILE = lib$(LIBNAME).so
+ #LDLIBS += -l$(LIBNAME)
+ endif
+- LDFLAGS += -Wl,-rpath=$(shell readlink -f $(KALDILIBDIR)) -L.
++ LDFLAGS += -L.
+ LDFLAGS += $(foreach dep,$(ADDLIBS), -L$(dir $(dep)) )
+ XDEPENDS = $(foreach dep,$(ADDLIBS), $(dir $(dep))/lib$(notdir $(basename $(dep))).so )
+ else # Platform not supported
+@@ -84,3 +84,8 @@
+ #.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_p20150101.ebuild b/sci-misc/kaldi/kaldi-0_p20150101.ebuild
new file mode 100644
index 000000000..6403bd828
--- /dev/null
+++ b/sci-misc/kaldi/kaldi-0_p20150101.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="5"
+
+inherit eutils flag-o-matic subversion
+
+DESCRIPTION="A toolkit for speech recognition"
+HOMEPAGE="http://kaldi.sourceforge.net/"
+ESVN_REPO_URI="https://svn.code.sf.net/p/kaldi/code/trunk/src@4735"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+IUSE="doc test threads"
+KEYWORDS="~amd64"
+
+RDEPEND="
+ media-libs/speex
+ sci-libs/atlas[lapack,threads=]
+ ~sci-misc/openfst-1.3.4"
+DEPEND="${RDEPEND}
+ doc? ( app-doc/doxygen )"
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/configure.patch \
+ "${FILESDIR}"/Makefile.patch \
+ "${FILESDIR}"/default_rules.mk.patch
+}
+
+src_configure() {
+ ./configure \
+ --shared \
+ --fst-root="${EPREFIX}/usr" \
+ $(use threads && echo --threaded-atlas=yes) \
+ --atlas-root="${EPREFIX}/usr/include/atlas" || die "failed to run configure"
+
+ use test || append-cxxflags -DNDEBUG
+
+ sed -i \
+ -e 's/OPENFST_VER =/OPENFST_VER = 1.3.4#/' \
+ -e "s:-g :-DHAVE_SPEEX ${CXXFLAGS} :" \
+ -e "s:-lm -lpthread -ldl:-lm -lpthread -ldl -lspeex ${LDFLAGS}:" \
+ kaldi.mk || die "sed unix/kaldi.mk failed"
+}
+
+src_compile() {
+ emake
+ use doc && doxygen
+}
+
+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
new file mode 100644
index 000000000..9e25ae0bb
--- /dev/null
+++ b/sci-misc/kaldi/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>pavel.a.denisov@gmail.com</email>
+ </maintainer>
+ <longdescription lang="en">
+ Kaldi is a toolkit for speech recognition written
+ in C++ and licensed under the Apache License v2.0.
+ Kaldi is intended for use by speech recognition researchers.
+ </longdescription>
+</pkgmetadata>