Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,14 @@ if errorlevel 1 (
REM 6. Verify build and package
echo --^> Verifying build output...
set EXECUTABLE_NAME=main
if exist "dist\%EXECUTABLE_NAME%.exe" (
set ONEDIR_EXE=dist\%EXECUTABLE_NAME%\%EXECUTABLE_NAME%.exe
set BUILT_EXECUTABLE=

if exist "%ONEDIR_EXE%" (
set BUILT_EXECUTABLE=%ONEDIR_EXE%
)

if not "!BUILT_EXECUTABLE!"=="" (
echo Build successful!
echo.

Expand All @@ -110,7 +117,11 @@ if exist "dist\%EXECUTABLE_NAME%.exe" (
echo Build complete!
echo.
echo To run:
echo cd dist ^&^& main.exe start
if exist "%ONEDIR_EXE%" (
echo cd dist\main ^&^& main.exe start
) else (
echo cd dist ^&^& main.exe start
)
echo.
echo Options: --port 9000 ^| --host 0.0.0.0 ^| --config config\config.yaml
echo.
Expand Down
25 changes: 20 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,24 @@ fi
# 6. Verify build and package
echo "--> Verifying build output..."
EXECUTABLE_NAME="main" # As defined in the original script
if [ -f "dist/$EXECUTABLE_NAME" ] || [ -f "dist/$EXECUTABLE_NAME.exe" ]; then
ONEDIR_EXECUTABLE="dist/$EXECUTABLE_NAME/$EXECUTABLE_NAME"
ONEDIR_EXECUTABLE_WIN="dist/$EXECUTABLE_NAME/$EXECUTABLE_NAME.exe"

if [ -f "$ONEDIR_EXECUTABLE" ]; then
BUILT_EXECUTABLE="$ONEDIR_EXECUTABLE"
elif [ -f "$ONEDIR_EXECUTABLE_WIN" ]; then
BUILT_EXECUTABLE="$ONEDIR_EXECUTABLE_WIN"
else
BUILT_EXECUTABLE=""
fi

if [ -n "$BUILT_EXECUTABLE" ]; then
echo "✅ Build successful!"

# Ad-hoc sign for macOS to avoid Gatekeeper issues
if [[ "$OSTYPE" == "darwin"* ]] && [ -f "dist/$EXECUTABLE_NAME" ]; then
if [[ "$OSTYPE" == "darwin"* ]] && [ -f "$BUILT_EXECUTABLE" ]; then
echo "--> Performing ad-hoc sign for macOS executable..."
codesign -s - --force --all-architectures --timestamp=none --deep "dist/$EXECUTABLE_NAME" 2>/dev/null || {
codesign -s - --force --all-architectures --timestamp=none --deep "$BUILT_EXECUTABLE" 2>/dev/null || {
echo "⚠️ Warning: Ad-hoc signing failed. The app might still run, but you may see security warnings."
}
fi
Expand All @@ -81,11 +92,15 @@ if [ -f "dist/$EXECUTABLE_NAME" ] || [ -f "dist/$EXECUTABLE_NAME.exe" ]; then
echo "✅ Build complete!"
echo
echo "To run:"
echo " cd dist && ./main start"
if [ -f "$ONEDIR_EXECUTABLE" ]; then
echo " cd dist/main && ./main start"
else
echo " cd dist/main && main.exe start"
fi
echo
echo "Options: --port 9000 | --host 0.0.0.0 | --config config/config.yaml"
echo
else
echo "❌ Build failed. Check the PyInstaller logs above for errors."
exit 1
fi
fi
3 changes: 1 addition & 2 deletions frontend/electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ extraResources:
- from: backend/
to: backend/
filter:
- 'main*'
- 'config/**/*'
- '**/*'
asarUnpack:
- resources/**
win:
Expand Down
3 changes: 1 addition & 2 deletions frontend/externals/python/window_capture/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pyobjc-core>=10.0
pyobjc-framework-Cocoa>=10.0
pyobjc>=10.0
pyobjc-framework-Quartz>=10.0
pyobjc-framework-CoreServices>=10.0
pyobjc-framework-LaunchServices>=10.0
pyobjc-framework-ApplicationServices>=10.0
pyobjc-framework-ApplicationServices>=10.0
25 changes: 18 additions & 7 deletions frontend/scripts/copy-prebuilt-backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ console.log('📦 Copying pre-built backend executable...')
const backendDir = path.join(__dirname, '..', 'backend')
const sourceDir = path.join(__dirname, '..', '..')
const executableName = process.platform === 'win32' ? 'main.exe' : 'main'
const sourceExecutablePath = path.join(sourceDir, 'dist', executableName)
const sourceDistDir = path.join(sourceDir, 'dist')
const sourceOnedirPath = path.join(sourceDistDir, 'main')
const sourceOnedirExecutablePath = path.join(sourceOnedirPath, executableName)
const destExecutablePath = path.join(backendDir, executableName)

// Clean up existing backend directory
Expand All @@ -22,9 +24,8 @@ if (fs.existsSync(backendDir)) {
// Ensure backend directory exists
fs.mkdirSync(backendDir, { recursive: true })

// Check if pre-built executable exists
if (!fs.existsSync(sourceExecutablePath)) {
console.error(`❌ Pre-built executable not found at: ${sourceExecutablePath}`)
if (!fs.existsSync(sourceOnedirExecutablePath)) {
console.error(`❌ Pre-built onedir executable not found at: ${sourceOnedirExecutablePath}`)
console.log('')
console.log('🔧 Please build the backend first by running `build.sh` in the project root directory:')
console.log(' cd ../..')
Expand All @@ -33,8 +34,18 @@ if (!fs.existsSync(sourceExecutablePath)) {
process.exit(1)
}

// Copy the executable
fs.copyFileSync(sourceExecutablePath, destExecutablePath)
console.log(`📁 Detected onedir backend build at: ${sourceOnedirPath}`)
const entries = fs.readdirSync(sourceOnedirPath)
entries.forEach((entry) => {
const src = path.join(sourceOnedirPath, entry)
const dest = path.join(backendDir, entry)
fs.cpSync(src, dest, { recursive: true, force: true })
})

if (!fs.existsSync(destExecutablePath)) {
console.error(`❌ Backend executable missing after copy: ${destExecutablePath}`)
process.exit(1)
}

// Make executable on Unix systems
if (process.platform !== 'win32') {
Expand All @@ -49,7 +60,7 @@ console.log(`✅ Copied executable (${fileSizeInMB} MB)`)

// Copy config files
const configDir = path.join(backendDir, 'config')
const sourceConfigDir = path.join(sourceDir, 'dist', 'config')
const sourceConfigDir = path.join(sourceDistDir, 'config')

if (fs.existsSync(sourceConfigDir)) {
// Create config directory
Expand Down
Loading