forked from azooKey/AzooKeyKanaKanjiConverter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_cli.sh
More file actions
executable file
·58 lines (50 loc) · 1.45 KB
/
install_cli.sh
File metadata and controls
executable file
·58 lines (50 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
set -e
USE_ZENZAI=0
USE_ZENZAI_CPU=0
USE_DEBUG=0
# 引数の解析
for arg in "$@"; do
if [ "$arg" = "--zenzai" ]; then
USE_ZENZAI=1
fi
if [ "$arg" = "--zenzai-cpu" ]; then
USE_ZENZAI_CPU=1
fi
if [ "$arg" = "--debug" ]; then
echo "⚠️ Debug mode is enabled. This may cause performance issues."
USE_DEBUG=1
fi
done
if [ "$USE_DEBUG" -eq 1 ]; then
CONFIGURATION="debug"
else
CONFIGURATION="release"
fi
if [ "$USE_ZENZAI" -eq 1 ]; then
echo "📦 Building with Zenzai support..."
swift build -c $CONFIGURATION -Xcxx -xobjective-c++ --traits Zenzai
elif [ "$USE_ZENZAI_CPU" -eq 1 ]; then
echo "📦 Building with ZenzaiCPU (CPU-only) support..."
swift build -c $CONFIGURATION -Xcxx -xobjective-c++ --traits ZenzaiCPU
else
echo "📦 Building..."
swift build -c $CONFIGURATION -Xcxx -xobjective-c++
fi
# Copy Required Resources
sudo cp -R .build/${CONFIGURATION}/llama.framework /usr/local/lib/
# add rpath
RPATH="/usr/local/lib/"
BINARY_PATH=".build/${CONFIGURATION}/CliTool"
if ! otool -l "$BINARY_PATH" | grep -q "$RPATH"; then
install_name_tool -add_rpath "$RPATH" "$BINARY_PATH"
else
echo "✅ RPATH $RPATH is already present in $BINARY_PATH"
fi
# if debug mode, codesign is required to execute
if [ "$USE_DEBUG" -eq 1 ]; then
echo "🔒 Signing the binary for debug mode..."
codesign --force --sign - .build/${CONFIGURATION}/CliTool
fi
# Install
sudo cp -f .build/${CONFIGURATION}/CliTool /usr/local/bin/anco