Gnome 42 SDK Snap as part of the gnome extension issue with g-ir-scanner

I’m looking at porting the GIMP Snap to core22 for the development release (the in development branch aimed at producing GIMP 3 eventually). The build for babl is failing as below:

2022-07-08 19:05:45.176 :: 2022-07-08 18:05:44.409 :: [174/269] Generating babl/Babl-0.1.gir with a custom command
2022-07-08 19:05:45.176 :: 2022-07-08 18:05:44.409 :: FAILED: babl/Babl-0.1.gir
2022-07-08 19:05:45.176 :: 2022-07-08 18:05:44.409 :: /snap/gnome-42-2204-sdk/current/usr/bin/g-ir-scanner --no-libtool --namespace=Babl --nsversion=0.1 --warn-all --output babl/Babl-0.1.gir --c-include=babl.h '--identifier-filter-cmd=/usr/bin/python3 /root/parts/babl/src/babl/identfilter.py' -DBABL_IS_BEING_COMPILED -I/root/parts/babl/src/babl -I/root/parts/babl/build/babl -I/root/parts/babl/src/. -I/root/parts/babl/build/. -I/root/parts/babl/src/babl/base/. -I/root/parts/babl/build/babl/base/. --filelist=/root/parts/babl/build/babl/libbabl-0.1.so.0.191.1.p/Babl_0.1_gir_filelist --cflags-begin -I/root/parts/babl/src/. -I/root/parts/babl/build/. -I/root/parts/babl/src/babl/base/. -I/root/parts/babl/build/babl/base/. -I/snap/gnome-42-2204-sdk/current/usr/include -I/snap/gnome-42-2204-sdk/current/usr/include/gobject-introspection-1.0 -I/snap/gnome-42-2204-sdk/current/usr/include/glib-2.0 -I/snap/gnome-42-2204-sdk/current/usr/lib/x86_64-linux-gnu/glib-2.0/include --cflags-end --add-include-path=/snap/gnome-42-2204-sdk/current/usr/share/gir-1.0 -L/root/parts/babl/build/babl --library babl-0.1 -L/snap/gnome-42-2204-sdk/current/usr/lib/x86_64-linux-gnu -L/root/parts/babl/install/lib -L/root/parts/babl/install/usr/lib -L/root/parts/babl/install/lib/x86_64-linux-gnu -L/root/parts/babl/install/usr/lib/x86_64-linux-gnu -lm -ldl -L/snap/gnome-42-2204-sdk/current/usr/lib/x86_64-linux-gnu -llcms2 -lgirepository-1.0 -lgobject-2.0 -lglib-2.0
2022-07-08 19:05:45.176 :: 2022-07-08 18:05:44.409 :: Traceback (most recent call last):
2022-07-08 19:05:45.176 :: 2022-07-08 18:05:44.409 ::   File "/snap/gnome-42-2204-sdk/current/usr/bin/g-ir-scanner", line 94, in <module>
2022-07-08 19:05:45.176 :: 2022-07-08 18:05:44.409 ::     from giscanner.utils import dll_dirs
2022-07-08 19:05:45.176 :: 2022-07-08 18:05:44.409 :: ModuleNotFoundError: No module named 'giscanner

I’m not sure if this is an issue with the gnome-42-2204-sdk snap, or if my snapcraft.yaml has a mistake in it. This is my snapcraft.yaml as it stands now:

snapcraft.yaml
name: gimp
version: '2.99.10'
summary: GNU Image Manipulation Program
description: |
  Whether you are a graphic designer, photographer, illustrator, or scientist,
  GIMP provides you with sophisticated tools to get your job done. You can
  further enhance your productivity with GIMP thanks to many customization
  options and 3rd party plugins.

grade: stable
confinement: strict
base: core22
compression: lzo

architectures:
- build-on: amd64
- build-on: arm64
- build-on: armhf

layout:
  /etc/gimp:
    bind: $SNAP/etc/gimp
  /etc/ld.so.cache:
    bind-file: $SNAP_DATA/etc/ld.so.cache
  /usr/lib/$CRAFT_ARCH_TRIPLET/babl-0.1:
    bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/babl-0.1
  /usr/lib/$CRAFT_ARCH_TRIPLET/gegl-0.4:
    bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/gegl-0.4
  # /usr/lib/$CRAFT_ARCH_TRIPLET/darktable:
  #   bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/darktable
  /usr/lib/$CRAFT_ARCH_TRIPLET/evince/4/backends:
    bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/evince/4/backends
  /usr/lib/gimp:
    bind: $SNAP/usr/lib/gimp
  /usr/lib/python3.8:
    bind: $SNAP/usr/lib/python3.8
  /usr/lib/gvfs:
    bind: $SNAP/usr/lib/gvfs
  /usr/lib/$CRAFT_ARCH_TRIPLET/gvfs:
    bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/gvfs
  /usr/libexec:
    bind: $SNAP/usr/libexec
  /usr/share/color:
    bind: $SNAP/usr/share/color
  # /usr/share/darktable:
  #   bind: $SNAP/usr/share/darktable
  /usr/share/ghostscript:
    bind: $SNAP/usr/share/ghostscript
  /usr/share/gimp:
    bind: $SNAP/usr/share/gimp
  /usr/share/gvfs:
    bind: $SNAP/usr/share/gvfs
  /usr/share/lensfun:
    bind: $SNAP/usr/share/lensfun
  /usr/share/locale:
    bind: $SNAP/usr/share/locale
  /usr/share/mypaint-data:
    bind: $SNAP/usr/share/mypaint-data

