1
0
aki b0479bfbf4 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.
2025-05-06 17:02:01 +08:00

43 lines
1.3 KiB
Docker

# Use Debian 12 Slim as the base image
FROM debian:12-slim
# Set environment variables for non-interactive install
ENV DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC
# Install necessary tools: Flatpak, builder, git, etc.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
flatpak \
flatpak-builder \
git \
curl \
unzip \
ca-certificates \
elfutils \
# Build dependencies for system libraries
build-essential \
ninja-build \
pkg-config \
python3 \
# Clean up apt cache
&& rm -rf /var/lib/apt/lists/*
# Add Flathub remote and install the Freedesktop SDK and Platform
# Using 23.08 version as specified in the manifest
RUN flatpak remote-add --system --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo && \
flatpak install --system --noninteractive flathub org.freedesktop.Sdk//23.08 && \
flatpak install --system --noninteractive flathub org.freedesktop.Platform//23.08
# Set working directory for the build process
WORKDIR /build
# Create cache-friendly directory structure
# This creates a clear layer separation for better Docker/Flatpak caching
RUN mkdir -p /sources /build/cache /build/build-dir /build/repo
# Copy the Flatpak manifest into the build directory
COPY com.aseprite.Aseprite.yaml .
# Default command for interactive use
CMD ["bash"]