Skip to content

Commit ac2b437

Browse files
fix(nemo-speech-cpp): make SentencePiece install portable
The upstream helper uses GNU install -D for license files, which BSD install on Darwin does not support. Rewrite those invocations after checkout and create the destination directory explicitly before building. Assisted-by: Codex:gpt-5.4
1 parent 9cb6637 commit ac2b437

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

backend/go/nemo-speech-cpp/Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ ITN_FST_HEADER=$(ITN_PREFIX)/include/fst/fst.h
9494
# dependency instead of relying on an undeclared system package.
9595
SENTENCEPIECE_PREFIX=sources/NeMo-Speech.cpp/.deps/sentencepiece
9696
SENTENCEPIECE_MARKER=$(SENTENCEPIECE_PREFIX)/lib/libsentencepiece.a
97+
SENTENCEPIECE_INSTALL_PATCH=sources/NeMo-Speech.cpp/scripts/.localai-portable-install
9798

9899
# Linux's ASR CMake block looks in NEMO_SPEECH_DEPENDENCY_PREFIX directly, but
99100
# the Apple branch uses generic find_library()/find_path(). Put the same private
@@ -278,7 +279,15 @@ patch-itn-headers:
278279

279280
itn: $(ITN_MARKER)
280281

281-
$(SENTENCEPIECE_MARKER): | sources/NeMo-Speech.cpp
282+
$(SENTENCEPIECE_INSTALL_PATCH): | sources/NeMo-Speech.cpp
283+
# BSD install (Darwin) has no GNU -D option. The destination directory is
284+
# created by our recipe below, so the helper only needs portable -m here.
285+
sed -i.bak 's/install -Dm0644/install -m 0644/g' sources/NeMo-Speech.cpp/scripts/build_sentencepiece_static.sh
286+
rm -f sources/NeMo-Speech.cpp/scripts/build_sentencepiece_static.sh.bak
287+
touch $@
288+
289+
$(SENTENCEPIECE_MARKER): $(SENTENCEPIECE_INSTALL_PATCH)
290+
install -d $(SENTENCEPIECE_PREFIX)/share/licenses/nemo-speech/third_party/sentencepiece
282291
cd sources/NeMo-Speech.cpp && JOBS=$(JOBS) scripts/build_sentencepiece_static.sh
283292

284293
sentencepiece: $(SENTENCEPIECE_MARKER)

0 commit comments

Comments
 (0)