janet-lang / janet

A dynamic language and bytecode vm
https://janet-lang.org
MIT License
3.52k stars 227 forks source link

Improve cross compilation #1132

Closed zevv closed 1 year ago

zevv commented 1 year ago

This PR adds some smoother support for easy cross compilation.

Building janet requires janet_boot to be run on the host at build time; for this some changes were made

Examples:

Cross compiling for win32 and running under wine:

make repl \
       CC=i686-w64-mingw32-gcc \
       LD=i686-w64-mingw32-gcc \
       UNAME=MINGW \
       RUN=wine

Janet 1.27.0-ad7c3bed mingw/x86/gcc - '(doc)' for help

Cross compiling for aarch64 and running under qemu:

make repl \
        CC=aarch64-none-linux-gnu-gcc \
        LD=aarch64-none-linux-gnu-gcc \
        RUN="qemu-aarch64 -L /tmp/aarch64/"

Janet 1.27.0-ad7c3bed linux/aarch64/gcc - '(doc)' for help