mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-11 18:58:24 +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)
|
* `libunwind` (macOS should already have this one installed)
|
||||||
* `libc++-dev`
|
* `libc++-dev`
|
||||||
* Python 2.7 (Windows only), `python-is-python3` (Ubuntu)
|
* 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)
|
* a particular version of LLVM (see below)
|
||||||
|
|
||||||
To run the test suite (via `cargo test`), you additionally need to install:
|
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`.)
|
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
|
### 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)
|
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`
|
||||||
Alternatively, any recent master branch build should work. To install the latest master branch build you can use:
|
For any other OS, checkout the [Zig installation page](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager)
|
||||||
* `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.
|
|
||||||
|
|
||||||
### LLVM
|
### LLVM
|
||||||
|
|
||||||
|
75
nix/zig.nix
75
nix/zig.nix
@ -1,42 +1,37 @@
|
|||||||
{ pkgs, isMacOS, isAarch64 }:
|
{ pkgs, isMacOS, isAarch64 }:
|
||||||
|
|
||||||
# We require at least specific commit of Zig after the latest tagged
|
if isMacOS then
|
||||||
# release (0.6.0), so we just download the binaries for that commit
|
let
|
||||||
|
version = "0.7.1";
|
||||||
let
|
osName =
|
||||||
version = "0.6.0+0088efc4b";
|
if isMacOS
|
||||||
osName =
|
then "macos"
|
||||||
if isMacOS
|
else "linux";
|
||||||
then "macos"
|
archName =
|
||||||
else "linux";
|
if isAarch64
|
||||||
archName =
|
then "aarch64"
|
||||||
if isAarch64
|
else "x86_64";
|
||||||
then "aarch64"
|
archiveName = "zig-${osName}-${archName}-${version}";
|
||||||
else "x86_64";
|
sha256 = "845cb17562978af0cf67e3993f4e33330525eaf01ead9386df9105111e3bc519";
|
||||||
archiveName = "zig-${osName}-${archName}-${version}";
|
in
|
||||||
sha256 =
|
pkgs.stdenv.mkDerivation {
|
||||||
if isMacOS
|
pname = "zig";
|
||||||
then "665c1a7f472cfc5e0715f0ddf6ff8409fb749ac91cbbae68c443b4a37ebd058e"
|
version = version;
|
||||||
else if isAarch64
|
buildInputs = [ pkgs.gzip ];
|
||||||
then "116ms44vx4xz57m9z9lsgrxd1g22qp00m5qbmklky8xdd2jmj24w"
|
src = pkgs.fetchurl {
|
||||||
else "bab70ae3bd0af538022bc3ef50d8f34fa8dceac39ba7d9e5d528eee7e6d5a1cf";
|
inherit sha256;
|
||||||
in
|
name = "${archiveName}.tar.xz";
|
||||||
pkgs.stdenv.mkDerivation {
|
url = "https://ziglang.org/builds/${archiveName}.tar.xz";
|
||||||
pname = "zig";
|
};
|
||||||
version = version;
|
phases = [ "installPhase" ];
|
||||||
buildInputs = [ pkgs.gzip ];
|
installPhase = ''
|
||||||
src = pkgs.fetchurl {
|
mkdir -p $out/bin
|
||||||
inherit sha256;
|
tar -xf $src
|
||||||
name = "${archiveName}.tar.xz";
|
cp ${archiveName}/zig $out/zig
|
||||||
url = "https://ziglang.org/builds/${archiveName}.tar.xz";
|
cp -r ${archiveName}/lib $out/lib
|
||||||
};
|
ln -s "$out/zig" "$out/bin/zig"
|
||||||
phases = [ "installPhase" ];
|
chmod +x $out/bin/zig
|
||||||
installPhase = ''
|
'';
|
||||||
mkdir -p $out/bin
|
}
|
||||||
tar -xf $src
|
else
|
||||||
cp ${archiveName}/zig $out/zig
|
pkgs.zig
|
||||||
cp -r ${archiveName}/lib $out/lib
|
|
||||||
ln -s "$out/zig" "$out/bin/zig"
|
|
||||||
chmod +x $out/bin/zig
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
@ -8,10 +8,10 @@ in with {
|
|||||||
# Look here for information about how pin version of nixpkgs
|
# Look here for information about how pin version of nixpkgs
|
||||||
# → https://nixos.wiki/wiki/FAQ/Pinning_Nixpkgs
|
# → https://nixos.wiki/wiki/FAQ/Pinning_Nixpkgs
|
||||||
pkgs = import (builtins.fetchGit {
|
pkgs = import (builtins.fetchGit {
|
||||||
name = "nixpkgs-2020-11-24";
|
name = "nixpkgs-2021-01-05";
|
||||||
url = "https://github.com/nixos/nixpkgs/";
|
url = "https://github.com/nixos/nixpkgs/";
|
||||||
ref = "refs/heads/nixpkgs-unstable";
|
ref = "refs/heads/nixpkgs-unstable";
|
||||||
rev = "6625284c397b44bc9518a5a1567c1b5aae455c08";
|
rev = "f53c431645da8e6760268092aa10f736b5cfb117";
|
||||||
}) { };
|
}) { };
|
||||||
|
|
||||||
isMacOS = currentOS == "darwin";
|
isMacOS = currentOS == "darwin";
|
||||||
|
Loading…
Reference in New Issue
Block a user