Passing argument to snapcraft.yaml to differentiate between amd64 and arm64 build for a part

I make use of openssl 1_1_0f in my snap. Until now I was only building for amd64 target.

Now I need to build for arm64 using same snapcraft.yaml. Building for arm64 requires me to pass extra config flag ‘no-afalgeng’.

Q: How to pass an argument to snapcraft.yaml which can be used to differentiate between build for arm64 / amd64 target?

You could use override-build (see https://snapcraft.io/docs/scriptlets) in combination with a check against $SNAPCRAFT_ARCH_TRIPLET or dpkg-architecture -q DEB_HOST_ARCH.

1 Like

Sounds like we need to consider adding enhanced vocabulary to things like configflags for the snapcraft plugins. e.g.

parts:
    moo:
        plugin: autotools
        configflags:
            - --prefix=/usr
            - on arm64:
                - --do-army-things=true
2 Likes