How do we package architecture specific software it in snapcraft? Our build CI is able to cross-compile and line the binaries up as the following:
bin/hello-i386 bin/hello-amd64 bin/hello-arm bin/hello-arm64 bin/hello-armhf
For simplicity sake, let’s leave the source-codes (as in, the way Launchpad did with the
.deb packages) asides.
#1 Multiple arch specific snaps?
Each snaps is specific to one architecture and I’ll have to run a build script looping all the
snapcraft.yaml and upstream them accordingly. This is similar to building
deb packages for Launchpad.
NOTE: following Multiple architectures in store
#2 Build a bash script and wrap around each command in the snap?
This is to make use of
$SNAP_ARCH environment variables, mentioned in https://askubuntu.com/questions/757668/how-to-build-multi-arch-snaps.
Quote from David Planella: https://askubuntu.com/users/9781/david-planella
#!/bin/sh case "$SNAP_ARCH" in "amd64") ARCH='x86_64-linux-gnu' ;; "i386") ARCH='i386-linux-gnu' ;; *) echo "Unsupported architecture for this clock app build" exit 1 ;; esac
NOTE: If possible, I want to avoid this step. It’s ridiculous for snap with a lot of commands.
snapcraft.yaml are mostly using
install keywords for our
dump plugin. We use the shell script commands to pack the binaries accordingly.
We do have a packaging script that help us automate
.snap packaging for our current not architecture specific projects. We don’t mind upgrade it as long as the direction is right.