# See https://wiki.debian.org/Multiarch/Tuples

# "dpkg-architecture -qDEB_HOST_MULTIARCH" would give us the triplet to use,
# but it's implemented in Perl, which requires us to know the triplet to
# correctly execute, so we have to work around by duplicating the table here.
# This is the set of architectures supported by Ubuntu currently.

case "$SNAP_ARCH" in
    amd64) triplet=x86_64-linux-gnu ;;
    arm64) triplet=aarch64-linux-gnu ;;
    armhf) triplet=arm-linux-gnueabihf ;;
    ppc64el) triplet=powerpc64le-linux-gnu ;;
    riscv64) triplet=riscv64-linux-gnu ;;
    s390x) triplet=s390x-linux-gnu ;;
    *)
        echo "Error: SNAP_ARCH $SNAP_ARCH unknown" >&2
        exit 1
        ;;
esac

export PERL5LIB="$SNAP/usr/share/perl5:$SNAP/usr/share/perl/5.38:$SNAP/usr/lib/$triplet/perl-base:$SNAP/usr/lib/$triplet/perl/5.38:$SNAP/usr/lib/$triplet/perl5/5.38"
