commit:     4bb0a5fafca7f6562b2b47c4c62bb54680237c99
Author:     Pavel Denisov <pavel.a.denisov <AT> gmail <DOT> com>
AuthorDate: Wed Jul 20 04:54:46 2016 +0000
Commit:     Christoph Junghans <ottxor <AT> gentoo <DOT> org>
CommitDate: Wed Jul 20 04:54:46 2016 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=4bb0a5fa

sci-misc/kaldi: version bump; add speex USE flag

Package-Manager: portage-2.3.0

 sci-misc/kaldi/files/Makefile.patch                |   4 +-
 sci-misc/kaldi/files/configure.patch               |  93 --------------
 .../kaldi/files/default_rules.mk.a7d9824.patch     |   4 +-
 sci-misc/kaldi/files/default_rules.mk.patch        |  47 -------
 sci-misc/kaldi/kaldi-0_p20150709.ebuild            |  58 ---------
 sci-misc/kaldi/kaldi-0_p20160628.ebuild            | 136 +++++++++++++++++++++
 6 files changed, 140 insertions(+), 202 deletions(-)

diff --git a/sci-misc/kaldi/files/Makefile.patch 
b/sci-misc/kaldi/files/Makefile.patch
index 9fa1841..0556e25 100644
--- a/sci-misc/kaldi/files/Makefile.patch
+++ b/sci-misc/kaldi/files/Makefile.patch
@@ -1,5 +1,5 @@
---- Makefile.orig      2015-11-06 18:43:31.000000000 -0400
-+++ Makefile   2015-11-17 20:15:14.452502675 -0400
+--- src/Makefile.orig  2015-11-06 18:43:31.000000000 -0400
++++ src/Makefile       2015-11-17 20:15:14.452502675 -0400
 @@ -30,7 +30,7 @@
  
  # Reset the default goal, so that the all target will become default

