Nix flake: Use Makefile instead of CMake
I can't test whether this works on Darwin, but it can build libllama.so. I did try building via CMake with -DBUILD_SHARED_LIBS=ON, but it did not work and I could not make it work.
This commit is contained in:
parent
884e7d7a2b
commit
14a4fc874b
1 changed files with 11 additions and 7 deletions
18
flake.nix
18
flake.nix
|
@ -18,17 +18,21 @@
|
||||||
packages.default = pkgs.stdenv.mkDerivation {
|
packages.default = pkgs.stdenv.mkDerivation {
|
||||||
name = "llama.cpp";
|
name = "llama.cpp";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
nativeBuildInputs = with pkgs; [ cmake ];
|
|
||||||
buildInputs = with pkgs; lib.optionals stdenv.isDarwin [
|
buildInputs = with pkgs; lib.optionals stdenv.isDarwin [
|
||||||
darwin.apple_sdk.frameworks.Accelerate
|
darwin.apple_sdk.frameworks.Accelerate
|
||||||
];
|
];
|
||||||
cmakeFlags = with pkgs; lib.optionals (system == "aarch64-darwin") [
|
buildPhase = ''
|
||||||
"-DCMAKE_C_FLAGS=-D__ARM_FEATURE_DOTPROD=1"
|
make main quantize quantize-stats perplexity embedding vdot libllama.so
|
||||||
];
|
'';
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/lib/
|
||||||
mv bin/* $out/bin/
|
cp libllama.so $out/lib/
|
||||||
mv $out/bin/main $out/bin/llama
|
|
||||||
|
mkdir -p $out/bin/
|
||||||
|
mv main $out/bin/llama
|
||||||
|
for exe in quantize quantize-stats perplexity embedding vdot; do
|
||||||
|
mv $exe $out/bin/
|
||||||
|
done
|
||||||
|
|
||||||
echo "#!${llama-python}/bin/python" > $out/bin/convert-pth-to-ggml
|
echo "#!${llama-python}/bin/python" > $out/bin/convert-pth-to-ggml
|
||||||
cat ${./convert-pth-to-ggml.py} >> $out/bin/convert-pth-to-ggml
|
cat ${./convert-pth-to-ggml.py} >> $out/bin/convert-pth-to-ggml
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue