diff options
| author | Jan Tojnar <jtojnar@gmail.com> | 2023-06-06 14:51:09 +0200 |
|---|---|---|
| committer | Jan Tojnar <jtojnar@gmail.com> | 2023-06-06 22:02:36 +0200 |
| commit | 34711ba5cfbe6eb28bef5f53aca02d622880ba59 (patch) | |
| tree | 08028e8de710a23d47962ec12f9bf43f61c94883 | |
| parent | Merge pull request #235254 from r-ryantm/auto-update/powerline-go (diff) | |
| download | nixpkgs-34711ba5cfbe6eb28bef5f53aca02d622880ba59.tar.gz | |
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.
| -rw-r--r-- | pkgs/tools/audio/kaldi/default.nix | 42 |
1 files changed, 11 insertions, 31 deletions
diff --git a/pkgs/tools/audio/kaldi/default.nix b/pkgs/tools/audio/kaldi/default.nix index 79da94f72435..6c67924f9eea 100644 --- a/pkgs/tools/audio/kaldi/default.nix +++ b/pkgs/tools/audio/kaldi/default.nix @@ -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 |
