I am happy to announce that atspkg now has experimental support for cross-compiling! I will give a short illustration of how this works using my own project, polyglot.

First, get a copy of the project:

git clone https://github.com/vmchale/polyglot.git cd polyglot

Install a cross compiler for C (here, we are using Debian, but you can install a cross-compiler another way):

sudo apt install gcc-arm-linux-gnueabihf

Then, install atspkg:

curl -sSl https://raw.githubusercontent.com/vmchale/atspkg/master/bash/install.sh | bash -s

And invoke it:

atspkg clean atspkg nuke atspkg build --target=arm-linux-gnueabihf

If all goes well, your build should terminate with atspkg: thread blocked indefinitely in an MVar operation (yes, really). While that is certainly a bug I hope to fix before I declare atspkg done, being able to cross-compile for Raspberry Pi is quite a nice feature in the meantime.

It's worth noting that doing this by hand is difficult - it requires us to cross-compile the ATS core libraries as well as the garbage collector and its dependencies. The ATS libraries are unfortunately difficult to cross-compile; I won't claim that it is impossible to do so using the provided makefiles, but it was difficult enough that I simply replaced the make build steps with atspkg. I included the atspkg.dhall for the core libraries below as it is a nice example of configuration using Dhall.

{- Dhall prelude imports -} let map = https://ipfs.io/ipfs/QmQ8w5PLcsNz56dMvRtq54vbuPe9cNnCCUXAQp6xLc6Ccx/Prelude/List/map in let concat = https://ipfs.io/ipfs/QmQ8w5PLcsNz56dMvRtq54vbuPe9cNnCCUXAQp6xLc6Ccx/Prelude/List/concat in

{- Helper functions -} let mapDir = λ(rec : {dir : Text, xs : List Text }) → map Text Text (λ(x : Text) → "${rec.dir}/DATS/${x}.dats") rec.xs in

let mapUtil = λ(xs : List Text) → map Text Text (λ(x : Text) → "utils/atscc/DATS/atscc_${x}.dats") xs in

let mapPre = λ(xs : List Text) → mapDir { dir = "prelude", xs = xs } in

let mapC = λ(xs : List Text) → mapDir { dir = "libats/libc", xs = xs } in

let mapML = λ(xs : List Text) → mapDir { dir = "libats/ML", xs = xs } in

{- ATSPackage parts -} let prelude = https://raw.githubusercontent.com/vmchale/atspkg/master/ats-pkg/dhall/atspkg-prelude.dhall

in prelude.default ⫽ { libraries = [ prelude.staticLib ⫽ { libTarget = "lib/ats2-postiats-0.3.9/ccomp/atslib/lib/libatslib.a" , name = "atslib" , src = concat Text [ mapPre [ "bool", "integer", "basics", "pointer", "integer_long", "integer_short", "integer_size", "char", "float", "string", "strptr", "integer_ptr", "integer_fixed", "filebas" ] , mapC [ "math", "float", "errno", "fcntl", "dirent", "stdio", "stdlib", "string", "strings", "time", "unistd" ] , mapML [ "list0", "option0", "array0", "matrix0", "string", "strarr", "gvalue", "dynarray", "hashtblref", "filebas", "filebas_dirent" ] ] , includes = ([] : List Text) } , prelude.staticLib ⫽ { libTarget = "lib/ats2-postiats-0.3.9/ccomp/atslib/lib/libatsopt.a" , name = "atsopt" , src = mapUtil [ "main", "print", "util" ] } ] , cflags = [ "-fPIC" ] , compiler = [0,3,10] }