Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jcbhmr/zig-cosmo

⚡ All-in-one multiplatform Zig binary
https://github.com/jcbhmr/zig-cosmo

cosmopolitan single-executable zig ziglang

Last synced: about 1 month ago
JSON representation

⚡ All-in-one multiplatform Zig binary

Awesome Lists containing this project

README

        

# Zig as an [Actually Portable Executable](https://justine.lol/ape.html)

⚡ All-in-one multiplatform Zig binary

```sh
wget https://github.com/jcbhmr/zig-ape/releases/download/0.13.0/zig-ape-0.13.0.zip
unzip zig-ape-0.13.0.zip
./zig-ape-0.13.0/zig zen
```

🌌 Uses [`cosmocc`](https://github.com/jart/cosmopolitan/tree/master/tool/cosmocc) to build a multiplatform binary \
📂 Extracts the platform-specific `zig` and `lib/*` files to a cache folder \
💻 Works on Windows, macOS, and Linux on both x86-64 & AArch64 CPUs \
**😎 It's just one binary!**

## Installation

![Windows](https://img.shields.io/static/v1?style=for-the-badge&message=Windows&color=0078D4&logo=Windows&logoColor=FFFFFF&label=)
![Linux](https://img.shields.io/static/v1?style=for-the-badge&message=Linux&color=222222&logo=Linux&logoColor=FCC624&label=)
![macOS](https://img.shields.io/static/v1?style=for-the-badge&message=macOS&color=000000&logo=macOS&logoColor=FFFFFF&label=)

**🛑 This is an unofficial redistribution of the Zig binaries.** You should probably use [the official Zig download page](https://ziglang.org/download/).

1. Download the ZIP.
2. Extract it.
3. Rename it to `zig.com` or `zig.exe`. (Windows only)

**https://github.com/jcbhmr/zig-cosmo/releases/download/0.13.0/zig-ape-0.13.0.zip**

The all-in-one binary should work on Windows x86-64, Windows AArch64, macOS x86-64, macOS AArch64, Linux x86-64, Linux AArch64, and FreeBSD x86-64. **For other platforms make sure you check out [Zig's official download page](https://ziglang.org/download/).**

## Development

![C++](https://img.shields.io/static/v1?style=for-the-badge&message=C%2B%2B&color=00599C&logo=C%2B%2B&logoColor=FFFFFF&label=)
![GitHub Actions](https://img.shields.io/static/v1?style=for-the-badge&message=GitHub+Actions&color=2088FF&logo=GitHub+Actions&logoColor=FFFFFF&label=)

The GitHub actions workflow doesn't actually build Zig itself. That's too complex. Instead, it pulls the precompiled artifacts from the [Zig downloads page](https://ziglang.org/download/) and bundles them into a single ZIP archive.

TODO: I need some assistance in handling non-zero exit codes and process signals properly in Windows. If anyone reading this knows how to `waitpid()` correctly please enlighten me! ️😊