# plugs:
  # color-profiles:
  #   interface: system-files
  #   read:
  #   - /usr/share/color/icc

slots:
  dbus-gimp:
    interface: dbus
    bus: session
    name: org.gimp.GIMP.UI

environment:
  GTK_USE_PORTAL: '1'
  GIMP2_LOCALEDIR: $SNAP/usr/share/locale
  LD_LIBRARY_PATH: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/lapack:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/blas
  PYTHONPATH: $SNAP/usr/lib/python3.8:$SNAP/usr/lib/python3.8/site-packages:$PYTHONPATH

apps:
  gimp:
    command: usr/bin/gimp
    extensions: [gnome]
    desktop: usr/share/applications/gimp.desktop
    common-id: org.gimp.GIMP
    slots:
    - dbus-gimp
    plugs:
    - cups-control
    - browser-support
    - desktop
    - desktop-legacy
    - gsettings
    - home
    - network
    - opengl
    - removable-media
    - unity7
    - wayland
    - x11

  # darktable:
  #   command: usr/bin/darktable
  #   command-chain: [snap/command-chain/desktop-launch]
  #   desktop: usr/share/applications/darktable.desktop
  #   common-id: darktable.desktop
  #   plugs:
  #   - cups-control
  #   - desktop
  #   - desktop-legacy
  #   - gsettings
  #   - home
  #   - network
  #   - opengl
  #   - removable-media
  #   - unity7
  #   - wayland
  #   - x11

build-snaps:
- gnome-42-2204-sdk/latest/edge
- gnome-42-2204/latest/edge

