-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_linux.sh
More file actions
executable file
·103 lines (86 loc) · 3.14 KB
/
build_linux.sh
File metadata and controls
executable file
·103 lines (86 loc) · 3.14 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
# CVFit Linux Build Script
echo "========================================================="
echo " Building CVFit for Linux "
echo "========================================================="
if [ ! -d "resources" ]; then
mkdir resources
echo "Created resources directory"
fi
if [ -d "env" ]; then
source env/bin/activate
echo "✅ Activated virtual environment"
else
echo "⚠️ Virtual environment not found, creating one..."
python3 -m venv env
source env/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
echo "✅ Virtual environment created and activated"
fi
if [ ! -f "yolov8n-pose.pt" ]; then
echo "⚠️ YOLOv8 model not found, downloading..."
python -c "from ultralytics import YOLO; YOLO('yolov8n-pose.pt')"
echo "✅ Model downloaded"
fi
echo "Cleaning previous build files..."
rm -rf build dist
echo "Building CVFit executable..."
pyinstaller cvfit.spec
if [ $? -ne 0 ]; then
echo "❌ Build failed"
exit 1
fi
if command -v appimagetool &> /dev/null; then
echo "Creating AppImage..."
mkdir -p AppDir/usr/{bin,share/{applications,icons/hicolor/256x256/apps}}
cp -r dist/CVFit/* AppDir/usr/bin/
cat > AppDir/usr/share/applications/cvfit.desktop << EOF
[Desktop Entry]
Name=CVFit
Exec=CVFit
Icon=cvfit
Type=Application
Categories=Utility;
Terminal=false
EOF
if [ -f "resources/icon.png" ]; then
cp resources/icon.png AppDir/usr/share/icons/hicolor/256x256/apps/cvfit.png
else
convert -size 256x256 xc:transparent \
-font Helvetica -pointsize 72 -fill black -gravity center \
-annotate 0 "CVFit" AppDir/usr/share/icons/hicolor/256x256/apps/cvfit.png || \
echo "⚠️ Failed to create icon (ImageMagick not installed?)"
fi
cat > AppDir/AppRun << EOF
#!/bin/bash
cd "\$(dirname "\$0")"
exec usr/bin/CVFit "\$@"
EOF
chmod +x AppDir/AppRun
ARCH=x86_64 appimagetool AppDir dist/CVFit-1.0.0-x86_64.AppImage
rm -rf AppDir
echo "✅ AppImage created: dist/CVFit-1.0.0-x86_64.AppImage"
else
echo "⚠️ appimagetool not found, skipping AppImage creation"
echo "If you want to create an AppImage, install appimagetool:"
echo " wget -O appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
echo " chmod +x appimagetool"
echo " sudo mv appimagetool /usr/local/bin/"
echo "Creating tarball instead..."
cd dist
tar -czvf CVFit-1.0.0-linux.tar.gz CVFit
cd ..
echo "✅ Tarball created: dist/CVFit-1.0.0-linux.tar.gz"
fi
echo "========================================================="
echo "✅ Build completed successfully! Output is in dist folder."
echo "Distribution options:"
echo " - dist/CVFit/: standalone application folder"
if [ -f "dist/CVFit-1.0.0-x86_64.AppImage" ]; then
echo " - dist/CVFit-1.0.0-x86_64.AppImage: portable AppImage"
fi
if [ -f "dist/CVFit-1.0.0-linux.tar.gz" ]; then
echo " - dist/CVFit-1.0.0-linux.tar.gz: compressed tarball"
fi
echo "========================================================="