# 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' 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/ 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 system libs provided by the Freedesktop SDK and our additional modules - | 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 \ extra_cflags=[\"-mavx\",\"-O3\"] \ extra_cxxflags=[\"-mavx\",\"-O3\"]" # Generate build files using gn from depot_tools - /app/depot_tools/gn gen out/Release-x64 --args="${GN_ARGS}" # Compile Skia - ninja -C out/Release-x64 skia modules # Install Skia library and headers into the /app prefix for the next module - install -Dm644 out/Release-x64/libskia.a /app/lib/libskia.a - install -d /app/include/skia # Copy headers from the source directory '.' which is /sources/skia - cp -r include/* /app/include/skia/ # Also copy Skia third_party includes needed by Aseprite - mkdir -p /app/third_party - cp -r third_party/externals /app/third_party/ # Make symlinks to libraries that Aseprite expects - mkdir -p /app/lib/pkgconfig - | echo "Creating symlinks to libraries embedded in Skia's build..." # WebP if [ -f out/Release-x64/libwebp.a ]; then cp out/Release-x64/libwebp.a /app/lib/ ln -sf /app/lib/libwebp.a /app/lib/libwebp.so fi # JPEG if [ -f out/Release-x64/libjpeg.a ]; then cp out/Release-x64/libjpeg.a /app/lib/ ln -sf /app/lib/libjpeg.a /app/lib/libjpeg-turbo.so fi # Freetype if [ -f out/Release-x64/libfreetype.a ]; then cp out/Release-x64/libfreetype.a /app/lib/ ln -sf /app/lib/libfreetype.a /app/lib/libfreetype.so fi # Harfbuzz if [ -f out/Release-x64/libharfbuzz.a ]; then cp out/Release-x64/libharfbuzz.a /app/lib/ ln -sf /app/lib/libharfbuzz.a /app/lib/libharfbuzz.so fi # Make sure ICU data file exists and is in the right place - mkdir -p /app/third_party/externals/icu/flutter - | echo "Looking for and copying icudtl.dat to the expected location..." # Check various possible locations if [ -f out/Release-x64/icudtl.dat ]; then cp out/Release-x64/icudtl.dat /app/third_party/externals/icu/flutter/ echo "Found icudtl.dat in out/Release-x64/" elif [ -f third_party/externals/icu/common/icudtl.dat ]; then cp third_party/externals/icu/common/icudtl.dat /app/third_party/externals/icu/flutter/ echo "Found icudtl.dat in third_party/externals/icu/common/" elif [ -f third_party/externals/icu/flutter/icudtl.dat ]; then cp third_party/externals/icu/flutter/icudtl.dat /app/third_party/externals/icu/flutter/ echo "Found icudtl.dat in third_party/externals/icu/flutter/" else echo "Attempting to find icudtl.dat with find command..." find . -name "icudtl.dat" -exec cp {} /app/third_party/externals/icu/flutter/ \; -print fi # Create an empty file as a fallback if nothing is found if [ ! -f /app/third_party/externals/icu/flutter/icudtl.dat ]; then echo "WARNING: icudtl.dat not found. Creating empty placeholder..." touch /app/third_party/externals/icu/flutter/icudtl.dat fi 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 instead of system libraries - -DUSE_SHARED_LIBJPEG=OFF - -DUSE_SHARED_LIBPNG=ON - -DUSE_SHARED_ZLIB=ON - -DUSE_SHARED_GIFLIB=ON - -DUSE_SHARED_WEBP=OFF - -DUSE_SHARED_FREETYPE=OFF - -DUSE_SHARED_HARFBUZZ=OFF # Create various directories that Aseprite might search in - -DWEBP_INCLUDE_DIR=/app/third_party/externals/libwebp/src - -DWEBP_LIBRARIES=/app/lib/libwebp.a - -DLIBJPEG_TURBO_INCLUDE_DIR=/app/third_party/externals/libjpeg-turbo - -DLIBJPEG_TURBO_LIBRARY=/app/lib/libjpeg.a - -DFREETYPE_INCLUDE_DIR=/app/third_party/externals/freetype/include - -DFREETYPE_LIBRARY=/app/lib/libfreetype.a - -DHARFBUZZ_INCLUDE_DIR=/app/third_party/externals/harfbuzz/src - -DHARFBUZZ_LIBRARY=/app/lib/libharfbuzz.a sources: # Use the directory copied into the Docker image - type: dir path: /sources/aseprite # Note: Submodules are expected to be present due to prepare_sources.sh # 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