aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sci-misc/kaldi/Manifest2
-rw-r--r--sci-misc/kaldi/files/Makefile.0d5e4b1.patch45
-rw-r--r--sci-misc/kaldi/files/default_rules.mk.96eec2b.patch30
-rw-r--r--sci-misc/kaldi/kaldi-0_p20151106.ebuild124
-rw-r--r--sci-misc/kaldi/kaldi-5.1.65.ebuild146
-rw-r--r--sci-misc/kaldi/metadata.xml3
6 files changed, 225 insertions, 125 deletions
diff --git a/sci-misc/kaldi/Manifest b/sci-misc/kaldi/Manifest
index e9d062c..0aa4d1b 100644
--- a/sci-misc/kaldi/Manifest
+++ b/sci-misc/kaldi/Manifest
@@ -1,2 +1,2 @@
-DIST kaldi-0_p20151106.tar.xz 2533608 SHA256 77726388b33739dcd3840b49bca027c3d97afad02e7b52c931d65ae08d900d40 SHA512 35f41bea999f8fdc5bc8d33753b9630bafddb23975254b12d30287e65cb2bfd48c7d1f126d96fc669cbbd43ad80abf6a5d5ccd6a24d516061454f8f84f560333 WHIRLPOOL 6e6c3ebc2f4701185e5d5c6eae727b5a4c06a764495e5a5172be142724ce89cd7e521b6f9602ae051d44e8766269000cde96ad12e9439cd16890bce6e311eabe
DIST kaldi-0_p20160628.tar.gz 8280371 SHA256 c14b88921fc1d80a0285df77670013c4ea568e1d9506e7a7f3532115061ef145 SHA512 31132feb3a3d971a55d4e5f3c37e5ac4bf56c527bb3aa1381e4bb6e149e542ec9f3117943515b57e75c1f7c51db415f0436f7f4d801babd0dc27fd521b939e76 WHIRLPOOL 56145409bf66814526c2027bac955ef3abfdad35ee0e3b6cf1bafa24bcb762003ae40be04b1c1b3ca41873125c31214cc5a17e8e10e3c1a483c0518f6c709f33
+DIST kaldi-5.1.65.tar.gz 9177937 SHA256 8b3f60cdf62c8f80b56ed0f5e3da90477728941a5193bae9d9f198b9c081c4c1 SHA512 731e76eb387977a303cf4b466381705682253adfe7c32bb82b75e1eea86ce236a224e2bb217cc0654728f6648a7be5c902bca3826c3e6e760317e46f6ca82448 WHIRLPOOL 1088a64b1b9e265591c9707567f8e6e1c1feb358ffad5348f4a4be2ee3885a232f91b3572cfefdff9b02af5dc5e6f32b96ec4704b381b7eacd4f749a8d73849e
diff --git a/sci-misc/kaldi/files/Makefile.0d5e4b1.patch b/sci-misc/kaldi/files/Makefile.0d5e4b1.patch
new file mode 100644
index 0000000..80b9862
--- /dev/null
+++ b/sci-misc/kaldi/files/Makefile.0d5e4b1.patch
@@ -0,0 +1,45 @@
+--- src/Makefile.orig 2017-03-03 01:33:22.000000000 +0100
++++ src/Makefile 2017-03-03 18:06:59.912864196 +0100
+@@ -32,7 +32,6 @@
+ # Reset the default goal, so that the all target will become default
+ .DEFAULT_GOAL :=
+ all:
+- $(MAKE) checkversion
+ $(MAKE) kaldi.mk
+ $(MAKE) mklibdir
+ $(MAKE) subdirs
+@@ -52,18 +51,6 @@
+ @true
+ endif
+
+-.PHONY: checkversion
+-checkversion:
+-ifeq ($(shell ./configure --version),$(CONFIGURE_VERSION))
+- @echo "The version of configure script matches kaldi.mk version. Good."
+-else
+- @echo ""
+- @echo "The kaldi.mk file was generated using a different version of configure script. Please rerun the configure again"
+- @test -f ./kaldi.mk && echo "Hint: Previous configure command line: " && head -n 2 ./kaldi.mk | grep configure | sed 's/^# *//g'
+- @echo ""
+- @false
+-endif
+-
+ biglib: $(SUBDIRS_LIB)
+ ifeq ($(KALDI_FLAVOR), dynamic)
+ ifeq ($(shell uname), Darwin)
+@@ -136,6 +123,15 @@
+ 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/default_rules.mk.96eec2b.patch b/sci-misc/kaldi/files/default_rules.mk.96eec2b.patch
new file mode 100644
index 0000000..89a3103
--- /dev/null
+++ b/sci-misc/kaldi/files/default_rules.mk.96eec2b.patch
@@ -0,0 +1,30 @@
+--- src/makefiles/default_rules.mk.orig 2017-03-03 01:33:22.000000000 +0100
++++ src/makefiles/default_rules.mk 2017-03-03 18:24:54.159740235 +0100
+@@ -12,7 +12,7 @@
+ ifdef LIBNAME
+ LIBFILE = lib$(LIBNAME).so
+ endif
+- LDFLAGS += -Wl,-rpath=$(shell readlink -f $(KALDILIBDIR))
++ LDFLAGS += -L. $(foreach dep,$(ADDLIBS), -L$(dir $(dep)))
+ EXTRA_LDLIBS += $(foreach dep,$(ADDLIBS), $(dir $(dep))lib$(notdir $(basename $(dep))).so)
+ else # Platform not supported
+ $(error Dynamic libraries not supported on this platform. Run configure with --static flag.)
+@@ -82,7 +82,7 @@
+ for x in $(TESTFILES); do \
+ printf "Running $$x ..."; \
+ timestamp1=$$(date +"%s"); \
+- ./$$x >$$x.testlog 2>&1; \
++ LD_LIBRARY_PATH=$(KALDILIBDIR):${LD_LIBRARY_PATH} ./$$x >$$x.testlog 2>&1; \
+ ret=$$? \
+ timestamp2=$$(date +"%s"); \
+ time_taken=$$[timestamp2-timestamp1]; \
+@@ -121,3 +121,9 @@
+ # 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
deleted file mode 100644
index 7dbc93e..0000000
--- a/sci-misc/kaldi/kaldi-0_p20151106.ebuild
+++ /dev/null
@@ -1,124 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-
-inherit eutils toolchain-funcs cuda 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 cuda"
-KEYWORDS="~amd64"
-
-RDEPEND="
- media-libs/speex
- virtual/cblas
- virtual/lapack
- virtual/lapacke
- >=sci-misc/openfst-1.4.1
- cuda? ( dev-util/nvidia-cuda-toolkit )"
-DEPEND="${RDEPEND}
- 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="test? ( 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() {
- epatch \
- "${FILESDIR}"/Makefile.patch \
- "${FILESDIR}"/default_rules.mk.a7d9824.patch
-}
-
-src_configure() {
- append-cxxflags \
- -DKALDI_DOUBLEPRECISION=0 \
- -DHAVE_POSIX_MEMALIGN \
- -DHAVE_EXECINFO_H=1 \
- -DHAVE_CXXABI_H \
- -DHAVE_SPEEX \
- -DHAVE_OPENFST_GE_10400 \
- -std=c++0x \
- -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 \
- -lspeex \
- -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
-
- cat <<-EOF > kaldi.mk
- KALDI_FLAVOR := dynamic
- KALDILIBDIR := "${S}"/lib
- CC = $(tc-getCXX)
- RANLIB = $(tc-getRANLIB)
- LDLIBS = ${LIBS}
- EOF
-
- if use cuda; then
- cat <<-EOF >> kaldi.mk
- CUDA = true
- CUDATKDIR = "${EPREFIX}"/opt/cuda
- EOF
- cat makefiles/linux_x86_64_cuda.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
-}
diff --git a/sci-misc/kaldi/kaldi-5.1.65.ebuild b/sci-misc/kaldi/kaldi-5.1.65.ebuild
new file mode 100644
index 0000000..4304f69
--- /dev/null
+++ b/sci-misc/kaldi/kaldi-5.1.65.ebuild
@@ -0,0 +1,146 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit toolchain-funcs cuda flag-o-matic
+
+COMMIT_ID="9e06caa1fb0306898632c6fa3ad67571c4d06cf5"
+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"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="cuda doc double-precision speex test"
+REQUIRED_USE="double-precision? ( !speex )"
+
+RDEPEND="
+ >=sci-misc/openfst-1.6.0
+ virtual/cblas
+ virtual/lapack
+ virtual/lapacke
+ cuda? ( dev-util/nvidia-cuda-toolkit )
+ speex? ( media-libs/speex )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ doc? ( app-doc/doxygen )"
+
+S=${WORKDIR}/${PN}-${COMMIT_ID}/src
+
+PATCHES=(
+ "${FILESDIR}"/Makefile.0d5e4b1.patch
+ "${FILESDIR}"/default_rules.mk.96eec2b.patch
+)
+
+# 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|openblas) ]]; then
+ die "Build with '${cblas_provider}' CBLAS is not supported"
+ fi
+}
+
+src_prepare() {
+ default
+ use cuda && cuda_src_prepare
+}
+
+src_configure() {
+ cat <<-EOF > base/version.h
+ #define KALDI_VERSION "${PV}-${COMMIT_ID:0:5}"
+ #define KALDI_GIT_HEAD "${COMMIT_ID}"
+ EOF
+
+ echo "true" > base/get_version.sh
+
+ append-cxxflags \
+ $($(tc-getPKG_CONFIG) --cflags cblas) \
+ $($(tc-getPKG_CONFIG) --cflags lapack)
+
+ append-libs \
+ $($(tc-getPKG_CONFIG) --libs cblas) \
+ $($(tc-getPKG_CONFIG) --libs lapack)
+
+ use test || append-cppflags -DNDEBUG
+
+ if use speex; then
+ append-cppflags -DHAVE_SPEEX
+ append-libs -lspeex
+ fi
+
+ cat <<-EOF > kaldi.mk
+ KALDI_FLAVOR := dynamic
+ KALDILIBDIR := "${S}"/lib
+ CXX = $(tc-getCXX)
+ AR = $(tc-getAR)
+ AS = $(tc-getAS)
+ RANLIB = $(tc-getRANLIB)
+ DOUBLE_PRECISION = $(usex double-precision 1 0)
+ OPENFSTINC = "."
+ OPENFSTLIBS = -lfst
+ EOF
+
+ local cblas_provider=$(eselect cblas show)
+
+ if [[ ${cblas_provider} =~ atlas ]]; then
+ cat <<-EOF >> kaldi.mk
+ ATLASINC = "."
+ ATLASLIBS = -L.
+ EOF
+
+ cat makefiles/linux_atlas.mk >> kaldi.mk
+ elif [[ ${cblas_provider} =~ openblas ]]; then
+ append-cxxflags $($(tc-getPKG_CONFIG) --cflags lapacke)
+
+ cat <<-EOF >> kaldi.mk
+ OPENBLASINC = "."
+ OPENBLASLIBS = -L.
+ EOF
+
+ cat makefiles/linux_openblas.mk >> kaldi.mk
+ fi
+
+ cat <<-EOF >> kaldi.mk
+ CXXFLAGS += ${CXXFLAGS}
+ LDLIBS += ${LIBS}
+ 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
+}
diff --git a/sci-misc/kaldi/metadata.xml b/sci-misc/kaldi/metadata.xml
index fbed389..e441381 100644
--- a/sci-misc/kaldi/metadata.xml
+++ b/sci-misc/kaldi/metadata.xml
@@ -17,5 +17,8 @@
<flag name="cuda">
Build with CUDA support.
</flag>
+ <flag name="double-precision">
+ Build in double precision mode.
+ </flag>
</use>
</pkgmetadata>