diff --git a/llm/generate/gen_common.sh b/llm/generate/gen_common.sh index 5cb237da..d1e64d7d 100644 --- a/llm/generate/gen_common.sh +++ b/llm/generate/gen_common.sh @@ -83,8 +83,9 @@ build() { compress_libs() { echo "Compressing payloads to reduce overall binary size..." pids="" + rm -rf ${BUILD_DIR}/lib/*.${LIB_EXT}*.gz for lib in ${BUILD_DIR}/lib/*.${LIB_EXT}* ; do - gzip --best ${lib} & + gzip --best -f ${lib} & pids+=" $!" done echo diff --git a/llm/generate/gen_darwin.sh b/llm/generate/gen_darwin.sh index cf131af5..1d085656 100755 --- a/llm/generate/gen_darwin.sh +++ b/llm/generate/gen_darwin.sh @@ -12,6 +12,12 @@ init_vars git_module_setup apply_patches +sign() { + if [ -n "$APPLE_IDENTITY" ]; then + codesign -f --timestamp --deep --options=runtime --sign "$APPLE_IDENTITY" --identifier ai.ollama.ollama $1 + fi +} + COMMON_DARWIN_DEFS="-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_SYSTEM_NAME=Darwin -DLLAMA_ACCELERATE=off" case "${GOARCH}" in @@ -25,6 +31,7 @@ case "${GOARCH}" in BUILD_DIR="${LLAMACPP_DIR}/build/darwin/${ARCH}/cpu" echo "Building LCD CPU" build + sign ${LLAMACPP_DIR}/build/darwin/${ARCH}/cpu/lib/libext_server.dylib compress_libs # @@ -36,6 +43,7 @@ case "${GOARCH}" in BUILD_DIR="${LLAMACPP_DIR}/build/darwin/${ARCH}/cpu_avx" echo "Building AVX CPU" build + sign ${LLAMACPP_DIR}/build/darwin/${ARCH}/cpu_avx/lib/libext_server.dylib compress_libs # @@ -47,6 +55,7 @@ case "${GOARCH}" in BUILD_DIR="${LLAMACPP_DIR}/build/darwin/${ARCH}/cpu_avx2" echo "Building AVX2 CPU" build + sign ${LLAMACPP_DIR}/build/darwin/${ARCH}/cpu_avx2/lib/libext_server.dylib compress_libs ;; "arm64") @@ -54,6 +63,7 @@ case "${GOARCH}" in BUILD_DIR="${LLAMACPP_DIR}/build/darwin/${ARCH}/metal" EXTRA_LIBS="${EXTRA_LIBS} -framework Accelerate -framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders" build + sign ${LLAMACPP_DIR}/build/darwin/${ARCH}/metal/lib/libext_server.dylib compress_libs ;; *) diff --git a/llm/generate/gen_windows.ps1 b/llm/generate/gen_windows.ps1 index e5d99f37..109b8602 100644 --- a/llm/generate/gen_windows.ps1 +++ b/llm/generate/gen_windows.ps1 @@ -76,7 +76,7 @@ function compress_libs { write-host "Compressing dlls..." $libs = dir "${script:buildDir}/lib/*.dll" foreach ($file in $libs) { - & "$script:GZIP" --best $file + & "$script:GZIP" --best -f $file } }