update zig version

This commit is contained in:
Mitchell Hashimoto
2023-05-07 20:40:05 -07:00
parent e2dc12cd6d
commit 97d9157d22
19 changed files with 64 additions and 50 deletions

2
.gitmodules vendored
View File

@ -27,7 +27,7 @@
url = https://github.com/cimgui/cimgui.git
[submodule "vendor/pixman"]
path = vendor/pixman
url = https://github.com/freedesktop/pixman.git
url = https://gitlab.freedesktop.org/pixman/pixman.git
[submodule "vendor/zig-js"]
path = vendor/zig-js
url = https://github.com/mitchellh/zig-js.git

View File

@ -427,7 +427,6 @@ pub fn build(b: *std.Build) !void {
.target = wasm_crosstarget,
.optimize = optimize,
});
wasm.setOutputDir("zig-out");
wasm.addOptions("build_options", exe_options);
// So that we can use web workers with our wasm binary
@ -442,8 +441,12 @@ pub fn build(b: *std.Build) !void {
// Wasm-specific deps
_ = try addDeps(b, wasm, true);
// Install
const wasm_install = b.addInstallArtifact(wasm);
wasm_install.dest_dir = .{ .prefix = {} };
const step = b.step("wasm", "Build the wasm library");
step.dependOn(&wasm.step);
step.dependOn(&wasm_install.step);
// We support tests via wasmtime. wasmtime uses WASI so this
// isn't an exact match to our freestanding target above but
@ -468,8 +471,8 @@ pub fn build(b: *std.Build) !void {
defer conformance_exes.deinit();
break :blk conformance_exes.get(name) orelse return error.InvalidConformance;
} else exe;
const run_cmd = run_exe.run();
run_cmd.step.dependOn(&run_exe.step);
const run_cmd = b.addRunArtifact(run_exe);
if (b.args) |args| {
run_cmd.addArgs(args);
}
@ -487,14 +490,14 @@ pub fn build(b: *std.Build) !void {
.name = "ghostty-test",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.filter = test_filter,
});
{
if (emit_test_exe) main_test.install();
main_test.setFilter(test_filter);
if (emit_test_exe) b.installArtifact(main_test);
_ = try addDeps(b, main_test, true);
main_test.addOptions("build_options", exe_options);
const test_run = main_test.run();
const test_run = b.addRunArtifact(main_test);
test_step.dependOn(&test_run.step);
}
@ -513,7 +516,7 @@ pub fn build(b: *std.Build) !void {
.root_source_file = module.source_file,
.target = target,
});
if (emit_test_exe) test_exe.install();
if (emit_test_exe) b.installArtifact(test_exe);
_ = try addDeps(b, test_exe, true);
// if (pkg.dependencies) |children| {
@ -521,7 +524,7 @@ pub fn build(b: *std.Build) !void {
// try test_.packages.appendSlice(children);
// }
const test_run = test_exe.run();
const test_run = b.addRunArtifact(test_exe);
test_step.dependOn(&test_run.step);
}
}
@ -785,7 +788,7 @@ fn benchSteps(
.optimize = optimize,
});
c_exe.setMainPkgPath("./src");
if (install) c_exe.install();
if (install) b.installArtifact(c_exe);
_ = try addDeps(b, c_exe, true);
}
}
@ -823,8 +826,10 @@ fn conformanceSteps(
.target = target,
.optimize = optimize,
});
c_exe.setOutputDir("zig-out/bin/conformance");
c_exe.install();
const install = b.addInstallArtifact(c_exe);
install.dest_sub_path = "conformance";
b.getInstallStep().dependOn(&install.step);
// Store the mapping
try map.put(name, c_exe);

6
flake.lock generated
View File