parts:
  fix-pkgconfig-files:
    plugin: nil
    override-build: |
      cat <<'EOF' > $CRAFT_PART_INSTALL/fix-pkgconfig-files.sh
      for pcfile in $CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig/*.pc $CRAFT_PART_INSTALL/usr/lib/pkgconfig/*.pc $CRAFT_PART_INSTALL/usr/local/lib/$CRAFT_ARCH_TRIPLET/pkgconfig/*.pc $CRAFT_PART_INSTALL/usr/local/lib/pkgconfig/*.pc; do
        sed -i -E "s~^((include|lib)dir=)/usr(/local)?~\1\\\${prefix}~g" $pcfile || true
        sed -i -E "s~^((exec_)?prefix=)(/usr(/local)?)~\1/\3~" $pcfile || true
      done
      EOF
      chmod +x $CRAFT_PART_INSTALL/fix-pkgconfig-files.sh
    prime:
    - -*

  fix-symlinks:
    # REF: https://unix.stackexchange.com/questions/100918/convert-absolute-symlink-to-relative-symlink-with-simple-linux-command
    plugin: nil
    override-build: |
      cat <<'EOF' > $CRAFT_PART_INSTALL/fix-symlinks.sh
      cd $CRAFT_PART_INSTALL
      find . -lname '/*' |
      while read l ; do
        echo ln -sf $(echo $(echo $l | sed 's|/[^/]*|/..|g')$(readlink $l) | sed 's/.....//') $l
      done |
      sh
      EOF
      chmod +x $CRAFT_PART_INSTALL/fix-symlinks.sh
    prime:
    - -*

  # https://download.gimp.org/mirror/pub/babl
  babl:
    after:
    - fix-pkgconfig-files
    plugin: meson
    source: https://download.gimp.org/mirror/pub/babl/0.1/babl-0.1.92.tar.xz
    source-checksum: sha256/f667735028944b6375ad18f160a64ceb93f5c7dccaa9d8751de359777488a2c1
    meson-parameters:
    - --prefix=/usr
    - --buildtype=release
    - -Db_lto=true
    - -Dwith-docs=false
    build-environment:
    - to armhf:
      - CFLAGS: -Ofast -g -pipe -mfpu=neon
      - CXXFLAGS: -Ofast -g -pipe -mfpu=neon
      - LDFLAGS: -mfpu=neon
    - else:
      - CFLAGS: -Ofast -g -pipe
      - CXXFLAGS: -Ofast -g -pipe
    override-pull: |
      craftctl default
      sed -i 's/not stable, Description:/not stable, description:/' meson.build
    override-build: |
      # LTO fails on armhf
      LTO=-Db_lto=true
      if [ $CRAFT_ARCH_TRIPLET = "arm-linux-gnueabihf" ]; then
        LTO=-Db_lto=false
      fi

      meson \
        --prefix=/usr \
        --buildtype=release \
        -Dwith-docs=false \
        $LTO \
        $CRAFT_PART_SRC
      ninja
      DESTDIR=$CRAFT_PART_INSTALL ninja install
      $CRAFT_STAGE/fix-pkgconfig-files.sh
    build-packages:
    - git
    - gobject-introspection
    - libgirepository1.0-dev
    - liblcms2-dev
    - librsvg2-bin
    - librsvg2-dev
    - meson
    - valac
    - w3m
    stage-packages:
    - gobject-introspection
    - libgirepository-1.0-1
    - liblcms2-2
    - librsvg2-2
    prime:
    - -usr/include
    - -usr/lib/pkgconfig
    - -**/*.la

  # https://download.gimp.org/mirror/pub/gegl
  gegl:
    after:
    - babl
    - fix-pkgconfig-files
    source: https://download.gimp.org/mirror/pub/gegl/0.4/gegl-0.4.36.tar.xz
    source-checksum: sha256/6fd58a0cdcc7702258adaeffb573a389228ae8f0eff47578efda2309b61b2ca6
    plugin: meson
    meson-parameters:
    - --prefix=/usr
    - --buildtype=release
    - -Dworkshop=true
    - -Db_lto=true
    build-environment:
    - to armhf:
      - CFLAGS: -Ofast -g -pipe -mfpu=neon
      - CXXFLAGS: -Ofast -g -pipe -mfpu=neon
      - LDFLAGS: -mfpu=neon
    - else:
      - CFLAGS: -Ofast -g -pipe
      - CXXFLAGS: -Ofast -g -pipe
    - GIO_MODULE_DIR: $CRAFT_STAGE/usr/lib/gio/modules
    - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/usr/local/share:/usr/share
    override-build: |
      # LTO fails on armhf
      LTO=-Db_lto=true
      if [ $CRAFT_ARCH_TRIPLET = "arm-linux-gnueabihf" ]; then
        LTO=-Db_lto=false
      fi

      meson \
        --prefix=/usr \
        --buildtype=release \
        -Dworkshop=true \
        $LTO \
        $CRAFT_PART_SRC
      ninja
      DESTDIR=$CRAFT_PART_INSTALL ninja install
      $CRAFT_STAGE/fix-pkgconfig-files.sh
    build-packages:
    - gobject-introspection
    - libavcodec-dev
    - libavformat-dev
    - libavutil-dev
    - libcairo2-dev
    - libexiv2-dev
    - libfftw3-dev
    - libgdk-pixbuf2.0-dev
    - libgexiv2-dev
    - libgirepository1.0-dev
    - libglib2.0-dev
    - libglu1-mesa-dev
    - libgraphviz-dev
    - libgs-dev
    - libjpeg-dev
    - libjson-glib-dev
    - liblcms2-dev
    - liblensfun-dev
    - libluajit-5.1-dev
    - libmaxflow-dev
    - libopenexr-dev
    - libopenjp2-7-dev
    - libpango1.0-dev
    - libpng-dev
    - libpoppler-glib-dev
    - libraw-dev
    - librsvg2-dev
    - libsdl2-dev
    - libspiro-dev
    - libsuitesparse-dev
    - libswscale-dev
    - libtiff5-dev
    - libv4l-dev
    - libwebp-dev
    - meson
    - pkg-config
    - python-gi-dev
    - valac
    stage-packages:
    - libamd2
    - libavcodec58
    - libavformat58
    - libavutil56
    - libbtf1
    - libcairo2
    - libcamd2
    - libccolamd2
    - libcdt5
    - libcgraph6
    - libcholmod3
    - libcolamd2
    - libcxsparse3
    - libexiv2-27
    - libgdk-pixbuf2.0-0
    - libgexiv2-2
    - libgraphblas6
    - libgs9
    - libgvc6
    - libgvc6-plugins-gtk
    - libgvpr2
    - libjpeg-turbo8
    - libklu1
    - liblab-gamut1
    - liblapack3
    - liblcms2-2
    - libldl2
    - liblensfun1
    - libluajit-5.1-2
    - libmaxflow0
    - libopenexr25
    - libpathplan4
    - libpng16-16
    - libpoppler-glib8
    - libraw20
    - librbio2
    - librsvg2-2
    - libsdl2-2.0-0
    - libspiro1
    - libspqr2
    - libswscale5
    - libtiff5
    - libumfpack5
    - libv4l-0
    - libxdot4
    - python3-gi
    stage:
    - -**/*.la
    - -etc
    - -var/lib/ucf
    - -usr/sbin/update-mime
    - -usr/share/X11
    - -usr/share/alsa
    - -usr/share/applications
    - -usr/share/apport
    - -usr/share/apps
    - -usr/share/binfmts
    - -usr/share/bug
    - -usr/share/debhelper
    - -usr/share/doc
    - -usr/share/doc-base
    - -usr/share/fonts
    - -usr/share/glib-2.0
    - -usr/share/libdrm
    - -usr/share/libthai
    - -usr/share/lintian
    - -usr/share/locale
    - -usr/share/man
    - -usr/share/menu
    - -usr/share/mime
    - -usr/share/perl5
    - -usr/share/pixmaps
    - -usr/share/pkgconfig
    - -usr/share/python
    - -usr/share/xml
    prime:
    - -usr/include
    - -usr/lib/pkgconfig
    - -usr/share/vala

  libaom:
    after: [gegl]
    source: https://aomedia.googlesource.com/aom
    source-type: git
    plugin: cmake
    build-snaps: [cmake]
    build-environment:
    - to armhf:
      # LTO succeeds here, but breaks libheif build on armhf
      - CFLAGS: -Ofast -g -pipe -mfpu=neon
      - CXXFLAGS: -Ofast -g -pipe -mfpu=neon
      - LDFLAGS: -mfpu=neon
    - else:
      - CFLAGS: -Ofast -g -pipe -flto
      - CXXFLAGS: -Ofast -g -pipe -flto
      - LDFLAGS: -flto
    cmake-parameters:
    - -DCMAKE_BUILD_TYPE=Release
    - -DCMAKE_INSTALL_PREFIX=/usr
    - -DENABLE_DOCS=OFF
    - -DENABLE_EXAMPLES=OFF
    - -DENABLE_TESTDATA=OFF
    - -DENABLE_TESTS=OFF
    - -DCONFIG_PIC=1
    - -DCONFIG_AV1_ENCODER=1
    - -DCONFIG_AV1_DECODER=1
    - -DCONFIG_MULTITHREAD=1
    # Needs advanced grammar support from Snapcraft that isn't available here
    # Tested against Snapcraft 7.0 (beta - 2022-05-05 (7468)).
    # - to armhf:
    #   - -DAOM_NEON_INTRIN_FLAG=-mfpu=neon
    override-build: |
      EXTRA=""
      if [ $CRAFT_ARCH_TRIPLET = "arm-linux-gnueabihf" ]; then
        EXTRA="-DAOM_NEON_INTRIN_FLAG=-mfpu=neon"
      fi

      export DESTDIR="$CRAFT_PART_INSTALL"

      cmake $CRAFT_PART_SRC \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DENABLE_DOCS=OFF \
        -DENABLE_EXAMPLES=OFF \
        -DENABLE_TESTDATA=OFF \
        -DENABLE_TESTS=OFF \
        -DCONFIG_PIC=1 \
        -DCONFIG_AV1_ENCODER=1 \
        -DCONFIG_AV1_DECODER=1 \
        -DCONFIG_MULTITHREAD=1 \
        $EXTRA

      cmake --build . -- -j$CRAFT_PARALLEL_BUILD_COUNT

      cmake --build . --target install
    build-packages:
    - yasm

  # https://github.com/strukturag/libheif/releases
  libheif:
    after: [libaom]
    source: https://github.com/strukturag/libheif/releases/download/v1.12.0/libheif-1.12.0.tar.gz
    plugin: autotools
    build-environment:
    - to armhf:
      # LTO fails on armhf
      - CFLAGS: -Ofast -g -pipe -mfpu=neon
      - CXXFLAGS: -Ofast -g -pipe -mfpu=neon
      - LDFLAGS: -mfpu=neon
    - else:
      - CFLAGS: -Ofast -g -pipe -flto
      - CXXFLAGS: -Ofast -g -pipe -flto
      - LDFLAGS: -flto
    autotools-configure-parameters:
    - --prefix=/usr
    - --disable-go
    - --disable-examples
    build-packages:
    - libde265-dev
    - libgdk-pixbuf2.0-dev
    - libjpeg-dev
    - libpng-dev
    - libx265-dev
    stage-packages:
    - libde265-0
    - libgdk-pixbuf2.0-0
    - libjpeg-turbo8
    - libpng16-16
    - libx265-199
    override-build: |
      craftctl default
      $CRAFT_STAGE/fix-pkgconfig-files.sh

  # https://github.com/mypaint/libmypaint/releases
  libmypaint:
    after:
    - fix-pkgconfig-files
    plugin: autotools
    source: https://github.com/mypaint/libmypaint/releases/download/v1.6.1/libmypaint-1.6.1.tar.xz
    source-checksum: sha256/741754f293f6b7668f941506da07cd7725629a793108bb31633fb6c3eae5315f
    build-packages:
    - gobject-introspection
    - intltool
    - libgirepository1.0-dev
    - libglib2.0-dev
    - libjson-c-dev
    - libjson-glib-dev
    autotools-configure-parameters:
    - --prefix=/usr
    - --disable-static
    build-environment:
    - to armhf:
      - CFLAGS: -Ofast -g -pipe -mfpu=neon -flto
      - CXXFLAGS: -Ofast -g -pipe -mfpu=neon -flto
      - LDFLAGS: -mfpu=neon -flto
    - else:
      - CFLAGS: -Ofast -g -pipe -flto
      - CXXFLAGS: -Ofast -g -pipe -flto
      - LDFLAGS: -flto
    - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/usr/local/share:/usr/share
    override-build: |
      craftctl default
      $CRAFT_STAGE/fix-pkgconfig-files.sh
    stage:
    - -**/*.la
    prime:
    - -usr/include
    - -usr/lib/pkgconfig

  # https://github.com/Jehan/mypaint-brushes/releases
  mypaint-brushes:
    after:
    - libmypaint
    source: https://github.com/Jehan/mypaint-brushes/archive/v1.3.0.tar.gz
    plugin: autotools
    autotools-configure-parameters:
    - --prefix=/usr
    build-environment:
    - to armhf:
      - CFLAGS: -Ofast -g -pipe -mfpu=neon -flto
      - CXXFLAGS: -Ofast -g -pipe -mfpu=neon -flto
      - LDFLAGS: -mfpu=neon -flto
    - else:
      - CFLAGS: -Ofast -g -pipe -flto
      - CXXFLAGS: -Ofast -g -pipe -flto
      - LDFLAGS: -flto
    build-packages:
    - automake

  # TODO: Think about splitting to a separate snap and consume via content interface?
  # # https://download.gimp.org/mirror/pub/gimp/help
  # gimp-help:
  #   after: [gimp]
  #   plugin: autotools
  #   source: https://download.gimp.org/mirror/pub/gimp/help/gimp-help-2.10.0.tar.bz2
  #   source-checksum: sha512/2f6d5e7cf0c3b4960c92074ef02d51a1d089c148f6453a66e453a3084cdede280f72c6b77d35f66777adbda8aa273ec2a472fb538142e51bb263c3077eec473a
  #   autotools-configure-parameters:
  #   - --prefix=/usr
  #   build-environment:
  #   - PATH: /usr/bin:$PATH # Ensure system python is used, not from staging area
  #   build-packages:
  #   - dblatex
  #   - docbook2odf
  #   - pngcrush
  #   - pngnq
  #   - python
  #   - python-libxml2
  #   organize:
  #     root/stage/usr: usr
  #   prime:
  #   - -root

  # https://download.gimp.org/mirror/pub/gimp/v2.10/
  gimp:
    after:
    - babl
    - gegl
    - libheif
    - libmypaint
    - mypaint-brushes
    plugin: autotools
    source: https://download.gimp.org/mirror/pub/gimp/v2.99/gimp-$SNAPCRAFT_PROJECT_VERSION.tar.bz2
    source-checksum: sha512/898c1e1ffd2270ccc965db9a8263e04d95455535361b47f92256b4028808e1e91eb1924cf6cef7ff9e988194ebbc67535bd9cfbf0243159824e58551a2b91ba3
    autotools-configure-parameters:
    - --prefix=/usr
    - --sysconfdir=/etc
    - --with-bug-report-url=https://github.com/snapcrafters/gimp/issues/
    - --with-build-id=org.gimp.GIMP.snapcraft.stable
    - --disable-check-update
    - --disable-docs
    - --disable-gtk-doc
    - --disable-gtk-doc-html
    - --disable-python
    build-environment:
    - to armhf:
      - CFLAGS: -Ofast -g -pipe -mfpu=neon -flto
      - CXXFLAGS: -Ofast -g -pipe -mfpu=neon -flto
      - LDFLAGS: -mfpu=neon -flto
    - else:
      - CFLAGS: -Ofast -g -pipe -flto
      - CXXFLAGS: -Ofast -g -pipe -flto
      - LDFLAGS: -flto
    - BABL_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET/babl-0.1
    - GEGL_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET/gegl-0.4
    # the LD_LIBRARY_PATH is to fix configure failing to test for gegl matting-levin support
    - LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET
    - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/usr/local/share:/usr/share
    - PYTHON: /usr/bin/python3.8
    override-pull: |
      craftctl default
      sed -i 's|^Icon=.*|Icon=/usr/share/icons/hicolor/256x256/apps/gimp.png|' desktop/gimp.desktop.in.in
    override-build: |
      rm -f $CRAFT_PART_INSTALL/usr/share/pkgconfig/iso-codes.pc
      craftctl default
      sed -i -E "s|^(.*python3?=).*|\1/snap/$CRAFT_PROJECT_NAME/current/usr/bin/python|" $CRAFT_PART_INSTALL/usr/lib/gimp/2.0/interpreters/pygimp.interp || true
      sed -i -E 's|^# \(mypaint-brush-path .*$|(mypaint-brush-path "/usr/share/mypaint-data/1.0/brushes:~/.mypaint/brushes")|' $CRAFT_PART_INSTALL/etc/gimp/2.0/gimprc
    build-packages:
    - automake
    - glib-networking
    - gobject-introspection
    - gtk-doc-tools
    - intltool
    - iso-codes
    - libaa1-dev
    - libart-2.0-dev
    - libbz2-dev
    - libcairo2-dev
    - libcurl4-openssl-dev
    - libdbus-glib-1-dev
    - libexif-dev
    - libfftw3-dev
    - libgdk-pixbuf2.0-dev
    - libgexiv2-dev
    - libgirepository1.0-dev
    - libglib2.0-dev
    - libgpm-dev
    - libgs-dev
    - libgtk-3-dev
    - libgudev-1.0-dev
    - libice-dev
    - libilmbase-dev
    - libisocodes-dev
    - libjpeg-dev
    - libjson-glib-dev
    - liblcms2-dev
    - liblzma-dev
    - libmng-dev
    - libopenexr-dev
    - libopenjp2-7-dev
    - libpng-dev
    - libpoppler-glib-dev
    - libslang2-dev
    - libsm-dev
    - libtiff5-dev
    - libwebp-dev
    - libwmf-dev
    - libx11-dev
    - libxcursor-dev
    - libxmu-dev
    - libxpm-dev
    - libxt-dev
    - python3-dev
    - python3-cairo-dev
    - xdg-utils
    - xsltproc
    - zlib1g-dev
    - libunwind-dev
    stage-packages:
    - dbus-x11
    - evince
    - ghostscript
    - gir1.2-poppler-0.18
    - glib-networking
    - gvfs-backends
    - libaa1
    - libart-2.0-2
    - libbz2-1.0
    - libcairo2
    - libcurl4
    - libdbus-glib-1-2
    - libexif12
    - libgexiv2-2
    - libfftw3-3
    - libgdk-pixbuf2.0-0
    - libglib2.0-0
    - libgpm2
    - libgs9
    - libilmbase25
    - libjpeg-turbo8
    - libjson-glib-1.0-0
    - liblcms2-2
    - liblzma5
    - libmng2
    - libopenexr25
    - libopenjp2-7
    - libpng16-16
    - libpoppler-glib8
    - libslang2
    - libtiff5
    - libwebp7
    - libwebpdemux2
    - libwebpmux3
    - libwmf0.2-7
    - libxmu6
    - libxpm4
    - libxt6
    - python3-cairo
    - python3-dev
    - python3-gi
    - rawtherapee
    - zlib1g
    - libunwind8
    stage:
    - -**/*.la
    - -etc/dbus-1
    - -etc/default
    - -etc/dictionaries-common
    - -etc/emacs
    - -etc/fonts
    - -etc/glvnd
    - -etc/gnome
    - -etc/gss
    - -etc/gtk-3.0
    - -etc/init.d
    - -etc/libblockdev
    - -etc/libpaper.d
    - -etc/mailcap.order
    - -etc/mime.types
    - -etc/rc*.d
    - -etc/sensors3.conf
    - -etc/systemd
    - -etc/ucf.conf
    - -etc/udisks2
    - -etc/X11
    - -sbin/cfdisk
    - -sbin/cgdisk
    - -sbin/fdisk
    - -sbin/fixparts
    - -sbin/gdisk
    - -sbin/parted
    - -sbin/partprobe
    - -sbin/sfddisk
    - -sbin/sgdisk
    - -usr/bin/aspell*
    - -usr/bin/dbus*
    - -usr/bin/desktop-file-*
    - -usr/bin/fc-*
    - -usr/bin/gtk-update-icon-cache
    - -usr/bin/ispell*
    - -usr/bin/mtrace
    - -usr/bin/rpcgen
    - -usr/bin/run-*
    - -usr/bin/select-default-iwrap
    - -usr/bin/update-*-database
    - -usr/bin/xdpyinfo
    - -usr/bin/xdriinfo
    - -usr/bin/xev
    - -usr/bin/xfd
    - -usr/bin/xfontsel
    - -usr/bin/xkill
    - -usr/bin/xlsatoms
    - -usr/bin/xlsclients
    - -usr/bin/xlsfonts
    - -usr/bin/xmessage
    - -usr/bin/xprop
    - -usr/bin/xvinfo
    - -usr/bin/xwininfo
    - -usr/lib/aspell
    - -usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig/libcrypt.pc
    - -usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig/libxcrypt.pc
    - -usr/share/doc/libjpeg*
    - -usr/share/ghostscript
    - -usr/share/pkgconfig/iso-codes.pc
    - -**/iso-codes
    - -var/cache
    - -var/lib/aspell
    - -var/lib/dbus
    - -var/lib/dictionaries-common
    - -var/lib/emacsen-common
    - -var/lib/ispell
    - -var/lib/systemd
    - -var/lib/ucf
    prime:
    - -usr/include
    - -usr/lib/pkgconfig

  gmic:
    after: [gimp]
    plugin: nil
    override-pull: |
      git clone https://github.com/dtschump/gmic.git
      git clone https://github.com/dtschump/CImg.git
      git clone https://github.com/c-koi/gmic-qt.git
      cd gmic-qt
      # VERSION="$(git tag -l 'v.*.*' --sort=version:refname | tail -n1)"
      VERSION=v.2.9.6
      git checkout "$VERSION"
      cd ../gmic
      git checkout "$VERSION"
      cd ../CImg
      git checkout "$VERSION"
    override-build: |
      make -C gmic/src CImg.h gmic_stdlib.h
      cd gmic-qt
      mkdir build
      cd build
      cmake .. \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DGMIC_QT_HOST=gimp \
        -DGMIC_PATH=$CRAFT_PART_BUILD/gmic/src \
        -DCMAKE_BUILD_TYPE=Release
      make -j$CRAFT_PARALLEL_BUILD_COUNT
      make DESTDIR=$CRAFT_PART_INSTALL install
    build-environment:
    - PATH: /snap/bin:$PATH
    - to armhf:
      - CFLAGS: -Ofast -g -pipe -mfpu=neon -flto
      - CXXFLAGS: -Ofast -g -pipe -mfpu=neon -flto
      - LDFLAGS: -mfpu=neon -flto
    - else:
      - CFLAGS: -Ofast -g -pipe -flto
      - CXXFLAGS: -Ofast -g -pipe -flto
      - LDFLAGS: -flto
    build-packages:
      - curl
      - g++
      - gcc
      - libappstream-glib-dev
      - libarchive-dev
      - libcurl4-openssl-dev
      - libfftw3-dev
      - libgexiv2-dev
      - libgraphicsmagick++1-dev
      - libgraphicsmagick1-dev
      - libjpeg-dev
      - libluajit-5.1-dev
      - libopencv-core-dev
      - libopencv-highgui-dev
      - libopencv-videoio-dev
      # - libopencv-imgcodecs-dev
      # - libopencv-imgproc-dev
      - libopenexr-dev
      - libpng-dev
      - libtiff5-dev
      - libxkbfile-dev
      - libxres-dev
      - luajit
      - make
      - pkg-config
      - qt5-qmake
      - qtbase5-dev
      - qtbase5-dev-tools
      - qtchooser
      - qttools5-dev
      - wget
      - zlib1g-dev
    stage-packages:
      - libappstream-glib8
      - libarchive13
      - libcurl4
      - libdouble-conversion3
      - libfftw3-3
      - libgexiv2-2
      - libgraphicsmagick-q16-3
      - libgraphicsmagick++-q16-12
      - libjpeg-turbo8
      - libluajit-5.1-2
      - libopencv-core4.5d
      - libopencv-highgui4.5d
      - libopencv-videoio4.5d
      - libopenexr25
      - libpng16-16
      - libqt5core5a
      - libqt5gui5
      - libqt5network5
      - libqt5widgets5
      - libtiff5
      - libxkbfile1
      - libxres1
      - luajit
      - qtwayland5
      - zlib1g

  # # https://github.com/darktable-org/darktable/releases
  # darktable:
  #   after: [gimp, gmic]
  #   source: https://github.com/darktable-org/darktable/releases/download/release-3.0.2/darktable-3.0.2.tar.xz
  #   source-checksum: sha256/6abaf661fe9414e92bdb33b58b98ef024ccf6132b7876abaf0751ec2109f36fb
  #   plugin: cmake
  #   override-pull: |
  #     craftctl default
  #     sed -i 's|Exec=.*|Exec=darktable %U|;s|TryExec=.*|TryExec=darktable|;s|Icon=.*|Icon=${SNAP}/usr/share/icons/hicolor/scalable/apps/darktable.svg|' data/darktable.desktop.in
  #   cmkae-parameters:
  #     - -DCMAKE_BUILD_TYPE=Release
  #     - -DCMAKE_INSTALL_PREFIX=/usr
  #   build-environment:
  #     - CFLAGS: -Ofast -g -pipe -flto
  #     - CXXFLAGS: -Ofast -g -pipe -flto
  #     - LDFLAGS: -flto
  #   build-snaps: [cmake]
  #   build-packages:
  #     - curl
  #     - freeglut3-dev
  #     - fop
  #     - intltool
  #     - libcairo2-dev
  #     - libcolord-dev
  #     - libcolord-gtk-dev
  #     - libcups2-dev
  #     - libdbus-glib-1-dev
  #     - libexiv2-dev
  #     - libflickcurl-dev
  #     - libgnome-keyring-dev
  #     - libgphoto2-dev
  #     - libgraphicsmagick1-dev
  #     - libgtk-3-dev
  #     - libjpeg-dev
  #     - libjson-glib-dev
  #     - liblcms2-dev
  #     - liblensfun-dev
  #     - liblua5.3-dev
  #     - libopenexr-dev
  #     - libopenjp2-7-dev
  #     - libosmgpsmap-1.0-dev
  #     - libpng-dev
  #     - libpugixml-dev
  #     - librsvg2-dev
  #     - libsdl1.2-dev
  #     - libsecret-1-dev
  #     - libsoup2.4-dev
  #     - libsqlite3-dev
  #     - libtiff-dev
  #     - libwebp-dev
  #     - xsltproc
  #     - zlib1g-dev
  #   stage-packages:
  #     - freeglut3
  #     - libcolord2
  #     - libcolord-gtk1
  #     - libcups2
  #     - libdbus-glib-1-2
  #     - libexiv2-27
  #     - libflickcurl0
  #     - libgnome-keyring0
  #     - libgphoto2-6
  #     - libgraphicsmagick-q16-3
  #     - libjpeg-turbo8
  #     - libjson-glib-1.0-0
  #     - liblcms2-2
  #     - liblensfun1
  #     - liblensfun-data-v1
  #     - liblua5.3-0
  #     - libopenexr25
  #     - libopenjp2-7
  #     - libosmgpsmap-1.0-1
  #     - libpng16-16
  #     - libpugixml1v5
  #     - librsvg2-2
  #     - libsdl1.2debian
  #     - libsecret-1-0
  #     - libsoup2.4-1
  #     - libsqlite3-0
  #     - libtiff5
  #     - libwebp7

  cleanup:
    after: [ gimp, gmic ]
    plugin: nil
    build-snaps:
    - core22
    - gtk-common-themes
    override-prime: |
      set -eux
      for snap in "gnome-42-2204" "gtk-common-themes"; do  # List all content-snaps you're using here
        cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$CRAFT_PRIME/{}" \;
      done
      for CRUFT in bug lintian man; do
        rm -rf $CRAFT_PRIME/usr/share/$CRUFT
      done
      find $CRAFT_PRIME/usr/share/doc/ -type f -not -name 'copyright' -delete
      find $CRAFT_PRIME/usr/share -type d -empty -not -path "$CRAFT_PRIME/usr/share/gimp/*" -delete

