Skip to content

mcandre/snek

Repository files navigation

snek: the toolchain armada

                ~.
         Ya...___|__..ab.     .   .
          Y88b  \88b  \88b   (     )
           Y88b  :88b  :88b   `.xx'
           :888  |888  |888  ( (`{#}
  .---.    d88P  ;88P  ;88P   `.`.
 / .-._)  d8P-"""|"""'-Y8P      `.`.
( (`._) .-.  .-. |.-.  .-.  .-.   ) )
 \ `---( O )( O )( O )( O )( O )-' /
  `.    `-'  `-'  `-'  `-'  `-'  .'
    `---------------------------'

SUMMARY

snek simplifies the process of porting software to multiple platforms.

VM's are slow. snek is fast.

Hardware is expensive. snek is free.

EXAMPLE

$ cd example

$ snek

$ tree bin
bin
└── hello-0.0.1
    ├── aarch64-linux-gnu
    │   └── hello
    ├── arm-linux-gnueabi
    │   └── hello
    ├── arm-linux-gnueabihf
    │   └── hello
    ├── arm64-apple-darwin
    │   └── hello
...

LICENSE

BSD-2-Clause

RUNTIME REQUIREMENTS

Recommended

  • a host capable of running musl/Linux containers (e.g. a GNU/Linux, musl/Linux, macOS, or Windows host)
  • Docker First Aid Kit
  • Apply DOCKER_DEFAULT_PLATFORM = linux/amd64 environment variable
  • cmake 3.5+
  • make or ninja
  • file
  • tree
  • tug
  • POSIX compatible tar
  • a UNIX environment, such as macOS, Linux, BSD, WSL, etc.

Non-UNIX environments may produce subtle adverse effects when linting or generating application ports.

CONTRIBUTING

For more information on developing snek itself, see DEVELOPMENT.md.

CONFIGURATION

snek offers several preconfigured toolchain Docker ships, or you can specify your own custom ships.

snek automatically mounts the host current working directory as a guest /src directory.

Standard Ships

snek curates a set of standard Docker image ships for easy porting of cmake/make projects to common POSIX-esque target environments. These are primarily clang / gcc based, in order to support a wide variety of environments and C/C++ language features.

The standard images automatically set the guest working directory to /src.

The standard images aim to reduce their footprint, in order to keep the snek system fairly lean and fast on mediumish hardware. For example, snek may be run on a cheap laptop, or a beefy workstation, or an expensive CI/CD instance, or on a RAM-appropraite Raspberry Pi with sufficient patience.

The total size of the image collection is only bounded by your build host's disk space.

The Docker images for your ships are extensible and customizable. See example/snek.yaml for more detail.

Note that not all packages, such as certain Conan Central dependencies, will be available for all platforms.

CREDITS

  • chroot can assist with isolating compiler toolchains on UNIX hosts
  • crit ports Rust applications
  • distcc can distribute compilations to remote servers
  • factorio ports Go applications
  • LLVM bitcode offers an abstract assembler format for C/C++ code.
  • osxcross provides patches to enable Darwin targets.
  • tug automates multi-platform Docker image builds.
  • WASM provides a portable interface for C/C++ code.
  • xgo ports cgo applications