commit:     37fed9bcfb03ea5915e20dc5af15c74fbf3622bc
Author:     Pavel Denisov <pavel.a.denisov <AT> gmail <DOT> com>
AuthorDate: Sun Jan 11 20:33:12 2015 +0000
Commit:     Justin Lecher <jlec <AT> gentoo <DOT> org>
CommitDate: Thu Jan 15 06:52:56 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=37fed9bc

sci-misc/kaldi: New package

Package-Manager: portage-2.2.15

---
 sci-misc/kaldi/ChangeLog                    | 10 ++++
 sci-misc/kaldi/files/Makefile.patch         | 19 ++++++++
 sci-misc/kaldi/files/configure.patch        | 71 +++++++++++++++++++++++++++++
 sci-misc/kaldi/files/default_rules.mk.patch | 20 ++++++++
 sci-misc/kaldi/kaldi-0_p20150101.ebuild     | 57 +++++++++++++++++++++++
 sci-misc/kaldi/metadata.xml                 | 12 +++++
 6 files changed, 189 insertions(+)

diff --git a/sci-misc/kaldi/ChangeLog b/sci-misc/kaldi/ChangeLog
new file mode 100644
index 0000000..f7406fa
--- /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 <[email protected]> +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 0000000..07302d6
--- /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 0000000..07d663e
--- /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 0000000..26c7f36
--- /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 0000000..6403bd8
--- /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 0000000..9e25ae0
--- /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>[email protected]</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>

Reply via email to