@ -126,11 +126,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1680782874,
"narHash": "sha256-H/ATZl/uXdo5ruyDlGlJE2uSO7g4/+D+1048Uk+8Ewc=",
"lastModified": 1683461227,
"narHash": "sha256-IhHbNNK+XeiKEvsdnMTiFw99ck2Iwdrt2gCbWXrmlRc=",
"owner": "mitchellh",
"repo": "zig-overlay",
"rev": "0517edcc1356ed89aec9751bfa123fe5f8b88e20",
"rev": "6ab09a96babc526ba9743ebab3f7863d140a73a5",
"type": "github"
},
"original": {

View File

@ -116,7 +116,7 @@ pub fn buildFontconfig(
"-DHAVE_RAND",
"-DHAVE_RANDOM",
"-DHAVE_LRAND48",
"-DHAVE_RANDOM_R",
//"-DHAVE_RANDOM_R",
"-DHAVE_RAND_R",
"-DHAVE_READLINK",
"-DHAVE_FSTATVFS",

View File

@ -28,10 +28,10 @@ pub fn build(b: *std.Build) !void {
tests.setBuildMode(mode);
tests.setTarget(target);
_ = try link(b, tests, .{});
tests.install();
b.installArtifact(tests);
const test_step = b.step("test", "Run tests");
const tests_run = tests.run();
const tests_run = b.addRunArtifact(tests);
test_step.dependOn(&tests_run.step);
}

View File

@ -171,7 +171,7 @@ test "create and destroy" {
const len = height * @intCast(usize, stride);
var data = try alloc.alloc(u32, len);
defer alloc.free(data);
std.mem.set(u32, data, 0);
@memset(data, 0);
const img = try Image.createBitsNoClear(.g1, width, height, data.ptr, stride);
try testing.expectEqual(@as(c_int, height), img.getHeight());
try testing.expectEqual(@as(c_int, stride), img.getStride());
@ -193,7 +193,7 @@ test "fill boxes a1" {
const len = height * @intCast(usize, stride);
var data = try alloc.alloc(u32, len);
defer alloc.free(data);
std.mem.set(u32, data, 0);
@memset(data, 0);
const img = try Image.createBitsNoClear(format, width, height, data.ptr, stride);
defer _ = img.unref();

View File

@ -275,7 +275,7 @@ pub fn grow(self: *Atlas, alloc: Allocator, size_new: u32) Allocator.Error!void
// If our allocation and rectangle add succeeded, we can go ahead
// and persist our new size and copy over the old data.
self.size = size_new;
std.mem.set(u8, self.data, 0);
@memset(self.data, 0);
self.set(.{
.x = 0, // don't bother skipping border so we can avoid strides
.y = 1, // skip the first border row
@ -291,7 +291,7 @@ pub fn grow(self: *Atlas, alloc: Allocator, size_new: u32) Allocator.Error!void
// Empty the atlas. This doesn't reclaim any previously allocated memory.
pub fn clear(self: *Atlas) void {
self.modified = true;
std.mem.set(u8, self.data, 0);
@memset(self.data, 0);
self.nodes.clearRetainingCapacity();
// Add our initial rectangle. This is the size of the full texture
@ -403,7 +403,7 @@ pub const Wasm = struct {
// Convert from A8 to RGBA so every 4th byte is set to a value.
var buf: []u8 = try alloc.alloc(u8, self.data.len * 4);
errdefer alloc.free(buf);
std.mem.set(u8, buf, 0);
@memset(buf, 0);
for (self.data, 0..) |value, i| {
buf[(i * 4) + 3] = value;
}

View File

@ -440,7 +440,7 @@ pub const Face = struct {
// cell height (mainly: non-scalable fonts, i.e. emoji)
break :underline_pos cell_height - 1;
};
const underline_thickness = @max(1, fontUnitsToPxY(
const underline_thickness = @max(@as(f32, 1), fontUnitsToPxY(
face,
face.handle.*.underline_thickness,
));
@ -461,7 +461,7 @@ pub const Face = struct {
break :pos @intToFloat(f32, ascender_px - declared_px);
},
.thickness = @max(1, fontUnitsToPxY(face, os2.yStrikeoutSize)),
.thickness = @max(@as(f32, 1), fontUnitsToPxY(face, os2.yStrikeoutSize)),
} else .{
.pos = cell_baseline * 0.6,
.thickness = underline_thickness,

View File

@ -2178,7 +2178,7 @@ fn draw_light_arc(
// Allocate our supersample sized canvas
var ss_data = try alloc.alloc(u8, height * width);
defer alloc.free(ss_data);
std.mem.set(u8, ss_data, 0);
@memset(ss_data, 0);
const height_pixels = self.height;
const width_pixels = self.width;

View File

@ -310,7 +310,7 @@ const PixmanImpl = struct {
// by 4 since u32 / u8 = 4.
var data = try alloc.alloc(u32, len / 4);
errdefer alloc.free(data);
std.mem.set(u32, data, 0);
@memset(data, 0);
// Create the image we'll draw to
const img = try pixman.Image.createBitsNoClear(

View File

@ -1116,12 +1116,21 @@ fn syncCells(
}
// We can fit within the vertex buffer so we can just replace bytes.
const dst = dst: {
const ptr = target.msgSend(?[*]u8, objc.sel("contents"), .{}) orelse {
log.warn("buf_cells contents ptr is null", .{});
return error.MetalFailed;
};
@memcpy(ptr, @ptrCast([*]const u8, cells.items.ptr), req_bytes);
break :dst ptr[0..req_bytes];
};
const src = src: {
const ptr = @ptrCast([*]const u8, cells.items.ptr);
break :src ptr[0..req_bytes];
};
@memcpy(dst, src);
}
/// Sync the atlas data to the given texture. This copies the bytes

View File

@ -105,11 +105,12 @@ pub const Padding = struct {
const padding_top = @min(padding_left, @floor(space_bot / 2));
const padding_bot = space_bot - padding_top;
const zero = @as(f32, 0);
return .{
.top = @max(0, padding_top),
.bottom = @max(0, padding_bot),
.right = @max(0, padding_right),
.left = @max(0, padding_left),
.top = @max(zero, padding_top),
.bottom = @max(zero, padding_bot),
.right = @max(zero, padding_right),
.left = @max(zero, padding_left),
};
}

View File

@ -319,7 +319,7 @@ pub const Row = struct {
// If our row has no graphemes, then this is a fast copy
if (!self.storage[0].header.flags.grapheme) {
std.mem.set(StorageCell, self.storage[start + 1 .. len + 1], .{ .cell = cell });
@memset(self.storage[start + 1 .. len + 1], .{ .cell = cell });
return;
}
@ -1013,7 +1013,7 @@ pub fn scrollRegionUp(self: *Screen, top: RowIndex, bottom: RowIndex, count: usi
// is a lot more of that.
const dst_offset = total_copy;
const dst = buf[dst_offset..];
std.mem.set(StorageCell, dst, .{ .cell = self.cursor.pen });
@memset(dst, .{ .cell = self.cursor.pen });
// Then we make sure our row headers are zeroed out. We set
// the value to a dirty row header so that the renderer re-draws.
@ -1093,7 +1093,7 @@ pub fn scrollRegionUp(self: *Screen, top: RowIndex, bottom: RowIndex, count: usi
if (offset >= slices[i].len) continue;
const dst = slices[i][offset..];
std.mem.set(StorageCell, dst, .{ .cell = self.cursor.pen });
@memset(dst, .{ .cell = self.cursor.pen });
var j: usize = offset;
while (j < slices[i].len) : (j += self.cols + 1) {
@ -1557,8 +1557,7 @@ pub fn selectionString(
// we use are correct by default.
if (std.debug.runtime_safety) {
if (cell.header.id == 0) {
std.mem.set(
StorageCell,
@memset(
slice[i + 1 .. i + 1 + self.cols],
.{ .cell = .{} },
);

View File

@ -145,8 +145,8 @@ pub fn capacity(self: Tabstops) usize {
/// Unset all tabstops and then reset the initial tabstops to the given
/// interval. An interval of 0 sets no tabstops.
pub fn reset(self: *Tabstops, interval: usize) void {
std.mem.set(Unit, &self.prealloc_stops, 0);
std.mem.set(Unit, self.dynamic_stops, 0);
@memset(&self.prealloc_stops, 0);
@memset(self.dynamic_stops, 0);
if (interval > 0) {
var i: usize = interval - 1;

View File

@ -28,7 +28,7 @@ pub fn CircBuf(comptime T: type, comptime default: T) type {
/// Initialize a new circular buffer that can store size elements.
pub fn init(alloc: Allocator, size: usize) !Self {
var buf = try alloc.alloc(T, size);
std.mem.set(T, buf, default);
@memset(buf, default);
return Self{
.storage = buf,
@ -60,7 +60,7 @@ pub fn CircBuf(comptime T: type, comptime default: T) type {
// If we grew, we need to set our new defaults. We can add it
// at the end since we rotated to start.
if (size > prev_cap) {
std.mem.set(T, self.storage[prev_cap..], default);
@memset(self.storage[prev_cap..], default);
// Fix up our head/tail
if (self.full) {
@ -127,7 +127,7 @@ pub fn CircBuf(comptime T: type, comptime default: T) type {
// Clear the values back to default
const slices = self.getPtrSlice(0, n);
inline for (slices) |slice| std.mem.set(T, slice, default);
inline for (slices) |slice| @memset(slice, default);
// If we're not full, we can just advance the tail. We know
// it'll be less than the length because otherwise we'd be full.

2
vendor/harfbuzz vendored

@ -1 +1 @@
Subproject commit 9e4ae09fe76e0ab908095940c880b4ded94c1e18
Subproject commit 8df5cdbcda495a582e72a7e2ce35d6106401edce

2
vendor/mach-glfw vendored

@ -1 +1 @@
Subproject commit 871de9334926273b41c80b0fb13a74d8438eb4e7
Subproject commit 1b3def95123bc5b040bb1786f6ef3f551504a6f5

2
vendor/pixman vendored

@ -1 +1 @@
Subproject commit 713077d0a3c310ca1955bc331d46d55d0ae4a72b
Subproject commit e4c878d17942346dce5f54b25d7624440ef47de6

2
vendor/zig-libxml2 vendored

@ -1 +1 @@
Subproject commit eabfcf3a0b3ca319693d3e5991098a77dace5e9b
Subproject commit 252c732429a686e4a835831038263a554e752c40