diff --git a/sci-misc/kaldi/files/configure.patch 
b/sci-misc/kaldi/files/configure.patch
deleted file mode 100644
index f6086fc..0000000
--- a/sci-misc/kaldi/files/configure.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-*** configure.orig     2015-02-28 16:31:35.568045409 -0400
---- configure  2015-02-28 17:21:58.477634475 -0400
-***************
-*** 46,60 ****
-    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/`
---- 46,51 ----
-***************
-*** 522,527 ****
---- 513,535 ----
-    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
-***************
-*** 682,688 ****
-  echo "FSTROOT = $FSTROOT" >> kaldi.mk
-  
-  # Check installed OpenFst version and add C++11 flags if OpenFst >= 1.4
-! OPENFST_VER=`grep 'PACKAGE_VERSION' $FSTROOT/Makefile | sed -e 's:.*= ::'`
-  echo "OPENFST_VER = $OPENFST_VER" >> kaldi.mk
-  OPENFST_VER_NUM=`echo $OPENFST_VER | sed 's/\./ /g' | xargs printf 
"%d%02d%02d"`
-  if [ $OPENFST_VER_NUM -ge 10400 ]; then
---- 690,696 ----
-  echo "FSTROOT = $FSTROOT" >> kaldi.mk
-  
-  # Check installed OpenFst version and add C++11 flags if OpenFst >= 1.4
-! OPENFST_VER="1.4.1"
-  echo "OPENFST_VER = $OPENFST_VER" >> kaldi.mk
-  OPENFST_VER_NUM=`echo $OPENFST_VER | sed 's/\./ /g' | xargs printf 
"%d%02d%02d"`
-  if [ $OPENFST_VER_NUM -ge 10400 ]; then
-***************
-*** 765,772 ****
-  
-    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'"
-      fi
-      echo "Using ATLAS as the linear algebra library."
-      
---- 773,780 ----
-  
-    echo "On Linux: Checking for linear algebra header files ..."
-    if [ "$MATHLIB" == "ATLAS" ]; then
-!     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."
-      
-***************
-*** 797,802 ****
---- 805,812 ----
-      else
-        # Prefer dynamic to static math.
-        linux_configure_debian_ubuntu3 || \
-+         linux_configure_gentoo 64 || \
-+         linux_configure_gentoo || \
-          linux_configure_dynamic || \
-          linux_configure_static || \
-          linux_configure_debian_ubuntu 64 || \

diff --git a/sci-misc/kaldi/files/default_rules.mk.a7d9824.patch 
b/sci-misc/kaldi/files/default_rules.mk.a7d9824.patch
index 7e60268..a51fd20 100644
--- a/sci-misc/kaldi/files/default_rules.mk.a7d9824.patch
+++ b/sci-misc/kaldi/files/default_rules.mk.a7d9824.patch
@@ -1,5 +1,5 @@
---- makefiles/default_rules.mk.orig    2015-11-06 18:43:31.000000000 -0400
-+++ makefiles/default_rules.mk 2015-11-09 18:42:33.609774157 -0400
+--- src/makefiles/default_rules.mk.orig        2015-11-06 18:43:31.000000000 
-0400
++++ src/makefiles/default_rules.mk     2015-11-09 18:42:33.609774157 -0400
 @@ -14,7 +14,7 @@
          LIBFILE = lib$(LIBNAME).so
          #LDLIBS  += -l$(LIBNAME)

diff --git a/sci-misc/kaldi/files/default_rules.mk.patch 
b/sci-misc/kaldi/files/default_rules.mk.patch
deleted file mode 100644
index 60e3430..0000000
--- a/sci-misc/kaldi/files/default_rules.mk.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-*** makefiles/default_rules.mk.orig    2015-02-28 16:32:00.830458169 -0400
---- makefiles/default_rules.mk 2015-02-28 19:10:50.692172138 -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
-***************
-*** 72,78 ****
-  test_compile: $(TESTFILES)
-    
-  test: test_compile
-!      @result=0; for x in $(TESTFILES); do printf "Running $$x ..."; ./$$x 
>/dev/null 2>&1; if [ $$? -ne 0 ]; then echo "... FAIL $$x"; result=1; else 
echo "... SUCCESS";  fi;  done; exit $$result
-  
-  .valgrind: $(BINFILES) $(TESTFILES)
-  
---- 72,78 ----
-  test_compile: $(TESTFILES)
-    
-  test: test_compile
-!      @result=0; for x in $(TESTFILES); do printf "Running $$x ..."; 
LD_LIBRARY_PATH=$(KALDILIBDIR):${LD_LIBRARY_PATH} ./$$x >/dev/null 2>&1; if [ 
$$? -ne 0 ]; then echo "... FAIL $$x"; result=1; else echo "... SUCCESS";  fi;  
done; exit $$result
-  
-  .valgrind: $(BINFILES) $(TESTFILES)
-  
-***************
-*** 84,86 ****
---- 84,91 ----
-  #.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_p20150709.ebuild 
b/sci-misc/kaldi/kaldi-0_p20150709.ebuild
deleted file mode 100644
index ad8c84d..0000000
--- a/sci-misc/kaldi/kaldi-0_p20150709.ebuild
+++ /dev/null
@@ -1,58 +0,0 @@
-# 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.sourceforge.net/";
-SRC_URI="http://gentoo.akreal.net/distfiles/${P}.tar.xz";
-
-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.4.1"
-DEPEND="${RDEPEND}
-       doc? ( app-doc/doxygen )"
-
-src_prepare() {
-       epatch \
-               "${FILESDIR}"/configure.patch \
-               "${FILESDIR}"/Makefile.patch \
-               "${FILESDIR}"/default_rules.mk.patch
-}
-
-src_configure() {
-       # 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 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:-g :-DHAVE_SPEEX ${CXXFLAGS} :" \
-               -e "s:-lm -lpthread -ldl:-lm -lpthread -ldl -lspeex 
${LDFLAGS}:" \
-               kaldi.mk || die "sed unix/kaldi.mk failed"
-}
-
-src_compile() {
-       default
-       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/kaldi-0_p20160628.ebuild 
b/sci-misc/kaldi/kaldi-0_p20160628.ebuild
new file mode 100644
index 0000000..65effe5
--- /dev/null
+++ b/sci-misc/kaldi/kaldi-0_p20160628.ebuild
@@ -0,0 +1,136 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit toolchain-funcs cuda flag-o-matic
+
+COMMIT_ID="16e69f1aacce8ad0665d2b6666c053b1421a9e91"
+DESCRIPTION="A toolkit for speech recognition"
+HOMEPAGE="http://kaldi-asr.org/";
+SRC_URI="https://github.com/kaldi-asr/kaldi/archive/${COMMIT_ID}.tar.gz -> 
${P}.tar.gz"
+
+S=${WORKDIR}/${PN}-${COMMIT_ID}/src
+
+LICENSE="Apache-2.0"
+SLOT="0"
+IUSE="cuda doc speex test"
+KEYWORDS="~amd64"
+
+RDEPEND="
+       speex? ( media-libs/speex )
+       virtual/cblas
+       virtual/lapack
+       virtual/lapacke
+       <sci-misc/openfst-1.5.0
+       cuda? ( dev-util/nvidia-cuda-toolkit )"
+DEPEND="${RDEPEND}
+       virtual/pkgconfig
+       doc? ( app-doc/doxygen )"
+
+# 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 )"
+
+pkg_pretend() {
+       local cblas_provider=$(eselect cblas show)
+
+       if [[ ! ${cblas_provider} =~ (atlas|mkl|openblas) ]]; then
+               die "Build with '${cblas_provider}' CBLAS is not supported"
+       fi
+}
+
+src_prepare() {
+       eapply \
+               "${FILESDIR}"/Makefile.patch \
+               "${FILESDIR}"/default_rules.mk.a7d9824.patch
+       eapply_user
+
+       use cuda && cuda_src_prepare
+}
+
+src_configure() {
+       append-cxxflags \
+               -DHAVE_EXECINFO_H=1 \
+               -DHAVE_CXXABI_H \
+               -DHAVE_OPENFST_GE_10400 \
+               -std=c++11 \
+               -Wall \
+               -I.. \
+               -pthread \
+               -Wno-sign-compare \
+               -Wno-unused-local-typedefs \
+               -Winit-self \
+               -rdynamic \
+               -fPIC \
+               $($(tc-getPKG_CONFIG) --cflags cblas) \
+               $($(tc-getPKG_CONFIG) --cflags lapack)
+
+       append-libs \
+               -lfst \
+               -lm \
+               -lpthread \
+               -ldl \
+               $($(tc-getPKG_CONFIG) --libs cblas) \
+               $($(tc-getPKG_CONFIG) --libs lapack)
+
+       local cblas_provider=$(eselect cblas show)
+
+       if [[ ${cblas_provider} =~ atlas ]]; then
+               append-cxxflags -DHAVE_ATLAS
+       elif [[ ${cblas_provider} =~ mkl ]]; then
+               append-cxxflags -DHAVE_MKL
+       elif [[ ${cblas_provider} =~ openblas ]]; then
+               append-cxxflags -DHAVE_OPENBLAS $($(tc-getPKG_CONFIG) --cflags 
lapacke)
+       fi
+
+       use test || append-cxxflags -DNDEBUG
+
+       if use speex; then
+               append-cxxflags -DHAVE_SPEEX
+               append-libs -lspeex
+       fi
+
+       cat <<-EOF > kaldi.mk
+               KALDI_FLAVOR := dynamic
+               KALDILIBDIR := "${S}"/lib
+               CC = $(tc-getCXX)
+               RANLIB = $(tc-getRANLIB)
+               LDLIBS = ${LIBS}
+               DOUBLE_PRECISION = 0
+       EOF
+
+       if use cuda; then
+               cat <<-EOF >> kaldi.mk
+                       CUDA = true
+                       CUDATKDIR = "${EPREFIX}"/opt/cuda
+                       CUDA_ARCH :=
+                       CUDA_ARCH +=
+               EOF
+               cat makefiles/cuda_64bit.mk >> kaldi.mk
+               sed -i \
+                       -e "s:CUDA_FLAGS = -g:CUDA_FLAGS = ${NVCCFLAGS}:" \
+                       kaldi.mk || die "sed unix/kaldi.mk failed"
+       fi
+}
+
+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 && dodoc -r html
+}

Reply via email to