What is the proper way to build and support multi-architecture snap in store (year 2018)?

Thanks for the sharing @ogra.

Based on the documentations, we’ll upgrade our packaging script towards the multiple arch-specific snaps. That’s is the convincing way to do it while maintaining single snapcraft.yaml script.


To build arch-specific snaps, we issue the snapcraft command with the --target-arch flag and loop across each architectures. E.g.

$ snapcraft --target-arch=i386 ...
$ snapcraft --target-arch=arm64 ...

Inside the scriplets, we chop the $SNAP_ARCH_TRIPLET to get identify the target architecture. From there, we can move the correct arch-specific binary accordingly to match the app commands. Something, like this:

    override-build: |
            case ${SNAPCRAFT_ARCH_TRIPLET%%-*} in
            x86_64)
                echo "x86_64"
                ;;
            i386)
                echo "i386"
                ;;
            *)
                echo "ailen"
            esac

Side-note: the $SNAP_TARGET_ARCH idea is really helpful. +1 instead of doing manual chopping.


When up-streaming all the snaps, the store is able to identify and sort the architectures out under 1 snap name. This applies to user downloads the snap as well.