minimal reproduction snapcraft.yaml

snapcraft.yaml
name: gnome-42-g-ir-scanner
version: experiment
summary: gnome-42-g-ir-scanner test
description: |
  gnome-42-g-ir-scanner test

grade: stable
confinement: strict
base: core22

apps:
  bash:
    command: usr/bin/bash
    extensions: [gnome]

build-snaps:
- gnome-42-2204-sdk/latest/edge
- gnome-42-2204/latest/edge

parts:
  babl:
    plugin: meson
    source: https://download.gimp.org/mirror/pub/babl/0.1/babl-0.1.92.tar.xz
    source-checksum: sha256/f667735028944b6375ad18f160a64ceb93f5c7dccaa9d8751de359777488a2c1
    meson-parameters:
    - --prefix=/usr
    - --buildtype=release
    - -Db_lto=true
    - -Dwith-docs=false
    override-pull: |
      craftctl default
      sed -i 's/not stable, Description:/not stable, description:/' meson.build
    build-packages:
    - git
    - gobject-introspection
    - libgirepository1.0-dev
    - liblcms2-dev
    - librsvg2-bin
    - librsvg2-dev
    - meson
    - valac
    - w3m
    stage-packages:
    - gobject-introspection
    - libgirepository-1.0-1
    - liblcms2-2
    - librsvg2-2

The answer to this is: The gnome extension in snapcraft is failing to include /snap/gnome-42-2204-sdk/current/usr/lib/x86_64-linux-gnu/gobject-introspection in the build environment’s PYTHONPATH.

1 Like