-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_binary.sh
More file actions
executable file
·61 lines (50 loc) · 1.67 KB
/
build_binary.sh
File metadata and controls
executable file
·61 lines (50 loc) · 1.67 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
#!/bin/bash
# Build diskcomp binary for current platform using PyInstaller
set -e
echo "Building diskcomp binary for platform: $OSTYPE"
echo "Python version: $(python3 --version)"
echo "PyInstaller version: $(python3 -c 'import PyInstaller; print(PyInstaller.__version__)')"
# Clean previous builds
echo "Cleaning previous builds..."
rm -rf build/ dist/
# Verify spec file exists
if [ ! -f "diskcomp.spec" ]; then
echo "❌ diskcomp.spec not found"
exit 1
fi
echo "Building with PyInstaller..."
# Build with PyInstaller spec
pyinstaller diskcomp.spec --clean --log-level INFO
# Get binary info
BINARY_PATH="dist/diskcomp"
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
BINARY_PATH="dist/diskcomp.exe"
fi
echo "Checking binary at: $BINARY_PATH"
if [ -f "$BINARY_PATH" ]; then
BINARY_SIZE=$(du -h "$BINARY_PATH" | cut -f1)
echo "✅ Binary built successfully: $BINARY_PATH ($BINARY_SIZE)"
# Make binary executable
chmod +x "$BINARY_PATH"
# Show file info
file "$BINARY_PATH" || true
ls -la "$BINARY_PATH"
# Test the binary
echo "Testing binary..."
if "$BINARY_PATH" --version > /dev/null 2>&1; then
echo "✅ Binary --version test passed"
elif "$BINARY_PATH" --help > /dev/null 2>&1; then
echo "✅ Binary --help test passed"
else
echo "❌ Binary test failed"
echo "Attempting to run binary with no args..."
"$BINARY_PATH" || echo "Binary failed to run"
exit 1
fi
else
echo "❌ Binary build failed - file not found: $BINARY_PATH"
echo "Contents of dist directory:"
ls -la dist/ || echo "No dist directory found"
exit 1
fi
echo "✅ Build complete!"