mirror of
https://github.com/roc-lang/roc.git
synced 2024-08-17 06:41:22 +03:00
Update Zig snapshot, Nix Zig version, and Zig install instructions
This commit is contained in:
parent
2cc5178a9b
commit
66f39e0a92
@ -8,7 +8,7 @@ To build the compiler, you need these installed:
|
||||
* `libunwind` (macOS should already have this one installed)
|
||||
* `libc++-dev`
|
||||
* Python 2.7 (Windows only), `python-is-python3` (Ubuntu)
|
||||
* a particular version of Zig (see below)
|
||||
* Zig (0.7.0 or greater, see below)
|
||||
* a particular version of LLVM (see below)
|
||||
|
||||
To run the test suite (via `cargo test`), you additionally need to install:
|
||||
@ -24,32 +24,10 @@ MacOS systems should already have `libunwind`, but other systems will need to in
|
||||
Some systems may already have `libc++-dev` on them, but if not, you may need to install it. (On Ubuntu, this can be done with `sudo apt-get install libc++-dev`.)
|
||||
|
||||
### Zig
|
||||
We use a specific version of Zig, a build off the the commit `0088efc4b`. The latest tagged version of Zig, 0.6.0, doesn't include the feature to emit LLVM ir, which is a core feature of how we use Zig. To download this specific version, you can:
|
||||
* use the following commands on Debian/Ubuntu (on other distros, steps should be essentially the same):
|
||||
```
|
||||
cd /tmp
|
||||
# download the files
|
||||
wget https://ziglang.org/builds/zig-linux-x86_64-0.6.0+0088efc4b.tar.xz
|
||||
# uncompress:
|
||||
xz -d zig-linux-x86_64-0.6.0+0088efc4b.tar.xz
|
||||
# untar:
|
||||
tar xvf zig-linux-x86_64-0.6.0+0088efc4b.tar
|
||||
# move the files into /opt:
|
||||
sudo mkdir -p /opt/zig
|
||||
sudo mv zig-linux-x86_64-0.6.0+0088efc4b/* /opt/zig/
|
||||
```
|
||||
Then add `/opt/zig/` to your `PATH` (e.g. in `~/.bashrc`).
|
||||
|
||||
Reload your `.bashrc` file: `source ~/.bashrc` and test that `zig` is
|
||||
an available command.
|
||||
|
||||
* [macOS](https://ziglang.org/builds/zig-macos-x86_64-0.6.0+0088efc4b.tar.xz)
|
||||
|
||||
Alternatively, any recent master branch build should work. To install the latest master branch build you can use:
|
||||
* `brew install zig --HEAD` (on macos)
|
||||
* `snap install zig --classic --edge` (on ubunutu)
|
||||
|
||||
Once 0.7.0 is released, we'll switch back to installing the tagged releases and this process will get easier.
|
||||
If you're on MacOS, you can install with `brew install zig`
|
||||
If you're on Ubuntu and use Snap, you can install with `snap install zig --classic --beta`
|
||||
For any other OS, checkout the [Zig installation page](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager)
|
||||
|
||||
### LLVM
|
||||
|
||||
|
75
nix/zig.nix
75
nix/zig.nix
@ -1,42 +1,37 @@
|
||||
{ pkgs, isMacOS, isAarch64 }:
|
||||
|
||||
# We require at least specific commit of Zig after the latest tagged
|
||||
# release (0.6.0), so we just download the binaries for that commit
|
||||
|
||||
let
|
||||
version = "0.6.0+0088efc4b";
|
||||
osName =
|
||||
if isMacOS
|
||||
then "macos"
|
||||
else "linux";
|
||||
archName =
|
||||
if isAarch64
|
||||
then "aarch64"
|
||||
else "x86_64";
|
||||
archiveName = "zig-${osName}-${archName}-${version}";
|
||||
sha256 =
|
||||
if isMacOS
|
||||
then "665c1a7f472cfc5e0715f0ddf6ff8409fb749ac91cbbae68c443b4a37ebd058e"
|
||||
else if isAarch64
|
||||
then "116ms44vx4xz57m9z9lsgrxd1g22qp00m5qbmklky8xdd2jmj24w"
|
||||
else "bab70ae3bd0af538022bc3ef50d8f34fa8dceac39ba7d9e5d528eee7e6d5a1cf";
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
pname = "zig";
|
||||
version = version;
|
||||
buildInputs = [ pkgs.gzip ];
|
||||
src = pkgs.fetchurl {
|
||||
inherit sha256;
|
||||
name = "${archiveName}.tar.xz";
|
||||
url = "https://ziglang.org/builds/${archiveName}.tar.xz";
|
||||
};
|
||||
phases = [ "installPhase" ];
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
tar -xf $src
|
||||
cp ${archiveName}/zig $out/zig
|
||||
cp -r ${archiveName}/lib $out/lib
|
||||
ln -s "$out/zig" "$out/bin/zig"
|
||||
chmod +x $out/bin/zig
|
||||
'';
|
||||
}
|
||||
if isMacOS then
|
||||
let
|
||||
version = "0.7.1";
|
||||
osName =
|
||||
if isMacOS
|
||||
then "macos"
|
||||
else "linux";
|
||||
archName =
|
||||
if isAarch64
|
||||
then "aarch64"
|
||||
else "x86_64";
|
||||
archiveName = "zig-${osName}-${archName}-${version}";
|
||||
sha256 = "845cb17562978af0cf67e3993f4e33330525eaf01ead9386df9105111e3bc519";
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
pname = "zig";
|
||||
version = version;
|
||||
buildInputs = [ pkgs.gzip ];
|
||||
src = pkgs.fetchurl {
|
||||
inherit sha256;
|
||||
name = "${archiveName}.tar.xz";
|
||||
url = "https://ziglang.org/builds/${archiveName}.tar.xz";
|
||||
};
|
||||
phases = [ "installPhase" ];
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
tar -xf $src
|
||||
cp ${archiveName}/zig $out/zig
|
||||
cp -r ${archiveName}/lib $out/lib
|
||||
ln -s "$out/zig" "$out/bin/zig"
|
||||
chmod +x $out/bin/zig
|
||||
'';
|
||||
}
|
||||
else
|
||||
pkgs.zig
|
||||
|
@ -8,10 +8,10 @@ in with {
|
||||
# Look here for information about how pin version of nixpkgs
|
||||
# → https://nixos.wiki/wiki/FAQ/Pinning_Nixpkgs
|
||||
pkgs = import (builtins.fetchGit {
|
||||
name = "nixpkgs-2020-11-24";
|
||||
name = "nixpkgs-2021-01-05";
|
||||
url = "https://github.com/nixos/nixpkgs/";
|
||||
ref = "refs/heads/nixpkgs-unstable";
|
||||
rev = "6625284c397b44bc9518a5a1567c1b5aae455c08";
|
||||
rev = "f53c431645da8e6760268092aa10f736b5cfb117";
|
||||
}) { };
|
||||
|
||||
isMacOS = currentOS == "darwin";
|
||||
|
Loading…
Reference in New Issue
Block a user