forked from akippnn/docker-aseprite-linux
feat: Implement Flatpak build system using flatpak-builder in Docker
This commit replaces the previous multi-distribution Docker build system with a unified Flatpak build process executed inside a Docker container. This is the intended final architecture for building Aseprite bundles.
**Key Changes:**
* **Transition to Flatpak:** The core build logic now uses `flatpak-builder` and a Flatpak manifest (`com.aseprite.Aseprite.yaml`) to compile Aseprite and its dependencies against a standard Flatpak SDK runtime.
* **Unified Docker Environment:** Replaced distribution-specific `Dockerfile.<distro>` files with a single `Dockerfile` that sets up a consistent environment containing `flatpak-builder` and the necessary Flatpak SDK.
* **Simplified Makefile:** Removed OS detection logic and multi-distro targets. The Makefile now orchestrates:
1. Running `prepare_sources.sh` on the host (still responsible for reliable source fetching/syncing).
2. Building the single Flatpak builder Docker image.
3. Running `flatpak-builder` inside a *privileged* container (required for `flatpak-builder` sandboxing) to perform the actual build.
4. Running `flatpak build-bundle` inside the container.
5. Extracting the final `.flatpak` bundle from the container to `./target/aseprite.flatpak`.
* **Updated .gitignore:** Added `build/`, `target/`, `*.flatpak`, and `*.log` to ignore Flatpak build directories, output bundles, and logs. Removed the old `dependencies` ignore pattern.
* **Prepare Sources Update:** Modified `prepare_sources.sh` to explicitly initialize `depot_tools` on the host, as this is required before sources are copied into the Flatpak build environment for `gn` usage.
* **Removal of Old Files:** Deleted `Dockerfile.<distro>`, `Dockerfile.debian`, `Dockerfile.fedora`, `Dockerfile.arch` (multi-distro Dockerfiles), and the original generic `Dockerfile` and `docker-compose.yml`.
**Rationale:**
This refactor moves to the planned final architecture. Building within a Flatpak SDK provides a highly consistent environment independent of the host Linux distribution. The output is a portable `.flatpak` bundle, simplifying distribution and runtime compatibility compared to dynamically linking against varied host libraries. While `prepare_sources.sh` on the host still handles the initial (and potentially rate-limited) source fetching, the subsequent build process is significantly standardized and more reliable.
This architecture is now the **forward-maintained** build method.
This commit is contained in:
@@ -37,8 +37,8 @@ print_usage() {
|
||||
}
|
||||
|
||||
_CURRENT_STEP=0
|
||||
_TOTAL_STEPS=${#REPOS[@]} # Number of repositories +1 for Skia sync
|
||||
_TOTAL_STEPS=$((_TOTAL_STEPS + 1))
|
||||
_TOTAL_STEPS=${#REPOS[@]} # Number of repositories
|
||||
_TOTAL_STEPS=$((_TOTAL_STEPS + 2)) # +1 for initializing depot_tools, +1 for Skia sync
|
||||
|
||||
print_step() {
|
||||
_CURRENT_STEP=$((_CURRENT_STEP + 1))
|
||||
@@ -265,6 +265,29 @@ for repo_info in "${REPOS[@]}"; do
|
||||
fi
|
||||
done
|
||||
|
||||
# Initialize depot_tools after all repositories are processed
|
||||
print_step "Initializing depot_tools"
|
||||
if [[ -n "$DEPOT_TOOLS_DIR" && -d "$DEPOT_TOOLS_DIR" ]]; then
|
||||
print_info "Running depot_tools initialization..."
|
||||
# Add depot_tools to PATH for proper initialization
|
||||
export PATH="${DEPOT_TOOLS_DIR}:${PATH}"
|
||||
|
||||
# Check if initialization was already done
|
||||
if [[ ! -f "${DEPOT_TOOLS_DIR}/python3_bin_reldir.txt" ]]; then
|
||||
# Run ensure_bootstrap to initialize depot_tools
|
||||
if (cd "$DEPOT_TOOLS_DIR" && ./ensure_bootstrap); then
|
||||
print_success "depot_tools initialized successfully."
|
||||
else
|
||||
print_error "Failed to initialize depot_tools. Build may fail."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
print_info "depot_tools already initialized (python3_bin_reldir.txt exists)."
|
||||
fi
|
||||
else
|
||||
print_error "depot_tools directory not found or not processed correctly. Cannot initialize."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Sync Skia dependencies locally with retry logic (after Skia repo is processed)
|
||||
# Find Skia dir again (could be improved by storing dirs in an associative array if using Bash 4+)
|
||||
|
||||
Reference in New Issue
Block a user