update to stage3 zig with -fstage1

This commit is contained in:
Mitchell Hashimoto
2022-09-08 13:31:18 -07:00
parent 97aef76501
commit d7d372124b
5 changed files with 16 additions and 12 deletions

View File

@ -38,7 +38,7 @@ jobs:
# Cross-compile the binary. We always use static building for this
# because its the only way to access the headers.
- name: Test Build
run: nix develop -c zig build -Dstatic=true -Dtarget=${{ matrix.target }}
run: nix develop -c zig build -fstage1 -Dstatic=true -Dtarget=${{ matrix.target }}
test:
strategy:
@ -58,8 +58,8 @@ jobs:
nix_path: nixpkgs=channel:nixos-unstable
- name: test
run: nix develop -c zig build test
run: nix develop -c zig build test -fstage1
- name: Test Dynamic Build
run: nix develop -c zig build -Dstatic=false
run: nix develop -c zig build -fstage1 -Dstatic=false

View File

@ -5,7 +5,7 @@ init:
# Slightly cursed way that we setup a dev version of this locally on NixOS.
dev/install:
zig build -Dcpu=baseline -Drelease-fast
zig build -fstage1 -Dcpu=baseline -Drelease-fast
if [ -f "/etc/NIXOS" ]; then patchelf --set-rpath "${LD_LIBRARY_PATH}" zig-out/bin/ghostty; fi
mkdir -p ${HOME}/bin
cp zig-out/bin/ghostty ${HOME}/bin/devtty

View File

@ -75,12 +75,16 @@ on the [Zig downloads page](https://ziglang.org/download/).
With Zig installed, a binary can be built using `zig build`:
```shell-session
$ zig build
$ zig build -fstage1
...
$ zig-out/bin/ghostty
```
**Important: you must specify the `-fstage1` flag.** Ghostty can't yet be
built with the self-hosted Zig backend, so we have to use "stage1" (the
C++ LLVM backend).
This will build a binary for the currently running system (if supported).
You can cross compile by setting `-Dtarget=<target-triple>`. For example,
`zig build -Dtarget=aarch64-macos` will build for Apple Silicon macOS. Note

6
flake.lock generated
View File

@ -109,11 +109,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1662000959,
"narHash": "sha256-2wW8/BWusCtDYiHkF4/o4Se16qc/EbtMsZuQspTW4lY=",
"lastModified": 1662668669,
"narHash": "sha256-91R5xjCt1cLJBbYygtiQwXCex596/2cxsTneKUdnVwc=",
"owner": "mitchellh",
"repo": "zig-overlay",
"rev": "9c8e4148bdc806397900cb95c7d2b3f844ac7aff",
"rev": "6ed17531becf61347f4f30b62ad22d21e14fc4da",
"type": "github"
},
"original": {

View File

@ -13,8 +13,8 @@ final: prev: rec {
wraptest = prev.callPackage ./wraptest.nix { };
# zig we want to be the latest nightly since 0.9.0 is not released yet.
# NOTE: we are pinned to this master version because it broke at a certain
# point due to the self-hosted compiler. We'll fix this ASAP.
#zig = final.zigpkgs.master;
zig = final.zigpkgs.master-2022-08-19;
zig = final.zigpkgs.master;
# last known working stage1 build, the rest in the future are stage3
#zig = final.zigpkgs.master-2022-08-19;
}