-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
whisper-cpp: make compatible with --HEAD
install
#202270
base: master
Are you sure you want to change the base?
Conversation
This is to accommodate the build system changes in the upcoming v1.7.4
a7ac849
to
0fd2a7e
Compare
@@ -24,7 +24,7 @@ class WhisperCpp < Formula | |||
|
|||
def install | |||
args = %W[ | |||
-DBUILD_SHARED_LIBS=OFF | |||
-DBUILD_SHARED_LIBS=#{head? ? "ON" : "OFF"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-DBUILD_SHARED_LIBS=#{head? ? "ON" : "OFF"} | |
-DBUILD_SHARED_LIBS=#{build.head? ? "ON" : "OFF"} |
@@ -33,11 +33,27 @@ def install | |||
-DWHISPER_BUILD_SERVER=OFF | |||
] | |||
args << "-DLLAMA_METAL_MACOSX_VERSION_MIN=#{MacOS.version}" if OS.mac? | |||
args << "-DCMAKE_INSTALL_RPATH=#{OS.mac? ? "@loader_path/../libinternal" : "'$ORIGIN/../libinternal'"}" if head? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the rpath
helper (and build.head?
) instead:
args << "-DCMAKE_INSTALL_RPATH=#{OS.mac? ? "@loader_path/../libinternal" : "'$ORIGIN/../libinternal'"}" if head? | |
args << "-DCMAKE_INSTALL_RPATH=#{rpath(target: prefix/"libinternal")}" if build.head? |
system "cmake", "--build", "build", "--target", "main" | ||
bin.install "build/bin/main" => "whisper-cpp" | ||
# avoid installing libggml libraries to "lib" since they would conflict with llama.cpp | ||
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args(install_libdir: "libinternal") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args(install_libdir: "libinternal") | |
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args(install_libdir: "lib/ggml") |
Maybe? You'll need to adjust the argument to #rpath
from my suggestion above if you apply this. (to rpath(target: lib/"ggml")
).
Though, ideally we should be using libggml
from llama.cpp
instead (or vice-versa).
bin.install "build/bin/main" => "whisper-cpp" | ||
# avoid installing libggml libraries to "lib" since they would conflict with llama.cpp | ||
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args(install_libdir: "libinternal") | ||
if head? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if head? | |
if build.head? |
(bin/"whisper-cpp").write <<~EOS | ||
#!/bin/bash | ||
here="${BASH_SOURCE[0]}" | ||
echo "${BASH_SOURCE[0]}: warning: whisper-cpp is deprecated. Use whisper-cli instead." >&2 | ||
exec "$(dirname "$here")/whisper-cli" "$@" | ||
EOS | ||
(bin/"whisper-cpp").chmod 0755 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably do this unconditionally?
This is to accommodate the build system changes in the upcoming v1.7.4 release.
HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew test <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingHOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>
)? If this is a new formula, does it passbrew audit --new <formula>
?In
--HEAD
mode, the main changes are that dylibs are now enabled and that the main binary is now calledwhisper-cli
.Libraries and header files currently unfortunately conflict with the
llama.cpp
formula, so in this installation we rename the "lib" folder and omit the header files to avoid the conflict. ggerganov/ggml#1050 (comment)