mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-21 12:59:04 +02:00
kaldi: Fix build
It looks like after a bump, CMake started passing `--git-dir=.git` as the first argument of `git rev-parse`. But we do not really need to spoof `git` program now that Kaldi uses CMake’s `FetchContent` module. We can just pass the path using configure flag directly: https://cmake.org/cmake/help/latest/module/FetchContent.html#variable:FETCHCONTENT_SOURCE_DIR_%3CuppercaseName%3E Git was also inadvertently used for generating `KALDI_PATCH_NUMBER` in `VersionHelper`, to be potentially appended to `KALDI_VERSION` but it was not actually being done by default. We can set the variable directly to skip `VersionHelper`. Also remove redundant `enableParallelBuild` since CMake enables it. And drop separate `dev` output since Kaldi currently hardcodes the `include/` directory so consumers would not be able to find them. Splitting it out only removes 7 out of 303 MB.
This commit is contained in:
parent
4f53efe34b
commit
34711ba5cf
|
@ -39,39 +39,9 @@ stdenv.mkDerivation {
|
|||
"-DBUILD_SHARED_LIBS=on"
|
||||
"-DBLAS_LIBRARIES=-lblas"
|
||||
"-DLAPACK_LIBRARIES=-llapack"
|
||||
"-DFETCHCONTENT_SOURCE_DIR_OPENFST:PATH=${openfst}"
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
preConfigure = ''
|
||||
mkdir bin
|
||||
cat > bin/git <<'EOF'
|
||||
#!${stdenv.shell}
|
||||
if [[ "$1" == "--version" ]]; then
|
||||
# cmake checks this
|
||||
${git}/bin/git --version
|
||||
elif [[ "$1" == "clone" ]]; then
|
||||
# mock this call:
|
||||
|
||||
# https://github.com/kaldi-asr/kaldi/blob/c9d8b9ad3fef89237ba5517617d977b7d70a7ed5/cmake/third_party/openfst.cmake#L5
|
||||
cp -r ${openfst} ''${@: -1}
|
||||
chmod -R +w ''${@: -1}
|
||||
elif [[ "$1" == "rev-list" ]]; then
|
||||
# fix up this call:
|
||||
# https://github.com/kaldi-asr/kaldi/blob/c9d8b9ad3fef89237ba5517617d977b7d70a7ed5/cmake/VersionHelper.cmake#L8
|
||||
echo 0
|
||||
elif [[ "$1" == "rev-parse" ]]; then
|
||||
echo ${openfst.rev}
|
||||
echo 0
|
||||
fi
|
||||
true
|
||||
EOF
|
||||
chmod +x bin/git
|
||||
export PATH=$(pwd)/bin:$PATH
|
||||
'';
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
buildInputs = [
|
||||
openblas
|
||||
openfst
|
||||
|
@ -86,6 +56,16 @@ stdenv.mkDerivation {
|
|||
python3
|
||||
];
|
||||
|
||||
preConfigure = ''
|
||||
cmakeFlagsArray+=(
|
||||
# Extract version without the need for git.
|
||||
# https://github.com/kaldi-asr/kaldi/blob/71f38e62cad01c3078555bfe78d0f3a527422d75/cmake/VersionHelper.cmake
|
||||
# Patch number is not actually used by default so we can just ignore it.
|
||||
# https://github.com/kaldi-asr/kaldi/blob/71f38e62cad01c3078555bfe78d0f3a527422d75/CMakeLists.txt#L214
|
||||
"-DKALDI_VERSION=$(cat src/.version)"
|
||||
)
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p $out/share/kaldi
|
||||
cp -r ../egs $out/share/kaldi
|
||||
|
|
Loading…
Reference in a new issue