diff --git a/pkgs/by-name/sp/speech-tools/fix-unbonded-variable.patch b/pkgs/by-name/sp/speech-tools/fix-unbonded-variable.patch new file mode 100644 index 000000000000..4b63d05b69b8 --- /dev/null +++ b/pkgs/by-name/sp/speech-tools/fix-unbonded-variable.patch @@ -0,0 +1,39 @@ +diff --git a/scripts/est_examples.sh b/scripts/est_examples.sh +index 5e6f38c..b931fda 100755 +--- a/scripts/est_examples.sh ++++ b/scripts/est_examples.sh +@@ -64,7 +64,7 @@ EOF + prepend() { + var="$1" + extra="$2" +- eval "val=\$$var" ++ eval "val=\${$var:-}" + + if [ -n "$val" ] + then +diff --git a/scripts/shared_script b/scripts/shared_script +index b159134..2732699 100644 +--- a/scripts/shared_script ++++ b/scripts/shared_script +@@ -5,7 +5,7 @@ + extend() { + var="$1" + extra="$2" +- eval "val=\$$var" ++ eval "val=\${$var:-}" + + if [ -n "$val" ] + then +diff --git a/scripts/shared_setup_sh b/scripts/shared_setup_sh +index 64f0ba9..e0488f4 100644 +--- a/scripts/shared_setup_sh ++++ b/scripts/shared_setup_sh +@@ -4,7 +4,7 @@ + extend() { + var="$1" + extra="$2" +- eval "val=\$$var" ++ eval "val=\${$var:-}" + + if [ -n "$val" ] + then diff --git a/pkgs/by-name/sp/speech-tools/package.nix b/pkgs/by-name/sp/speech-tools/package.nix index 44cad0adedae..7d55117771d7 100644 --- a/pkgs/by-name/sp/speech-tools/package.nix +++ b/pkgs/by-name/sp/speech-tools/package.nix @@ -5,6 +5,7 @@ fetchpatch, ncurses, alsa-lib, + perl, }: stdenv.mkDerivation (finalAttrs: { @@ -24,10 +25,13 @@ stdenv.mkDerivation (finalAttrs: { }) # Fix C23 compatibility: https://github.com/festvox/speech_tools/pull/58 ./fix-c23.patch + # Fix "unbonded variable" error in some scripts + ./fix-unbonded-variable.patch ]; buildInputs = [ ncurses + perl ] ++ lib.optionals stdenv.hostPlatform.isLinux [ alsa-lib @@ -50,11 +54,16 @@ stdenv.mkDerivation (finalAttrs: { # c99 makes isnan valid for float and double substituteInPlace include/EST_math.h \ --replace '__isnanf(X)' 'isnan(X)' + + # fix script referenced paths + substituteInPlace config/rules/script_process.awk \ + --replace-fail "topdir" "\"$out\"" \ + --replace-fail "est" "\"$out\"" ''; installPhase = '' - mkdir -p "$out"/{bin,lib} - for d in bin lib; do + mkdir -p "$out"/{bin,include,lib} + for d in bin include lib; do for i in ./$d/*; do test "$(basename "$i")" = "Makefile" || cp -r "$(readlink -f $i)" "$out/$d"