Some checks failed
CI / markdown-lint (push) Failing after 14s
- Reorganized directory structure following open source best practices - Created src/ directory for all source code components - Moved build artifacts to build/ subdirectories - Organized documentation into phases/, guides/, and api/ subdirectories - Moved third-party code to vendor/ directory - Moved downloads to downloads/ directory - Updated all build scripts to reference new directory structure - Created comprehensive PROJECT_STRUCTURE.md documentation - Added DEVELOPMENT_GUIDE.md as main entry point - Improved separation of concerns and maintainability - Follows standard open source project conventions
242 lines
6.2 KiB
Bash
Executable File
242 lines
6.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# BBeOS UI Build Script
|
|
# Builds UI components and integrates them into the system
|
|
|
|
set -e
|
|
|
|
echo "Building BBeOS UI components..."
|
|
|
|
# Configuration
|
|
UI_DIR="src/ui"
|
|
BUILD_DIR="build/ui"
|
|
ROOTFS_DIR="rootfs"
|
|
|
|
# Set up environment
|
|
export ARCH=arm
|
|
export CROSS_COMPILE=arm-linux-gnueabihf-
|
|
|
|
# Check for required tools
|
|
check_dependencies() {
|
|
echo "Checking build dependencies..."
|
|
|
|
# Check for cross-compiler
|
|
if ! command -v arm-linux-gnueabihf-gcc &> /dev/null; then
|
|
echo "Error: ARM cross-compiler not found"
|
|
echo "Please install: sudo apt-get install gcc-arm-linux-gnueabihf"
|
|
exit 1
|
|
fi
|
|
|
|
# Check for required libraries (development headers)
|
|
echo "Note: Wayland, wlroots, Cairo, and Pango development libraries are required"
|
|
echo "These will need to be cross-compiled for ARM or installed in the target system"
|
|
}
|
|
|
|
# Create build directory
|
|
setup_build() {
|
|
echo "Setting up build directory..."
|
|
rm -rf $BUILD_DIR
|
|
mkdir -p $BUILD_DIR
|
|
|
|
# Copy UI source to build directory
|
|
cp -r $UI_DIR/. $BUILD_DIR/
|
|
}
|
|
|
|
# Build UI components
|
|
build_ui() {
|
|
echo "Building UI components..."
|
|
cd $BUILD_DIR
|
|
|
|
# Build compositor
|
|
echo "Building Q20 compositor..."
|
|
if [ -f "compositor/q20-compositor.c" ]; then
|
|
# Note: This will fail without wlroots headers, but we'll create a stub
|
|
echo "Creating compositor stub (requires wlroots for full build)..."
|
|
cat > compositor/q20-compositor-stub.c << 'EOF'
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
printf("Q20 Compositor (stub)\n");
|
|
printf("This is a placeholder for the Wayland compositor\n");
|
|
printf("Full implementation requires wlroots library\n");
|
|
return 0;
|
|
}
|
|
EOF
|
|
arm-linux-gnueabihf-gcc -o compositor/q20-compositor compositor/q20-compositor-stub.c
|
|
else
|
|
echo "Warning: Compositor source not found"
|
|
fi
|
|
|
|
# Build home screen application
|
|
echo "Building home screen application..."
|
|
if [ -f "applications/home-screen.c" ]; then
|
|
# Note: This will fail without Cairo headers, but we'll create a stub
|
|
echo "Creating home screen stub (requires Cairo for full build)..."
|
|
cat > applications/home-screen-stub.c << 'EOF'
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
printf("Q20 Home Screen (stub)\n");
|
|
printf("This is a placeholder for the home screen application\n");
|
|
printf("Full implementation requires Cairo and Wayland libraries\n");
|
|
return 0;
|
|
}
|
|
EOF
|
|
arm-linux-gnueabihf-gcc -o applications/home-screen applications/home-screen-stub.c
|
|
else
|
|
echo "Warning: Home screen source not found"
|
|
fi
|
|
|
|
cd ..
|
|
}
|
|
|
|
# Create UI assets
|
|
create_assets() {
|
|
echo "Creating UI assets..."
|
|
mkdir -p $BUILD_DIR/assets
|
|
|
|
# Create basic theme configuration
|
|
cat > $BUILD_DIR/assets/theme.conf << 'EOF'
|
|
# BBeOS Theme Configuration
|
|
# BlackBerry Classic Q20 UI Theme
|
|
|
|
[colors]
|
|
background=#1a1a1a
|
|
foreground=#ffffff
|
|
accent=#0066cc
|
|
highlight=#3399ff
|
|
error=#cc3333
|
|
success=#33cc33
|
|
warning=#cc9933
|
|
|
|
[fonts]
|
|
default=Sans 12
|
|
title=Sans Bold 16
|
|
status=Sans 10
|
|
help=Sans 9
|
|
|
|
[layout]
|
|
status_bar_height=40
|
|
app_grid_size=4
|
|
app_icon_size=80
|
|
app_icon_spacing=20
|
|
EOF
|
|
|
|
# Create default wallpaper (simple pattern)
|
|
cat > $BUILD_DIR/assets/wallpaper.svg << 'EOF'
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<svg width="720" height="720" xmlns="http://www.w3.org/2000/svg">
|
|
<defs>
|
|
<pattern id="grid" width="20" height="20" patternUnits="userSpaceOnUse">
|
|
<path d="M 20 0 L 0 0 0 20" fill="none" stroke="#333333" stroke-width="1"/>
|
|
</pattern>
|
|
</defs>
|
|
<rect width="720" height="720" fill="#1a1a1a"/>
|
|
<rect width="720" height="720" fill="url(#grid)"/>
|
|
</svg>
|
|
EOF
|
|
|
|
echo "UI assets created"
|
|
}
|
|
|
|
# Install to rootfs
|
|
install_to_rootfs() {
|
|
echo "Installing UI components to rootfs..."
|
|
|
|
if [ ! -d "$ROOTFS_DIR" ]; then
|
|
echo "Creating rootfs directory..."
|
|
mkdir -p $ROOTFS_DIR
|
|
fi
|
|
|
|
# Create directory structure
|
|
mkdir -p $ROOTFS_DIR/usr/bin
|
|
mkdir -p $ROOTFS_DIR/usr/share/bbeos/ui
|
|
mkdir -p $ROOTFS_DIR/etc/bbeos
|
|
|
|
# Install binaries
|
|
if [ -f "$BUILD_DIR/compositor/q20-compositor" ]; then
|
|
cp $BUILD_DIR/compositor/q20-compositor $ROOTFS_DIR/usr/bin/
|
|
chmod +x $ROOTFS_DIR/usr/bin/q20-compositor
|
|
fi
|
|
|
|
if [ -f "$BUILD_DIR/applications/home-screen" ]; then
|
|
cp $BUILD_DIR/applications/home-screen $ROOTFS_DIR/usr/bin/
|
|
chmod +x $ROOTFS_DIR/usr/bin/home-screen
|
|
fi
|
|
|
|
# Install assets
|
|
if [ -d "$BUILD_DIR/assets" ]; then
|
|
cp -r $BUILD_DIR/assets/* $ROOTFS_DIR/usr/share/bbeos/ui/
|
|
fi
|
|
|
|
# Create UI startup script
|
|
cat > $ROOTFS_DIR/usr/bin/start-ui << 'EOF'
|
|
#!/bin/sh
|
|
|
|
# BBeOS UI Startup Script
|
|
# Starts the Q20 compositor and home screen
|
|
|
|
echo "Starting BBeOS UI..."
|
|
|
|
# Set up environment
|
|
export WAYLAND_DISPLAY=wayland-0
|
|
export XDG_RUNTIME_DIR=/tmp/runtime-root
|
|
|
|
# Create runtime directory
|
|
mkdir -p $XDG_RUNTIME_DIR
|
|
chmod 700 $XDG_RUNTIME_DIR
|
|
|
|
# Start compositor in background
|
|
echo "Starting Q20 compositor..."
|
|
q20-compositor &
|
|
COMPOSITOR_PID=$!
|
|
|
|
# Wait for compositor to start
|
|
sleep 2
|
|
|
|
# Start home screen
|
|
echo "Starting home screen..."
|
|
home-screen
|
|
|
|
# Cleanup
|
|
kill $COMPOSITOR_PID 2>/dev/null || true
|
|
echo "UI stopped"
|
|
EOF
|
|
chmod +x $ROOTFS_DIR/usr/bin/start-ui
|
|
|
|
echo "UI components installed to rootfs"
|
|
}
|
|
|
|
# Main build process
|
|
main() {
|
|
echo "=== BBeOS UI Build Process ==="
|
|
|
|
check_dependencies
|
|
setup_build
|
|
build_ui
|
|
create_assets
|
|
install_to_rootfs
|
|
|
|
echo ""
|
|
echo "=== UI Build Complete ==="
|
|
echo "Generated files:"
|
|
echo " - $BUILD_DIR/compositor/q20-compositor (stub)"
|
|
echo " - $BUILD_DIR/applications/home-screen (stub)"
|
|
echo " - $BUILD_DIR/assets/ (theme and assets)"
|
|
echo " - $ROOTFS_DIR/usr/bin/start-ui (startup script)"
|
|
echo ""
|
|
echo "Note: These are stub implementations."
|
|
echo "Full functionality requires:"
|
|
echo " - wlroots library (for compositor)"
|
|
echo " - Cairo and Pango libraries (for applications)"
|
|
echo " - Wayland development libraries"
|
|
echo ""
|
|
echo "To test on target hardware:"
|
|
echo " ./scripts/flash-boot.sh"
|
|
echo " Then run: start-ui"
|
|
}
|
|
|
|
# Run main function
|
|
main "$@" |