# Flatpak manifest for Aseprite # Build using: flatpak-builder --force-clean build-dir com.aseprite.Aseprite.yaml --repo=repo # Bundle using: flatpak build-bundle repo aseprite.flatpak com.aseprite.Aseprite app-id: com.aseprite.Aseprite runtime: org.freedesktop.Platform runtime-version: '23.08' sdk: org.freedesktop.Sdk command: aseprite finish-args: # Graphics and display - --share=ipc - --socket=x11 - --socket=wayland - --device=dri # Filesystem access (adjust as needed, 'home' is broad) - --filesystem=home # Needed for Skia/fontconfig - --filesystem=xdg-config/fontconfig:ro # Allow talking to portals (for file dialogs etc.) - --talk-name=org.freedesktop.portal.Desktop - --talk-name=org.freedesktop.portal.Documents - --talk-name=org.freedesktop.portal.FileChooser # Add separate state directory to force consistent cache behavior build-options: env: FLATPAK_BUILDER_BUILDDIR: "/tmp/flatpak-builder-dir" cleanup: - /include - /lib/pkgconfig - /man - /share/man - /share/pkgconfig - '*-debuginfo*' - '*.la' # Remove files that cause cleanup errors - /third_party/externals/emsdk modules: # 1. Depot Tools (Needed for Skia build) - name: depot_tools buildsystem: simple build-commands: # depot_tools doesn't need building, just needs to be present. # Install it into /app/depot_tools within the build environment. # The source '.' is now /sources/depot_tools - install -d /app/depot_tools - cp -r ./* /app/depot_tools/ - chmod -R u+rX /app/depot_tools sources: # Use the directory copied into the Docker image - type: dir path: /sources/depot_tools # 2. Skia (Aseprite Dependency) - name: skia buildsystem: simple build-options: # Ensure depot_tools is accessible during build prepend-path: /app/depot_tools env: # Needed to locate some of the dependencies we added PKG_CONFIG_PATH: /app/lib/pkgconfig:/usr/lib/pkgconfig build-commands: # Prepare GN arguments # Using Skia's bundled libs for better compatibility - | echo "Generating Skia build configuration..." GN_ARGS="is_debug=false \ is_official_build=true \ skia_use_system_expat=true \ skia_use_system_icu=true \ skia_use_system_libjpeg_turbo=false \ skia_use_system_libpng=true \ skia_use_system_libwebp=false \ skia_use_system_zlib=true \ skia_use_sfntly=false \ skia_use_freetype=true \ skia_use_harfbuzz=true \ skia_pdf_subset_harfbuzz=true \ skia_use_system_freetype2=false \ skia_use_system_harfbuzz=false \ skia_enable_fontmgr_empty=false \ skia_enable_fontmgr_android=false \ skia_enable_fontmgr_win=false \ skia_enable_fontmgr_win_gdi=false \ skia_enable_fontmgr_custom_directory=false \ skia_enable_fontmgr_custom_embedded=false \ skia_enable_fontmgr_fontconfig=true \ skia_enable_pdf=false \ skia_enable_tools=false \ extra_cflags=[\"-mavx\",\"-O3\"] \ extra_cxxflags=[\"-mavx\",\"-O3\"]" # Generate build files using gn from depot_tools - echo "Running GN to generate Ninja build files..." - /app/depot_tools/gn gen out/Release-x64 --args="${GN_ARGS}" # Compile Skia (only the necessary targets) - echo "Building Skia with Ninja (this may take a while)..." - ninja -C out/Release-x64 skia modules # Create directory structure for Aseprite - echo "Installing Skia libraries and headers..." - install -d /app/lib - install -d /app/include/skia - install -d /app/third_party/externals # Install Skia library - install -m644 out/Release-x64/libskia.a /app/lib/libskia.a # Copy headers - cp -r include/* /app/include/skia/ # Extract and install libraries that Aseprite needs - | echo "Extracting and installing bundled libraries..." # Find and install freetype for lib_file in $(find out/Release-x64 -name "libfreetype.a" 2>/dev/null || echo ""); do echo "Installing libfreetype.a from $lib_file" install -m644 "$lib_file" /app/lib/libfreetype.a break done # Find and install harfbuzz for lib_file in $(find out/Release-x64 -name "libharfbuzz.a" 2>/dev/null || echo ""); do echo "Installing libharfbuzz.a from $lib_file" install -m644 "$lib_file" /app/lib/libharfbuzz.a break done # Find and install webp for lib_file in $(find out/Release-x64 -name "libwebp.a" 2>/dev/null || echo ""); do echo "Installing libwebp.a from $lib_file" install -m644 "$lib_file" /app/lib/libwebp.a break done # Find and install jpeg for lib_file in $(find out/Release-x64 -name "libjpeg.a" 2>/dev/null || echo ""); do echo "Installing libjpeg.a from $lib_file" install -m644 "$lib_file" /app/lib/libjpeg.a break done # Create symlinks for libraries that might have different names (cd /app/lib && [ -f libjpeg.a ] && ln -sf libjpeg.a libjpeg-turbo.a || true) # Copy necessary include directories from third_party - | echo "Copying third_party includes needed by Aseprite..." # Instead of copying the whole externals directory (which is large and causes cleanup issues) # Copy only the specific libraries that Aseprite needs mkdir -p /app/third_party/externals/freetype/include mkdir -p /app/third_party/externals/harfbuzz/src mkdir -p /app/third_party/externals/libwebp/src mkdir -p /app/third_party/externals/libjpeg-turbo mkdir -p /app/third_party/externals/icu/flutter # Copy only the necessary include files if [ -d third_party/externals/freetype/include ]; then cp -r third_party/externals/freetype/include/* /app/third_party/externals/freetype/include/ fi if [ -d third_party/externals/harfbuzz/src ]; then cp -r third_party/externals/harfbuzz/src/*.h /app/third_party/externals/harfbuzz/src/ fi if [ -d third_party/externals/libwebp/src ]; then cp -r third_party/externals/libwebp/src/webp /app/third_party/externals/libwebp/src/ fi if [ -d third_party/externals/libjpeg-turbo ]; then cp -r third_party/externals/libjpeg-turbo/*.h /app/third_party/externals/libjpeg-turbo/ fi # Find and copy the ICU data file - | echo "Looking for ICU data file..." # Check for icudtl.dat in various places for icu_file in $(find . -name "icudtl.dat" 2>/dev/null || echo ""); do echo "Found ICU data file at $icu_file" mkdir -p /app/third_party/externals/icu/flutter cp "$icu_file" /app/third_party/externals/icu/flutter/icudtl.dat break done # Create an empty placeholder if not found if [ ! -f /app/third_party/externals/icu/flutter/icudtl.dat ]; then echo "ICU data file not found, creating placeholder..." touch /app/third_party/externals/icu/flutter/icudtl.dat fi # List what we've installed for debugging echo "Contents of /app/lib:" ls -la /app/lib echo "Skia installation complete." sources: # Use the directory copied into the Docker image - type: dir path: /sources/skia # 3. Aseprite - name: aseprite # Use cmake-ninja buildsystem for convenience buildsystem: cmake-ninja # Set build directory outside of source builddir: true # CMake configuration options config-opts: - -DCMAKE_BUILD_TYPE=RelWithDebInfo # Add optimization flags as separate options - -DCMAKE_CXX_FLAGS=-mavx - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O3 # Use Skia backend - -DLAF_BACKEND=skia # Point to the Skia installed in the /app prefix by the previous module - -DSKIA_DIR=/app - -DSKIA_LIBRARY_DIR=/app/lib - -DSKIA_LIBRARY=/app/lib/libskia.a # Use Skia's bundled libraries (static) or SDK-provided shared libraries - -DUSE_SHARED_JPEG=OFF # Bundled static with Skia - -DUSE_SHARED_LIBPNG=ON # Provided by SDK (shared) - -DUSE_SHARED_ZLIB=ON # Provided by SDK (shared) - -DUSE_SHARED_GIFLIB=ON # Provided by SDK (shared) - -DUSE_SHARED_WEBP=OFF # Bundled static with Skia - -DUSE_SHARED_FREETYPE=OFF # Bundled static with Skia - -DUSE_SHARED_HARFBUZZ=OFF # Bundled static with Skia # Set library locations explicitly for bundled static libs # CMake standard variable names (often plural for DIRS/LIBRARIES) - -DWebP_INCLUDE_DIRS=/app/third_party/externals/libwebp/src - -DWebP_LIBRARIES=/app/lib/libwebp.a - -DJPEG_INCLUDE_DIRS=/app/third_party/externals/libjpeg-turbo - -DJPEG_LIBRARIES=/app/lib/libjpeg.a - -DFreetype_INCLUDE_DIRS=/app/third_party/externals/freetype/include - -DFreetype_LIBRARIES=/app/lib/libfreetype.a - -DHarfBuzz_INCLUDE_DIRS=/app/third_party/externals/harfbuzz/src - -DHarfBuzz_LIBRARIES=/app/lib/libharfbuzz.a build-commands: # Standard ninja build - ninja # Verify libraries exist before install - | echo "Verifying required libraries..." if [ ! -f /app/lib/libskia.a ]; then echo "ERROR: libskia.a missing"; exit 1; fi if [ ! -f /app/lib/libfreetype.a ]; then echo "ERROR: libfreetype.a missing"; exit 1; fi if [ ! -f /app/lib/libharfbuzz.a ]; then echo "ERROR: libharfbuzz.a missing"; exit 1; fi echo "All required libraries present." # Install with ninja - DESTDIR=/app ninja install sources: # Use the directory copied into the Docker image - type: dir path: /sources/aseprite # Install desktop file and icon after build/install post-install: # Install files from the source directory (/sources/aseprite) - install -Dm644 /sources/aseprite/data/linux/aseprite.desktop /app/share/applications/com.aseprite.Aseprite.desktop # Install icon (using the 256px version) - install -Dm644 /sources/aseprite/data/icons/ase256.png /app/share/icons/hicolor/256x256/apps/com.aseprite.Aseprite.png # Update caches (optional but recommended) - update-desktop-database -q /app/share/applications - gtk-update-icon-cache -f -t /app/share/icons/hicolor || true