1
0
aseprite-flatpak-builder/com.aseprite.Aseprite.yaml

238 lines
9.8 KiB
YAML

# 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/
# Extract and install the bundled static libraries that Aseprite needs
- |
echo "Extracting and installing static libraries from Skia build..."
# Look for Freetype
if [ -f out/Release-x64/libfreetype.a ]; then
echo "Installing libfreetype.a from Skia build"
cp -f out/Release-x64/libfreetype.a /app/lib/
else
echo "libfreetype.a not found in Skia build output, checking third_party..."
find . -name "libfreetype.a" -exec cp -f {} /app/lib/ \; -print || echo "Failed to find libfreetype.a"
fi
# Look for Harfbuzz
if [ -f out/Release-x64/libharfbuzz.a ]; then
echo "Installing libharfbuzz.a from Skia build"
cp -f out/Release-x64/libharfbuzz.a /app/lib/
else
echo "libharfbuzz.a not found in Skia build output, checking third_party..."
find . -name "libharfbuzz.a" -exec cp -f {} /app/lib/ \; -print || echo "Failed to find libharfbuzz.a"
fi
# Look for WebP
if [ -f out/Release-x64/libwebp.a ]; then
echo "Installing libwebp.a from Skia build"
cp -f out/Release-x64/libwebp.a /app/lib/
else
echo "libwebp.a not found in Skia build output, checking third_party..."
find . -name "libwebp.a" -exec cp -f {} /app/lib/ \; -print || echo "Failed to find libwebp.a"
fi
# Look for JPEG
if [ -f out/Release-x64/libjpeg.a ]; then
echo "Installing libjpeg.a from Skia build"
cp -f out/Release-x64/libjpeg.a /app/lib/
else
echo "libjpeg.a not found in Skia build output, checking third_party..."
find . -name "libjpeg.a" -exec cp -f {} /app/lib/ \; -print || echo "Failed to find libjpeg.a"
fi
# Create symlinks for libraries that might have different names
echo "Creating symlinks for libraries with different names..."
(cd /app/lib && [ -f libjpeg.a ] && ln -sf libjpeg.a libjpeg-turbo.a || true)
# Create a pkgconfig directory to help CMake find our libraries
mkdir -p /app/lib/pkgconfig
# List installed libraries for debugging
echo "Installed static libraries in /app/lib:"
ls -la /app/lib/*.a || true
# 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
# Set library locations explicitly to avoid CMake warnings/errors
- -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
build-commands:
# Run the standard build from cmake-ninja
- ninja
# Add additional step to copy all Skia's static libraries that might be needed
- |
echo "Verifying libraries are available before install..."
if [ ! -f /app/lib/libfreetype.a ]; then
echo "ERROR: libfreetype.a is missing"
exit 1
fi
if [ ! -f /app/lib/libharfbuzz.a ]; then
echo "ERROR: libharfbuzz.a is missing"
exit 1
fi
# Install the build artifacts using standard ninja install
- DESTDIR=/app ninja install
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